diff options
author | Eric Anholt <[email protected]> | 2018-06-06 21:06:44 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2018-06-14 16:52:25 -0700 |
commit | a40bc33b116cef0b5723489081f7755ccef68d09 (patch) | |
tree | 3c4c77665c4fe778c5129ec5e6479179b644342e /src | |
parent | 600d34c8228b4d5e8468b56a8ba23d82a0790583 (diff) |
v3d: Fix undefined results for a swap_color_rb RT from a float shader output.
Fixes segfaults and undefined behavior in
dEQP-GLES3.functional.fragment_out.basic.fixed.srgb8_alpha8_lowp_float
Diffstat (limited to 'src')
-rw-r--r-- | src/broadcom/compiler/nir_to_vir.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/broadcom/compiler/nir_to_vir.c b/src/broadcom/compiler/nir_to_vir.c index 0f7e47689dc..23b5975a334 100644 --- a/src/broadcom/compiler/nir_to_vir.c +++ b/src/broadcom/compiler/nir_to_vir.c @@ -969,6 +969,9 @@ emit_frag_end(struct v3d_compile *c) conf |= TLB_SAMPLE_MODE_PER_PIXEL; conf |= (7 - rt) << TLB_RENDER_TARGET_SHIFT; + if (c->fs_key->swap_color_rb & (1 << rt)) + num_components = MAX2(num_components, 3); + assert(num_components != 0); switch (glsl_get_base_type(var->type)) { case GLSL_TYPE_UINT: @@ -1360,7 +1363,7 @@ ntq_setup_outputs(struct v3d_compile *c) assert(array_len == 1); (void)array_len; - for (int i = 0; i < glsl_get_vector_elements(var->type); i++) { + for (int i = 0; i < 4; i++) { add_output(c, loc + var->data.location_frac + i, var->data.location, var->data.location_frac + i); |