v3d: implement clear_render_target and clear_depth_stencil
authorItalo Nicola <italonicola@collabora.com>
Wed, 28 Jun 2023 14:23:27 +0000 (14:23 +0000)
committerMarge Bot <emma+marge@anholt.net>
Mon, 10 Jul 2023 15:23:06 +0000 (15:23 +0000)
Also added some related piglit failures to broadcom-rpi4-fails.txt.

Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23735>

src/broadcom/ci/broadcom-rpi4-fails.txt
src/gallium/drivers/v3d/v3d_blit.c
src/gallium/drivers/v3d/v3dx_draw.c

index 7c8f5b0..845201f 100644 (file)
@@ -502,6 +502,10 @@ spec@oes_texture_view@rendering-formats@clear GL_RGB10_A2 as GL_RGBA8I,Fail
 spec@!opengl 1.0@depth-clear-precision-check@depth16,Fail
 spec@!opengl 1.0@depth-clear-precision-check@depth24,Fail
 
+# This fails the subtest for GL_ALPHA16 because we don't support a 16-bit unorm format for rendering
+# so gallium falls back to using an 8-bit unorm format and we lose some precision in the result.
+spec@arb_clear_texture@arb_clear_texture-sized-formats,Fail
+
 # These fail because the shaders use indirect indexing on samplers which we
 # don't support (the GLSL linker fails to link the shaders because of this).
 # If loop unrolling kicks-in for these tests it removes the indirect indexing
index b7dc56a..0260bdd 100644 (file)
@@ -56,10 +56,10 @@ v3d_blitter_save(struct v3d_context *v3d, bool op_blit, bool render_cond)
         util_blitter_save_sample_mask(v3d->blitter, v3d->sample_mask, 0);
         util_blitter_save_so_targets(v3d->blitter, v3d->streamout.num_targets,
                                      v3d->streamout.targets);
+        util_blitter_save_framebuffer(v3d->blitter, &v3d->framebuffer);
 
         if (op_blit) {
                 util_blitter_save_scissor(v3d->blitter, &v3d->scissor);
-                util_blitter_save_framebuffer(v3d->blitter, &v3d->framebuffer);
                 util_blitter_save_fragment_sampler_states(v3d->blitter,
                                                           v3d->tex[PIPE_SHADER_FRAGMENT].num_samplers,
                                                           (void **)v3d->tex[PIPE_SHADER_FRAGMENT].samplers);
index 0640dab..1744250 100644 (file)
@@ -1684,7 +1684,13 @@ v3d_clear_render_target(struct pipe_context *pctx, struct pipe_surface *ps,
                         unsigned x, unsigned y, unsigned w, unsigned h,
                         bool render_condition_enabled)
 {
-        fprintf(stderr, "unimpl: clear RT\n");
+        struct v3d_context *v3d = v3d_context(pctx);
+
+        if (render_condition_enabled && !v3d_render_condition_check(v3d))
+                return;
+
+        v3d_blitter_save(v3d, false, render_condition_enabled);
+        util_blitter_clear_render_target(v3d->blitter, ps, color, x, y, w, h);
 }
 
 static void
@@ -1693,7 +1699,14 @@ v3d_clear_depth_stencil(struct pipe_context *pctx, struct pipe_surface *ps,
                         unsigned x, unsigned y, unsigned w, unsigned h,
                         bool render_condition_enabled)
 {
-        fprintf(stderr, "unimpl: clear DS\n");
+        struct v3d_context *v3d = v3d_context(pctx);
+
+        if (render_condition_enabled && !v3d_render_condition_check(v3d))
+                return;
+
+        v3d_blitter_save(v3d, false, render_condition_enabled);
+        util_blitter_clear_depth_stencil(v3d->blitter, ps, buffers, depth,
+                                         stencil, x, y, w, h);
 }
 
 void