mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-09 23:08:18 +02:00
zink/clear: handle texture clears on current fb texture
need to ensure existing clears are flushed before applying these cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41967>
This commit is contained in:
parent
6accf9a576
commit
01cbcdfe2e
8 changed files with 39 additions and 31 deletions
|
|
@ -508,10 +508,6 @@ spec@ext_transform_feedback@tessellation triangle_fan flat_first,Fail
|
|||
spec@khr_texture_compression_astc@miptree-gles srgb-fp,Fail
|
||||
spec@khr_texture_compression_astc@miptree-gles srgb-fp@sRGB decode full precision,Fail
|
||||
|
||||
# uprev Piglit in Mesa
|
||||
spec@!opengl 1.1@large-tex,Fail
|
||||
spec@!opengl 1.1@large-tex@test_clear_tex_sub_image,Fail
|
||||
|
||||
#glcts update
|
||||
spec@glsl-4.00@execution@built-in-functions@fs-inverse-dmat4,Crash
|
||||
dEQP-GLES3.functional.fbo.blit.rect.nearest_consistency_out_of_bounds_mag_reverse_src_y,Fail
|
||||
|
|
|
|||
|
|
@ -469,8 +469,6 @@ spec@khr_texture_compression_astc@sliced-3d-miptree-gles srgb-fp@sRGB decode ful
|
|||
glx@glx-multi-window-single-context,Fail
|
||||
|
||||
# uprev Piglit in Mesa
|
||||
spec@!opengl 1.1@large-tex,Fail
|
||||
spec@!opengl 1.1@large-tex@test_clear_tex_sub_image,Fail
|
||||
spec@arb_shader_storage_buffer_object@max-ssbo-size@fs,Crash
|
||||
spec@arb_shader_storage_buffer_object@max-ssbo-size@vs,Crash
|
||||
spec@egl_mesa_configless_context@basic,Fail
|
||||
|
|
|
|||
|
|
@ -147,8 +147,6 @@ spec@ext_transform_feedback@tessellation quads wireframe,Fail
|
|||
spec@ext_transform_feedback@tessellation quad_strip wireframe,Fail
|
||||
|
||||
# uprev Piglit in Mesa
|
||||
spec@!opengl 1.1@large-tex,Fail
|
||||
spec@!opengl 1.1@large-tex@test_clear_tex_sub_image,Fail
|
||||
spec@khr_texture_compression_astc@sliced-3d-miptree-gles srgb-fp,Fail
|
||||
spec@khr_texture_compression_astc@sliced-3d-miptree-gles srgb-fp@sRGB decode full precision,Fail
|
||||
|
||||
|
|
|
|||
|
|
@ -40,8 +40,3 @@ spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_yvyu,Fail
|
|||
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-transcode-nv12-as-r8-gr88,Fail
|
||||
|
||||
spec@arb_pipeline_statistics_query@arb_pipeline_statistics_query-clip,Fail
|
||||
|
||||
# uprev Piglit in Mesa
|
||||
spec@!opengl 1.1@large-tex,Fail
|
||||
spec@!opengl 1.1@large-tex@test_clear_tex_sub_image,Fail
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,3 @@ spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_yvu420,Fail
|
|||
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_yvyu,Fail
|
||||
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-transcode-nv12-as-r8-gr88,Fail
|
||||
|
||||
# uprev Piglit in Mesa
|
||||
spec@!opengl 1.1@large-tex,Fail
|
||||
spec@!opengl 1.1@large-tex@test_clear_tex_sub_image,Fail
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@ glx@glx-multi-window-single-context,Fail
|
|||
spec@egl_mesa_configless_context@basic,Fail
|
||||
|
||||
# uprev Piglit in Mesa
|
||||
spec@!opengl 1.1@large-tex,Fail
|
||||
spec@!opengl 1.1@large-tex@test_clear_tex_sub_image,Fail
|
||||
spec@arb_query_buffer_object@qbo@query-GL_GEOMETRY_SHADER_INVOCATIONS-ASYNC-GL_INT,Fail
|
||||
spec@arb_query_buffer_object@qbo@query-GL_GEOMETRY_SHADER_INVOCATIONS-ASYNC-GL_UNSIGNED_INT,Fail
|
||||
spec@arb_query_buffer_object@qbo@query-GL_GEOMETRY_SHADER_INVOCATIONS-ASYNC-GL_UNSIGNED_INT64_ARB,Fail
|
||||
|
|
|
|||
|
|
@ -209,6 +209,4 @@ spec@khr_texture_compression_astc@sliced-3d-miptree-gles srgb-fp@sRGB decode ful
|
|||
|
||||
# uprev Piglit in Mesa
|
||||
spec@!opengl 1.1@large-tex,Fail
|
||||
spec@!opengl 1.1@large-tex@test_clear_tex_sub_image,Fail
|
||||
spec@!opengl 1.1@large-tex@test_image_load_store,Fail
|
||||
|
||||
|
|
|
|||
|
|
@ -438,6 +438,20 @@ set_clear_fb(struct pipe_context *pctx, struct pipe_surface *psurf, struct pipe_
|
|||
pctx->set_framebuffer_state(pctx, &fb_state);
|
||||
}
|
||||
|
||||
static int
|
||||
surf_matches_fb(struct zink_context *ctx, struct pipe_surface *psurf)
|
||||
{
|
||||
if (util_format_is_depth_or_stencil(psurf->format)) {
|
||||
return pipe_surface_equal(psurf, &ctx->fb_state.zsbuf) ? PIPE_MAX_COLOR_BUFS : -1;
|
||||
} else {
|
||||
for (unsigned i = 0; i < ctx->fb_state.nr_cbufs; i++) {
|
||||
if (pipe_surface_equal(psurf, &ctx->fb_state.cbufs[i]))
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
zink_clear_texture_dynamic(struct pipe_context *pctx,
|
||||
struct pipe_resource *pres,
|
||||
|
|
@ -488,10 +502,21 @@ zink_clear_texture_dynamic(struct pipe_context *pctx,
|
|||
util_format_unpack_s_8uint(pres->format, &stencil, data, 1);
|
||||
}
|
||||
|
||||
zink_blit_barriers(ctx, NULL, res, full_clear);
|
||||
VkCommandBuffer cmdbuf = zink_get_cmdbuf(ctx, NULL, res);
|
||||
if (cmdbuf == ctx->bs->cmdbuf && ctx->in_rp)
|
||||
zink_batch_no_rp(ctx);
|
||||
VkCommandBuffer cmdbuf;
|
||||
bool needs_rp = false;
|
||||
int idx = surf_matches_fb(ctx, &psurf);
|
||||
if (res->fb_bind_count && idx != -1) {
|
||||
cmdbuf = ctx->bs->cmdbuf;
|
||||
if (!ctx->in_rp)
|
||||
zink_batch_rp(ctx);
|
||||
} else {
|
||||
zink_blit_barriers(ctx, NULL, res, full_clear);
|
||||
cmdbuf = zink_get_cmdbuf(ctx, NULL, res);
|
||||
if (cmdbuf == ctx->bs->cmdbuf && ctx->in_rp)
|
||||
zink_batch_no_rp(ctx);
|
||||
zink_batch_reference_resource_rw(ctx, res, true);
|
||||
needs_rp = true;
|
||||
}
|
||||
|
||||
if (res->aspect & VK_IMAGE_ASPECT_COLOR_BIT) {
|
||||
memcpy(&att.clearValue, &color, sizeof(float) * 4);
|
||||
|
|
@ -505,22 +530,26 @@ zink_clear_texture_dynamic(struct pipe_context *pctx,
|
|||
if (res->aspect & VK_IMAGE_ASPECT_STENCIL_BIT)
|
||||
info.pStencilAttachment = &att;
|
||||
}
|
||||
VKCTX(CmdBeginRendering)(cmdbuf, &info);
|
||||
if (!full_clear) {
|
||||
if (needs_rp)
|
||||
VKCTX(CmdBeginRendering)(cmdbuf, &info);
|
||||
if (!full_clear || !needs_rp) {
|
||||
VkClearRect rect;
|
||||
rect.rect = info.renderArea;
|
||||
rect.baseArrayLayer = box->z;
|
||||
rect.baseArrayLayer = 0;
|
||||
rect.layerCount = box->depth;
|
||||
|
||||
VkClearAttachment clear_att;
|
||||
clear_att.aspectMask = res->aspect;
|
||||
clear_att.colorAttachment = 0;
|
||||
if (needs_rp)
|
||||
clear_att.colorAttachment = idx == -1 ? 0 : idx;
|
||||
else if (!util_format_is_depth_or_stencil(pres->format))
|
||||
clear_att.colorAttachment = ffs(res->fb_binds) - 1;
|
||||
clear_att.clearValue = att.clearValue;
|
||||
|
||||
VKCTX(CmdClearAttachments)(cmdbuf, 1, &clear_att, 1, &rect);
|
||||
}
|
||||
VKCTX(CmdEndRendering)(cmdbuf);
|
||||
zink_batch_reference_resource_rw(ctx, res, true);
|
||||
if (needs_rp)
|
||||
VKCTX(CmdEndRendering)(cmdbuf);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue