mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-02 14:28:05 +02:00
vc4: add specific stencil blit path
This implementation reinterprets the stencil data as a RGBA8888 texture. Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23136>
This commit is contained in:
parent
2232320fe9
commit
ceb923bc2a
2 changed files with 74 additions and 16 deletions
|
|
@ -929,11 +929,6 @@ spec@arb_fragment_coord_conventions@fp-arb-fragment-coord-conventions-integer,Fa
|
|||
spec@arb_fragment_coord_conventions@fp-arb-fragment-coord-conventions-none,Fail
|
||||
spec@arb_fragment_program@fp-indirections2,Fail
|
||||
spec@arb_fragment_program@minmax,Fail
|
||||
spec@arb_framebuffer_object@arb_framebuffer_object-depth-stencil-blit stencil gl_depth24_stencil8,Fail
|
||||
spec@arb_framebuffer_object@arb_framebuffer_object-depth-stencil-blit stencil gl_stencil_index16,Fail
|
||||
spec@arb_framebuffer_object@arb_framebuffer_object-depth-stencil-blit stencil gl_stencil_index1,Fail
|
||||
spec@arb_framebuffer_object@arb_framebuffer_object-depth-stencil-blit stencil gl_stencil_index4,Fail
|
||||
spec@arb_framebuffer_object@arb_framebuffer_object-depth-stencil-blit stencil gl_stencil_index8,Fail
|
||||
spec@arb_framebuffer_object@fbo-attachments-blit-scaled-linear,Fail
|
||||
spec@arb_framebuffer_object@fbo-blit-stretch,Fail
|
||||
spec@arb_framebuffer_object@fbo-mipmap-copypix,Fail
|
||||
|
|
@ -996,15 +991,9 @@ spec@ext_framebuffer_multisample@sample-coverage 2 inverted,Fail
|
|||
spec@ext_framebuffer_multisample@sample-coverage 2 non-inverted,Fail
|
||||
spec@ext_framebuffer_multisample@sample-coverage 4 inverted,Fail
|
||||
spec@ext_framebuffer_multisample@sample-coverage 4 non-inverted,Fail
|
||||
spec@ext_framebuffer_multisample@upsample 2 stencil,Fail
|
||||
spec@ext_framebuffer_multisample@upsample 4 stencil,Fail
|
||||
|
||||
spec@ext_framebuffer_object@fbo-blending-format-quirks,Fail
|
||||
spec@ext_framebuffer_object@fbo-depth-sample-compare,Fail
|
||||
spec@ext_framebuffer_object@fbo-stencil-gl_stencil_index1-blit,Fail
|
||||
spec@ext_framebuffer_object@fbo-stencil-gl_stencil_index16-blit,Fail
|
||||
spec@ext_framebuffer_object@fbo-stencil-gl_stencil_index4-blit,Fail
|
||||
spec@ext_framebuffer_object@fbo-stencil-gl_stencil_index8-blit,Fail
|
||||
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-export,Fail
|
||||
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_p010,Fail
|
||||
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_p012,Fail
|
||||
|
|
@ -1018,7 +1007,6 @@ spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_y416,Fail
|
|||
spec@ext_occlusion_query_boolean@any-samples,Fail
|
||||
spec@ext_packed_depth_stencil@depth_stencil texture,Fail
|
||||
spec@ext_packed_depth_stencil@fbo-depthstencil-gl_depth24_stencil8-clear,Fail
|
||||
spec@ext_packed_depth_stencil@fbo-stencil-gl_depth24_stencil8-blit,Fail
|
||||
spec@ext_packed_depth_stencil@texwrap formats,Fail
|
||||
spec@ext_packed_depth_stencil@texwrap formats@GL_DEPTH24_STENCIL8,Fail
|
||||
spec@ext_packed_depth_stencil@texwrap formats@GL_DEPTH24_STENCIL8- NPOT,Fail
|
||||
|
|
|
|||
|
|
@ -471,6 +471,79 @@ vc4_render_blit(struct pipe_context *ctx, struct pipe_blit_info *info)
|
|||
info->mask = 0;
|
||||
}
|
||||
|
||||
/* Implement stencil and stencil/depth blit by reinterpreting stencil data as
|
||||
* an RGBA8888 texture.
|
||||
*/
|
||||
static void
|
||||
vc4_stencil_blit(struct pipe_context *ctx, struct pipe_blit_info *info)
|
||||
{
|
||||
struct vc4_context *vc4 = vc4_context(ctx);
|
||||
struct vc4_resource *src = vc4_resource(info->src.resource);
|
||||
struct vc4_resource *dst = vc4_resource(info->dst.resource);
|
||||
enum pipe_format src_format, dst_format;
|
||||
|
||||
if ((info->mask & PIPE_MASK_S) == 0)
|
||||
return;
|
||||
|
||||
src_format = (info->mask & PIPE_MASK_ZS) ?
|
||||
PIPE_FORMAT_RGBA8888_UINT :
|
||||
PIPE_FORMAT_R8_UINT;
|
||||
|
||||
dst_format = (info->mask & PIPE_MASK_ZS) ?
|
||||
PIPE_FORMAT_RGBA8888_UINT :
|
||||
PIPE_FORMAT_R8_UINT;
|
||||
|
||||
/* Initialize the surface */
|
||||
struct pipe_surface dst_tmpl = {
|
||||
.u.tex = {
|
||||
.level = info->dst.level,
|
||||
.first_layer = info->dst.box.z,
|
||||
.last_layer = info->dst.box.z,
|
||||
},
|
||||
.format = dst_format,
|
||||
};
|
||||
struct pipe_surface *dst_surf =
|
||||
ctx->create_surface(ctx, &dst->base, &dst_tmpl);
|
||||
|
||||
/* Initialize the sampler view */
|
||||
struct pipe_sampler_view src_tmpl = {
|
||||
.target = (src->base.target == PIPE_TEXTURE_CUBE_ARRAY) ?
|
||||
PIPE_TEXTURE_2D_ARRAY :
|
||||
src->base.target,
|
||||
.format = src_format,
|
||||
.u.tex = {
|
||||
.first_level = info->src.level,
|
||||
.last_level = info->src.level,
|
||||
.first_layer = 0,
|
||||
.last_layer = (PIPE_TEXTURE_2D ?
|
||||
u_minify(src->base.depth0,
|
||||
info->src.level) - 1 :
|
||||
src->base.array_size - 1),
|
||||
},
|
||||
.swizzle_r = PIPE_SWIZZLE_X,
|
||||
.swizzle_g = PIPE_SWIZZLE_Y,
|
||||
.swizzle_b = PIPE_SWIZZLE_Z,
|
||||
.swizzle_a = PIPE_SWIZZLE_W,
|
||||
};
|
||||
struct pipe_sampler_view *src_view =
|
||||
ctx->create_sampler_view(ctx, &src->base, &src_tmpl);
|
||||
|
||||
vc4_blitter_save(vc4);
|
||||
util_blitter_blit_generic(vc4->blitter, dst_surf, &info->dst.box,
|
||||
src_view, &info->src.box,
|
||||
src->base.width0, src->base.height0,
|
||||
(info->mask & PIPE_MASK_ZS) ?
|
||||
PIPE_MASK_RGBA : PIPE_MASK_R,
|
||||
PIPE_TEX_FILTER_NEAREST,
|
||||
info->scissor_enable ? &info->scissor : NULL,
|
||||
info->alpha_blend, false, 0);
|
||||
|
||||
pipe_surface_reference(&dst_surf, NULL);
|
||||
pipe_sampler_view_reference(&src_view, NULL);
|
||||
|
||||
info->mask &= ~PIPE_MASK_ZS;
|
||||
}
|
||||
|
||||
/* Optimal hardware path for blitting pixels.
|
||||
* Scaling, format conversion, up- and downsampling (resolve) are allowed.
|
||||
*/
|
||||
|
|
@ -487,10 +560,7 @@ vc4_blit(struct pipe_context *pctx, const struct pipe_blit_info *blit_info)
|
|||
util_try_blit_via_copy_region(pctx, &info, false))
|
||||
return;
|
||||
|
||||
if (info.mask & PIPE_MASK_S) {
|
||||
fprintf(stderr, "cannot blit stencil, skipping\n");
|
||||
info.mask &= ~PIPE_MASK_S;
|
||||
}
|
||||
vc4_stencil_blit(pctx, &info);
|
||||
|
||||
vc4_render_blit(pctx, &info);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue