2 * Copyright 2009 Nicolai Hähnle <nhaehnle@gmail.com>
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE. */
27 #define R300_PFS_MAX_ALU_INST 64
28 #define R300_PFS_MAX_TEX_INST 32
29 #define R300_PFS_MAX_TEX_INDIRECT 4
30 #define R300_PFS_NUM_TEMP_REGS 32
31 #define R300_PFS_NUM_CONST_REGS 32
33 #define R500_PFS_MAX_INST 512
34 #define R500_PFS_NUM_TEMP_REGS 128
35 #define R500_PFS_NUM_CONST_REGS 256
38 #define STATE_R300_WINDOW_DIMENSION (STATE_INTERNAL_DRIVER+0)
39 #define STATE_R300_TEXRECT_FACTOR (STATE_INTERNAL_DRIVER+1)
43 * Stores state that influences the compilation of a fragment program.
45 struct r300_fragment_program_external_state
{
48 * If the sampler is used as a shadow sampler,
53 * depending on the depth texture mode.
55 GLuint depth_texture_mode
: 2;
58 * If the sampler is used as a shadow sampler,
59 * this field is (texture_compare_func - GL_NEVER).
60 * [e.g. if compare function is GL_LEQUAL, this field is 3]
62 * Otherwise, this field is 0.
64 GLuint texture_compare_func
: 3;
70 struct r300_fragment_program_node
{
71 int tex_offset
; /**< first tex instruction */
72 int tex_end
; /**< last tex instruction, relative to tex_offset */
73 int alu_offset
; /**< first ALU instruction */
74 int alu_end
; /**< last ALU instruction, relative to alu_offset */
79 * Stores an R300 fragment program in its compiled-to-hardware form.
81 struct r300_fragment_program_code
{
83 int length
; /**< total # of texture instructions used */
84 GLuint inst
[R300_PFS_MAX_TEX_INST
];
88 int length
; /**< total # of ALU instructions used */
94 } inst
[R300_PFS_MAX_ALU_INST
];
97 struct r300_fragment_program_node node
[4];
99 int first_node_has_tex
;
102 * Remember which program register a given hardware constant
105 struct prog_src_register constant
[R300_PFS_NUM_CONST_REGS
];
112 struct r500_fragment_program_code
{
120 } inst
[R500_PFS_MAX_INST
];
126 * Remember which program register a given hardware constant
129 struct prog_src_register constant
[R500_PFS_NUM_CONST_REGS
];
135 struct rX00_fragment_program_code
{
137 struct r300_fragment_program_code r300
;
138 struct r500_fragment_program_code r500
;
141 GLboolean writes_depth
;
143 /* attribute that we are sending the WPOS in */
144 gl_frag_attrib wpos_attr
;
145 /* attribute that we are sending the fog coordinate in */
146 gl_frag_attrib fog_attr
;
150 #endif /* RADEON_CODE_H */