diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 5b37860..4653147 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -3139,6 +3139,7 @@ static inline void vrend_fill_shader_key(struct vrend_context *ctx, memcpy(key->prev_stage_generic_and_patch_outputs_layout, ctx->sub->shaders[prev_type]->sinfo.generic_outputs_layout, 64 * sizeof (struct vrend_layout_info)); + key->force_invariant_inputs = ctx->sub->shaders[prev_type]->sinfo.invariant_outputs; } int next_type = -1; diff --git a/src/vrend_shader.c b/src/vrend_shader.c index 921e493..1279d03 100644 --- a/src/vrend_shader.c +++ b/src/vrend_shader.c @@ -4644,6 +4644,15 @@ iter_instruction(struct tgsi_iterate_context *iter, } if (ctx->so) prepare_so_movs(ctx); + + /* GLES doesn't allow invariant specifiers on inputs, but on GL with + * GLSL < 4.30 it is required to match the output of the previous stage */ + if (!ctx->cfg->use_gles) { + for (unsigned i = 0; i < ctx->num_inputs; ++i) { + if (ctx->key->force_invariant_inputs & (1ull << i)) + ctx->inputs[i].invariant = 1; + } + } } if (!get_destination_info(ctx, inst, &dinfo, dsts, fp64_dsts, writemask)) @@ -6567,6 +6576,11 @@ static void fill_sinfo(struct dump_ctx *ctx, struct vrend_shader_info *sinfo) sinfo->image_arrays = ctx->image_arrays; sinfo->num_image_arrays = ctx->num_image_arrays; sinfo->generic_inputs_emitted_mask = ctx->generic_inputs_emitted_mask; + + for (unsigned i = 0; i < ctx->num_outputs; ++i) { + if (ctx->outputs[i].invariant) + sinfo->invariant_outputs |= 1ull << i; + } } static bool allocate_strbuffers(struct dump_ctx* ctx) diff --git a/src/vrend_shader.h b/src/vrend_shader.h index ca7008e..bd80228 100644 --- a/src/vrend_shader.h +++ b/src/vrend_shader.h @@ -90,6 +90,7 @@ struct vrend_shader_info { struct vrend_interp_info *interpinfo; char **so_names; + uint64_t invariant_outputs; }; struct vrend_shader_key { @@ -125,6 +126,7 @@ struct vrend_shader_key { uint8_t num_indirect_patch_inputs; uint32_t generic_outputs_expected_mask; uint8_t fs_swizzle_output_rgb_to_bgr; + uint64_t force_invariant_inputs; }; struct vrend_shader_cfg {