r300/fragprog: Move wpos_attr and fog_attr where they belong
authorNicolai Hähnle <nhaehnle@gmail.com>
Sun, 26 Jul 2009 11:50:56 +0000 (13:50 +0200)
committerNicolai Hähnle <nhaehnle@gmail.com>
Mon, 27 Jul 2009 20:51:39 +0000 (22:51 +0200)
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
src/mesa/drivers/dri/r300/compiler/radeon_code.h
src/mesa/drivers/dri/r300/r300_context.h
src/mesa/drivers/dri/r300/r300_fragprog_common.c
src/mesa/drivers/dri/r300/r300_swtcl.c
src/mesa/drivers/dri/r300/r300_vertprog.c

index 6f51358f55e9453e9b86ebb2186cefa0bb3c4cdd..9fd37dc8d24c250299ce2967a3e0a9af2387f238 100644 (file)
@@ -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;
 };
 
 
index 56f05723b8c4aa83a4b55feb4fd8be6f248347c4..24dc6bc6a34638cdda930dc2c1d0eb56dd428a0f 100644 (file)
@@ -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 {
index 2947f5ef7e0441cbd99d156448f3da03146be632..3bfe8a9dedee62468a95a7ad1262fd8f7050ea79 100644 (file)
@@ -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;
index 1e4ea2c577586f184ea89f3846eba80b68f9e1ce..a634cb5192da8f2e5a8dd4d978dff09d8e7f4fd7 100644 (file)
@@ -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];
index 69d6b021d5c6b4a990c134397ee8f51d9aa9b1cc..c5edbd0052b51e2790cd603c98c16f7bc1f7f18b 100644 (file)
@@ -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))