[Mesa-dev] [PATCH 2/2] mesa/sso: Add compute shader support

Jordan Justen jordan.l.justen at intel.com
Thu Oct 29 10:06:00 PDT 2015


On 2015-10-29 03:04:38, Iago Toral wrote:
> On Thu, 2015-10-29 at 00:52 -0700, Jordan Justen wrote:
> > Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> > ---
> >  src/mesa/main/api_validate.c |  2 +-
> >  src/mesa/main/pipelineobj.c  | 11 +++++++++++
> >  2 files changed, 12 insertions(+), 1 deletion(-)
> > 
> > diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
> > index c59b6f3..46f39e7 100644
> > --- a/src/mesa/main/api_validate.c
> > +++ b/src/mesa/main/api_validate.c
> > @@ -923,7 +923,7 @@ check_valid_to_compute(struct gl_context *ctx, const char *function)
> >      * "An INVALID_OPERATION error is generated if there is no active program
> >      *  for the compute shader stage."
> >      */
> > -   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)",
> 
> This hunk won't apply on current master, there is no such comment before
> this line. Maybe this is part of another series of patches?

I guess this depends on some nearby changed lines in my unreviewed
patch:

  "main: Match DispatchCompute* API validation from main specification"

http://patchwork.freedesktop.org/patch/61881/

-Jordan

> For the rest of the patch:
> Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>
> 
> > diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c
> > index c8c50fa..58730f4 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;
> >     }
> 
> 


More information about the mesa-dev mailing list