mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 06:50:11 +01:00
zink: add an alternate path for EXT_color_write_enable usage
for drivers where this is broken/missing, the same effect can be achieved by feeding the renderpass a framebuffer with null/dummy attachments Acked-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15392>
This commit is contained in:
parent
447099629e
commit
3892c13381
3 changed files with 27 additions and 17 deletions
|
|
@ -2572,9 +2572,16 @@ void
|
||||||
zink_set_color_write_enables(struct zink_context *ctx)
|
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 VkBool32 enables[PIPE_MAX_COLOR_BUFS] = {1, 1, 1, 1, 1, 1, 1, 1};
|
||||||
|
const VkBool32 disables[PIPE_MAX_COLOR_BUFS] = {0};
|
||||||
const unsigned max_att = MIN2(PIPE_MAX_COLOR_BUFS, zink_screen(ctx->base.screen)->info.props.limits.maxColorAttachments);
|
const unsigned max_att = MIN2(PIPE_MAX_COLOR_BUFS, zink_screen(ctx->base.screen)->info.props.limits.maxColorAttachments);
|
||||||
|
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);
|
||||||
|
update_framebuffer_state(ctx, ctx->fb_state.width, ctx->fb_state.height);
|
||||||
|
} else {
|
||||||
VKCTX(CmdSetColorWriteEnableEXT)(ctx->batch.state->cmdbuf, max_att, enables);
|
VKCTX(CmdSetColorWriteEnableEXT)(ctx->batch.state->cmdbuf, max_att, enables);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
zink_set_framebuffer_state(struct pipe_context *pctx,
|
zink_set_framebuffer_state(struct pipe_context *pctx,
|
||||||
|
|
|
||||||
|
|
@ -290,6 +290,7 @@ struct zink_context {
|
||||||
struct list_head suspended_queries;
|
struct list_head suspended_queries;
|
||||||
struct list_head primitives_generated_queries;
|
struct list_head primitives_generated_queries;
|
||||||
struct zink_query *vertices_query;
|
struct zink_query *vertices_query;
|
||||||
|
bool disable_color_writes;
|
||||||
bool primitives_generated_active;
|
bool primitives_generated_active;
|
||||||
bool queries_disabled, render_condition_active;
|
bool queries_disabled, render_condition_active;
|
||||||
struct {
|
struct {
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ zink_get_framebuffer_imageless(struct zink_context *ctx)
|
||||||
unsigned num_resolves = 0;
|
unsigned num_resolves = 0;
|
||||||
for (int i = 0; i < ctx->fb_state.nr_cbufs; i++) {
|
for (int i = 0; i < ctx->fb_state.nr_cbufs; i++) {
|
||||||
struct pipe_surface *psurf = ctx->fb_state.cbufs[i];
|
struct pipe_surface *psurf = ctx->fb_state.cbufs[i];
|
||||||
if (!psurf)
|
if (!psurf || ctx->disable_color_writes)
|
||||||
psurf = ctx->dummy_surface[util_logbase2_ceil(ctx->gfx_pipeline_state.rast_samples+1)];
|
psurf = ctx->dummy_surface[util_logbase2_ceil(ctx->gfx_pipeline_state.rast_samples+1)];
|
||||||
struct zink_surface *surface = zink_csurface(psurf);
|
struct zink_surface *surface = zink_csurface(psurf);
|
||||||
struct zink_surface *transient = zink_transient_surface(psurf);
|
struct zink_surface *transient = zink_transient_surface(psurf);
|
||||||
|
|
@ -300,6 +300,7 @@ zink_get_framebuffer(struct zink_context *ctx)
|
||||||
unsigned num_resolves = 0;
|
unsigned num_resolves = 0;
|
||||||
|
|
||||||
struct zink_framebuffer_state state = {0};
|
struct zink_framebuffer_state state = {0};
|
||||||
|
if (!ctx->disable_color_writes) {
|
||||||
for (int i = 0; i < ctx->fb_state.nr_cbufs; i++) {
|
for (int i = 0; i < ctx->fb_state.nr_cbufs; i++) {
|
||||||
struct pipe_surface *psurf = ctx->fb_state.cbufs[i];
|
struct pipe_surface *psurf = ctx->fb_state.cbufs[i];
|
||||||
if (psurf) {
|
if (psurf) {
|
||||||
|
|
@ -319,6 +320,7 @@ zink_get_framebuffer(struct zink_context *ctx)
|
||||||
}
|
}
|
||||||
attachments[i] = psurf;
|
attachments[i] = psurf;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
state.num_attachments = ctx->fb_state.nr_cbufs;
|
state.num_attachments = ctx->fb_state.nr_cbufs;
|
||||||
const unsigned zsresolve_offset = cresolve_offset + num_resolves;
|
const unsigned zsresolve_offset = cresolve_offset + num_resolves;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue