aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2019-11-01 22:04:57 -0400
committerMarek Olšák <[email protected]>2019-11-19 18:02:06 -0500
commit60398e2d45f602fb3bf3a6cf770f4e26eee50587 (patch)
treed10b247398ae7b6231ce5968640db6217bed22c5 /src/mesa
parent445ec0fc63f855b763079a05d1da4dc3bfcb56ae (diff)
st/mesa: start deduplicating some program code
Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_cb_program.c7
-rw-r--r--src/mesa/state_tracker/st_program.c11
-rw-r--r--src/mesa/state_tracker/st_program.h3
-rw-r--r--src/mesa/state_tracker/st_shader_cache.c5
4 files changed, 13 insertions, 13 deletions
diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c
index 806fbbc7c34..50fa5d2ad67 100644
--- a/src/mesa/state_tracker/st_cb_program.c
+++ b/src/mesa/state_tracker/st_cb_program.c
@@ -123,7 +123,6 @@ st_delete_program(struct gl_context *ctx, struct gl_program *prog)
_mesa_delete_program( ctx, prog );
}
-
/**
* Called via ctx->Driver.ProgramStringNotify()
* Called when the program's text/code is changed. We have to free
@@ -135,7 +134,6 @@ st_program_string_notify( struct gl_context *ctx,
struct gl_program *prog )
{
struct st_context *st = st_context(ctx);
- gl_shader_stage stage = _mesa_program_enum_to_shader_stage(target);
if (target == GL_FRAGMENT_PROGRAM_ARB ||
target == GL_FRAGMENT_SHADER_ATI) {
@@ -180,10 +178,7 @@ st_program_string_notify( struct gl_context *ctx,
st->dirty |= stcp->affected_states;
}
- if (ST_DEBUG & DEBUG_PRECOMPILE ||
- st->shader_has_one_variant[stage])
- st_precompile_shader_variant(st, prog);
-
+ st_finalize_program(st, prog);
return GL_TRUE;
}
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index f6a35475286..597a0a6135f 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -2005,7 +2005,7 @@ st_destroy_program_variants(struct st_context *st)
/**
* Compile one shader variant.
*/
-void
+static void
st_precompile_shader_variant(struct st_context *st,
struct gl_program *prog)
{
@@ -2050,3 +2050,12 @@ st_precompile_shader_variant(struct st_context *st,
assert(0);
}
}
+
+void
+st_finalize_program(struct st_context *st, struct gl_program *prog)
+{
+ /* Create Gallium shaders now instead of on demand. */
+ if (ST_DEBUG & DEBUG_PRECOMPILE ||
+ st->shader_has_one_variant[prog->info.stage])
+ st_precompile_shader_variant(st, prog);
+}
diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h
index 90e06e9effb..c2df2463273 100644
--- a/src/mesa/state_tracker/st_program.h
+++ b/src/mesa/state_tracker/st_program.h
@@ -378,8 +378,7 @@ st_translate_common_program(struct st_context *st,
struct st_common_program *stcp);
extern void
-st_precompile_shader_variant(struct st_context *st,
- struct gl_program *prog);
+st_finalize_program(struct st_context *st, struct gl_program *prog);
#ifdef __cplusplus
}
diff --git a/src/mesa/state_tracker/st_shader_cache.c b/src/mesa/state_tracker/st_shader_cache.c
index 2671b95a5af..1d544470a94 100644
--- a/src/mesa/state_tracker/st_shader_cache.c
+++ b/src/mesa/state_tracker/st_shader_cache.c
@@ -270,10 +270,7 @@ st_deserialise_ir_program(struct gl_context *ctx,
st_set_prog_affected_state_flags(prog);
_mesa_associate_uniform_storage(ctx, shProg, prog);
- /* Create Gallium shaders now instead of on demand. */
- if (ST_DEBUG & DEBUG_PRECOMPILE ||
- st->shader_has_one_variant[prog->info.stage])
- st_precompile_shader_variant(st, prog);
+ st_finalize_program(st, prog);
}
bool