radv: fix stencil only clears.
authorDave Airlie <airlied@redhat.com>
Tue, 2 May 2017 05:29:28 +0000 (15:29 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 2 May 2017 20:31:20 +0000 (06:31 +1000)
If we are clearing stencil only, we still need to provide a
a valid Z output from the vertex shader, we can't rely
on the depth clear value having any meaning, as we use this
for the position output, and it could get clipped, so we
don't end up clearing anything.

Fixes:
dEQP-VK.renderpass.simple.stencil
since I added S8 support.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/radv_meta_clear.c

index 190af651a1a40c60ed4bc378efc5c2483085b78d..2fa50cf0b5db1c54ac9ca03145ff00af04211b69 100644 (file)
@@ -672,6 +672,9 @@ emit_depthstencil_clear(struct radv_cmd_buffer *cmd_buffer,
                           VK_IMAGE_ASPECT_STENCIL_BIT));
        assert(pass_att != VK_ATTACHMENT_UNUSED);
 
+       if (!(aspects & VK_IMAGE_ASPECT_DEPTH_BIT))
+               clear_value.depth = 1.0f;
+
        const struct depthstencil_clear_vattrs vertex_data[3] = {
                {
                        .depth_clear = clear_value.depth,