aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2019-09-30 17:37:42 -0400
committerMarek Olšák <[email protected]>2019-10-16 20:10:47 -0400
commit196fc59c40e77248e843252908de6ad128dbb6aa (patch)
tree157bad260d21ad504a6ae6342c928d90a0f6da32 /src/mesa/state_tracker
parent05f59bb777c76c2be0c94d97a249ab7ac7eb4d1e (diff)
st/mesa: deduplicate st_common_program code in st_program_string_notify
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_cb_program.c48
1 files changed, 8 insertions, 40 deletions
diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c
index c59da29a2b8..7e23c0875f6 100644
--- a/src/mesa/state_tracker/st_cb_program.c
+++ b/src/mesa/state_tracker/st_cb_program.c
@@ -165,18 +165,7 @@ st_program_string_notify( struct gl_context *ctx,
if (st->fp == stfp)
st->dirty |= stfp->affected_states;
- }
- else if (target == GL_GEOMETRY_PROGRAM_NV) {
- struct st_common_program *stgp = st_common_program(prog);
-
- st_release_basic_variants(st, stgp);
- if (!st_translate_common_program(st, stgp))
- return false;
-
- if (st->gp == stgp)
- st->dirty |= stgp->affected_states;
- }
- else if (target == GL_VERTEX_PROGRAM_ARB) {
+ } else if (target == GL_VERTEX_PROGRAM_ARB) {
struct st_vertex_program *stvp = (struct st_vertex_program *) prog;
st_release_vp_variants(st, stvp);
@@ -185,39 +174,18 @@ st_program_string_notify( struct gl_context *ctx,
if (st->vp == stvp)
st->dirty |= ST_NEW_VERTEX_PROGRAM(st, stvp);
- }
- else if (target == GL_TESS_CONTROL_PROGRAM_NV) {
- struct st_common_program *sttcp =
- st_common_program(prog);
-
- st_release_basic_variants(st, sttcp);
- if (!st_translate_common_program(st, sttcp))
- return false;
-
- if (st->tcp == sttcp)
- st->dirty |= sttcp->affected_states;
- }
- else if (target == GL_TESS_EVALUATION_PROGRAM_NV) {
- struct st_common_program *sttep =
- st_common_program(prog);
-
- st_release_basic_variants(st, sttep);
- if (!st_translate_common_program(st, sttep))
- return false;
-
- if (st->tep == sttep)
- st->dirty |= sttep->affected_states;
- }
- else if (target == GL_COMPUTE_PROGRAM_NV) {
- struct st_common_program *stcp =
- (struct st_common_program *) prog;
+ } else {
+ struct st_common_program *stcp = st_common_program(prog);
st_release_basic_variants(st, stcp);
if (!st_translate_common_program(st, stcp))
return false;
- if (st->cp == stcp)
- st->dirty |= stcp->affected_states;
+ if ((prog->info.stage == MESA_SHADER_TESS_CTRL && st->tcp == stcp) ||
+ (prog->info.stage == MESA_SHADER_TESS_EVAL && st->tep == stcp) ||
+ (prog->info.stage == MESA_SHADER_GEOMETRY && st->gp == stcp) ||
+ (prog->info.stage == MESA_SHADER_COMPUTE && st->cp == stcp))
+ st->dirty |= stcp->affected_states;
}
if (ST_DEBUG & DEBUG_PRECOMPILE ||