summaryrefslogtreecommitdiffstats
path: root/src/broadcom/compiler
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2019-02-01 13:13:48 -0800
committerEric Anholt <[email protected]>2019-02-05 15:42:04 -0800
commitbdef17b052b9c4d2568544c1b745880f5db50f1d (patch)
treeb6cbe476cacab035384cb3872e68d5e763cc8210 /src/broadcom/compiler
parent17a649af052b8d4b0eef0a6a52b772ceb9732494 (diff)
v3d: Store the actual mask of color buffers present in the key.
If you only bound rt 1+, we'd still emit a write to the rt0 that isn't present (noticed while debugging an ext_framebuffer_multisample-alpha-to-coverage-no-draw-buffer-zero regression in another change).
Diffstat (limited to 'src/broadcom/compiler')
-rw-r--r--src/broadcom/compiler/nir_to_vir.c8
-rw-r--r--src/broadcom/compiler/v3d_compiler.h3
2 files changed, 6 insertions, 5 deletions
diff --git a/src/broadcom/compiler/nir_to_vir.c b/src/broadcom/compiler/nir_to_vir.c
index a5e75f650e8..d983f91e718 100644
--- a/src/broadcom/compiler/nir_to_vir.c
+++ b/src/broadcom/compiler/nir_to_vir.c
@@ -1129,8 +1129,8 @@ emit_frag_end(struct v3d_compile *c)
*/
bool has_any_tlb_color_write = false;
- for (int rt = 0; rt < c->fs_key->nr_cbufs; rt++) {
- if (c->output_color_var[rt])
+ for (int rt = 0; rt < V3D_MAX_DRAW_BUFFERS; rt++) {
+ if (c->fs_key->cbufs & (1 << rt) && c->output_color_var[rt])
has_any_tlb_color_write = true;
}
@@ -1194,8 +1194,8 @@ emit_frag_end(struct v3d_compile *c)
* uniform setup
*/
- for (int rt = 0; rt < c->fs_key->nr_cbufs; rt++) {
- if (!c->output_color_var[rt])
+ for (int rt = 0; rt < V3D_MAX_DRAW_BUFFERS; rt++) {
+ if (!(c->fs_key->cbufs & (1 << rt)) || !c->output_color_var[rt])
continue;
nir_variable *var = c->output_color_var[rt];
diff --git a/src/broadcom/compiler/v3d_compiler.h b/src/broadcom/compiler/v3d_compiler.h
index 127b04136d1..cea26484a8f 100644
--- a/src/broadcom/compiler/v3d_compiler.h
+++ b/src/broadcom/compiler/v3d_compiler.h
@@ -357,7 +357,8 @@ struct v3d_fs_key {
bool sample_alpha_to_one;
bool clamp_color;
bool shade_model_flat;
- uint8_t nr_cbufs;
+ /* Mask of which color render targets are present. */
+ uint8_t cbufs;
uint8_t swap_color_rb;
/* Mask of which render targets need to be written as 32-bit floats */
uint8_t f32_color_rb;