summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_program.c
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2017-10-23 06:18:37 +0100
committerDave Airlie <[email protected]>2017-10-26 00:55:52 +0100
commit3c34d11589f05e0876a92bd77fd37d3b79a69d35 (patch)
tree7198696bdf0b4741dd34719f36bad1de654bcca1 /src/mesa/state_tracker/st_program.c
parent3720d913dd39852be7debfa17823f730a77bb478 (diff)
st/program: rework basic variant interface
This just passes st_common_program and uses it. Reviewed-by: Timothy Arceri <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker/st_program.c')
-rw-r--r--src/mesa/state_tracker/st_program.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 41ebfa9003f..1695f4835db 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -1604,8 +1604,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)
+ struct st_common_program *prog)
{
struct pipe_context *pipe = st->pipe;
struct st_basic_variant *v;
@@ -1615,7 +1614,7 @@ st_get_basic_variant(struct st_context *st,
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;
}
@@ -1628,13 +1627,13 @@ st_get_basic_variant(struct st_context *st,
/* 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");
@@ -1645,8 +1644,8 @@ st_get_basic_variant(struct st_context *st,
v->key = key;
/* insert into list */
- v->next = *variants;
- *variants = v;
+ v->next = prog->variants;
+ prog->variants = v;
}
}
@@ -2004,19 +2003,19 @@ st_precompile_shader_variant(struct st_context *st,
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;
}