for (int i = 0; i < fb->nr_cbufs; i++) {
struct pipe_surface *surf = fb->cbufs[i];
- if (surf) {
+ if (surf && !zink_use_dummy_attachments(ctx)) {
struct zink_surface *transient = zink_transient_surface(surf);
state.rts[i].format = zink_get_format(screen, surf->format);
state.rts[i].samples = MAX3(transient ? transient->base.nr_samples : 0, surf->texture->nr_samples, 1);
static VkImageView
prep_fb_attachment(struct zink_context *ctx, struct zink_surface *surf, unsigned i)
{
- if (!surf)
+ if (!surf || (i < ctx->fb_state.nr_cbufs && zink_use_dummy_attachments(ctx)))
return zink_csurface(ctx->dummy_surface[util_logbase2_ceil(ctx->fb_state.samples)])->image_view;
zink_batch_resource_usage_set(&ctx->batch, zink_resource(surf->base.texture), true);
if (zink_screen(ctx->base.screen)->driver_workarounds.color_write_missing) {
/* use dummy color buffers instead of the more sane option */
zink_end_render_pass(ctx);
+ ctx->rp_changed = true;
update_framebuffer_state(ctx, ctx->fb_state.width, ctx->fb_state.height);
} else {
VKCTX(CmdSetColorWriteEnableEXT)(ctx->batch.state->cmdbuf, max_att, disable_color_writes ? disables : enables);
return NULL;
}
+bool
+zink_use_dummy_attachments(const struct zink_context *ctx)
+{
+ return ctx->disable_color_writes && zink_screen(ctx->base.screen)->driver_workarounds.color_write_missing;
+}
+
struct zink_framebuffer *
zink_get_framebuffer_imageless(struct zink_context *ctx)
{
unsigned num_resolves = 0;
for (int i = 0; i < ctx->fb_state.nr_cbufs; i++) {
struct pipe_surface *psurf = ctx->fb_state.cbufs[i];
- if (!psurf || ctx->disable_color_writes)
+ if (!psurf || zink_use_dummy_attachments(ctx))
psurf = ctx->dummy_surface[util_logbase2_ceil(ctx->gfx_pipeline_state.rast_samples+1)];
struct zink_surface *surface = zink_csurface(psurf);
struct zink_surface *transient = zink_transient_surface(psurf);
unsigned num_resolves = 0;
struct zink_framebuffer_state state = {0};
- if (!ctx->disable_color_writes) {
+ if (!zink_use_dummy_attachments(ctx)) {
for (int i = 0; i < ctx->fb_state.nr_cbufs; i++) {
struct pipe_surface *psurf = ctx->fb_state.cbufs[i];
if (psurf) {