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)
+ struct st_common_program *prog)
{
struct pipe_context *pipe = st->pipe;
struct st_basic_variant *v;
key.st = st->has_shareable_shaders ? NULL : st;
/* Search for existing variant */
- for (v = *variants; v; v = v->next) {
+ for (v = prog->variants; v; v = v->next) {
if (memcmp(&v->key, &key, sizeof(key)) == 0) {
break;
}
/* fill in new variant */
switch (pipe_shader) {
case PIPE_SHADER_TESS_CTRL:
- v->driver_shader = pipe->create_tcs_state(pipe, tgsi);
+ v->driver_shader = pipe->create_tcs_state(pipe, &prog->tgsi);
break;
case PIPE_SHADER_TESS_EVAL:
- v->driver_shader = pipe->create_tes_state(pipe, tgsi);
+ v->driver_shader = pipe->create_tes_state(pipe, &prog->tgsi);
break;
case PIPE_SHADER_GEOMETRY:
- v->driver_shader = pipe->create_gs_state(pipe, tgsi);
+ v->driver_shader = pipe->create_gs_state(pipe, &prog->tgsi);
break;
default:
assert(!"unhandled shader type");
v->key = key;
/* insert into list */
- v->next = *variants;
- *variants = v;
+ v->next = prog->variants;
+ prog->variants = v;
}
}
case GL_TESS_CONTROL_PROGRAM_NV: {
struct st_common_program *p = st_common_program(prog);
- st_get_basic_variant(st, PIPE_SHADER_TESS_CTRL, &p->tgsi, &p->variants);
+ st_get_basic_variant(st, PIPE_SHADER_TESS_CTRL, p);
break;
}
case GL_TESS_EVALUATION_PROGRAM_NV: {
struct st_common_program *p = st_common_program(prog);
- st_get_basic_variant(st, PIPE_SHADER_TESS_EVAL, &p->tgsi, &p->variants);
+ st_get_basic_variant(st, PIPE_SHADER_TESS_EVAL, p);
break;
}
case GL_GEOMETRY_PROGRAM_NV: {
struct st_common_program *p = st_common_program(prog);
- st_get_basic_variant(st, PIPE_SHADER_GEOMETRY, &p->tgsi, &p->variants);
+ st_get_basic_variant(st, PIPE_SHADER_GEOMETRY, p);
break;
}