unsigned clear_buffers = buffers >> 2;
for (unsigned i = 0; i < ctx->fb_state.nr_cbufs; i++) {
if (ctx->fb_state.cbufs[i] &&
- (ctx->fb_layer_mismatch & clear_buffers & BITFIELD_BIT(i)))
+ (ctx->fb_layer_mismatch & clear_buffers & BITFIELD_BIT(i))) {
+ if (ctx->void_clears & (PIPE_CLEAR_COLOR0 << i)) {
+ union pipe_color_union color;
+ color.f[0] = color.f[1] = color.f[2] = 0;
+ color.f[3] = 1.0;
+ pctx->clear_render_target(pctx, ctx->fb_state.cbufs[i], &color,
+ 0, 0,
+ ctx->fb_state.cbufs[i]->width, ctx->fb_state.cbufs[i]->height,
+ ctx->render_condition_active);
+ }
pctx->clear_render_target(pctx, ctx->fb_state.cbufs[i], pcolor,
x, y, w, h, ctx->render_condition_active);
+ }
}
if (ctx->fb_state.zsbuf && (buffers & PIPE_CLEAR_DEPTHSTENCIL))
pctx->clear_depth_stencil(pctx, ctx->fb_state.zsbuf, buffers & PIPE_CLEAR_DEPTHSTENCIL, depth, stencil,
return;
}
+ if (ctx->void_clears & buffers) {
+ unsigned void_clears = ctx->void_clears & buffers;
+ ctx->void_clears &= ~buffers;
+ union pipe_color_union color;
+ color.f[0] = color.f[1] = color.f[2] = 0;
+ color.f[3] = 1.0;
+ pctx->clear(pctx, void_clears, NULL, &color, 0, 0);
+ }
+
if (buffers & PIPE_CLEAR_COLOR) {
for (unsigned i = 0; i < fb->nr_cbufs; i++) {
if ((buffers & (PIPE_CLEAR_COLOR0 << i)) && fb->cbufs[i]) {
{
if (ctx->batch.in_rp)
return;
+ if (!ctx->batch.in_rp && ctx->void_clears) {
+ union pipe_color_union color;
+ color.f[0] = color.f[1] = color.f[2] = 0;
+ color.f[3] = 1.0;
+ ctx->base.clear(&ctx->base, ctx->void_clears, NULL, &color, 0, 0);
+ ctx->void_clears = 0;
+ }
unsigned clear_buffers;
/* use renderpass for multisample-to-singlesample or fbfetch:
* - msrtss is TODO
ctx->dynamic_fb.info.layerCount = layers;
ctx->gfx_pipeline_state.rendering_info.colorAttachmentCount = ctx->fb_state.nr_cbufs;
+ ctx->void_clears = 0;
for (int i = 0; i < ctx->fb_state.nr_cbufs; i++) {
struct pipe_surface *psurf = ctx->fb_state.cbufs[i];
if (psurf) {
}
}
res->fb_binds++;
- ctx->gfx_pipeline_state.void_alpha_attachments |= util_format_has_alpha1(psurf->format) ? BITFIELD_BIT(i) : 0;
+ if (util_format_has_alpha1(psurf->format)) {
+ ctx->gfx_pipeline_state.void_alpha_attachments |= BITFIELD_BIT(i);
+ if (!res->valid)
+ ctx->void_clears |= (PIPE_CLEAR_COLOR0 << i);
+ }
}
}
if (ctx->gfx_pipeline_state.void_alpha_attachments != prev_void_alpha_attachments)