struct gl_fragment_program_state FragmentProgram; /**< GL_NV_fragment_program */
struct gl_ati_fragment_shader_state ATIFragmentShader; /**< GL_ATI_fragment_shader */
- struct fragment_program _TexEnvProgram; /**< Texture state as fragment program */
- struct vertex_program _TnlProgram; /**< Fixed func TNL state as vertex program */
+ struct fragment_program *_TexEnvProgram; /**< Texture state as fragment program */
+ struct vertex_program *_TnlProgram; /**< Fixed func TNL state as vertex program */
GLboolean _MaintainTexEnvProgram;
GLboolean _MaintainTnlProgram;
#include "nvfragprog.h"
#include "nvprogram.h"
#include "program.h"
+#include "texenvprogram.h"
#endif
#if FEATURE_ARB_shader_objects
#include "shaderobjects.h"
ctx->FragmentProgram._Active = ctx->FragmentProgram._Enabled;
if (ctx->_MaintainTexEnvProgram && !ctx->FragmentProgram._Enabled) {
- ctx->FragmentProgram._Current = &ctx->_TexEnvProgram;
+ if (!ctx->_TexEnvProgram)
+ ctx->_TexEnvProgram = (struct fragment_program *)
+ ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0);
+
+ ctx->FragmentProgram._Current = ctx->_TexEnvProgram;
ctx->FragmentProgram._Active = GL_TRUE;
}
}
update_arrays( ctx );
if (ctx->_MaintainTexEnvProgram) {
- if (new_state & (_NEW_TEXTURE | _DD_NEW_SEPARATE_SPECULAR))
+ if (new_state & (_NEW_TEXTURE | _DD_NEW_SEPARATE_SPECULAR | _NEW_FOG))
_mesa_UpdateTexEnvProgram(ctx);
}
if (ctx->FragmentProgram._Enabled)
return;
+ if (!ctx->_TexEnvProgram)
+ ctx->_TexEnvProgram = (struct fragment_program *)
+ ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0);
+
p.ctx = ctx;
- p.program = &ctx->_TexEnvProgram;
+ p.program = ctx->_TexEnvProgram;
if (p.program->Instructions == NULL) {
p.program->Instructions = MALLOC(sizeof(struct fp_instruction) * 100);
}
p.program->Base.NumInstructions = 0;
+ p.program->Base.Target = GL_FRAGMENT_PROGRAM_ARB;
p.program->NumTexIndirections = 1; /* correct? */
p.program->NumTexInstructions = 0;
p.program->NumAluInstructions = 0;
*/
emit_arith( &p, FP_OPCODE_END, undef, WRITEMASK_XYZW, 0, undef, undef, undef);
+ if (ctx->Fog.Enabled)
+ p.program->FogOption = ctx->Fog.Mode;
+ else
+ p.program->FogOption = GL_NONE;
if (p.program->NumTexIndirections > ctx->Const.MaxFragmentProgramTexIndirections)
program_error(&p, "Exceeded max nr indirect texture lookups");