Disable vertex shader fog, compute fog in fragment shader.
authorBrian <brian.paul@tungstengraphics.com>
Tue, 25 Sep 2007 21:18:51 +0000 (15:18 -0600)
committerKeith Whitwell <keith@tungstengraphics.com>
Wed, 24 Sep 2008 17:04:17 +0000 (10:04 -0700)
src/mesa/main/texenvprogram.c

index d471030f1463e9e0efdf359924f0a5d7ff6a5783..7387f4fb2fd2c3dec16aa973d8a9bfdc9c8e3c9e 100644 (file)
@@ -1116,15 +1116,21 @@ create_new_program(GLcontext *ctx, struct state_key *key,
    ASSERT(p.program->Base.NumInstructions <= MAX_INSTRUCTIONS);
 
    /* Allocate final instruction array */
-   program->Base.Instructions
-      = _mesa_alloc_instructions(program->Base.NumInstructions);
-   if (!program->Base.Instructions) {
+   p.program->Base.Instructions
+      = _mesa_alloc_instructions(p.program->Base.NumInstructions);
+   if (!p.program->Base.Instructions) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY,
                   "generating tex env program");
       return;
    }
-   _mesa_copy_instructions(program->Base.Instructions, instBuffer,
-                           program->Base.NumInstructions);
+   _mesa_copy_instructions(p.program->Base.Instructions, instBuffer,
+                           p.program->Base.NumInstructions);
+
+   if (p.program->FogOption) {
+      _mesa_append_fog_code(ctx, p.program);
+      p.program->FogOption = GL_NONE;
+   }
+
 
    /* Notify driver the fragment program has (actually) changed.
     */