From: Marek Olšák Date: Thu, 11 Feb 2016 15:40:54 +0000 (+0100) Subject: st/mesa: use correct pipe functions to create tess shaders X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0f235c960c8a564ff8817835716e8f377b2f5f16;p=mesa.git st/mesa: use correct pipe functions to create tess shaders Broken by one of my cleanups. Spotted by luck. Radeonsi doesn't care, because all shader create callbacks go to the same function. Reviewed-by: Brian Paul --- diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c index 23b7abfc1c5..c8650a5899a 100644 --- a/src/mesa/state_tracker/st_atom_shader.c +++ b/src/mesa/state_tracker/st_atom_shader.c @@ -172,7 +172,8 @@ update_gp( struct st_context *st ) stgp = st_geometry_program(st->ctx->GeometryProgram._Current); assert(stgp->Base.Base.Target == GL_GEOMETRY_PROGRAM_NV); - st->gp_variant = st_get_basic_variant(st, &stgp->tgsi, &stgp->variants); + st->gp_variant = st_get_basic_variant(st, PIPE_SHADER_GEOMETRY, + &stgp->tgsi, &stgp->variants); st_reference_geomprog(st, &st->gp, stgp); @@ -204,7 +205,8 @@ update_tcp( struct st_context *st ) sttcp = st_tessctrl_program(st->ctx->TessCtrlProgram._Current); assert(sttcp->Base.Base.Target == GL_TESS_CONTROL_PROGRAM_NV); - st->tcp_variant = st_get_basic_variant(st, &sttcp->tgsi, &sttcp->variants); + st->tcp_variant = st_get_basic_variant(st, PIPE_SHADER_TESS_CTRL, + &sttcp->tgsi, &sttcp->variants); st_reference_tesscprog(st, &st->tcp, sttcp); @@ -236,7 +238,8 @@ update_tep( struct st_context *st ) sttep = st_tesseval_program(st->ctx->TessEvalProgram._Current); assert(sttep->Base.Base.Target == GL_TESS_EVALUATION_PROGRAM_NV); - st->tep_variant = st_get_basic_variant(st, &sttep->tgsi, &sttep->variants); + st->tep_variant = st_get_basic_variant(st, PIPE_SHADER_TESS_EVAL, + &sttep->tgsi, &sttep->variants); st_reference_tesseprog(st, &st->tep, sttep); diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 624586e6d67..5bd626f8610 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -1271,6 +1271,7 @@ st_translate_geometry_program(struct st_context *st, */ struct st_basic_variant * st_get_basic_variant(struct st_context *st, + unsigned pipe_shader, struct pipe_shader_state *tgsi, struct st_basic_variant **variants) { @@ -1293,7 +1294,22 @@ st_get_basic_variant(struct st_context *st, v = CALLOC_STRUCT(st_basic_variant); if (v) { /* fill in new variant */ - v->driver_shader = pipe->create_gs_state(pipe, tgsi); + switch (pipe_shader) { + case PIPE_SHADER_TESS_CTRL: + v->driver_shader = pipe->create_tcs_state(pipe, tgsi); + break; + case PIPE_SHADER_TESS_EVAL: + v->driver_shader = pipe->create_tes_state(pipe, tgsi); + break; + case PIPE_SHADER_GEOMETRY: + v->driver_shader = pipe->create_gs_state(pipe, tgsi); + break; + default: + assert(!"unhandled shader type"); + free(v); + return NULL; + } + v->key = key; /* insert into list */ @@ -1587,19 +1603,19 @@ st_precompile_shader_variant(struct st_context *st, case GL_TESS_CONTROL_PROGRAM_NV: { struct st_tessctrl_program *p = (struct st_tessctrl_program *)prog; - st_get_basic_variant(st, &p->tgsi, &p->variants); + st_get_basic_variant(st, PIPE_SHADER_TESS_CTRL, &p->tgsi, &p->variants); break; } case GL_TESS_EVALUATION_PROGRAM_NV: { struct st_tesseval_program *p = (struct st_tesseval_program *)prog; - st_get_basic_variant(st, &p->tgsi, &p->variants); + st_get_basic_variant(st, PIPE_SHADER_TESS_EVAL, &p->tgsi, &p->variants); break; } case GL_GEOMETRY_PROGRAM_NV: { struct st_geometry_program *p = (struct st_geometry_program *)prog; - st_get_basic_variant(st, &p->tgsi, &p->variants); + st_get_basic_variant(st, PIPE_SHADER_GEOMETRY, &p->tgsi, &p->variants); break; } diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h index 7717d02cd3f..74f3def6095 100644 --- a/src/mesa/state_tracker/st_program.h +++ b/src/mesa/state_tracker/st_program.h @@ -352,6 +352,7 @@ st_get_fp_variant(struct st_context *st, extern struct st_basic_variant * st_get_basic_variant(struct st_context *st, + unsigned pipe_shader, struct pipe_shader_state *tgsi, struct st_basic_variant **variants);