summaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/mesa/state_tracker/st_atom_shader.c3
-rw-r--r--src/mesa/state_tracker/st_program.c21
-rw-r--r--src/mesa/state_tracker/st_program.h3
3 files changed, 12 insertions, 15 deletions
diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
index b5ba33a4884..c6faa3f07ff 100644
--- a/src/mesa/state_tracker/st_atom_shader.c
+++ b/src/mesa/state_tracker/st_atom_shader.c
@@ -215,8 +215,7 @@ st_update_common_program(struct st_context *st, struct gl_program *prog,
if (st->shader_has_one_variant[prog->info.stage] && stp->variants)
return stp->variants->driver_shader;
- return st_get_basic_variant(st, pipe_shader, &stp->tgsi,
- &stp->variants)->driver_shader;
+ return st_get_basic_variant(st, pipe_shader, stp)->driver_shader;
}
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;
}
diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h
index 8e9f4c5e826..27cc9b6e92f 100644
--- a/src/mesa/state_tracker/st_program.h
+++ b/src/mesa/state_tracker/st_program.h
@@ -384,8 +384,7 @@ st_get_cp_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);
+ struct st_common_program *p);
extern void
st_release_vp_variants( struct st_context *st,