Path: blob/21.2-virgl/src/gallium/drivers/r300/r300_fs.h
4570 views
/*1* Copyright 2008 Corbin Simpson <[email protected]>2* Joakim Sindholt <[email protected]>3* Copyright 2009 Marek Olšák <[email protected]>4*5* Permission is hereby granted, free of charge, to any person obtaining a6* copy of this software and associated documentation files (the "Software"),7* to deal in the Software without restriction, including without limitation8* on the rights to use, copy, modify, merge, publish, distribute, sub9* license, and/or sell copies of the Software, and to permit persons to whom10* the Software is furnished to do so, subject to the following conditions:11*12* The above copyright notice and this permission notice (including the next13* paragraph) shall be included in all copies or substantial portions of the14* Software.15*16* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR17* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,18* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL19* THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,20* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR21* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE22* USE OR OTHER DEALINGS IN THE SOFTWARE. */2324#ifndef R300_FS_H25#define R300_FS_H2627#include "pipe/p_state.h"28#include "tgsi/tgsi_scan.h"29#include "compiler/radeon_code.h"30#include "r300_shader_semantics.h"3132struct r300_fragment_shader_code {33struct rX00_fragment_program_code code;34struct tgsi_shader_info info;35struct r300_shader_semantics inputs;3637/* Whether the shader was replaced by a dummy one due to a shader38* compilation failure. */39boolean dummy;4041/* Numbers of constants for each type. */42unsigned externals_count;43unsigned immediates_count;44unsigned rc_state_count;4546/* Registers for fragment depth output setup. */47uint32_t fg_depth_src; /* R300_FG_DEPTH_SRC: 0x4bd8 */48uint32_t us_out_w; /* R300_US_W_FMT: 0x46b4 */4950struct r300_fragment_program_external_state compare_state;5152unsigned cb_code_size;53uint32_t *cb_code;5455struct r300_fragment_shader_code* next;5657boolean write_all;5859};6061struct r300_fragment_shader {62/* Parent class */63struct pipe_shader_state state;6465/* Currently-bound fragment shader. */66struct r300_fragment_shader_code* shader;6768/* List of the same shaders compiled with different texture-compare69* states. */70struct r300_fragment_shader_code* first;71};7273void r300_shader_read_fs_inputs(struct tgsi_shader_info* info,74struct r300_shader_semantics* fs_inputs);7576/* Return TRUE if the shader was switched and should be re-emitted. */77boolean r300_pick_fragment_shader(struct r300_context* r300);7879static inline boolean r300_fragment_shader_writes_depth(struct r300_fragment_shader *fs)80{81if (!fs)82return FALSE;83return (fs->shader->code.writes_depth) ? TRUE : FALSE;84}8586static inline boolean r300_fragment_shader_writes_all(struct r300_fragment_shader *fs)87{88if (!fs)89return FALSE;90return (fs->shader->write_all) ? TRUE : FALSE;91}92#endif /* R300_FS_H */939495