From 6fe64a7c70d556f740b677c4c2a5c70376d241a2 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Mon, 4 Jun 2018 18:15:25 -0700 Subject: [PATCH] Add tests for compute pipeline derivatives 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 | 1 + android/cts/master/vk-master.txt | 2 + .../modules/vulkan/pipeline/CMakeLists.txt | 2 + .../vulkan/pipeline/vktPipelineDerivativeTests.cpp | 192 +++++++++++++++++++++ .../vulkan/pipeline/vktPipelineDerivativeTests.hpp | 39 +++++ .../modules/vulkan/pipeline/vktPipelineTests.cpp | 2 + .../mustpass/1.1.2/vk-default-no-waivers.txt | 2 + external/vulkancts/mustpass/1.1.2/vk-default.txt | 2 + 8 files changed, 242 insertions(+) create mode 100644 external/vulkancts/modules/vulkan/pipeline/vktPipelineDerivativeTests.cpp create mode 100644 external/vulkancts/modules/vulkan/pipeline/vktPipelineDerivativeTests.hpp diff --git a/AndroidGen.mk b/AndroidGen.mk index 0f15d99..ad24988 100644 --- a/AndroidGen.mk +++ b/AndroidGen.mk @@ -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 \ diff --git a/android/cts/master/vk-master.txt b/android/cts/master/vk-master.txt index 148f84e..b44eef3 100755 --- a/android/cts/master/vk-master.txt +++ b/android/cts/master/vk-master.txt @@ -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 diff --git a/external/vulkancts/modules/vulkan/pipeline/CMakeLists.txt b/external/vulkancts/modules/vulkan/pipeline/CMakeLists.txt index 45dab0d..9bd3c72 100644 --- a/external/vulkancts/modules/vulkan/pipeline/CMakeLists.txt +++ b/external/vulkancts/modules/vulkan/pipeline/CMakeLists.txt @@ -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 index 0000000..9ab5b4e --- /dev/null +++ b/external/vulkancts/modules/vulkan/pipeline/vktPipelineDerivativeTests.cpp @@ -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 +#include + +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 shaderModule = createShaderModule(vk, vkDevice, context.getBinaryCollection().get("comp"), 0); + + Move 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 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 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 shaderModule = createShaderModule(vk, vkDevice, context.getBinaryCollection().get("comp"), 0); + + Move 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 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 derivativeTests (new tcu::TestCaseGroup(testCtx, "derivative", "pipeline derivative tests")); + de::MovePtr 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 index 0000000..9d0706f --- /dev/null +++ b/external/vulkancts/modules/vulkan/pipeline/vktPipelineDerivativeTests.hpp @@ -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 diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineTests.cpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineTests.cpp index aa3587a..3bd6735 100644 --- a/external/vulkancts/modules/vulkan/pipeline/vktPipelineTests.cpp +++ b/external/vulkancts/modules/vulkan/pipeline/vktPipelineTests.cpp @@ -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 diff --git a/external/vulkancts/mustpass/1.1.2/vk-default-no-waivers.txt b/external/vulkancts/mustpass/1.1.2/vk-default-no-waivers.txt index 208c261..e8b88dc 100644 --- a/external/vulkancts/mustpass/1.1.2/vk-default-no-waivers.txt +++ b/external/vulkancts/mustpass/1.1.2/vk-default-no-waivers.txt @@ -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 diff --git a/external/vulkancts/mustpass/1.1.2/vk-default.txt b/external/vulkancts/mustpass/1.1.2/vk-default.txt index f2e67d8..61f8895 100644 --- a/external/vulkancts/mustpass/1.1.2/vk-default.txt +++ b/external/vulkancts/mustpass/1.1.2/vk-default.txt @@ -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 -- 2.7.4