--- /dev/null
+#!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
--- /dev/null
+#!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
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
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);
}
};
{
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,
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;
}
{
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();