case MESA_SHADER_VERTEX:
shader_program = ((struct st_vertex_program *)prog)->shader_program;
break;
+ case MESA_SHADER_GEOMETRY:
+ case MESA_SHADER_TESS_CTRL:
+ case MESA_SHADER_TESS_EVAL:
+ shader_program = ((struct st_common_program *)prog)->shader_program;
+ break;
case MESA_SHADER_FRAGMENT:
shader_program = ((struct st_fragment_program *)prog)->shader_program;
break;
_mesa_associate_uniform_storage(ctx, shader_program, prog, true);
struct st_vertex_program *stvp;
+ struct st_common_program *stp;
struct st_fragment_program *stfp;
struct st_compute_program *stcp;
stvp = (struct st_vertex_program *)prog;
stvp->shader_program = shader_program;
break;
+ case MESA_SHADER_GEOMETRY:
+ case MESA_SHADER_TESS_CTRL:
+ case MESA_SHADER_TESS_EVAL:
+ stp = (struct st_common_program *)prog;
+ stp->shader_program = shader_program;
+ break;
case MESA_SHADER_FRAGMENT:
stfp = (struct st_fragment_program *)prog;
stfp->shader_program = shader_program;
{
struct ureg_program *ureg;
+ if (stgp->shader_program) {
+ nir_shader *nir = st_glsl_to_nir(st, &stgp->Base, stgp->shader_program,
+ MESA_SHADER_GEOMETRY);
+
+ stgp->tgsi.type = PIPE_SHADER_IR_NIR;
+ stgp->tgsi.ir.nir = nir;
+
+ return true;
+ }
+
ureg = ureg_create_with_screen(PIPE_SHADER_GEOMETRY, st->pipe->screen);
if (ureg == NULL)
return false;
struct pipe_context *pipe = st->pipe;
struct st_basic_variant *v;
struct st_basic_variant_key key;
-
+ struct pipe_shader_state tgsi = {0};
memset(&key, 0, sizeof(key));
key.st = st->has_shareable_shaders ? NULL : st;
/* create new */
v = CALLOC_STRUCT(st_basic_variant);
if (v) {
+
+ if (prog->tgsi.type == PIPE_SHADER_IR_NIR) {
+ tgsi.type = PIPE_SHADER_IR_NIR;
+ tgsi.ir.nir = nir_shader_clone(NULL, prog->tgsi.ir.nir);
+ st_finalize_nir(st, &prog->Base, tgsi.ir.nir);
+ } else
+ tgsi = prog->tgsi;
/* fill in new variant */
switch (pipe_shader) {
case PIPE_SHADER_TESS_CTRL:
- v->driver_shader = pipe->create_tcs_state(pipe, &prog->tgsi);
+ v->driver_shader = pipe->create_tcs_state(pipe, &tgsi);
break;
case PIPE_SHADER_TESS_EVAL:
- v->driver_shader = pipe->create_tes_state(pipe, &prog->tgsi);
+ v->driver_shader = pipe->create_tes_state(pipe, &tgsi);
break;
case PIPE_SHADER_GEOMETRY:
- v->driver_shader = pipe->create_gs_state(pipe, &prog->tgsi);
+ v->driver_shader = pipe->create_gs_state(pipe, &tgsi);
break;
default:
assert(!"unhandled shader type");
{
struct ureg_program *ureg;
+ if (sttcp->shader_program) {
+ nir_shader *nir = st_glsl_to_nir(st, &sttcp->Base, sttcp->shader_program,
+ MESA_SHADER_TESS_EVAL);
+
+ sttcp->tgsi.type = PIPE_SHADER_IR_NIR;
+ sttcp->tgsi.ir.nir = nir;
+
+ return true;
+ }
+
ureg = ureg_create_with_screen(PIPE_SHADER_TESS_CTRL, st->pipe->screen);
if (ureg == NULL)
return false;
{
struct ureg_program *ureg;
+ if (sttep->shader_program) {
+ nir_shader *nir = st_glsl_to_nir(st, &sttep->Base, sttep->shader_program,
+ MESA_SHADER_TESS_EVAL);
+
+ sttep->tgsi.type = PIPE_SHADER_IR_NIR;
+ sttep->tgsi.ir.nir = nir;
+
+ return true;
+ }
+
ureg = ureg_create_with_screen(PIPE_SHADER_TESS_EVAL, st->pipe->screen);
if (ureg == NULL)
return false;