*/
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;
}
* 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];
nir_foreach_variable(var, &s->outputs) {
if (var->data.location == FRAG_RESULT_COLOR) {
- key.nr_cbufs = 1;
+ key.cbufs |= 1 << 0;
} else if (var->data.location >= FRAG_RESULT_DATA0) {
- key.nr_cbufs = MAX2(key.nr_cbufs,
- var->data.location -
- FRAG_RESULT_DATA0 + 1);
+ key.cbufs |= 1 << (var->data.location -
+ FRAG_RESULT_DATA0);
}
}
key->alpha_test_func = v3d->zsa->base.alpha.func;
}
- /* gl_FragColor's propagation to however many bound color buffers
- * there are means that the buffer count needs to be in the key.
- */
- key->nr_cbufs = v3d->framebuffer.nr_cbufs;
key->swap_color_rb = v3d->swap_color_rb;
- for (int i = 0; i < key->nr_cbufs; i++) {
+ for (int i = 0; i < v3d->framebuffer.nr_cbufs; i++) {
struct pipe_surface *cbuf = v3d->framebuffer.cbufs[i];
if (!cbuf)
continue;
+ /* gl_FragColor's propagation to however many bound color
+ * buffers there are means that the shader compile needs to
+ * know what buffers are present.
+ */
+ key->cbufs |= 1 << i;
+
const struct util_format_description *desc =
util_format_description(cbuf->format);