aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2019-11-12 23:46:37 -0500
committerMarek Olšák <[email protected]>2019-11-26 15:14:10 -0500
commite8f0a39d4506285582b245962a82b18bcc0e05f2 (patch)
tree30bf341bd8b7389c5e83a2356a35c99d0fa2683e
parent5a714531f7189f9e2e0059218b5004c3cbfc687e (diff)
st/mesa: don't call ProgramStringNotify in glsl_to_nir
Reviewed-by: Timothy Arceri <[email protected]>
-rw-r--r--src/mesa/state_tracker/st_cb_program.c12
-rw-r--r--src/mesa/state_tracker/st_glsl_to_nir.cpp17
2 files changed, 16 insertions, 13 deletions
diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c
index 3a62212cce7..0bc6e90ee07 100644
--- a/src/mesa/state_tracker/st_cb_program.c
+++ b/src/mesa/state_tracker/st_cb_program.c
@@ -114,6 +114,9 @@ st_program_string_notify( struct gl_context *ctx,
struct st_context *st = st_context(ctx);
struct st_program *stp = (struct st_program *) prog;
+ /* GLSL-to-NIR should not end up here. */
+ assert(!stp->shader_program);
+
if (target == GL_FRAGMENT_PROGRAM_ARB ||
target == GL_FRAGMENT_SHADER_ATI) {
if (target == GL_FRAGMENT_SHADER_ATI) {
@@ -124,18 +127,15 @@ st_program_string_notify( struct gl_context *ctx,
}
st_release_fp_variants(st, stp);
- if (!stp->shader_program && /* not GLSL->NIR */
- !st_translate_fragment_program(st, stp))
+ if (!st_translate_fragment_program(st, stp))
return false;
} else if (target == GL_VERTEX_PROGRAM_ARB) {
st_release_vp_variants(st, stp);
- if (!stp->shader_program && /* not GLSL->NIR */
- !st_translate_vertex_program(st, stp))
+ if (!st_translate_vertex_program(st, stp))
return false;
} else {
st_release_common_variants(st, stp);
- if (!stp->shader_program && /* not GLSL->NIR */
- !st_translate_common_program(st, stp))
+ if (!st_translate_common_program(st, stp))
return false;
}
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index 9f41a7a3b0b..f8f1ee3fce2 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -790,11 +790,12 @@ st_link_nir(struct gl_context *ctx,
continue;
struct gl_program *prog = shader->Program;
+ struct st_program *stp = st_program(prog);
st_glsl_to_nir_post_opts(st, prog, shader_program);
/* Initialize st_vertex_program members. */
if (i == MESA_SHADER_VERTEX)
- st_prepare_vertex_program(st_program(prog));
+ st_prepare_vertex_program(stp);
/* Get pipe_stream_output_info. */
if (i == MESA_SHADER_VERTEX ||
@@ -804,12 +805,14 @@ st_link_nir(struct gl_context *ctx,
st_store_ir_in_disk_cache(st, prog, true);
- if (!ctx->Driver.ProgramStringNotify(ctx,
- _mesa_shader_stage_to_program(i),
- prog)) {
- _mesa_reference_program(ctx, &shader->Program, NULL);
- return false;
- }
+ if (prog->info.stage == MESA_SHADER_VERTEX)
+ st_release_vp_variants(st, stp);
+ else if (prog->info.stage == MESA_SHADER_FRAGMENT)
+ st_release_fp_variants(st, stp);
+ else
+ st_release_common_variants(st, stp);
+
+ st_finalize_program(st, prog);
/* The GLSL IR won't be needed anymore. */
ralloc_free(shader->ir);