summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Berry <[email protected]>2014-01-10 21:39:25 -0800
committerJordan Justen <[email protected]>2015-05-02 00:34:28 -0700
commitbf058dad6b97aaa2422c3ed462c4f27490719800 (patch)
tree6d68d508ae3f4468e6e6c31a9eca7549aeda88b4 /src
parentabb049dab6155ee4994cf7df88b7913897078dff (diff)
mesa/cs: Add compute support to update_program().
Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/state.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index cc84c61486c..99db37bafd7 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -101,9 +101,12 @@ update_program(struct gl_context *ctx)
ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY];
struct gl_shader_program *fsProg =
ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT];
+ const struct gl_shader_program *csProg =
+ ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
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;
+ const struct gl_compute_program *prevCP = ctx->ComputeProgram._Current;
GLbitfield new_state = 0x0;
/*
@@ -199,6 +202,16 @@ update_program(struct gl_context *ctx)
_mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, NULL);
}
+ if (csProg && csProg->LinkStatus
+ && csProg->_LinkedShaders[MESA_SHADER_COMPUTE]) {
+ /* Use GLSL compute shader */
+ _mesa_reference_compprog(ctx, &ctx->ComputeProgram._Current,
+ gl_compute_program(csProg->_LinkedShaders[MESA_SHADER_COMPUTE]->Program));
+ } else {
+ /* no compute program */
+ _mesa_reference_compprog(ctx, &ctx->ComputeProgram._Current, NULL);
+ }
+
/* Let the driver know what's happening:
*/
if (ctx->FragmentProgram._Current != prevFP) {
@@ -225,6 +238,14 @@ update_program(struct gl_context *ctx)
}
}
+ if (ctx->ComputeProgram._Current != prevCP) {
+ new_state |= _NEW_PROGRAM;
+ if (ctx->Driver.BindProgram) {
+ ctx->Driver.BindProgram(ctx, GL_COMPUTE_PROGRAM_NV,
+ (struct gl_program *) ctx->ComputeProgram._Current);
+ }
+ }
+
return new_state;
}