diff options
author | Rob Clark <[email protected]> | 2018-08-21 08:33:39 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2018-09-05 13:38:43 -0400 |
commit | 1a24f519663494b212d16693b5a5d9ab2f2464c0 (patch) | |
tree | 4571585be995bcc7d7fa0ac49669c05546695146 /src | |
parent | 6b4397feabeda43dca7bbfc02ba59b8c95dd4e5e (diff) |
freedreno/ir3: ignore unused inputs
We could end up w/ inputs larger than vec4, simply because unused inputs
are not split.
Fixes things like dEQP-GLES31.functional.separate_shader.random.77 (and
probably a handful of others)
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c index e4979a60a02..005e043a63b 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c @@ -3233,6 +3233,25 @@ create_frag_coord(struct ir3_context *ctx, unsigned comp) } } +static uint64_t +input_bitmask(struct ir3_context *ctx, nir_variable *in) +{ + unsigned ncomp = glsl_get_components(in->type); + unsigned slot = in->data.location; + + /* let's pretend things other than vec4 don't exist: */ + ncomp = MAX2(ncomp, 4); + + if (ctx->so->type == SHADER_FRAGMENT) { + /* see st_nir_fixup_varying_slots(): */ + if (slot >= VARYING_SLOT_VAR9) + slot -= 9; + } + + /* Note that info.inputs_read is in units of vec4 slots: */ + return ((1ull << (ncomp/4)) - 1) << slot; +} + static void setup_input(struct ir3_context *ctx, nir_variable *in) { @@ -3247,6 +3266,15 @@ setup_input(struct ir3_context *ctx, nir_variable *in) /* let's pretend things other than vec4 don't exist: */ ncomp = MAX2(ncomp, 4); + + /* skip unread inputs, we could end up with (for example), unsplit + * matrix/etc inputs in the case they are not read, so just silently + * skip these. + * + */ + if (!(ctx->s->info.inputs_read & input_bitmask(ctx, in))) + return; + compile_assert(ctx, ncomp == 4); so->inputs[n].slot = slot; @@ -3264,7 +3292,7 @@ setup_input(struct ir3_context *ctx, nir_variable *in) so->frag_coord = true; instr = create_frag_coord(ctx, i); } else if (slot == VARYING_SLOT_PNTC) { - /* see for example st_get_generic_varying_index().. this is + /* see for example st_nir_fixup_varying_slots().. this is * maybe a bit mesa/st specific. But we need things to line * up for this in fdN_program: * unsigned texmask = 1 << (slot - VARYING_SLOT_VAR0); |