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) {
}
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;
}
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 ||
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);