diff options
author | Nicolai Hähnle <[email protected]> | 2009-07-26 13:50:56 +0200 |
---|---|---|
committer | Nicolai Hähnle <[email protected]> | 2009-07-27 22:51:39 +0200 |
commit | e82a50a6a1abd39aa7153846be07b7c5e9172485 (patch) | |
tree | c32343f254bf2b023e5278ad002b7b875f25d684 /src | |
parent | 790334883a80ee1d19cb1bba018ed7dc32299dac (diff) |
r300/fragprog: Move wpos_attr and fog_attr where they belong
Signed-off-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/r300/compiler/radeon_code.h | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_context.h | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_fragprog_common.c | 21 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_swtcl.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_vertprog.c | 4 |
5 files changed, 21 insertions, 22 deletions
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_code.h b/src/mesa/drivers/dri/r300/compiler/radeon_code.h index 6f51358f55e..9fd37dc8d24 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_code.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_code.h @@ -174,11 +174,6 @@ struct rX00_fragment_program_code { GLboolean writes_depth; struct rc_constant_list constants; - - /* attribute that we are sending the WPOS in */ - gl_frag_attrib wpos_attr; - /* attribute that we are sending the fog coordinate in */ - gl_frag_attrib fog_attr; }; diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 56f05723b8c..24dc6bc6a34 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -433,6 +433,11 @@ struct r300_fragment_program { struct rX00_fragment_program_code code; GLbitfield InputsRead; + + /* attribute that we are sending the WPOS in */ + gl_frag_attrib wpos_attr; + /* attribute that we are sending the fog coordinate in */ + gl_frag_attrib fog_attr; }; struct r300_fragment_program_cont { diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c index 2947f5ef7e0..3bfe8a9dede 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_common.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.c @@ -95,24 +95,24 @@ static void build_state( * to read from a newly allocated temporary. * */ -static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler) +static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler, struct r300_fragment_program * fp) { int i; if (!(compiler->Base.Program.InputsRead & FRAG_BIT_WPOS)) { - compiler->code->wpos_attr = FRAG_ATTRIB_MAX; + fp->wpos_attr = FRAG_ATTRIB_MAX; return; } for (i = FRAG_ATTRIB_TEX0; i <= FRAG_ATTRIB_TEX7; ++i) { if (!(compiler->Base.Program.InputsRead & (1 << i))) { - compiler->code->wpos_attr = i; + fp->wpos_attr = i; break; } } - rc_transform_fragment_wpos(&compiler->Base, FRAG_ATTRIB_WPOS, compiler->code->wpos_attr); + rc_transform_fragment_wpos(&compiler->Base, FRAG_ATTRIB_WPOS, fp->wpos_attr); } /** @@ -122,28 +122,27 @@ static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler) * * See also the counterpart rewriting for vertex programs. */ -static void rewriteFog(struct r300_fragment_program_compiler *compiler) +static void rewriteFog(struct r300_fragment_program_compiler *compiler, struct r300_fragment_program * fp) { - struct rX00_fragment_program_code *code = compiler->code; struct prog_src_register src; int i; if (!(compiler->Base.Program.InputsRead & FRAG_BIT_FOGC)) { - code->fog_attr = FRAG_ATTRIB_MAX; + fp->fog_attr = FRAG_ATTRIB_MAX; return; } for (i = FRAG_ATTRIB_TEX0; i <= FRAG_ATTRIB_TEX7; ++i) { if (!(compiler->Base.Program.InputsRead & (1 << i))) { - code->fog_attr = i; + fp->fog_attr = i; break; } } memset(&src, 0, sizeof(src)); src.File = PROGRAM_INPUT; - src.Index = code->fog_attr; + src.Index = fp->fog_attr; src.Swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_ZERO, SWIZZLE_ZERO, SWIZZLE_ONE); rc_move_input(&compiler->Base, FRAG_ATTRIB_FOGC, src); } @@ -220,9 +219,9 @@ static void translate_fragment_program(GLcontext *ctx, struct r300_fragment_prog rc_mesa_to_rc_program(&compiler.Base, &cont->Base.Base); - insert_WPOS_trailer(&compiler); + insert_WPOS_trailer(&compiler, fp); - rewriteFog(&compiler); + rewriteFog(&compiler, fp); r3xx_compile_fragment_program(&compiler); fp->error = compiler.Base.Error; diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.c b/src/mesa/drivers/dri/r300/r300_swtcl.c index 1e4ea2c5775..a634cb5192d 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.c +++ b/src/mesa/drivers/dri/r300/r300_swtcl.c @@ -150,16 +150,16 @@ void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_ ADD_ATTR(VERT_ATTRIB_POINT_SIZE, R300_DATA_TYPE_FLOAT_1, SWTCL_OVM_POINT_SIZE, swiz, MASK_X, 0); } - if (rmesa->selected_fp->code.wpos_attr != FRAG_ATTRIB_MAX) { - int tex_id = rmesa->selected_fp->code.wpos_attr - FRAG_ATTRIB_TEX0; + if (rmesa->selected_fp->wpos_attr != FRAG_ATTRIB_MAX) { + int tex_id = rmesa->selected_fp->wpos_attr - FRAG_ATTRIB_TEX0; VB->AttribPtr[VERT_ATTRIB_TEX0 + tex_id] = VB->AttribPtr[VERT_ATTRIB_POS]; VB->TexCoordPtr[tex_id] = VB->AttribPtr[VERT_ATTRIB_POS]; RENDERINPUTS_SET(tnl->render_inputs_bitset, _TNL_ATTRIB_TEX0 + tex_id); } - if (rmesa->selected_fp->code.fog_attr != FRAG_ATTRIB_MAX) { - int tex_id = rmesa->selected_fp->code.fog_attr - FRAG_ATTRIB_TEX0; + if (rmesa->selected_fp->fog_attr != FRAG_ATTRIB_MAX) { + int tex_id = rmesa->selected_fp->fog_attr - FRAG_ATTRIB_TEX0; VB->AttribPtr[VERT_ATTRIB_TEX0 + tex_id] = VB->AttribPtr[VERT_ATTRIB_FOG]; VB->TexCoordPtr[tex_id] = VB->AttribPtr[VERT_ATTRIB_FOG]; diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 69d6b021d5c..c5edbd0052b 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -268,8 +268,8 @@ struct r300_vertex_program * r300SelectAndTranslateVertexShader(GLcontext *ctx) vpc = (struct r300_vertex_program_cont *)ctx->VertexProgram._Current; wanted_key.FpReads = r300->selected_fp->InputsRead; - wanted_key.FogAttr = r300->selected_fp->code.fog_attr; - wanted_key.WPosAttr = r300->selected_fp->code.wpos_attr; + wanted_key.FogAttr = r300->selected_fp->fog_attr; + wanted_key.WPosAttr = r300->selected_fp->wpos_attr; for (vp = vpc->progs; vp; vp = vp->next) { if (_mesa_memcmp(&vp->key, &wanted_key, sizeof(wanted_key)) |