Add tests for compute pipeline derivatives
authorChris Forbes <chrisforbes@google.com>
Tue, 5 Jun 2018 01:15:25 +0000 (18:15 -0700)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 28 Jun 2018 11:28:05 +0000 (07:28 -0400)
Initial touch-tests for CreateComputePipelines using a base pipeline by
index and by handle. I intend to add more over time, but this is enough
to expose trouble in some implementations.

VK-GL-CTS: 1220
Components: Vulkan
New Tests: dEQP-VK.pipeline.derivative.*

Change-Id: I693f5be8a2b1087b0a2eb89e1110b1c671cbd5dc

AndroidGen.mk
android/cts/master/vk-master.txt
external/vulkancts/modules/vulkan/pipeline/CMakeLists.txt
external/vulkancts/modules/vulkan/pipeline/vktPipelineDerivativeTests.cpp [new file with mode: 0644]
external/vulkancts/modules/vulkan/pipeline/vktPipelineDerivativeTests.hpp [new file with mode: 0644]
external/vulkancts/modules/vulkan/pipeline/vktPipelineTests.cpp
external/vulkancts/mustpass/1.1.2/vk-default-no-waivers.txt
external/vulkancts/mustpass/1.1.2/vk-default.txt

index 0f15d99..ad24988 100644 (file)
@@ -150,6 +150,7 @@ LOCAL_SRC_FILES := \
        external/vulkancts/modules/vulkan/pipeline/vktPipelineCacheTests.cpp \
        external/vulkancts/modules/vulkan/pipeline/vktPipelineClearUtil.cpp \
        external/vulkancts/modules/vulkan/pipeline/vktPipelineDepthTests.cpp \
+       external/vulkancts/modules/vulkan/pipeline/vktPipelineDerivativeTests.cpp \
        external/vulkancts/modules/vulkan/pipeline/vktPipelineEarlyDestroyTests.cpp \
        external/vulkancts/modules/vulkan/pipeline/vktPipelineFramebufferAttachmentTests.cpp \
        external/vulkancts/modules/vulkan/pipeline/vktPipelineImageSamplingInstance.cpp \
index 148f84e..b44eef3 100755 (executable)
@@ -165070,6 +165070,8 @@ dEQP-VK.pipeline.framebuffer_attachment.diff_attachments_2d_32x32_48x48_ms
 dEQP-VK.pipeline.framebuffer_attachment.diff_attachments_2d_32x32_39x41_ms
 dEQP-VK.pipeline.framebuffer_attachment.diff_attachments_2d_19x27_32x32_ms
 dEQP-VK.pipeline.shader_stencil_export.op_replace
+dEQP-VK.pipeline.derivative.compute.derivative_by_handle
+dEQP-VK.pipeline.derivative.compute.derivative_by_index
 dEQP-VK.binding_model.shader_access.primary_cmd_buf.sampler_mutable.no_access.single_descriptor.1d
 dEQP-VK.binding_model.shader_access.primary_cmd_buf.sampler_mutable.no_access.single_descriptor.1d_base_mip
 dEQP-VK.binding_model.shader_access.primary_cmd_buf.sampler_mutable.no_access.single_descriptor.1d_base_slice
index 45dab0d..9bd3c72 100644 (file)
@@ -11,6 +11,8 @@ set(DEQP_VK_PIPELINE_SRCS
        vktPipelineCombinationsIterator.hpp
        vktPipelineDepthTests.cpp
        vktPipelineDepthTests.hpp
+       vktPipelineDerivativeTests.cpp
+       vktPipelineDerivativeTests.hpp
        vktPipelineEarlyDestroyTests.cpp
        vktPipelineEarlyDestroyTests.hpp
        vktPipelineImageSamplingInstance.cpp
diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineDerivativeTests.cpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineDerivativeTests.cpp
new file mode 100644 (file)
index 0000000..9ab5b4e
--- /dev/null
@@ -0,0 +1,192 @@
+/*------------------------------------------------------------------------
+ * Vulkan Conformance Tests
+ * ------------------------
+ *
+ * Copyright (c) 2018 The Khronos Group Inc.
+ * Copyright (c) 2018 Google Inc.
+ *
+ * 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.
+ *
+ *//*!
+ * \file
+ * \brief Pipeline Derivative Tests
+ *//*--------------------------------------------------------------------*/
+
+#include "vktPipelineDerivativeTests.hpp"
+#include "vktPipelineClearUtil.hpp"
+#include "vktPipelineImageUtil.hpp"
+#include "vktPipelineMakeUtil.hpp"
+#include "vktPipelineVertexUtil.hpp"
+#include "vktTestCase.hpp"
+#include "vktTestCaseUtil.hpp"
+#include "vkImageUtil.hpp"
+#include "vkMemUtil.hpp"
+#include "vkPrograms.hpp"
+#include "vkBuilderUtil.hpp"
+#include "vkQueryUtil.hpp"
+#include "vkRef.hpp"
+#include "vkRefUtil.hpp"
+#include "vkTypeUtil.hpp"
+#include "vkCmdUtil.hpp"
+#include "vkObjUtil.hpp"
+#include "tcuImageCompare.hpp"
+#include "deUniquePtr.hpp"
+#include "deMemory.h"
+#include "tcuTestLog.hpp"
+
+#include <sstream>
+#include <vector>
+
+namespace vkt
+{
+namespace pipeline
+{
+
+using namespace vk;
+
+namespace
+{
+
+// Helper functions
+
+void initComputeDerivativePrograms (SourceCollections& sources)
+{
+       std::ostringstream computeSource;
+
+       // Trivial do-nothing compute shader
+       computeSource <<
+               "#version 310 es\n"
+               "layout(local_size_x=1) in;\n"
+               "void main (void)\n"
+               "{\n"
+               "}\n";
+
+       sources.glslSources.add("comp") << glu::ComputeSource(computeSource.str());
+}
+
+tcu::TestStatus testComputeDerivativeByHandle (Context& context)
+{
+       const DeviceInterface&          vk                              = context.getDeviceInterface();
+       const VkDevice                          vkDevice                = context.getDevice();
+       Move<VkShaderModule>            shaderModule    = createShaderModule(vk, vkDevice, context.getBinaryCollection().get("comp"), 0);
+
+       Move<VkPipelineLayout>          layout                  = makePipelineLayout(vk, vkDevice);
+
+       VkComputePipelineCreateInfo     cpci                    = {
+               VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO,
+               DE_NULL,
+               VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT,
+               {
+                       VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
+                       DE_NULL,
+                       0,
+                       VK_SHADER_STAGE_COMPUTE_BIT,
+                       shaderModule.get(),
+                       "main",
+                       DE_NULL
+               },
+               layout.get(),
+               0,
+               -1
+       };
+
+       Move<VkPipeline>                        basePipeline    = createComputePipeline(vk, vkDevice, DE_NULL, &cpci);
+
+       // Create second (identical) pipeline based on first
+       cpci.flags = VK_PIPELINE_CREATE_DERIVATIVE_BIT;
+       cpci.basePipelineHandle = basePipeline.get();
+
+       Move<VkPipeline>                        derivedPipeline = createComputePipeline(vk, vkDevice, DE_NULL, &cpci);
+
+       // If we got here without crashing, success.
+       return tcu::TestStatus::pass("OK");
+}
+
+tcu::TestStatus testComputeDerivativeByIndex (Context& context)
+{
+       const DeviceInterface&          vk                              = context.getDeviceInterface();
+       const VkDevice                          vkDevice                = context.getDevice();
+       Move<VkShaderModule>            shaderModule    = createShaderModule(vk, vkDevice, context.getBinaryCollection().get("comp"), 0);
+
+       Move<VkPipelineLayout>          layout                  = makePipelineLayout(vk, vkDevice);
+
+       VkComputePipelineCreateInfo     cpci[2]                 = { {
+               VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO,
+               DE_NULL,
+               VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT,
+               {
+                       VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
+                       DE_NULL,
+                       0,
+                       VK_SHADER_STAGE_COMPUTE_BIT,
+                       shaderModule.get(),
+                       "main",
+                       DE_NULL
+               },
+               layout.get(),
+               0,
+               -1
+       }, {
+               VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO,
+               DE_NULL,
+               VK_PIPELINE_CREATE_DERIVATIVE_BIT,
+               {
+                       VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
+                       DE_NULL,
+                       0,
+                       VK_SHADER_STAGE_COMPUTE_BIT,
+                       shaderModule.get(),
+                       "main",
+                       DE_NULL
+               },
+               layout.get(),
+               0,
+               0,
+       } };
+
+       std::vector<VkPipeline>         rawPipelines(2);
+       vk.createComputePipelines(vkDevice, 0, 2, cpci, DE_NULL, rawPipelines.data());
+
+       for (deUint32 i = 0; i < rawPipelines.size(); i++) {
+               vk.destroyPipeline(vkDevice, rawPipelines[i], DE_NULL);
+       }
+
+       // If we got here without crashing, success.
+       return tcu::TestStatus::pass("OK");
+}
+
+} // anonymous
+
+tcu::TestCaseGroup* createDerivativeTests (tcu::TestContext& testCtx)
+{
+       de::MovePtr<tcu::TestCaseGroup> derivativeTests (new tcu::TestCaseGroup(testCtx, "derivative", "pipeline derivative tests"));
+       de::MovePtr<tcu::TestCaseGroup> computeTests (new tcu::TestCaseGroup(testCtx, "compute", "compute tests"));
+
+       addFunctionCaseWithPrograms(computeTests.get(),
+                                                               "derivative_by_handle",
+                                                               "",
+                                                               initComputeDerivativePrograms,
+                                                               testComputeDerivativeByHandle);
+       addFunctionCaseWithPrograms(computeTests.get(),
+                                                               "derivative_by_index",
+                                                               "",
+                                                               initComputeDerivativePrograms,
+                                                               testComputeDerivativeByIndex);
+
+       derivativeTests->addChild(computeTests.release());
+       return derivativeTests.release();
+}
+
+} // pipeline
+
+} // vkt
diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineDerivativeTests.hpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineDerivativeTests.hpp
new file mode 100644 (file)
index 0000000..9d0706f
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef _VKTPIPELINEDERIVATIVETESTS_HPP
+#define _VKTPIPELINEDERIVATIVETESTS_HPP
+/*------------------------------------------------------------------------
+ * Vulkan Conformance Tests
+ * ------------------------
+ *
+ * Copyright (c) 2018 The Khronos Group Inc.
+ * Copyright (c) 2018 Google Inc.
+ *
+ * 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.
+ *
+ *//*!
+ * \file
+ * \brief Pipeline Derivative Tests
+ *//*--------------------------------------------------------------------*/
+
+#include "vktTestCase.hpp"
+
+namespace vkt
+{
+namespace pipeline
+{
+
+tcu::TestCaseGroup* createDerivativeTests (tcu::TestContext& testCtx);
+
+} // pipeline
+} // vkt
+
+#endif // _VKTPIPELINEDERIVATIVETESTS_HPP
index aa3587a..3bd6735 100644 (file)
@@ -43,6 +43,7 @@
 #include "vktPipelineRenderToImageTests.hpp"
 #include "vktPipelineFramebufferAttachmentTests.hpp"
 #include "vktPipelineStencilExportTests.hpp"
+#include "vktPipelineDerivativeTests.hpp"
 #include "vktTestGroupUtil.hpp"
 
 namespace vkt
@@ -77,6 +78,7 @@ void createChildren (tcu::TestCaseGroup* pipelineTests)
        pipelineTests->addChild(createRenderToImageTests                        (testCtx));
        pipelineTests->addChild(createFramebufferAttachmentTests        (testCtx));
        pipelineTests->addChild(createStencilExportTests                        (testCtx));
+       pipelineTests->addChild(createDerivativeTests                           (testCtx));
 }
 
 } // anonymous
index 208c261..e8b88dc 100644 (file)
@@ -165075,6 +165075,8 @@ dEQP-VK.pipeline.framebuffer_attachment.diff_attachments_2d_32x32_48x48_ms
 dEQP-VK.pipeline.framebuffer_attachment.diff_attachments_2d_32x32_39x41_ms
 dEQP-VK.pipeline.framebuffer_attachment.diff_attachments_2d_19x27_32x32_ms
 dEQP-VK.pipeline.shader_stencil_export.op_replace
+dEQP-VK.pipeline.derivative.compute.derivative_by_handle
+dEQP-VK.pipeline.derivative.compute.derivative_by_index
 dEQP-VK.binding_model.shader_access.primary_cmd_buf.sampler_mutable.no_access.single_descriptor.1d
 dEQP-VK.binding_model.shader_access.primary_cmd_buf.sampler_mutable.no_access.single_descriptor.1d_base_mip
 dEQP-VK.binding_model.shader_access.primary_cmd_buf.sampler_mutable.no_access.single_descriptor.1d_base_slice
index f2e67d8..61f8895 100644 (file)
@@ -165075,6 +165075,8 @@ dEQP-VK.pipeline.framebuffer_attachment.diff_attachments_2d_32x32_48x48_ms
 dEQP-VK.pipeline.framebuffer_attachment.diff_attachments_2d_32x32_39x41_ms
 dEQP-VK.pipeline.framebuffer_attachment.diff_attachments_2d_19x27_32x32_ms
 dEQP-VK.pipeline.shader_stencil_export.op_replace
+dEQP-VK.pipeline.derivative.compute.derivative_by_handle
+dEQP-VK.pipeline.derivative.compute.derivative_by_index
 dEQP-VK.binding_model.shader_access.primary_cmd_buf.sampler_mutable.no_access.single_descriptor.1d
 dEQP-VK.binding_model.shader_access.primary_cmd_buf.sampler_mutable.no_access.single_descriptor.1d_base_mip
 dEQP-VK.binding_model.shader_access.primary_cmd_buf.sampler_mutable.no_access.single_descriptor.1d_base_slice