}
st_release_fp_variants(st, stfp);
- if (!st_translate_fragment_program(st, stfp))
+ if (!stfp->shader_program && /* not GLSL->NIR */
+ !st_translate_fragment_program(st, stfp))
return false;
if (st->fp == stfp)
struct st_vertex_program *stvp = (struct st_vertex_program *) prog;
st_release_vp_variants(st, stvp);
- if (!st_translate_vertex_program(st, stvp))
+ if (!stvp->shader_program && /* not GLSL->NIR */
+ !st_translate_vertex_program(st, stvp))
return false;
if (st->vp == stvp)
struct st_common_program *stcp = st_common_program(prog);
st_release_basic_variants(st, stcp);
- if (!st_translate_common_program(st, stcp))
+ if (!stcp->shader_program && /* not GLSL->NIR */
+ !st_translate_common_program(st, stcp))
return false;
if ((prog->info.stage == MESA_SHADER_TESS_CTRL && st->tcp == stcp) ||
#include "st_context.h"
#include "st_glsl_types.h"
#include "st_program.h"
+#include "st_shader_cache.h"
#include "compiler/nir/nir.h"
#include "compiler/glsl_types.h"
struct gl_program *prog = shader->Program;
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_vertex_program(prog));
+
+ /* Get pipe_stream_output_info. */
+ if (i == MESA_SHADER_VERTEX ||
+ i == MESA_SHADER_TESS_EVAL ||
+ i == MESA_SHADER_GEOMETRY)
+ st_translate_stream_output_info(prog);
+
+ st_store_ir_in_disk_cache(st, prog, true);
+
if (!ctx->Driver.ProgramStringNotify(ctx,
_mesa_shader_stage_to_program(i),
prog)) {
output_semantic_index[num_outputs] = 0;
/* ARB_vp: */
- if (!stvp->glsl_to_tgsi && !stvp->shader_program) {
+ if (!stvp->glsl_to_tgsi) {
_mesa_remove_output_reads(&stvp->Base, PROGRAM_OUTPUT);
/* This determines which states will be updated when the assembly
/* No samplers are allowed in ARB_vp. */
}
- if (stvp->shader_program) {
- st_translate_stream_output_info(&stvp->Base);
- st_store_ir_in_disk_cache(st, &stvp->Base, true);
- return true;
- }
-
ureg = ureg_create_with_screen(PIPE_SHADER_VERTEX, st->pipe->screen);
if (ureg == NULL)
return false;
st_translate_fragment_program(struct st_context *st,
struct st_fragment_program *stfp)
{
- /* We have already compiled to NIR so just return */
- if (stfp->shader_program) {
- st_store_ir_in_disk_cache(st, &stfp->Base, true);
- return true;
- }
-
ubyte outputMapping[2 * FRAG_RESULT_MAX];
ubyte inputMapping[VARYING_SLOT_MAX];
ubyte inputSlotToAttr[VARYING_SLOT_MAX];
memset(inputSlotToAttr, ~0, sizeof(inputSlotToAttr));
/* Non-GLSL programs: */
- if (!stfp->glsl_to_tgsi && !stfp->shader_program) {
+ if (!stfp->glsl_to_tgsi) {
_mesa_remove_output_reads(&stfp->Base, PROGRAM_OUTPUT);
if (st->ctx->Const.GLSLFragCoordIsSysVal)
_mesa_program_fragment_position_to_sysval(&stfp->Base);
st_translate_common_program(struct st_context *st,
struct st_common_program *stcp)
{
- /* We have already compiled to NIR so just return */
- if (stcp->shader_program) {
- /* No variants */
- if (stcp->Base.info.stage == MESA_SHADER_TESS_EVAL ||
- stcp->Base.info.stage == MESA_SHADER_GEOMETRY)
- st_translate_stream_output_info(&stcp->Base);
- st_store_ir_in_disk_cache(st, &stcp->Base, true);
- return true;
- }
-
struct gl_program *prog = &stcp->Base;
enum pipe_shader_type stage =
pipe_shader_type_from_mesa(stcp->Base.info.stage);