mesa/sso: Add compute shader support
authorJordan Justen <jordan.l.justen@intel.com>
Sat, 17 Oct 2015 04:19:45 +0000 (21:19 -0700)
committerJordan Justen <jordan.l.justen@intel.com>
Sun, 1 Nov 2015 08:10:01 +0000 (01:10 -0700)
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
[itoral@igalia.com: Reviewed-by for all except the ctx->_Shader change]
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
src/mesa/main/api_validate.c
src/mesa/main/pipelineobj.c

index 06efe02e445727a4273c6c1170b1f9644221e1db..1f729e8a293952c59ee96ede8990d5f016e7b08b 100644 (file)
@@ -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)",
index 0b86771cb5faf7e04cc1b6bf770cd634d1e0109c..699a2ae47eba249f7a90828772f0120013a0ac33 100644 (file)
@@ -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;
    }