st/mesa: add conversion for compute shaders

According to the spec, there are no predefined inputs nor any
fixed-function outputs.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
Samuel Pitoiset
2016-02-03 18:08:01 +01:00
parent 7c79c1e3e2
commit 44e04dc809
2 changed files with 26 additions and 1 deletions

View File

@@ -5710,6 +5710,8 @@ st_translate_program(
t->inputs[i] = ureg_DECL_vs_input(ureg, i); t->inputs[i] = ureg_DECL_vs_input(ureg, i);
} }
break; break;
case TGSI_PROCESSOR_COMPUTE:
break;
default: default:
assert(0); assert(0);
} }
@@ -5719,6 +5721,7 @@ st_translate_program(
*/ */
switch (procType) { switch (procType) {
case TGSI_PROCESSOR_FRAGMENT: case TGSI_PROCESSOR_FRAGMENT:
case TGSI_PROCESSOR_COMPUTE:
break; break;
case TGSI_PROCESSOR_GEOMETRY: case TGSI_PROCESSOR_GEOMETRY:
case TGSI_PROCESSOR_TESS_EVAL: case TGSI_PROCESSOR_TESS_EVAL:
@@ -6188,6 +6191,7 @@ get_mesa_program(struct gl_context *ctx,
struct st_geometry_program *stgp; struct st_geometry_program *stgp;
struct st_tessctrl_program *sttcp; struct st_tessctrl_program *sttcp;
struct st_tesseval_program *sttep; struct st_tesseval_program *sttep;
struct st_compute_program *stcp;
switch (shader->Type) { switch (shader->Type) {
case GL_VERTEX_SHADER: case GL_VERTEX_SHADER:
@@ -6210,6 +6214,10 @@ get_mesa_program(struct gl_context *ctx,
sttep = (struct st_tesseval_program *)prog; sttep = (struct st_tesseval_program *)prog;
sttep->glsl_to_tgsi = v; sttep->glsl_to_tgsi = v;
break; break;
case GL_COMPUTE_SHADER:
stcp = (struct st_compute_program *)prog;
stcp->glsl_to_tgsi = v;
break;
default: default:
assert(!"should not be reached"); assert(!"should not be reached");
return NULL; return NULL;

View File

@@ -1428,7 +1428,24 @@ bool
st_translate_compute_program(struct st_context *st, st_translate_compute_program(struct st_context *st,
struct st_compute_program *stcp) struct st_compute_program *stcp)
{ {
return false; /* will be updated in the next commit */ struct ureg_program *ureg;
struct pipe_shader_state prog;
ureg = ureg_create_with_screen(TGSI_PROCESSOR_COMPUTE, st->pipe->screen);
if (ureg == NULL)
return false;
st_translate_program_common(st, &stcp->Base.Base, stcp->glsl_to_tgsi, ureg,
TGSI_PROCESSOR_COMPUTE, &prog);
stcp->tgsi.prog = prog.tokens;
stcp->tgsi.req_local_mem = stcp->Base.SharedSize;
stcp->tgsi.req_private_mem = 0;
stcp->tgsi.req_input_mem = 0;
free_glsl_to_tgsi_visitor(stcp->glsl_to_tgsi);
stcp->glsl_to_tgsi = NULL;
return true;
} }