diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 5362fb2040c..adbf58508f5 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -2513,6 +2513,7 @@ flush_batch(struct zink_context *ctx, bool sync) ctx->sample_locations_changed = ctx->gfx_pipeline_state.sample_locations_enabled; if (conditional_render_active) zink_start_conditional_render(ctx); + zink_set_color_write_enables(ctx); } } @@ -2567,6 +2568,14 @@ unbind_fb_surface(struct zink_context *ctx, struct pipe_surface *surf, bool chan check_resource_for_batch_ref(ctx, res); } +void +zink_set_color_write_enables(struct zink_context *ctx) +{ + const VkBool32 enables[PIPE_MAX_COLOR_BUFS] = {1, 1, 1, 1, 1, 1, 1, 1}; + const unsigned max_att = MIN2(PIPE_MAX_COLOR_BUFS, zink_screen(ctx->base.screen)->info.props.limits.maxColorAttachments); + VKCTX(CmdSetColorWriteEnableEXT)(ctx->batch.state->cmdbuf, max_att, enables); +} + static void zink_set_framebuffer_state(struct pipe_context *pctx, const struct pipe_framebuffer_state *state) @@ -4300,6 +4309,8 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags) zink_select_draw_vbo(ctx); zink_select_launch_grid(ctx); + zink_set_color_write_enables(ctx); + if (!(flags & PIPE_CONTEXT_PREFER_THREADED) || flags & PIPE_CONTEXT_COMPUTE_ONLY) { return &ctx->base; } diff --git a/src/gallium/drivers/zink/zink_context.h b/src/gallium/drivers/zink/zink_context.h index fd47db21599..976c0bd940d 100644 --- a/src/gallium/drivers/zink/zink_context.h +++ b/src/gallium/drivers/zink/zink_context.h @@ -526,7 +526,8 @@ zink_resource_rebind(struct zink_context *ctx, struct zink_resource *res); void zink_rebind_framebuffer(struct zink_context *ctx, struct zink_resource *res); - +void +zink_set_color_write_enables(struct zink_context *ctx); void zink_copy_buffer(struct zink_context *ctx, struct zink_resource *dst, struct zink_resource *src, unsigned dst_offset, unsigned src_offset, unsigned size); diff --git a/src/gallium/drivers/zink/zink_pipeline.c b/src/gallium/drivers/zink/zink_pipeline.c index fc6ed106c9d..d525e85cd20 100644 --- a/src/gallium/drivers/zink/zink_pipeline.c +++ b/src/gallium/drivers/zink/zink_pipeline.c @@ -232,6 +232,8 @@ zink_create_gfx_pipeline(struct zink_screen *screen, dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE_EXT; dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE_EXT; } + if (!screen->driver_workarounds.color_write_missing) + dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_COLOR_WRITE_ENABLE_EXT; VkPipelineRasterizationLineStateCreateInfoEXT rast_line_state; if (screen->info.have_EXT_line_rasterization) {