r300: more prepare for merge
authorMaciej Cencora <m.cencora@gmail.com>
Sat, 18 Apr 2009 02:00:51 +0000 (04:00 +0200)
committerDave Airlie <airlied@linux.ie>
Sun, 19 Apr 2009 12:14:53 +0000 (22:14 +1000)
src/mesa/drivers/dri/r300/r300_context.h
src/mesa/drivers/dri/r300/r300_fragprog.c
src/mesa/drivers/dri/r300/r300_fragprog.h
src/mesa/drivers/dri/r300/r300_state.c
src/mesa/drivers/dri/r300/r500_fragprog.c
src/mesa/drivers/dri/r300/r500_fragprog.h

index 41417f3122fbe4983b404b60963e4f949f215377..904218fde21ea720e4cf90d3e8df53a147190a7c 100644 (file)
@@ -616,6 +616,7 @@ struct r300_vtable {
        void (* SetupFragmentShaderTextures)(GLcontext *ctx, int *tmu_mappings);
        void (* TranslateFragmentShader)(GLcontext *ctx, struct gl_fragment_program *fp);
        GLboolean (* FragmentProgramEmit)(struct r300_fragment_program_compiler *compiler);
+       void (* FragmentProgramDump)(union rX00_fragment_program_code *code);
        GLboolean (* SetupPixelShader)(GLcontext *ctx);
 };
 
index d58b0921224033b1d870b4dbedfec57e5f11d400..a8b885a4c6d2a8b834ae6f15525b6044122ce2cc 100644 (file)
@@ -464,19 +464,19 @@ void r300TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp)
 
                r300_fp->translated = GL_TRUE;
 
-               if (r300_fp->error || (RADEON_DEBUG & DEBUG_PIXEL))
-                       r300FragmentProgramDump(r300_fp, &r300_fp->code.r300);
                r300UpdateStateParameters(ctx, _NEW_PROGRAM);
+
+               if (r300_fp->error || (RADEON_DEBUG & DEBUG_PIXEL))
+                       r300->vtbl.FragmentProgramDump(&r300_fp->code);
        }
 
        update_params(ctx, fp);
 }
 
 /* just some random things... */
-void r300FragmentProgramDump(
-       struct r300_fragment_program *fp,
-       struct r300_fragment_program_code *code)
+void r300FragmentProgramDump(union rX00_fragment_program_code *c)
 {
+       struct r300_fragment_program_code *code = &c->r300;
        int n, i, j;
        static int pc = 0;
 
index 631e40913c648a2f075bb95043ad21ca8d877c00..5c2cb312af2caac50d8abdd99521da7cf8ae5abc 100644 (file)
@@ -114,9 +114,6 @@ extern void r300TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_progr
 
 extern GLboolean r300FragmentProgramEmit(struct r300_fragment_program_compiler *compiler);
 
-
-extern void r300FragmentProgramDump(
-       struct r300_fragment_program *fp,
-       struct r300_fragment_program_code *code);
+extern void r300FragmentProgramDump(union rX00_fragment_program_code *c);
 
 #endif
index 95380a2870efe4a43298ee7f26d95b1443daaf7e..64b462bc909cfcf25d9cfcdeab6ecfee950134d2 100644 (file)
@@ -2584,11 +2584,13 @@ void r300InitShaderFunctions(r300ContextPtr r300)
                r300->vtbl.SetupFragmentShaderTextures = r500SetupFragmentShaderTextures;
                r300->vtbl.TranslateFragmentShader = r500TranslateFragmentShader;
                r300->vtbl.FragmentProgramEmit = r500FragmentProgramEmit;
+               r300->vtbl.FragmentProgramDump = r500FragmentProgramDump;
        } else {
                r300->vtbl.SetupRSUnit = r300SetupRSUnit;
                r300->vtbl.SetupPixelShader = r300SetupPixelShader;
                r300->vtbl.SetupFragmentShaderTextures = r300SetupFragmentShaderTextures;
                r300->vtbl.TranslateFragmentShader = r300TranslateFragmentShader;
                r300->vtbl.FragmentProgramEmit = r300FragmentProgramEmit;
+               r300->vtbl.FragmentProgramDump = r300FragmentProgramDump;
        }
 }
index 3e21e0f4975c177276134f7e7825fcee3416189e..3b45eee537766d4be58cd59a224c6aed54ea267f 100644 (file)
@@ -435,8 +435,6 @@ static void build_state(
        }
 }
 
-static void dump_program(struct r500_fragment_program_code *code);
-
 void r500TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp)
 {
        r300ContextPtr r300 = R300_CONTEXT(ctx);
@@ -494,24 +492,19 @@ void r500TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp)
                if (!r300->vtbl.FragmentProgramEmit(&compiler))
                        r300_fp->error = GL_TRUE;
 
-               r300_fp->translated = GL_TRUE;
-
                /* Subtle: Rescue any parameters that have been added during transformations */
                _mesa_free_parameter_list(fp->Base.Parameters);
                fp->Base.Parameters = compiler.program->Parameters;
                compiler.program->Parameters = 0;
 
-               _mesa_reference_program(ctx, &compiler.program, 0);
+               _mesa_reference_program(ctx, &compiler.program, NULL);
 
-               r300UpdateStateParameters(ctx, _NEW_PROGRAM);
+               r300_fp->translated = GL_TRUE;
 
-               if (RADEON_DEBUG & DEBUG_PIXEL) {
-                       if (!r300_fp->error) {
-                               _mesa_printf("Machine-readable code:\n");
-                               dump_program(&r300_fp->code.r500);
-                       }
-               }
+               r300UpdateStateParameters(ctx, _NEW_PROGRAM);
 
+               if (r300_fp->error || (RADEON_DEBUG & DEBUG_PIXEL))
+                       r300->vtbl.FragmentProgramDump(&r300_fp->code);
        }
 
        update_params(ctx, fp);
@@ -615,9 +608,9 @@ static char *to_texop(int val)
   return NULL;
 }
 
-static void dump_program(struct r500_fragment_program_code *code)
+void r500FragmentProgramDump(union rX00_fragment_program_code *c)
 {
-
+  struct r500_fragment_program_code *code = &c->r500;
   fprintf(stderr, "R500 Fragment Program:\n--------\n");
 
   int n;
index 4e72ef7aac2979e8153194a4eea273a961042823..5bda0d1d0dac45721a7c7a55109ad44395d4bc67 100644 (file)
@@ -49,4 +49,5 @@ extern void r500TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_progr
 
 extern GLboolean r500FragmentProgramEmit(struct r300_fragment_program_compiler *compiler);
 
+extern void r500FragmentProgramDump(union rX00_fragment_program_code *c);
 #endif