From da7bd6a90e1fee5c16327338fd251c0f6be34e36 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Mon, 28 Jun 2010 17:31:21 -0400 Subject: mesa: initial support for ARB_geometry_shader4 laying down the foundation for everything and implementing most of the stuff. linking, gl_VerticesIn and multidimensional inputs are left. --- src/mesa/main/state.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'src/mesa/main/state.c') diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 2239ea4a85..583dee53f2 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -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; -- cgit v1.2.3