Additional dynamic depth bias tests
authorRicardo Garcia <rgarcia@igalia.com>
Mon, 12 Jul 2021 14:02:41 +0000 (16:02 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 23 Jul 2021 08:28:04 +0000 (08:28 +0000)
Additional tests to make sure the depth bias dynamic state is not
ignored and works properly, also when used in conjunction with the
dynamic depth bias enable state.

New tests:
dEQP-VK.dynamic_state.rs_state.nonzero_depth_bias*
dEQP-VK.pipeline.extended_dynamic_state.*dynamic_bias_params

Affected tests:
dEQP-VK.pipeline.extended_dynamic_state.*.depth_bias*

Components: Vulkan
VK-GL-CTS issue: 2965

Change-Id: Ic2b4428d112547ca054161728b8e1d403f6394b4

android/cts/master/vk-master-2021-03-01/dynamic-state.txt
android/cts/master/vk-master-2021-03-01/pipeline.txt
android/cts/master/vk-master/dynamic-state.txt
android/cts/master/vk-master/pipeline.txt
external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateRSTests.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineExtendedDynamicStateTests.cpp
external/vulkancts/mustpass/master/vk-default/dynamic-state.txt
external/vulkancts/mustpass/master/vk-default/pipeline.txt

index d50f1f0..30b6faf 100644 (file)
@@ -1,3 +1,5 @@
+dEQP-VK.dynamic_state.rs_state.nonzero_depth_bias_constant
+dEQP-VK.dynamic_state.rs_state.nonzero_depth_bias_clamp
 dEQP-VK.dynamic_state.compute_transfer.single.compute.viewport.before
 dEQP-VK.dynamic_state.compute_transfer.single.compute.viewport.after
 dEQP-VK.dynamic_state.compute_transfer.single.compute.scissor.before
index 7c58b90..b21e8d5 100644 (file)
@@ -16668,6 +16668,8 @@ dEQP-VK.pipeline.extended_dynamic_state.cmd_buffer_start.depth_write_enable
 dEQP-VK.pipeline.extended_dynamic_state.cmd_buffer_start.depth_write_disable
 dEQP-VK.pipeline.extended_dynamic_state.cmd_buffer_start.depth_bias_enable
 dEQP-VK.pipeline.extended_dynamic_state.cmd_buffer_start.depth_bias_disable
+dEQP-VK.pipeline.extended_dynamic_state.cmd_buffer_start.depth_bias_enable_dynamic_bias_params
+dEQP-VK.pipeline.extended_dynamic_state.cmd_buffer_start.depth_bias_disable_dynamic_bias_params
 dEQP-VK.pipeline.extended_dynamic_state.cmd_buffer_start.depth_compare_never
 dEQP-VK.pipeline.extended_dynamic_state.cmd_buffer_start.depth_compare_less
 dEQP-VK.pipeline.extended_dynamic_state.cmd_buffer_start.depth_compare_greater
@@ -18057,6 +18059,8 @@ dEQP-VK.pipeline.extended_dynamic_state.before_draw.depth_write_enable
 dEQP-VK.pipeline.extended_dynamic_state.before_draw.depth_write_disable
 dEQP-VK.pipeline.extended_dynamic_state.before_draw.depth_bias_enable
 dEQP-VK.pipeline.extended_dynamic_state.before_draw.depth_bias_disable
+dEQP-VK.pipeline.extended_dynamic_state.before_draw.depth_bias_enable_dynamic_bias_params
+dEQP-VK.pipeline.extended_dynamic_state.before_draw.depth_bias_disable_dynamic_bias_params
 dEQP-VK.pipeline.extended_dynamic_state.before_draw.depth_compare_never
 dEQP-VK.pipeline.extended_dynamic_state.before_draw.depth_compare_less
 dEQP-VK.pipeline.extended_dynamic_state.before_draw.depth_compare_greater
@@ -19446,6 +19450,8 @@ dEQP-VK.pipeline.extended_dynamic_state.between_pipelines.depth_write_enable
 dEQP-VK.pipeline.extended_dynamic_state.between_pipelines.depth_write_disable
 dEQP-VK.pipeline.extended_dynamic_state.between_pipelines.depth_bias_enable
 dEQP-VK.pipeline.extended_dynamic_state.between_pipelines.depth_bias_disable
+dEQP-VK.pipeline.extended_dynamic_state.between_pipelines.depth_bias_enable_dynamic_bias_params
+dEQP-VK.pipeline.extended_dynamic_state.between_pipelines.depth_bias_disable_dynamic_bias_params
 dEQP-VK.pipeline.extended_dynamic_state.between_pipelines.depth_compare_never
 dEQP-VK.pipeline.extended_dynamic_state.between_pipelines.depth_compare_less
 dEQP-VK.pipeline.extended_dynamic_state.between_pipelines.depth_compare_greater
@@ -20835,6 +20841,8 @@ dEQP-VK.pipeline.extended_dynamic_state.after_pipelines.depth_write_enable
 dEQP-VK.pipeline.extended_dynamic_state.after_pipelines.depth_write_disable
 dEQP-VK.pipeline.extended_dynamic_state.after_pipelines.depth_bias_enable
 dEQP-VK.pipeline.extended_dynamic_state.after_pipelines.depth_bias_disable
+dEQP-VK.pipeline.extended_dynamic_state.after_pipelines.depth_bias_enable_dynamic_bias_params
+dEQP-VK.pipeline.extended_dynamic_state.after_pipelines.depth_bias_disable_dynamic_bias_params
 dEQP-VK.pipeline.extended_dynamic_state.after_pipelines.depth_compare_never
 dEQP-VK.pipeline.extended_dynamic_state.after_pipelines.depth_compare_less
 dEQP-VK.pipeline.extended_dynamic_state.after_pipelines.depth_compare_greater
@@ -22224,6 +22232,8 @@ dEQP-VK.pipeline.extended_dynamic_state.before_good_static.depth_write_enable
 dEQP-VK.pipeline.extended_dynamic_state.before_good_static.depth_write_disable
 dEQP-VK.pipeline.extended_dynamic_state.before_good_static.depth_bias_enable
 dEQP-VK.pipeline.extended_dynamic_state.before_good_static.depth_bias_disable
+dEQP-VK.pipeline.extended_dynamic_state.before_good_static.depth_bias_enable_dynamic_bias_params
+dEQP-VK.pipeline.extended_dynamic_state.before_good_static.depth_bias_disable_dynamic_bias_params
 dEQP-VK.pipeline.extended_dynamic_state.before_good_static.depth_compare_never
 dEQP-VK.pipeline.extended_dynamic_state.before_good_static.depth_compare_less
 dEQP-VK.pipeline.extended_dynamic_state.before_good_static.depth_compare_greater
@@ -23613,6 +23623,8 @@ dEQP-VK.pipeline.extended_dynamic_state.two_draws_dynamic.depth_write_enable
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_dynamic.depth_write_disable
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_dynamic.depth_bias_enable
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_dynamic.depth_bias_disable
+dEQP-VK.pipeline.extended_dynamic_state.two_draws_dynamic.depth_bias_enable_dynamic_bias_params
+dEQP-VK.pipeline.extended_dynamic_state.two_draws_dynamic.depth_bias_disable_dynamic_bias_params
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_dynamic.depth_compare_never
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_dynamic.depth_compare_less
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_dynamic.depth_compare_greater
@@ -24999,6 +25011,8 @@ dEQP-VK.pipeline.extended_dynamic_state.two_draws_static.depth_write_enable
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_static.depth_write_disable
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_static.depth_bias_enable
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_static.depth_bias_disable
+dEQP-VK.pipeline.extended_dynamic_state.two_draws_static.depth_bias_enable_dynamic_bias_params
+dEQP-VK.pipeline.extended_dynamic_state.two_draws_static.depth_bias_disable_dynamic_bias_params
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_static.depth_compare_never
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_static.depth_compare_less
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_static.depth_compare_greater
index a1cd8f5..f20dc1b 100644 (file)
@@ -4,6 +4,8 @@ dEQP-VK.dynamic_state.vp_state.viewport_array
 dEQP-VK.dynamic_state.rs_state.depth_bias
 dEQP-VK.dynamic_state.rs_state.depth_bias_clamp
 dEQP-VK.dynamic_state.rs_state.line_width
+dEQP-VK.dynamic_state.rs_state.nonzero_depth_bias_constant
+dEQP-VK.dynamic_state.rs_state.nonzero_depth_bias_clamp
 dEQP-VK.dynamic_state.cb_state.blend_constants
 dEQP-VK.dynamic_state.ds_state.depth_bounds_1
 dEQP-VK.dynamic_state.ds_state.depth_bounds_2
index 8996e82..fc3dfba 100644 (file)
@@ -153544,6 +153544,8 @@ dEQP-VK.pipeline.extended_dynamic_state.cmd_buffer_start.depth_write_enable
 dEQP-VK.pipeline.extended_dynamic_state.cmd_buffer_start.depth_write_disable
 dEQP-VK.pipeline.extended_dynamic_state.cmd_buffer_start.depth_bias_enable
 dEQP-VK.pipeline.extended_dynamic_state.cmd_buffer_start.depth_bias_disable
+dEQP-VK.pipeline.extended_dynamic_state.cmd_buffer_start.depth_bias_enable_dynamic_bias_params
+dEQP-VK.pipeline.extended_dynamic_state.cmd_buffer_start.depth_bias_disable_dynamic_bias_params
 dEQP-VK.pipeline.extended_dynamic_state.cmd_buffer_start.depth_compare_never
 dEQP-VK.pipeline.extended_dynamic_state.cmd_buffer_start.depth_compare_less
 dEQP-VK.pipeline.extended_dynamic_state.cmd_buffer_start.depth_compare_greater
@@ -154933,6 +154935,8 @@ dEQP-VK.pipeline.extended_dynamic_state.before_draw.depth_write_enable
 dEQP-VK.pipeline.extended_dynamic_state.before_draw.depth_write_disable
 dEQP-VK.pipeline.extended_dynamic_state.before_draw.depth_bias_enable
 dEQP-VK.pipeline.extended_dynamic_state.before_draw.depth_bias_disable
+dEQP-VK.pipeline.extended_dynamic_state.before_draw.depth_bias_enable_dynamic_bias_params
+dEQP-VK.pipeline.extended_dynamic_state.before_draw.depth_bias_disable_dynamic_bias_params
 dEQP-VK.pipeline.extended_dynamic_state.before_draw.depth_compare_never
 dEQP-VK.pipeline.extended_dynamic_state.before_draw.depth_compare_less
 dEQP-VK.pipeline.extended_dynamic_state.before_draw.depth_compare_greater
@@ -156322,6 +156326,8 @@ dEQP-VK.pipeline.extended_dynamic_state.between_pipelines.depth_write_enable
 dEQP-VK.pipeline.extended_dynamic_state.between_pipelines.depth_write_disable
 dEQP-VK.pipeline.extended_dynamic_state.between_pipelines.depth_bias_enable
 dEQP-VK.pipeline.extended_dynamic_state.between_pipelines.depth_bias_disable
+dEQP-VK.pipeline.extended_dynamic_state.between_pipelines.depth_bias_enable_dynamic_bias_params
+dEQP-VK.pipeline.extended_dynamic_state.between_pipelines.depth_bias_disable_dynamic_bias_params
 dEQP-VK.pipeline.extended_dynamic_state.between_pipelines.depth_compare_never
 dEQP-VK.pipeline.extended_dynamic_state.between_pipelines.depth_compare_less
 dEQP-VK.pipeline.extended_dynamic_state.between_pipelines.depth_compare_greater
@@ -157711,6 +157717,8 @@ dEQP-VK.pipeline.extended_dynamic_state.after_pipelines.depth_write_enable
 dEQP-VK.pipeline.extended_dynamic_state.after_pipelines.depth_write_disable
 dEQP-VK.pipeline.extended_dynamic_state.after_pipelines.depth_bias_enable
 dEQP-VK.pipeline.extended_dynamic_state.after_pipelines.depth_bias_disable
+dEQP-VK.pipeline.extended_dynamic_state.after_pipelines.depth_bias_enable_dynamic_bias_params
+dEQP-VK.pipeline.extended_dynamic_state.after_pipelines.depth_bias_disable_dynamic_bias_params
 dEQP-VK.pipeline.extended_dynamic_state.after_pipelines.depth_compare_never
 dEQP-VK.pipeline.extended_dynamic_state.after_pipelines.depth_compare_less
 dEQP-VK.pipeline.extended_dynamic_state.after_pipelines.depth_compare_greater
@@ -159100,6 +159108,8 @@ dEQP-VK.pipeline.extended_dynamic_state.before_good_static.depth_write_enable
 dEQP-VK.pipeline.extended_dynamic_state.before_good_static.depth_write_disable
 dEQP-VK.pipeline.extended_dynamic_state.before_good_static.depth_bias_enable
 dEQP-VK.pipeline.extended_dynamic_state.before_good_static.depth_bias_disable
+dEQP-VK.pipeline.extended_dynamic_state.before_good_static.depth_bias_enable_dynamic_bias_params
+dEQP-VK.pipeline.extended_dynamic_state.before_good_static.depth_bias_disable_dynamic_bias_params
 dEQP-VK.pipeline.extended_dynamic_state.before_good_static.depth_compare_never
 dEQP-VK.pipeline.extended_dynamic_state.before_good_static.depth_compare_less
 dEQP-VK.pipeline.extended_dynamic_state.before_good_static.depth_compare_greater
@@ -160489,6 +160499,8 @@ dEQP-VK.pipeline.extended_dynamic_state.two_draws_dynamic.depth_write_enable
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_dynamic.depth_write_disable
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_dynamic.depth_bias_enable
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_dynamic.depth_bias_disable
+dEQP-VK.pipeline.extended_dynamic_state.two_draws_dynamic.depth_bias_enable_dynamic_bias_params
+dEQP-VK.pipeline.extended_dynamic_state.two_draws_dynamic.depth_bias_disable_dynamic_bias_params
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_dynamic.depth_compare_never
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_dynamic.depth_compare_less
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_dynamic.depth_compare_greater
@@ -161875,6 +161887,8 @@ dEQP-VK.pipeline.extended_dynamic_state.two_draws_static.depth_write_enable
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_static.depth_write_disable
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_static.depth_bias_enable
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_static.depth_bias_disable
+dEQP-VK.pipeline.extended_dynamic_state.two_draws_static.depth_bias_enable_dynamic_bias_params
+dEQP-VK.pipeline.extended_dynamic_state.two_draws_static.depth_bias_disable_dynamic_bias_params
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_static.depth_compare_never
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_static.depth_compare_less
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_static.depth_compare_greater
index 1d13ba0..d15ac45 100644 (file)
@@ -30,6 +30,8 @@
 #include "vkImageUtil.hpp"
 #include "vkTypeUtil.hpp"
 #include "vkCmdUtil.hpp"
+#include "vkObjUtil.hpp"
+#include "vkBuilderUtil.hpp"
 
 #include "tcuTextureUtil.hpp"
 #include "tcuImageCompare.hpp"
 
 #include "deMath.h"
 
+#include <vector>
+#include <string>
+#include <sstream>
+#include <iomanip>
+
 namespace vkt
 {
 namespace DynamicState
@@ -649,6 +656,306 @@ void checkWideLinesSupport (Context& context)
        context.requireDeviceCoreFeature(DEVICE_CORE_FEATURE_WIDE_LINES);
 }
 
+// Tests that fail if both the depth bias clamp or depth constant factor stay at 0.0f instead of applying the real values.
+struct DepthBiasNonZeroPushConstants
+{
+       float geometryDepth;
+       float minDepth;
+       float maxDepth;
+};
+
+struct DepthBiasNonZeroParams
+{
+       float                                                   depthBiasConstant;
+       float                                                   depthBiasClamp;
+       DepthBiasNonZeroPushConstants   pushConstants;
+};
+
+class DepthBiasNonZeroCase : public vkt::TestCase
+{
+private:
+       DepthBiasNonZeroParams m_params;
+
+public:
+                                               DepthBiasNonZeroCase    (tcu::TestContext& testCtx, const std::string& name, const std::string& description, const DepthBiasNonZeroParams& params);
+       virtual                         ~DepthBiasNonZeroCase   (void) {}
+
+       void                            checkSupport                    (Context& context) const override;
+       void                            initPrograms                    (vk::SourceCollections& programCollection) const override;
+       TestInstance*           createInstance                  (Context& context) const override;
+
+       static tcu::Vec4        getExpectedColor                () { return tcu::Vec4(0.0f, 1.0f, 0.0f, 1.0f); }
+};
+
+class DepthBiasNonZeroInstance : public vkt::TestInstance
+{
+private:
+       DepthBiasNonZeroParams m_params;
+
+public:
+                                               DepthBiasNonZeroInstance        (Context& context, const DepthBiasNonZeroParams& params);
+       virtual                         ~DepthBiasNonZeroInstance       (void) {}
+
+       tcu::TestStatus         iterate                                         (void) override;
+};
+
+DepthBiasNonZeroCase::DepthBiasNonZeroCase (tcu::TestContext& testCtx, const std::string& name, const std::string& description, const DepthBiasNonZeroParams& params)
+       : vkt::TestCase         (testCtx, name, description)
+       , m_params                      (params)
+{}
+
+TestInstance* DepthBiasNonZeroCase::createInstance (Context& context) const
+{
+       return new DepthBiasNonZeroInstance(context, m_params);
+}
+
+DepthBiasNonZeroInstance::DepthBiasNonZeroInstance (Context& context, const DepthBiasNonZeroParams& params)
+       : vkt::TestInstance     (context)
+       , m_params                      (params)
+{}
+
+void DepthBiasNonZeroCase::checkSupport (Context& context) const
+{
+       const auto& features = context.getDeviceFeatures();
+       if (m_params.depthBiasClamp != 0.0f && !features.depthBiasClamp)
+               TCU_THROW(NotSupportedError, "Depth bias clamping not supported");
+}
+
+void DepthBiasNonZeroCase::initPrograms (vk::SourceCollections& programCollection) const
+{
+       std::ostringstream vert;
+       vert
+               << "#version 450\n"
+               << "\n"
+               << "layout (push_constant, std430) uniform PushConstantBlock {\n"
+               << "    float geometryDepth;\n"
+               << "    float minDepth;\n"
+               << "    float maxDepth;\n"
+               << "} pc;\n"
+               << "\n"
+               << "vec2 positions[3] = vec2[](\n"
+               << "    vec2(-1.0, -1.0),\n"
+               << "    vec2(3.0, -1.0),\n"
+               << "    vec2(-1.0, 3.0)\n"
+               << ");\n"
+               << "\n"
+               << "void main() {\n"
+               << "    gl_Position = vec4(positions[gl_VertexIndex], pc.geometryDepth, 1.0);\n"
+               << "}\n"
+               ;
+
+       const auto outColor = getExpectedColor();
+       std::ostringstream frag;
+       frag
+               << std::fixed << std::setprecision(1)
+               << "#version 450\n"
+               << "\n"
+               << "layout (push_constant, std430) uniform PushConstantBlock {\n"
+               << "    float geometryDepth;\n"
+               << "    float minDepth;\n"
+               << "    float maxDepth;\n"
+               << "} pc;\n"
+               << "\n"
+               << "layout (location=0) out vec4 outColor;\n"
+               << "\n"
+               << "void main() {\n"
+               << "    const float depth = gl_FragCoord.z;\n"
+               << "    if (depth >= pc.minDepth && depth <= pc.maxDepth) {\n"
+               << "        outColor = vec4(" << outColor.x() << ", " << outColor.y() << ", " << outColor.z() << ", " << outColor.w() << ");\n"
+               << "    }\n"
+               << "}\n"
+               ;
+
+       programCollection.glslSources.add("vert") << glu::VertexSource(vert.str());
+       programCollection.glslSources.add("frag") << glu::FragmentSource(frag.str());
+}
+
+tcu::TestStatus DepthBiasNonZeroInstance::iterate (void)
+{
+       const auto&     vkd                     = m_context.getDeviceInterface();
+       const auto      device          = m_context.getDevice();
+       auto&           alloc           = m_context.getDefaultAllocator();
+       const auto      qIndex          = m_context.getUniversalQueueFamilyIndex();
+       const auto      queue           = m_context.getUniversalQueue();
+
+       const auto      depthFormat     = vk::VK_FORMAT_D16_UNORM;
+       const auto      colorFormat     = vk::VK_FORMAT_R8G8B8A8_UNORM;
+       const auto      colorUsage      = (vk::VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | vk::VK_IMAGE_USAGE_TRANSFER_SRC_BIT);
+       const auto      depthUsage      = (vk::VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | vk::VK_IMAGE_USAGE_TRANSFER_SRC_BIT);
+       const auto      extent          = vk::makeExtent3D(8u, 8u, 1u);
+       const auto&     pcData          = m_params.pushConstants;
+       const auto      pcDataSize      = static_cast<deUint32>(sizeof(pcData));
+       const auto      pcStages        = (vk::VK_SHADER_STAGE_VERTEX_BIT | vk::VK_SHADER_STAGE_FRAGMENT_BIT);
+       const auto      pcRange         = vk::makePushConstantRange(pcStages, 0u, pcDataSize);
+       const auto      renderPass      = vk::makeRenderPass(vkd, device, colorFormat, depthFormat, vk::VK_ATTACHMENT_LOAD_OP_CLEAR, vk::VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, vk::VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
+       const auto      stencilOp       = vk::makeStencilOpState(vk::VK_STENCIL_OP_KEEP, vk::VK_STENCIL_OP_KEEP, vk::VK_STENCIL_OP_KEEP, vk::VK_COMPARE_OP_NEVER, 0u, 0u, 0u);
+
+       // Color buffer.
+       const vk::VkImageCreateInfo colorBufferInfo =
+       {
+               vk::VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,        //      VkStructureType                 sType;
+               nullptr,                                                                        //      const void*                             pNext;
+               0u,                                                                                     //      VkImageCreateFlags              flags;
+               vk::VK_IMAGE_TYPE_2D,                                           //      VkImageType                             imageType;
+               colorFormat,                                                            //      VkFormat                                format;
+               extent,                                                                         //      VkExtent3D                              extent;
+               1u,                                                                                     //      deUint32                                mipLevels;
+               1u,                                                                                     //      deUint32                                arrayLayers;
+               vk::VK_SAMPLE_COUNT_1_BIT,                                      //      VkSampleCountFlagBits   samples;
+               vk::VK_IMAGE_TILING_OPTIMAL,                            //      VkImageTiling                   tiling;
+               colorUsage,                                                                     //      VkImageUsageFlags               usage;
+               vk::VK_SHARING_MODE_EXCLUSIVE,                          //      VkSharingMode                   sharingMode;
+               0u,                                                                                     //      deUint32                                queueFamilyIndexCount;
+               nullptr,                                                                        //      const deUint32*                 pQueueFamilyIndices;
+               vk::VK_IMAGE_LAYOUT_UNDEFINED,                          //      VkImageLayout                   initialLayout;
+       };
+       const auto colorBuffer = Image::createAndAlloc(vkd, device, colorBufferInfo, alloc, qIndex);
+
+       // Depth buffer.
+       const vk::VkImageCreateInfo depthBufferInfo =
+       {
+               vk::VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,        //      VkStructureType                 sType;
+               nullptr,                                                                        //      const void*                             pNext;
+               0u,                                                                                     //      VkImageCreateFlags              flags;
+               vk::VK_IMAGE_TYPE_2D,                                           //      VkImageType                             imageType;
+               depthFormat,                                                            //      VkFormat                                format;
+               extent,                                                                         //      VkExtent3D                              extent;
+               1u,                                                                                     //      deUint32                                mipLevels;
+               1u,                                                                                     //      deUint32                                arrayLayers;
+               vk::VK_SAMPLE_COUNT_1_BIT,                                      //      VkSampleCountFlagBits   samples;
+               vk::VK_IMAGE_TILING_OPTIMAL,                            //      VkImageTiling                   tiling;
+               depthUsage,                                                                     //      VkImageUsageFlags               usage;
+               vk::VK_SHARING_MODE_EXCLUSIVE,                          //      VkSharingMode                   sharingMode;
+               0u,                                                                                     //      deUint32                                queueFamilyIndexCount;
+               nullptr,                                                                        //      const deUint32*                 pQueueFamilyIndices;
+               vk::VK_IMAGE_LAYOUT_UNDEFINED,                          //      VkImageLayout                   initialLayout;
+       };
+       const auto depthBuffer = Image::createAndAlloc(vkd, device, depthBufferInfo, alloc, qIndex);
+
+       const auto colorSubresourceRange        = vk::makeImageSubresourceRange(vk::VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u);
+       const auto colorView                            = vk::makeImageView(vkd, device, colorBuffer->object(), vk::VK_IMAGE_VIEW_TYPE_2D, colorFormat, colorSubresourceRange);
+
+       const auto depthSubresourceRange        = vk::makeImageSubresourceRange(vk::VK_IMAGE_ASPECT_DEPTH_BIT, 0u, 1u, 0u, 1u);
+       const auto depthView                            = vk::makeImageView(vkd, device, depthBuffer->object(), vk::VK_IMAGE_VIEW_TYPE_2D, depthFormat, depthSubresourceRange);
+
+       // Create framebuffer.
+       const std::vector<vk::VkImageView>      attachments     = { colorView.get(), depthView.get() };
+       const auto                                                      framebuffer     = vk::makeFramebuffer(vkd, device, renderPass.get(), static_cast<deUint32>(attachments.size()), de::dataOrNull(attachments), extent.width, extent.height);
+
+       // Descriptor set and pipeline layout.
+       vk::DescriptorSetLayoutBuilder setLayoutBuilder;
+       const auto dsLayout                     = setLayoutBuilder.build(vkd, device);
+       const auto pipelineLayout       = vk::makePipelineLayout(vkd, device, 1u, &dsLayout.get(), 1u, &pcRange);
+
+       // Shader modules.
+       const auto vertModule = vk::createShaderModule(vkd, device, m_context.getBinaryCollection().get("vert"), 0u);
+       const auto fragModule = vk::createShaderModule(vkd, device, m_context.getBinaryCollection().get("frag"), 0u);
+
+       const std::vector<vk::VkViewport>       viewports       = { vk::makeViewport(extent) };
+       const std::vector<vk::VkRect2D>         scissors        = { vk::makeRect2D(extent) };
+
+       // Vertex input state without bindings and attributes.
+       const vk::VkPipelineVertexInputStateCreateInfo vertexInputInfo =
+       {
+               vk::VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,  // VkStructureType                             sType
+               nullptr,                                                                                                                // const void*                                 pNext
+               0u,                                                                                                                             // VkPipelineVertexInputStateCreateFlags       flags
+               0u,                                                                                                                             // deUint32                                    vertexBindingDescriptionCount
+               nullptr,                                                                                                                // const VkVertexInputBindingDescription*      pVertexBindingDescriptions
+               0u,                                                                                                                             // deUint32                                    vertexAttributeDescriptionCount
+               nullptr,                                                                                                                // const VkVertexInputAttributeDescription*    pVertexAttributeDescriptions
+       };
+
+       // Depth/stencil state, with depth test and writes enabled.
+       const vk::VkPipelineDepthStencilStateCreateInfo depthStencilStateInfo =
+       {
+               vk::VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO, // VkStructureType                          sType
+               nullptr,                                                                                                                // const void*                              pNext
+               0u,                                                                                                                             // VkPipelineDepthStencilStateCreateFlags   flags
+               VK_TRUE,                                                                                                                // VkBool32                                 depthTestEnable
+               VK_TRUE,                                                                                                                // VkBool32                                 depthWriteEnable
+               vk::VK_COMPARE_OP_ALWAYS,                                                                               // VkCompareOp                              depthCompareOp
+               VK_FALSE,                                                                                                               // VkBool32                                 depthBoundsTestEnable
+               VK_FALSE,                                                                                                               // VkBool32                                 stencilTestEnable
+               stencilOp,                                                                                                              // VkStencilOpState                         front
+               stencilOp,                                                                                                              // VkStencilOpState                         back
+               0.0f,                                                                                                                   // float                                    minDepthBounds
+               1.0f,                                                                                                                   // float                                    maxDepthBounds
+       };
+
+       // Rasterization state with depth bias enabled.
+       const vk::VkPipelineRasterizationStateCreateInfo rasterizationInfo =
+       {
+               vk::VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, // VkStructureType                            sType
+               nullptr,                                                                                                                // const void*                                pNext
+               0u,                                                                                                                             // VkPipelineRasterizationStateCreateFlags    flags
+               VK_FALSE,                                                                                                               // VkBool32                                   depthClampEnable
+               VK_FALSE,                                                                                                               // VkBool32                                   rasterizerDiscardEnable
+               vk::VK_POLYGON_MODE_FILL,                                                                               // VkPolygonMode                              polygonMode
+               vk::VK_CULL_MODE_NONE,                                                                                  // VkCullModeFlags                            cullMode
+               vk::VK_FRONT_FACE_CLOCKWISE,                                                                    // VkFrontFace                                frontFace
+               VK_TRUE,                                                                                                                // VkBool32                                   depthBiasEnable
+               0.0f,                                                                                                                   // float                                      depthBiasConstantFactor
+               0.0f,                                                                                                                   // float                                      depthBiasClamp
+               0.0f,                                                                                                                   // float                                      depthBiasSlopeFactor
+               1.0f                                                                                                                    // float                                      lineWidth
+       };
+
+       // Dynamic state.
+       const std::vector<vk::VkDynamicState> dynamicStates (1u, vk::VK_DYNAMIC_STATE_DEPTH_BIAS);
+
+       const vk::VkPipelineDynamicStateCreateInfo dynamicStateInfo =
+       {
+               vk::VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO,       //      VkStructureType                                         sType;
+               nullptr,                                                                                                        //      const void*                                                     pNext;
+               0u,                                                                                                                     //      VkPipelineDynamicStateCreateFlags       flags;
+               static_cast<deUint32>(dynamicStates.size()),                            //      deUint32                                                        dynamicStateCount;
+               de::dataOrNull(dynamicStates),                                                          //      const VkDynamicState*                           pDynamicStates;
+       };
+
+       // Graphics pipeline.
+       const auto pipeline = vk::makeGraphicsPipeline(vkd, device, pipelineLayout.get(),
+               vertModule.get(), DE_NULL, DE_NULL, DE_NULL, fragModule.get(), // shaders
+               renderPass.get(), viewports, scissors, vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, 0u/*subpass*/, 0u/*patchControlPoints*/,
+               &vertexInputInfo, &rasterizationInfo, nullptr, &depthStencilStateInfo, nullptr, &dynamicStateInfo);
+
+       // Command pool and buffer.
+       const auto cmdPool              = vk::makeCommandPool(vkd, device, qIndex);
+       const auto cmdBufferPtr = vk::allocateCommandBuffer(vkd, device, cmdPool.get(), vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY);
+       const auto cmdBuffer    = cmdBufferPtr.get();
+
+       // Clear colors.
+       const std::vector<vk::VkClearValue> clearColors =
+       {
+               vk::makeClearValueColorF32(0.0f, 0.0f, 0.0f, 1.0f),
+               vk::makeClearValueDepthStencil(0.0f, 0u),
+       };
+
+       vk::beginCommandBuffer(vkd, cmdBuffer);
+       vk::beginRenderPass(vkd, cmdBuffer, renderPass.get(), framebuffer.get(), scissors.at(0), static_cast<deUint32>(clearColors.size()), de::dataOrNull(clearColors));
+       vkd.cmdBindPipeline(cmdBuffer, vk::VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline.get());
+       vkd.cmdSetDepthBias(cmdBuffer, m_params.depthBiasConstant, m_params.depthBiasClamp, 0.0f);
+       vkd.cmdPushConstants(cmdBuffer, pipelineLayout.get(), pcStages, 0u, pcDataSize, &pcData);
+       vkd.cmdDraw(cmdBuffer, 3u, 1u, 0u, 0u);
+       vk::endRenderPass(vkd, cmdBuffer);
+       vk::endCommandBuffer(vkd, cmdBuffer);
+       vk::submitCommandsAndWait(vkd, device, queue, cmdBuffer);
+
+       // Check color buffer contents.
+       const auto              offset          = vk::makeOffset3D(0, 0, 0);
+       const auto              iWidth          = static_cast<int>(extent.width);
+       const auto              iHeight         = static_cast<int>(extent.height);
+       const auto              colorPixels     = colorBuffer->readSurface(queue, alloc, vk::VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, offset, iWidth, iHeight, vk::VK_IMAGE_ASPECT_COLOR_BIT);
+       const auto              expected        = DepthBiasNonZeroCase::getExpectedColor();
+       const tcu::Vec4 threshold       (0.0f);
+       auto&                   log                     = m_context.getTestContext().getLog();
+
+       if (!tcu::floatThresholdCompare(log, "Result", "Result", expected, colorPixels, threshold, tcu::COMPARE_LOG_ON_ERROR))
+               return tcu::TestStatus::fail("Unexpected color buffer value; check log for details");
+
+       return tcu::TestStatus::pass("Pass");
+}
+
 } //anonymous
 
 DynamicStateRSTests::DynamicStateRSTests (tcu::TestContext& testCtx)
@@ -670,6 +977,33 @@ void DynamicStateRSTests::init (void)
        addChild(new InstanceFactory<DepthBiasParamTestInstance>(m_testCtx, "depth_bias", "Test depth bias functionality", shaderPaths));
        addChild(new InstanceFactory<DepthBiasClampParamTestInstance, FunctionSupport0>(m_testCtx, "depth_bias_clamp", "Test depth bias clamp functionality", shaderPaths, checkDepthBiasClampSupport));
        addChild(new InstanceFactory<LineWidthParamTestInstance, FunctionSupport0>(m_testCtx, "line_width", "Draw a line with width set to max defined by physical device", shaderPaths, checkWideLinesSupport));
+
+       {
+               const DepthBiasNonZeroParams params =
+               {
+                       16384.0f,       //      float                                                   depthBiasConstant;
+                       0.0f,           //      float                                                   depthBiasClamp;
+                       {                       //      DepthBiasNonZeroPushConstants   pushConstants;
+                               0.375f, //              float geometryDepth;
+                               0.5f,   //              float minDepth;
+                               1.0f,   //              float maxDepth;
+                       },
+               };
+               addChild(new DepthBiasNonZeroCase(m_testCtx, "nonzero_depth_bias_constant", "", params));
+       }
+       {
+               const DepthBiasNonZeroParams params =
+               {
+                       16384.0f,               //      float                                                   depthBiasConstant;
+                       0.125f,                 //      float                                                   depthBiasClamp;
+                       {                               //      DepthBiasNonZeroPushConstants   pushConstants;
+                               0.375f,         //              float geometryDepth;
+                               0.46875f,       //              float minDepth;
+                               0.53125f,       //              float maxDepth;
+                       },
+               };
+               addChild(new DepthBiasNonZeroCase(m_testCtx, "nonzero_depth_bias_clamp", "", params));
+       }
 }
 
 } // DynamicState
index 539baa3..f39d48e 100644 (file)
@@ -528,6 +528,14 @@ const StencilOpParams kDefaultStencilOpParams =
        vk::VK_COMPARE_OP_ALWAYS
 };
 
+struct DepthBiasParams
+{
+       float constantFactor;
+       float clamp;
+};
+
+const DepthBiasParams kNoDepthBiasParams = { 0.0f, 0.0f };
+
 using ViewportVec      = std::vector<vk::VkViewport>;
 using ScissorVec       = std::vector<vk::VkRect2D>;
 using StencilOpVec     = std::vector<StencilOpParams>;
@@ -584,6 +592,7 @@ using RastDiscardEnableConfig               = BooleanFlagConfig;
 using PrimRestartEnableConfig          = BooleanFlagConfig;
 using LogicOpConfig                                    = StaticAndDynamicPair<vk::VkLogicOp>;
 using PatchControlPointsConfig         = StaticAndDynamicPair<deUint8>;
+using DepthBiasConfig                          = StaticAndDynamicPair<DepthBiasParams>;
 
 const tcu::Vec4                kDefaultTriangleColor   (0.0f, 0.0f, 1.0f, 1.0f);       // Opaque blue.
 const tcu::Vec4                kDefaultClearColor              (0.0f, 0.0f, 0.0f, 1.0f);       // Opaque black.
@@ -844,6 +853,7 @@ struct TestConfig
        PrimRestartEnableConfig         primRestartEnableConfig;
        LogicOpConfig                           logicOpConfig;
        PatchControlPointsConfig        patchControlPointsConfig;
+       DepthBiasConfig                         depthBiasConfig;
 
        // Sane defaults.
        TestConfig (SequenceOrdering ordering, const VertexGenerator* staticVertexGenerator = nullptr, const VertexGenerator* dynamicVertexGenerator = nullptr)
@@ -883,6 +893,7 @@ struct TestConfig
                , primRestartEnableConfig               (false)
                , logicOpConfig                                 (vk::VK_LOGIC_OP_CLEAR)
                , patchControlPointsConfig              (1u)
+               , depthBiasConfig                               (kNoDepthBiasParams)
                , m_swappedValues                               (false)
        {
        }
@@ -911,6 +922,12 @@ struct TestConfig
                return ((patchControlPointsConfig.dynamicValue && !m_swappedValues) ? patchControlPointsConfig.dynamicValue.get() : patchControlPointsConfig.staticValue);
        }
 
+       // Get the active depth bias parameters.
+       DepthBiasParams getActiveDepthBiasParams () const
+       {
+               return ((depthBiasConfig.dynamicValue && !m_swappedValues) ? depthBiasConfig.dynamicValue.get() : depthBiasConfig.staticValue);
+       }
+
        // Returns true if there is more than one viewport.
        bool isMultiViewport () const
        {
@@ -954,6 +971,7 @@ struct TestConfig
                primRestartEnableConfig.swapValues();
                logicOpConfig.swapValues();
                patchControlPointsConfig.swapValues();
+               depthBiasConfig.swapValues();
 
                m_swappedValues = !m_swappedValues;
        }
@@ -1007,6 +1025,12 @@ struct TestConfig
                return static_cast<bool>(primRestartEnableConfig.dynamicValue);
        }
 
+       // Returns true if the test needs the depth bias clamp feature.
+       bool needsDepthBiasClampFeature () const
+       {
+               return (getActiveDepthBiasParams().clamp != 0.0f);
+       }
+
        // Returns the appropriate color image format for the test.
        vk::VkFormat colorFormat () const
        {
@@ -1019,6 +1043,7 @@ struct TestConfig
        {
                std::vector<vk::VkDynamicState> dynamicStates;
 
+               if (depthBiasConfig.dynamicValue)                               dynamicStates.push_back(vk::VK_DYNAMIC_STATE_DEPTH_BIAS);
                if (cullModeConfig.dynamicValue)                                dynamicStates.push_back(vk::VK_DYNAMIC_STATE_CULL_MODE_EXT);
                if (frontFaceConfig.dynamicValue)                               dynamicStates.push_back(vk::VK_DYNAMIC_STATE_FRONT_FACE_EXT);
                if (topologyConfig.dynamicValue)                                dynamicStates.push_back(vk::VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT);
@@ -1196,7 +1221,7 @@ void ExtendedDynamicStateTest::checkSupport (Context& context) const
        const auto&     dbTestEnable    = m_testConfig.depthBoundsTestEnableConfig;
        const bool      useDepthBounds  = (dbTestEnable.staticValue || (dbTestEnable.dynamicValue && dbTestEnable.dynamicValue.get()));
 
-       if (useDepthBounds || m_testConfig.needsGeometryShader() || m_testConfig.needsTessellation())
+       if (useDepthBounds || m_testConfig.needsGeometryShader() || m_testConfig.needsTessellation() || m_testConfig.needsDepthBiasClampFeature())
        {
                const auto features = vk::getPhysicalDeviceFeatures(vki, physicalDevice);
 
@@ -1211,6 +1236,10 @@ void ExtendedDynamicStateTest::checkSupport (Context& context) const
                // Check tessellation support
                if (m_testConfig.needsTessellation() && !features.tessellationShader)
                        TCU_THROW(NotSupportedError, "Tessellation feature not supported");
+
+               // Check depth bias clamp feature.
+               if (m_testConfig.needsDepthBiasClampFeature() && !features.depthBiasClamp)
+                       TCU_THROW(NotSupportedError, "Depth bias clamp not supported");
        }
 
        // Check color image format support (depth/stencil will be chosen at runtime).
@@ -1506,6 +1535,12 @@ void setDynamicStates(const TestConfig& testConfig, const vk::DeviceInterface& v
        if (testConfig.depthBiasEnableConfig.dynamicValue)
                vkd.cmdSetDepthBiasEnableEXT(cmdBuffer, makeVkBool32(testConfig.depthBiasEnableConfig.dynamicValue.get()));
 
+       if (testConfig.depthBiasConfig.dynamicValue)
+       {
+               const auto& bias = testConfig.depthBiasConfig.dynamicValue.get();
+               vkd.cmdSetDepthBias(cmdBuffer, bias.constantFactor, bias.clamp, 0.0f);
+       }
+
        if (testConfig.rastDiscardEnableConfig.dynamicValue)
                vkd.cmdSetRasterizerDiscardEnableEXT(cmdBuffer, makeVkBool32(testConfig.rastDiscardEnableConfig.dynamicValue.get()));
 
@@ -2105,9 +2140,8 @@ tcu::TestStatus ExtendedDynamicStateInstance::iterate (void)
                m_testConfig.cullModeConfig.staticValue,                                                //      VkCullModeFlags                                                 cullMode;
                m_testConfig.frontFaceConfig.staticValue,                                               //      VkFrontFace                                                             frontFace;
                makeVkBool32(m_testConfig.depthBiasEnableConfig.staticValue),   //      VkBool32                                                                depthBiasEnable;
-               // Change the depth bias parameters if depth bias is dynamic
-               m_testConfig.depthBiasEnableConfig.dynamicValue ? 2e7f : 0.0f,  //      float                                                                   depthBiasConstantFactor;
-               m_testConfig.depthBiasEnableConfig.dynamicValue ? 0.25f : 0.0f, //      float                                                                   depthBiasClamp;
+               m_testConfig.depthBiasConfig.staticValue.constantFactor,                //      float                                                                   depthBiasConstantFactor;
+               m_testConfig.depthBiasConfig.staticValue.clamp,                                 //      float                                                                   depthBiasClamp;
                0.0f,                                                                                                                   //      float                                                                   depthBiasSlopeFactor;
                1.0f,                                                                                                                   //      float                                                                   lineWidth;
        };
@@ -2931,45 +2965,90 @@ tcu::TestCaseGroup* createExtendedDynamicStateTests (tcu::TestContext& testCtx)
                        orderingGroup->addChild(new ExtendedDynamicStateTest(testCtx, "depth_write_disable", "Dynamically disable writes to the depth buffer", config));
                }
 
-               // Depth bias enable.
+               // Depth bias enable with static or dynamic depth bias parameters.
                {
+                       const DepthBiasParams kAlternativeDepthBiasParams = { 2e7f, 0.25f };
+
+                       for (int dynamicBiasIter = 0; dynamicBiasIter < 2; ++dynamicBiasIter)
                        {
-                               TestConfig config(kOrdering);
-
-                               // Enable depth test and write 1.0f
-                               config.depthTestEnableConfig.staticValue = true;
-                               config.depthWriteEnableConfig.staticValue = true;
-                               config.depthCompareOpConfig.staticValue = vk::VK_COMPARE_OP_ALWAYS;
-                               // Clear depth buffer to 0.25f
-                               config.clearDepthValue = 0.25f;
-                               // Write depth to 0.5f
-                               config.meshParams[0].depth = 0.5f;
-
-                               // Enable dynamic depth bias and expect the depth value to be clamped to 0.75f based on depthBiasConstantFactor and depthBiasClamp
-                               config.depthBiasEnableConfig.staticValue = false;
-                               config.depthBiasEnableConfig.dynamicValue = tcu::just(true);
-                               config.expectedDepth = 0.75f;
-
-                               orderingGroup->addChild(new ExtendedDynamicStateTest(testCtx, "depth_bias_enable", "Dynamically enable the depth bias", config));
-                       }
-                       {
-                               TestConfig config(kOrdering);
-
-                               // Enable depth test and write 1.0f
-                               config.depthTestEnableConfig.staticValue = true;
-                               config.depthWriteEnableConfig.staticValue = true;
-                               config.depthCompareOpConfig.staticValue = vk::VK_COMPARE_OP_ALWAYS;
-                               // Clear depth buffer to 0.25f
-                               config.clearDepthValue = 0.25f;
-                               // Write depth to 0.5f
-                               config.meshParams[0].depth = 0.5f;
-
-                               // Disable dynamic depth bias and expect the depth value to remain at 0.5f based on written value
-                               config.depthBiasEnableConfig.staticValue = true;
-                               config.depthBiasEnableConfig.dynamicValue = tcu::just(false);
-                               config.expectedDepth = 0.5f;
-
-                               orderingGroup->addChild(new ExtendedDynamicStateTest(testCtx, "depth_bias_disable", "Dynamically disable the depth bias", config));
+                               const bool useDynamicBias = (dynamicBiasIter > 0);
+
+                               {
+                                       TestConfig config(kOrdering);
+
+                                       // Enable depth test and write 1.0f
+                                       config.depthTestEnableConfig.staticValue = true;
+                                       config.depthWriteEnableConfig.staticValue = true;
+                                       config.depthCompareOpConfig.staticValue = vk::VK_COMPARE_OP_ALWAYS;
+                                       // Clear depth buffer to 0.25f
+                                       config.clearDepthValue = 0.25f;
+                                       // Write depth to 0.5f
+                                       config.meshParams[0].depth = 0.5f;
+
+                                       // Enable dynamic depth bias and expect the depth value to be clamped to 0.75f based on depthBiasConstantFactor and depthBiasClamp
+                                       if (useDynamicBias)
+                                       {
+                                               config.depthBiasConfig.staticValue      = kNoDepthBiasParams;
+                                               config.depthBiasConfig.dynamicValue     = kAlternativeDepthBiasParams;
+                                       }
+                                       else
+                                       {
+                                               config.depthBiasConfig.staticValue      = kAlternativeDepthBiasParams;
+                                       }
+
+                                       config.depthBiasEnableConfig.staticValue = false;
+                                       config.depthBiasEnableConfig.dynamicValue = tcu::just(true);
+                                       config.expectedDepth = 0.75f;
+
+                                       std::string caseName = "depth_bias_enable";
+                                       std::string caseDesc = "Dynamically enable the depth bias";
+
+                                       if (useDynamicBias)
+                                       {
+                                               caseName += "_dynamic_bias_params";
+                                               caseDesc += " and set the bias params dynamically";
+                                       }
+
+                                       orderingGroup->addChild(new ExtendedDynamicStateTest(testCtx, caseName, caseDesc, config));
+                               }
+                               {
+                                       TestConfig config(kOrdering);
+
+                                       // Enable depth test and write 1.0f
+                                       config.depthTestEnableConfig.staticValue = true;
+                                       config.depthWriteEnableConfig.staticValue = true;
+                                       config.depthCompareOpConfig.staticValue = vk::VK_COMPARE_OP_ALWAYS;
+                                       // Clear depth buffer to 0.25f
+                                       config.clearDepthValue = 0.25f;
+                                       // Write depth to 0.5f
+                                       config.meshParams[0].depth = 0.5f;
+
+                                       // Disable dynamic depth bias and expect the depth value to remain at 0.5f based on written value
+                                       if (useDynamicBias)
+                                       {
+                                               config.depthBiasConfig.staticValue      = kNoDepthBiasParams;
+                                               config.depthBiasConfig.dynamicValue     = kAlternativeDepthBiasParams;
+                                       }
+                                       else
+                                       {
+                                               config.depthBiasConfig.staticValue      = kAlternativeDepthBiasParams;
+                                       }
+
+                                       config.depthBiasEnableConfig.staticValue = true;
+                                       config.depthBiasEnableConfig.dynamicValue = tcu::just(false);
+                                       config.expectedDepth = 0.5f;
+
+                                       std::string caseName = "depth_bias_disable";
+                                       std::string caseDesc = "Dynamically disable the depth bias";
+
+                                       if (useDynamicBias)
+                                       {
+                                               caseName += "_dynamic_bias_params";
+                                               caseDesc += " and set the bias params dynamically";
+                                       }
+
+                                       orderingGroup->addChild(new ExtendedDynamicStateTest(testCtx, caseName, caseDesc, config));
+                               }
                        }
                }
 
index a1cd8f5..f20dc1b 100644 (file)
@@ -4,6 +4,8 @@ dEQP-VK.dynamic_state.vp_state.viewport_array
 dEQP-VK.dynamic_state.rs_state.depth_bias
 dEQP-VK.dynamic_state.rs_state.depth_bias_clamp
 dEQP-VK.dynamic_state.rs_state.line_width
+dEQP-VK.dynamic_state.rs_state.nonzero_depth_bias_constant
+dEQP-VK.dynamic_state.rs_state.nonzero_depth_bias_clamp
 dEQP-VK.dynamic_state.cb_state.blend_constants
 dEQP-VK.dynamic_state.ds_state.depth_bounds_1
 dEQP-VK.dynamic_state.ds_state.depth_bounds_2
index 276fc49..86703bd 100644 (file)
@@ -153555,6 +153555,8 @@ dEQP-VK.pipeline.extended_dynamic_state.cmd_buffer_start.depth_write_enable
 dEQP-VK.pipeline.extended_dynamic_state.cmd_buffer_start.depth_write_disable
 dEQP-VK.pipeline.extended_dynamic_state.cmd_buffer_start.depth_bias_enable
 dEQP-VK.pipeline.extended_dynamic_state.cmd_buffer_start.depth_bias_disable
+dEQP-VK.pipeline.extended_dynamic_state.cmd_buffer_start.depth_bias_enable_dynamic_bias_params
+dEQP-VK.pipeline.extended_dynamic_state.cmd_buffer_start.depth_bias_disable_dynamic_bias_params
 dEQP-VK.pipeline.extended_dynamic_state.cmd_buffer_start.depth_compare_never
 dEQP-VK.pipeline.extended_dynamic_state.cmd_buffer_start.depth_compare_less
 dEQP-VK.pipeline.extended_dynamic_state.cmd_buffer_start.depth_compare_greater
@@ -154944,6 +154946,8 @@ dEQP-VK.pipeline.extended_dynamic_state.before_draw.depth_write_enable
 dEQP-VK.pipeline.extended_dynamic_state.before_draw.depth_write_disable
 dEQP-VK.pipeline.extended_dynamic_state.before_draw.depth_bias_enable
 dEQP-VK.pipeline.extended_dynamic_state.before_draw.depth_bias_disable
+dEQP-VK.pipeline.extended_dynamic_state.before_draw.depth_bias_enable_dynamic_bias_params
+dEQP-VK.pipeline.extended_dynamic_state.before_draw.depth_bias_disable_dynamic_bias_params
 dEQP-VK.pipeline.extended_dynamic_state.before_draw.depth_compare_never
 dEQP-VK.pipeline.extended_dynamic_state.before_draw.depth_compare_less
 dEQP-VK.pipeline.extended_dynamic_state.before_draw.depth_compare_greater
@@ -156333,6 +156337,8 @@ dEQP-VK.pipeline.extended_dynamic_state.between_pipelines.depth_write_enable
 dEQP-VK.pipeline.extended_dynamic_state.between_pipelines.depth_write_disable
 dEQP-VK.pipeline.extended_dynamic_state.between_pipelines.depth_bias_enable
 dEQP-VK.pipeline.extended_dynamic_state.between_pipelines.depth_bias_disable
+dEQP-VK.pipeline.extended_dynamic_state.between_pipelines.depth_bias_enable_dynamic_bias_params
+dEQP-VK.pipeline.extended_dynamic_state.between_pipelines.depth_bias_disable_dynamic_bias_params
 dEQP-VK.pipeline.extended_dynamic_state.between_pipelines.depth_compare_never
 dEQP-VK.pipeline.extended_dynamic_state.between_pipelines.depth_compare_less
 dEQP-VK.pipeline.extended_dynamic_state.between_pipelines.depth_compare_greater
@@ -157722,6 +157728,8 @@ dEQP-VK.pipeline.extended_dynamic_state.after_pipelines.depth_write_enable
 dEQP-VK.pipeline.extended_dynamic_state.after_pipelines.depth_write_disable
 dEQP-VK.pipeline.extended_dynamic_state.after_pipelines.depth_bias_enable
 dEQP-VK.pipeline.extended_dynamic_state.after_pipelines.depth_bias_disable
+dEQP-VK.pipeline.extended_dynamic_state.after_pipelines.depth_bias_enable_dynamic_bias_params
+dEQP-VK.pipeline.extended_dynamic_state.after_pipelines.depth_bias_disable_dynamic_bias_params
 dEQP-VK.pipeline.extended_dynamic_state.after_pipelines.depth_compare_never
 dEQP-VK.pipeline.extended_dynamic_state.after_pipelines.depth_compare_less
 dEQP-VK.pipeline.extended_dynamic_state.after_pipelines.depth_compare_greater
@@ -159111,6 +159119,8 @@ dEQP-VK.pipeline.extended_dynamic_state.before_good_static.depth_write_enable
 dEQP-VK.pipeline.extended_dynamic_state.before_good_static.depth_write_disable
 dEQP-VK.pipeline.extended_dynamic_state.before_good_static.depth_bias_enable
 dEQP-VK.pipeline.extended_dynamic_state.before_good_static.depth_bias_disable
+dEQP-VK.pipeline.extended_dynamic_state.before_good_static.depth_bias_enable_dynamic_bias_params
+dEQP-VK.pipeline.extended_dynamic_state.before_good_static.depth_bias_disable_dynamic_bias_params
 dEQP-VK.pipeline.extended_dynamic_state.before_good_static.depth_compare_never
 dEQP-VK.pipeline.extended_dynamic_state.before_good_static.depth_compare_less
 dEQP-VK.pipeline.extended_dynamic_state.before_good_static.depth_compare_greater
@@ -160500,6 +160510,8 @@ dEQP-VK.pipeline.extended_dynamic_state.two_draws_dynamic.depth_write_enable
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_dynamic.depth_write_disable
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_dynamic.depth_bias_enable
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_dynamic.depth_bias_disable
+dEQP-VK.pipeline.extended_dynamic_state.two_draws_dynamic.depth_bias_enable_dynamic_bias_params
+dEQP-VK.pipeline.extended_dynamic_state.two_draws_dynamic.depth_bias_disable_dynamic_bias_params
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_dynamic.depth_compare_never
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_dynamic.depth_compare_less
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_dynamic.depth_compare_greater
@@ -161886,6 +161898,8 @@ dEQP-VK.pipeline.extended_dynamic_state.two_draws_static.depth_write_enable
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_static.depth_write_disable
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_static.depth_bias_enable
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_static.depth_bias_disable
+dEQP-VK.pipeline.extended_dynamic_state.two_draws_static.depth_bias_enable_dynamic_bias_params
+dEQP-VK.pipeline.extended_dynamic_state.two_draws_static.depth_bias_disable_dynamic_bias_params
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_static.depth_compare_never
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_static.depth_compare_less
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_static.depth_compare_greater