Is it possible to enable depth test but without modifying depth buffer

I hava a depth buffer generated by geometry pass. In a pass after the geometry pass, I use the depth buffer to do depth test. But I do not want to modify the depth buffer.

I try to set store op of the depth attachment to VK_ATTACHMENT_STORE_OP_NONE_QCOM and load op to VK_ATTACHMENT_LOAD_OP_LOAD. However, the content of the depth buffer is still changed to 1.0, which is the value outputed by my vertex shader.

How can I enable depth test without depth write in Vulkan?

The depthWriteEnable is right next to the depthTestEnable member of VkPipelineDepthStencilStateCreateInfo.

1 Like