zink: use EXT_color_write_enable when possible

this should only verify that drivers aren't completely broken by
enabling it and have no other changes

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15392>
This commit is contained in:
Mike Blumenkrantz 2022-03-13 12:14:13 -04:00
parent ecca2564c1
commit 447099629e
3 changed files with 15 additions and 1 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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) {