Check for depthBounds support in shader builtin frag depth tests
authorTony Wasserka <tony.wasserka@imgtec.com>
Tue, 12 Sep 2017 11:03:13 +0000 (12:03 +0100)
committerTony Wasserka <tony.wasserka@imgtec.com>
Tue, 12 Sep 2017 14:22:12 +0000 (15:22 +0100)
Depth bounds testing was enabled without checking for feature support
in a couple of tests. With this change, tests that don't need this
feature leave it disabled, whereas other tests (currently only
dEQP-VK.glsl.builtin_var.fragdepth.*) now throw NotSupported when
the device doesn't support it.

Affects:

dEQP-VK.clipping.*
dEQP-VK.glsl.builtin_var.*

Components: Vulkan

VK-GL-CTS issue: 685

Change-Id: I44d94142e295ff135ad1a55d0d6e212b65994257

external/vulkancts/modules/vulkan/shaderrender/vktShaderRenderBuiltinVarTests.cpp
external/vulkancts/modules/vulkan/vktDrawUtil.cpp
external/vulkancts/modules/vulkan/vktDrawUtil.hpp

index e7d75fa..eaedb30 100644 (file)
@@ -789,6 +789,7 @@ TestStatus BuiltinFragDepthCaseInstance::iterate (void)
                drawState.compareOp                                     = rr::TESTFUNC_ALWAYS;
                drawState.depthTestEnable                       = true;
                drawState.depthWriteEnable                      = true;
+               drawState.depthBoundsTestEnable         = true;
                drawState.sampleShadingEnable           = true;
                vulkanProgram.depthImageView            = *depthImageView;
                vulkanProgram.descriptorSetLayout       = *descriptorSetLayout;
index ecf66bd..2325f54 100644 (file)
@@ -312,6 +312,7 @@ DrawState::DrawState(const vk::VkPrimitiveTopology topology_, deUint32 renderWid
        , depthTestEnable               (false)
        , depthWriteEnable              (false)
        , compareOp                             (rr::TESTFUNC_LESS)
+       , depthBoundsTestEnable (false)
        , blendEnable                   (false)
        , lineWidth                             (1.0)
        , numPatchControlPoints (0)
@@ -653,6 +654,9 @@ VulkanDrawContext::VulkanDrawContext ( Context&                             context,
                        0u,                                             // write mask
                        0u);                                    // reference
 
+               if (m_drawState.depthBoundsTestEnable && context.getDeviceFeatures().depthBounds)
+                       TCU_THROW(NotSupportedError, "depthBounds not supported");
+
                const VkPipelineDepthStencilStateCreateInfo pipelineDepthStencilStateInfo =
                {
                        VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO,     // VkStructureType                                                      sType;
@@ -661,7 +665,7 @@ VulkanDrawContext::VulkanDrawContext ( Context&                             context,
                        m_drawState.depthTestEnable,                                                            // VkBool32                                                                     depthTestEnable;
                        m_drawState.depthWriteEnable,                                                           // VkBool32                                                                     depthWriteEnable;
                        mapCompareOp(m_drawState.compareOp),                                            // VkCompareOp                                                          depthCompareOp;
-                       VK_TRUE,                                                                                                        // VkBool32                                                                     depthBoundsTestEnable;
+                       m_drawState.depthBoundsTestEnable,                                                      // VkBool32                                                                     depthBoundsTestEnable
                        VK_FALSE,                                                                                                       // VkBool32                                                                     stencilTestEnable;
                        stencilOpState,                                                                                         // VkStencilOpState                                                     front;
                        stencilOpState,                                                                                         // VkStencilOpState                                                     back;
index 8ea74b8..adda78b 100644 (file)
@@ -50,6 +50,7 @@ struct DrawState
        bool                                                    depthTestEnable;
        bool                                                    depthWriteEnable;
        rr::TestFunc                                    compareOp;
+       bool                                                    depthBoundsTestEnable;
        bool                                                    blendEnable;
        float                                                   lineWidth;
        deUint32                                                numPatchControlPoints;