bool brw_blorp_clear_color(struct brw_context *brw, struct gl_framebuffer *fb, GLbitfield mask, bool partial_clear, bool encode_srgb) { for (unsigned buf = 0; buf < fb->_NumColorDrawBuffers; buf++) { struct gl_renderbuffer *rb = fb->_ColorDrawBuffers[buf]; struct intel_renderbuffer *irb = intel_renderbuffer(rb); /* Only clear the buffers present in the provided mask */ if (((1 << fb->_ColorDrawBufferIndexes[buf]) & mask) == 0) continue; /* If this is an ES2 context or GL_ARB_ES2_compatibility is supported, * the framebuffer can be complete with some attachments missing. In * this case the _ColorDrawBuffers pointer will be NULL. */ if (rb == NULL) continue; if (!do_single_blorp_clear(brw, fb, rb, buf, partial_clear, encode_srgb)) { return false; } irb->need_downsample = true; } return true; }
bool brw_blorp_clear_color(struct brw_context *brw, struct gl_framebuffer *fb, bool partial_clear) { /* The constant color clear code doesn't work for multisampled surfaces, so * we need to support falling back to other clear mechanisms. * Unfortunately, our clear code is based on a bitmask that doesn't * distinguish individual color attachments, so we walk the attachments to * see if any require fallback, and fall back for all if any of them need * to. */ for (unsigned buf = 0; buf < fb->_NumColorDrawBuffers; buf++) { struct gl_renderbuffer *rb = fb->_ColorDrawBuffers[buf]; struct intel_renderbuffer *irb = intel_renderbuffer(rb); if (irb && irb->mt->msaa_layout != INTEL_MSAA_LAYOUT_NONE) return false; } for (unsigned buf = 0; buf < fb->_NumColorDrawBuffers; buf++) { struct gl_renderbuffer *rb = fb->_ColorDrawBuffers[buf]; struct intel_renderbuffer *irb = intel_renderbuffer(rb); /* If this is an ES2 context or GL_ARB_ES2_compatibility is supported, * the framebuffer can be complete with some attachments missing. In * this case the _ColorDrawBuffers pointer will be NULL. */ if (rb == NULL) continue; if (fb->NumLayers > 0) { assert(fb->NumLayers == irb->mt->level[irb->mt_level].depth); for (unsigned layer = 0; layer < fb->NumLayers; layer++) { if (!do_single_blorp_clear(brw, fb, rb, buf, partial_clear, layer)) return false; } } else { unsigned layer = irb->mt_layer; if (!do_single_blorp_clear(brw, fb, rb, buf, partial_clear, layer)) return false; } } return true; }
bool brw_blorp_clear_color(struct brw_context *brw, struct gl_framebuffer *fb, GLbitfield mask, bool partial_clear, bool encode_srgb) { for (unsigned buf = 0; buf < fb->_NumColorDrawBuffers; buf++) { struct gl_renderbuffer *rb = fb->_ColorDrawBuffers[buf]; struct intel_renderbuffer *irb = intel_renderbuffer(rb); /* Only clear the buffers present in the provided mask */ if (((1 << fb->_ColorDrawBufferIndexes[buf]) & mask) == 0) continue; /* If this is an ES2 context or GL_ARB_ES2_compatibility is supported, * the framebuffer can be complete with some attachments missing. In * this case the _ColorDrawBuffers pointer will be NULL. */ if (rb == NULL) continue; if (fb->MaxNumLayers > 0) { unsigned layer_multiplier = (irb->mt->msaa_layout == INTEL_MSAA_LAYOUT_UMS || irb->mt->msaa_layout == INTEL_MSAA_LAYOUT_CMS) ? irb->mt->num_samples : 1; unsigned num_layers = irb->layer_count; for (unsigned layer = 0; layer < num_layers; layer++) { if (!do_single_blorp_clear( brw, fb, rb, buf, partial_clear, encode_srgb, irb->mt_layer + layer * layer_multiplier)) { return false; } } } else { unsigned layer = irb->mt_layer; if (!do_single_blorp_clear(brw, fb, rb, buf, partial_clear, encode_srgb, layer)) return false; } irb->need_downsample = true; } return true; }