Add depth range interaction tests
authorGraeme Leese <gleese@broadcom.com>
Wed, 24 Aug 2022 16:12:27 +0000 (17:12 +0100)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Mon, 10 Oct 2022 16:42:58 +0000 (16:42 +0000)
Add versions of the VK_EXT_depth_clamp_zero_one tests that run with
VK_EXT_depth_range_unrestricted enabled to verify the interaction
between the extensions.

Components: Vulkan
New Tests: dEQP-VK.depth.out_of_range_unrestricted
           dEQP-VK.depth.bias_outside_range_fs_clamp_unrestricted

Change-Id: I50ede4e0bf65f304f8815ed636de3baaf56f8e61

android/cts/main/vk-master-2022-03-01/depth.txt
android/cts/main/vk-master/depth.txt
external/vulkancts/data/vulkan/amber/depth/bias_outside_range_fs_clamp_unrestricted.amber [new file with mode: 0644]
external/vulkancts/data/vulkan/amber/depth/out_of_range_unrestricted.amber [new file with mode: 0644]
external/vulkancts/modules/vulkan/amber/vktAmberDepthTests.cpp
external/vulkancts/mustpass/main/vk-default/depth.txt

index 13e3cc3..8abaa3c 100644 (file)
@@ -4,3 +4,5 @@ dEQP-VK.depth.ez_fs_clamp
 dEQP-VK.depth.bias_fs_clamp
 dEQP-VK.depth.bias_outside_range
 dEQP-VK.depth.bias_outside_range_fs_clamp
+dEQP-VK.depth.out_of_range_unrestricted
+dEQP-VK.depth.bias_outside_range_fs_clamp_unrestricted
index 13e3cc3..8abaa3c 100644 (file)
@@ -4,3 +4,5 @@ dEQP-VK.depth.ez_fs_clamp
 dEQP-VK.depth.bias_fs_clamp
 dEQP-VK.depth.bias_outside_range
 dEQP-VK.depth.bias_outside_range_fs_clamp
+dEQP-VK.depth.out_of_range_unrestricted
+dEQP-VK.depth.bias_outside_range_fs_clamp_unrestricted
diff --git a/external/vulkancts/data/vulkan/amber/depth/bias_outside_range_fs_clamp_unrestricted.amber b/external/vulkancts/data/vulkan/amber/depth/bias_outside_range_fs_clamp_unrestricted.amber
new file mode 100644 (file)
index 0000000..3f6e35b
--- /dev/null
@@ -0,0 +1,75 @@
+#!amber
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+DEVICE_EXTENSION VK_EXT_depth_clamp_zero_one
+DEVICE_EXTENSION VK_EXT_depth_range_unrestricted
+DEVICE_FEATURE fragmentStoresAndAtomics
+
+SHADER vertex vert_shader GLSL
+#version 430
+layout(location = 0) in vec2 position_in;
+
+void main()
+{
+    gl_Position = vec4(position_in, 1, 1);
+}
+END
+
+SHADER fragment frag_shader GLSL
+#version 430
+layout (binding=0) buffer B {
+    float d;
+};
+
+layout(location = 0) out highp vec4 frag_out;
+void main()
+{
+    d = gl_FragCoord.z;
+    frag_out = vec4(0, 1, 0, 1);
+}
+END
+
+BUFFER framebuffer0 FORMAT R8G8B8A8_UNORM
+BUFFER depth0 FORMAT D32_SFLOAT
+
+BUFFER fs_depth DATA_TYPE float DATA
+0.0
+END
+
+PIPELINE graphics pipeline
+  DEPTH
+    TEST on
+    WRITE on
+    BIAS constant 16777216.0 clamp 0.0 slope 0.0
+  END
+
+  VIEWPORT 0 0 SIZE 60 60 MIN_DEPTH 0.1 MAX_DEPTH 0.9
+
+  ATTACH vert_shader
+  ATTACH frag_shader
+  BIND BUFFER framebuffer0 AS color LOCATION 0
+  BIND BUFFER depth0 AS depth_stencil
+  FRAMEBUFFER_SIZE 60 60
+
+  BIND BUFFER fs_depth AS storage DESCRIPTOR_SET 0 BINDING 0
+END
+
+CLEAR_COLOR pipeline 0 0 0 0
+CLEAR_DEPTH pipeline 1.0
+CLEAR pipeline
+RUN pipeline DRAW_RECT POS 0 0 SIZE 60 60
+
+EXPECT framebuffer0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
+EXPECT depth0 IDX 0 TOLERANCE 1.0e-6 EQ 1.9
+EXPECT fs_depth IDX 0 TOLERANCE 1.0e-6 EQ 1.9
diff --git a/external/vulkancts/data/vulkan/amber/depth/out_of_range_unrestricted.amber b/external/vulkancts/data/vulkan/amber/depth/out_of_range_unrestricted.amber
new file mode 100644 (file)
index 0000000..b5a502e
--- /dev/null
@@ -0,0 +1,67 @@
+#!amber
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+DEVICE_EXTENSION VK_EXT_depth_clamp_zero_one
+DEVICE_EXTENSION VK_EXT_depth_range_unrestricted
+
+SHADER vertex vert_shader GLSL
+#version 430
+layout(location = 0) in vec2 position_in;
+
+void main()
+{
+    gl_Position = vec4(position_in, 0, 1);
+}
+END
+
+SHADER fragment frag_shader GLSL
+#version 430
+layout(location = 0) out highp vec4 frag_out;
+void main()
+{
+    gl_FragDepth = 2.0;
+    frag_out = vec4(0, 1, 0, 1);
+}
+END
+
+BUFFER framebuffer0 FORMAT R8G8B8A8_UNORM
+BUFFER depth0 FORMAT D32_SFLOAT
+
+BUFFER fs_depth DATA_TYPE float DATA
+0.0
+END
+
+PIPELINE graphics pipeline
+  DEPTH
+    TEST on
+    COMPARE_OP not_equal
+    WRITE on
+  END
+
+  VIEWPORT 0 0 SIZE 60 60 MIN_DEPTH 0.1 MAX_DEPTH 0.9
+
+  ATTACH vert_shader
+  ATTACH frag_shader
+  BIND BUFFER framebuffer0 AS color LOCATION 0
+  BIND BUFFER depth0 AS depth_stencil
+  FRAMEBUFFER_SIZE 60 60
+END
+
+CLEAR_COLOR pipeline 0 0 0 0
+CLEAR_DEPTH pipeline 1.0
+CLEAR pipeline
+RUN pipeline DRAW_RECT POS 0 0 SIZE 60 60
+
+EXPECT framebuffer0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
+EXPECT depth0 IDX 0 EQ 2.0
index 93126d2..5a1f553 100644 (file)
@@ -46,12 +46,16 @@ de::SharedPtr<Move<vk::VkDevice>> g_singletonDeviceDepthGroup;
 
 class DepthTestCase : public AmberTestCase
 {
+       bool m_useCustomDevice;
+
 public:
-       DepthTestCase  (tcu::TestContext&   testCtx,
-                                       const char*      name,
-                                       const char*      description,
-                                       const std::string&  readFilename)
-               : AmberTestCase(testCtx, name, description, readFilename)
+       DepthTestCase  (tcu::TestContext&       testCtx,
+                                       const char*                     name,
+                                       const char*                     description,
+                                       bool                            useCustomDevice,
+                                       const std::string&      readFilename)
+               :       AmberTestCase(testCtx, name, description, readFilename),
+                       m_useCustomDevice(useCustomDevice)
        { }
 
        TestInstance* createInstance (Context& ctx) const
@@ -104,7 +108,7 @@ public:
                        Move<VkDevice> device = createCustomDevice(ctx.getTestContext().getCommandLine().isValidationEnabled(), ctx.getPlatformInterface(), ctx.getInstance(), ctx.getInstanceInterface(), ctx.getPhysicalDevice(), &deviceCreateInfo);
                        g_singletonDeviceDepthGroup = de::SharedPtr<Move<VkDevice>>(new Move<VkDevice>(device));
                }
-               return new AmberTestInstance(ctx, m_recipe, g_singletonDeviceDepthGroup->get());
+               return new AmberTestInstance(ctx, m_recipe, m_useCustomDevice ? g_singletonDeviceDepthGroup->get() : nullptr);
        }
 };
 
@@ -112,7 +116,8 @@ struct TestInfo
 {
        std::string                                     name;
        std::string                                     desc;
-       std::vector<std::string>        required_features;
+       std::vector<std::string>        base_required_features;
+       bool                                            unrestricted;
 };
 
 DepthTestCase* createDepthTestCase (tcu::TestContext&   testCtx,
@@ -127,11 +132,14 @@ DepthTestCase* createDepthTestCase (tcu::TestContext&   testCtx,
        readFilename.append("/");
        readFilename.append(filename);
 
-       DepthTestCase *testCase = new DepthTestCase(testCtx, testInfo.name.c_str(), testInfo.desc.c_str(), readFilename);
+       DepthTestCase *testCase = new DepthTestCase(testCtx, testInfo.name.c_str(), testInfo.desc.c_str(), !testInfo.unrestricted, readFilename);
 
-       for (auto req : testInfo.required_features)
+       for (auto req : testInfo.base_required_features)
                testCase->addRequirement(req);
 
+       if (testInfo.unrestricted)
+               testCase->addRequirement("VK_EXT_depth_range_unrestricted");
+
        return testCase;
 }
 
@@ -139,12 +147,16 @@ static void createTests(tcu::TestCaseGroup *g)
 {
        static const std::vector<TestInfo>      tests           =
        {
-               { "fs_clamp",                                           "Test fragment shader depth value clamping",                                    { "VK_EXT_depth_clamp_zero_one", "Features.fragmentStoresAndAtomics", "Features.depthClamp" } },
-               { "out_of_range",                                       "Test late clamping of out-of-range depth values",                              { "VK_EXT_depth_clamp_zero_one" } },
-               { "ez_fs_clamp",                                        "Test fragment shader depth value with early fragment tests",   { "VK_EXT_depth_clamp_zero_one", "Features.fragmentStoresAndAtomics", "Features.depthClamp" } },
-               { "bias_fs_clamp",                                      "Test fragment shader depth value with depthBias enabled",              { "VK_EXT_depth_clamp_zero_one", "Features.fragmentStoresAndAtomics", "Features.depthClamp" } },
-               { "bias_outside_range",                         "Test biasing depth values out of the depth range",                             { "VK_EXT_depth_clamp_zero_one", "Features.fragmentStoresAndAtomics" } },
-               { "bias_outside_range_fs_clamp",        "Test fragment shader depth value when biasing out of range",   { "VK_EXT_depth_clamp_zero_one", "Features.fragmentStoresAndAtomics" } },
+               { "fs_clamp",                                           "Test fragment shader depth value clamping",                                    { "VK_EXT_depth_clamp_zero_one", "Features.fragmentStoresAndAtomics", "Features.depthClamp" },  false },
+               { "out_of_range",                                       "Test late clamping of out-of-range depth values",                              { "VK_EXT_depth_clamp_zero_one" },                                                                                                                              false },
+               { "ez_fs_clamp",                                        "Test fragment shader depth value with early fragment tests",   { "VK_EXT_depth_clamp_zero_one", "Features.fragmentStoresAndAtomics", "Features.depthClamp" },  false },
+               { "bias_fs_clamp",                                      "Test fragment shader depth value with depthBias enabled",              { "VK_EXT_depth_clamp_zero_one", "Features.fragmentStoresAndAtomics", "Features.depthClamp" },  false },
+               { "bias_outside_range",                         "Test biasing depth values out of the depth range",                             { "VK_EXT_depth_clamp_zero_one", "Features.fragmentStoresAndAtomics" },                                                 false },
+               { "bias_outside_range_fs_clamp",        "Test fragment shader depth value when biasing out of range",   { "VK_EXT_depth_clamp_zero_one", "Features.fragmentStoresAndAtomics" },                                                 false },
+
+               // Rerun any tests that will get different results with VK_EXT_depth_range_unrestricted
+               { "out_of_range_unrestricted",                                  "Test late clamping of out-of-range depth values",                              { "VK_EXT_depth_clamp_zero_one" },                                                                              true },
+               { "bias_outside_range_fs_clamp_unrestricted",   "Test fragment shader depth value when biasing out of range",   { "VK_EXT_depth_clamp_zero_one", "Features.fragmentStoresAndAtomics" }, true },
        };
 
    tcu::TestContext& testCtx = g->getTestContext();
index 13e3cc3..8abaa3c 100644 (file)
@@ -4,3 +4,5 @@ dEQP-VK.depth.ez_fs_clamp
 dEQP-VK.depth.bias_fs_clamp
 dEQP-VK.depth.bias_outside_range
 dEQP-VK.depth.bias_outside_range_fs_clamp
+dEQP-VK.depth.out_of_range_unrestricted
+dEQP-VK.depth.bias_outside_range_fs_clamp_unrestricted