Specifying a pipeline depth and stencil state
Usually, when we render a geometry, we want to mimic the way we see the world--objects further away are smaller, objects closer to us are larger and they cover the objects behind them (obscure our view). In modern 3D graphics, this last effect (objects further away being obscured by objects being nearer) is achieved through a depth test. The way in which a depth test is performed, is specified through a depth and stencil state of a graphics pipeline.
How to do it...
- Create a variable of type
VkPipelineDepthStencilStateCreateInfo
nameddepth_and_stencil_state_create_info
. Use the following values to initialize its members:VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO
value forsType
nullptr
value forpNext
0
value forflags
- A
true
value if we want to enable a depth test or otherwisefalse
fordepthTestEnable
- A
true
value if we want to store the depth value in a depth buffer and otherwisefalse
fordepthWriteEnable
- A chosen compare operator...