[Mesa-dev] [PATCH] anv/pipeline: do not disable depth writes if depth testing is disabled

Kenneth Graunke kenneth at whitecape.org
Fri May 19 04:28:17 UTC 2017


On Tuesday, March 28, 2017 11:58:54 PM PDT Iago Toral Quiroga wrote:
> Writing and testing are two different things and they can be set separately
> by the application. If an application wants to record depth data without
> caring for the depth test, it can enable depth test and set the depth
> compare function to VK_COMPARE_OP_ALWAYS or it can simply disable
> depth testing altogether. Some CTS tests do the latter.
> 
> Fixes all multisample tests with depth-only formats in:
> dEQP-VK.renderpass.multisample.*
> ---
>  src/intel/vulkan/genX_pipeline.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c
> index 85a9e4f..dc393cb 100644
> --- a/src/intel/vulkan/genX_pipeline.c
> +++ b/src/intel/vulkan/genX_pipeline.c
> @@ -728,10 +728,6 @@ sanitize_ds_state(VkPipelineDepthStencilStateCreateInfo *state,
>  {
>     *stencilWriteEnable = state->stencilTestEnable;
>  
> -   /* If the depth test is disabled, we won't be writing anything. */
> -   if (!state->depthTestEnable)
> -      state->depthWriteEnable = false;
> -
>     /* The Vulkan spec requires that if either depth or stencil is not present,
>      * the pipeline is to act as if the test silently passes.
>      */
> 

I think those tests are broken.

According to section 25.10 (Depth Test) of Vulkan 1.0.49...
https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#fragops-depth

"The comparison is enabled or disabled with the depthTestEnable member
 of the VkPipelineDepthStencilStateCreateInfo structure. When disabled,
 the depth comparison and subsequent possible updates to the value of the
 depth component of the depth/stencil attachment are bypassed and the
 fragment is passed to the next operation. The stencil value, however,
 can be modified as indicated above as if the depth test passed. If
 enabled, the comparison takes place and the depth/stencil attachment
 value can subsequently be modified."

So it sounds like depth writes aren't supposed to happen if the depth
test is disabled - but stencil writes may.  FWIW, that's how it works
in OpenGL as well.  (Thanks to Ilia for confirming this with me on IRC.)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170518/0204c279/attachment.sig>


More information about the mesa-dev mailing list