diff options
author | Jason Ekstrand <[email protected]> | 2016-05-31 22:23:18 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-06-03 19:29:28 -0700 |
commit | 56a178922fa200c98cbbb177e5fab106ad01072b (patch) | |
tree | 37cab5615ecafbd23ed4d16a885c0248503d9c0a /src/intel/vulkan/genX_pipeline_util.h | |
parent | bc7f7e195389e334ae8a5ee7d6f85b9e27983ca4 (diff) |
anv/pipeline: Silently pass tests if depth or stencil is missing
Signed-off-by: Jason Ekstrand <[email protected]>
Cc: "12.0" <[email protected]>
Diffstat (limited to 'src/intel/vulkan/genX_pipeline_util.h')
-rw-r--r-- | src/intel/vulkan/genX_pipeline_util.h | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/intel/vulkan/genX_pipeline_util.h b/src/intel/vulkan/genX_pipeline_util.h index fe24048192f..669b456860e 100644 --- a/src/intel/vulkan/genX_pipeline_util.h +++ b/src/intel/vulkan/genX_pipeline_util.h @@ -21,6 +21,8 @@ * IN THE SOFTWARE. */ +#include "vk_format_info.h" + static uint32_t vertex_element_comp_control(enum isl_format format, unsigned comp) { @@ -428,7 +430,9 @@ static const uint32_t vk_to_gen_stencil_op[] = { static void emit_ds_state(struct anv_pipeline *pipeline, - const VkPipelineDepthStencilStateCreateInfo *info) + const VkPipelineDepthStencilStateCreateInfo *info, + const struct anv_render_pass *pass, + const struct anv_subpass *subpass) { #if GEN_GEN == 7 # define depth_stencil_dw pipeline->gen7.depth_stencil_state @@ -470,6 +474,30 @@ emit_ds_state(struct anv_pipeline *pipeline, .BackfaceStencilTestFunction = vk_to_gen_compare_op[info->back.compareOp], }; + VkImageAspectFlags aspects = 0; + if (pass->attachments == NULL) { + /* This comes from meta. Assume we have verything. */ + aspects = VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT; + } else if (subpass->depth_stencil_attachment != VK_ATTACHMENT_UNUSED) { + VkFormat depth_stencil_format = + pass->attachments[subpass->depth_stencil_attachment].format; + aspects = vk_format_aspects(depth_stencil_format); + } + + /* The Vulkan spec requires that if either depth or stencil is not present, + * the pipeline is to act as if the test silently passes. + */ + if (!(aspects & VK_IMAGE_ASPECT_DEPTH_BIT)) { + depth_stencil.DepthBufferWriteEnable = false; + depth_stencil.DepthTestFunction = PREFILTEROPALWAYS; + } + + if (!(aspects & VK_IMAGE_ASPECT_STENCIL_BIT)) { + depth_stencil.StencilBufferWriteEnable = false; + depth_stencil.StencilTestFunction = PREFILTEROPALWAYS; + depth_stencil.BackfaceStencilTestFunction = PREFILTEROPALWAYS; + } + /* From the Broadwell PRM: * * "If Depth_Test_Enable = 1 AND Depth_Test_func = EQUAL, the |