summaryrefslogtreecommitdiff
path: root/src/mesa/main/state.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/state.c')
-rw-r--r--src/mesa/main/state.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index b971cc976e..4a3dffe4cf 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -41,8 +41,8 @@
#include "light.h"
#include "matrix.h"
#include "pixel.h"
-#include "shader/program.h"
-#include "shader/prog_parameter.h"
+#include "program/program.h"
+#include "program/prog_parameter.h"
#include "state.h"
#include "stencil.h"
#include "texenvprogram.h"
@@ -250,6 +250,7 @@ update_program(GLcontext *ctx)
const struct gl_shader_program *shProg = ctx->Shader.CurrentProgram;
const struct gl_vertex_program *prevVP = ctx->VertexProgram._Current;
const struct gl_fragment_program *prevFP = ctx->FragmentProgram._Current;
+ const struct gl_geometry_program *prevGP = ctx->GeometryProgram._Current;
GLbitfield new_state = 0x0;
/*
@@ -291,6 +292,15 @@ update_program(GLcontext *ctx)
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL);
}
+ if (shProg && shProg->LinkStatus && shProg->GeometryProgram) {
+ /* Use shader programs */
+ _mesa_reference_geomprog(ctx, &ctx->GeometryProgram._Current,
+ shProg->GeometryProgram);
+ } else {
+ /* no fragment program */
+ _mesa_reference_geomprog(ctx, &ctx->GeometryProgram._Current, NULL);
+ }
+
/* Examine vertex program after fragment program as
* _mesa_get_fixed_func_vertex_program() needs to know active
* fragprog inputs.
@@ -327,7 +337,15 @@ update_program(GLcontext *ctx)
(struct gl_program *) ctx->FragmentProgram._Current);
}
}
-
+
+ if (ctx->GeometryProgram._Current != prevGP) {
+ new_state |= _NEW_PROGRAM;
+ if (ctx->Driver.BindProgram) {
+ ctx->Driver.BindProgram(ctx, MESA_GEOMETRY_PROGRAM,
+ (struct gl_program *) ctx->GeometryProgram._Current);
+ }
+ }
+
if (ctx->VertexProgram._Current != prevVP) {
new_state |= _NEW_PROGRAM;
if (ctx->Driver.BindProgram) {
@@ -356,6 +374,16 @@ update_program_constants(GLcontext *ctx)
}
}
+ if (ctx->GeometryProgram._Current) {
+ const struct gl_program_parameter_list *params =
+ ctx->GeometryProgram._Current->Base.Parameters;
+ /*FIXME: StateFlags is always 0 because we have unnamed constant
+ * not state changes */
+ if (params /*&& params->StateFlags & ctx->NewState*/) {
+ new_state |= _NEW_PROGRAM_CONSTANTS;
+ }
+ }
+
if (ctx->VertexProgram._Current) {
const struct gl_program_parameter_list *params =
ctx->VertexProgram._Current->Base.Parameters;
@@ -537,7 +565,7 @@ _mesa_update_state_locked( GLcontext *ctx )
/* Determine which state flags effect vertex/fragment program state */
if (ctx->FragmentProgram._MaintainTexEnvProgram) {
- prog_flags |= (_NEW_TEXTURE | _NEW_FOG |
+ prog_flags |= (_NEW_BUFFERS | _NEW_TEXTURE | _NEW_FOG |
_NEW_ARRAY | _NEW_LIGHT | _NEW_POINT | _NEW_RENDERMODE |
_NEW_PROGRAM);
}