aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJordan Justen <[email protected]>2015-10-16 21:19:45 -0700
committerJordan Justen <[email protected]>2015-11-01 01:10:01 -0700
commit39bb59a56610e67c26df6f92d2c844b2a6f04082 (patch)
treecb9d312e38f41e1b29d31b15c2698a51a838be15
parent6e118550502f56410426ff4623b796e7e09eb5f9 (diff)
mesa/sso: Add compute shader support
Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Marta Lofstedt <[email protected]> [[email protected]: Reviewed-by for all except the ctx->_Shader change] Reviewed-by: Iago Toral Quiroga <[email protected]>
-rw-r--r--src/mesa/main/api_validate.c2
-rw-r--r--src/mesa/main/pipelineobj.c11
2 files changed, 12 insertions, 1 deletions
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index 06efe02e445..1f729e8a293 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -918,7 +918,7 @@ check_valid_to_compute(struct gl_context *ctx, const char *function)
return false;
}
- prog = ctx->Shader.CurrentProgram[MESA_SHADER_COMPUTE];
+ prog = ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
if (prog == NULL || prog->_LinkedShaders[MESA_SHADER_COMPUTE] == NULL) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"%s(no active compute shader)",
diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c
index 0b86771cb5f..699a2ae47eb 100644
--- a/src/mesa/main/pipelineobj.c
+++ b/src/mesa/main/pipelineobj.c
@@ -255,6 +255,8 @@ _mesa_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
if (_mesa_has_tessellation(ctx))
any_valid_stages |= GL_TESS_CONTROL_SHADER_BIT |
GL_TESS_EVALUATION_SHADER_BIT;
+ if (_mesa_has_compute_shaders(ctx))
+ any_valid_stages |= GL_COMPUTE_SHADER_BIT;
if (stages != GL_ALL_SHADER_BITS && (stages & ~any_valid_stages) != 0) {
_mesa_error(ctx, GL_INVALID_VALUE, "glUseProgramStages(Stages)");
@@ -336,6 +338,9 @@ _mesa_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
if ((stages & GL_TESS_EVALUATION_SHADER_BIT) != 0)
_mesa_use_shader_program(ctx, GL_TESS_EVALUATION_SHADER, shProg, pipe);
+
+ if ((stages & GL_COMPUTE_SHADER_BIT) != 0)
+ _mesa_use_shader_program(ctx, GL_COMPUTE_SHADER, shProg, pipe);
}
/**
@@ -669,6 +674,12 @@ _mesa_GetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
*params = pipe->CurrentProgram[MESA_SHADER_FRAGMENT]
? pipe->CurrentProgram[MESA_SHADER_FRAGMENT]->Name : 0;
return;
+ case GL_COMPUTE_SHADER:
+ if (!_mesa_has_compute_shaders(ctx))
+ break;
+ *params = pipe->CurrentProgram[MESA_SHADER_COMPUTE]
+ ? pipe->CurrentProgram[MESA_SHADER_COMPUTE]->Name : 0;
+ return;
default:
break;
}