From 3bf8d2ac7108a7f0f1722e411161e013bb8573f0 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 25 Sep 2007 15:18:51 -0600 Subject: Disable vertex shader fog, compute fog in fragment shader. --- src/mesa/main/texenvprogram.c | 16 +++++++++++----- src/mesa/state_tracker/st_context.c | 5 +++++ 2 files changed, 16 insertions(+), 5 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 37f8fc8090..48c28d45ca 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -1097,15 +1097,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. */ diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index e0304dd22d..7c20b036a4 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -26,6 +26,8 @@ **************************************************************************/ #include "main/imports.h" +#include "main/extensions.h" +#include "tnl/tnl.h" #include "vbo/vbo.h" #include "st_public.h" #include "st_context.h" @@ -98,6 +100,9 @@ struct st_context *st_create_context( GLcontext *ctx, /* XXXX This is temporary! */ _mesa_enable_sw_extensions(ctx); + /* we'll always do per-pixel fog in the fragment shader */ + _tnl_allow_vertex_fog(ctx, GL_FALSE); + return st; } -- cgit v1.2.3