From 867a8cc4c4068e84ebb593530fbddd209a514054 Mon Sep 17 00:00:00 2001 From: Jaakko Konttinen Date: Thu, 30 Jul 2020 18:02:32 -0400 Subject: [PATCH] Fix null shader module in raytracing tests The dEQP-VK.ray_tracing_pipeline.build.gpu_cpu.* tests use a shader module multiple times in two different hit groups. The variable is in Move container, so the first call to addShader() moves the module handle to the pipeline object and replaces the variable's value with a null handle. A subsequent call to addShader() then adds the null handle as a shader stage module for another hit group. I fixed it by just moving some code around to allow a second version of addShader() that accepts a shared pointer instead. Affects: dEQP-VK.ray_tracing_pipeline.build.gpu_cpu.* dEQP-VK.ray_tracing_pipeline.build.gpu_cpuht.* Components: Vulkan Change-Id: Ic2a4998e79b23cd43aaa1f6f267f60469de8f83a --- external/vulkancts/framework/vulkan/vkRayTracingUtil.cpp | 9 +++++++-- external/vulkancts/framework/vulkan/vkRayTracingUtil.hpp | 3 +++ .../modules/vulkan/ray_tracing/vktRayTracingBuildTests.cpp | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/external/vulkancts/framework/vulkan/vkRayTracingUtil.cpp b/external/vulkancts/framework/vulkan/vkRayTracingUtil.cpp index 99d9829..37ef386 100644 --- a/external/vulkancts/framework/vulkan/vkRayTracingUtil.cpp +++ b/external/vulkancts/framework/vulkan/vkRayTracingUtil.cpp @@ -2008,6 +2008,11 @@ RayTracingPipeline::~RayTracingPipeline () void RayTracingPipeline::addShader (VkShaderStageFlagBits shaderStage, Move shaderModule, deUint32 group) { + addShader(shaderStage, makeVkSharedPtr(shaderModule), group); +} + +void RayTracingPipeline::addShader (VkShaderStageFlagBits shaderStage, de::SharedPtr> shaderModule, deUint32 group) +{ if (group >= m_shadersGroupCreateInfos.size()) { for (size_t groupNdx = m_shadersGroupCreateInfos.size(); groupNdx <= group; ++groupNdx) @@ -2076,7 +2081,7 @@ void RayTracingPipeline::addShader (VkShaderStageFlagBits shaderStage, Move> pipelineLibrary) diff --git a/external/vulkancts/framework/vulkan/vkRayTracingUtil.hpp b/external/vulkancts/framework/vulkan/vkRayTracingUtil.hpp index cebb31e..6bfc8c0 100644 --- a/external/vulkancts/framework/vulkan/vkRayTracingUtil.hpp +++ b/external/vulkancts/framework/vulkan/vkRayTracingUtil.hpp @@ -526,6 +526,9 @@ public: void addShader (VkShaderStageFlagBits shaderStage, Move shaderModule, deUint32 group); + void addShader (VkShaderStageFlagBits shaderStage, + de::SharedPtr> shaderModule, + deUint32 group); void addLibrary (de::SharedPtr> pipelineLibrary); Move createPipeline (const DeviceInterface& vk, const VkDevice device, diff --git a/external/vulkancts/modules/vulkan/ray_tracing/vktRayTracingBuildTests.cpp b/external/vulkancts/modules/vulkan/ray_tracing/vktRayTracingBuildTests.cpp index be5ca47..039dac5 100644 --- a/external/vulkancts/modules/vulkan/ray_tracing/vktRayTracingBuildTests.cpp +++ b/external/vulkancts/modules/vulkan/ray_tracing/vktRayTracingBuildTests.cpp @@ -399,7 +399,7 @@ de::MovePtr RayTracingBuildTestInstance::runTest (bool useGpuB de::MovePtr rayTracingPipeline = de::newMovePtr(); Move raygenShader = createShaderModule(vkd, device, m_context.getBinaryCollection().get("rgen"), 0); - Move hitShader = createShaderModule(vkd, device, m_context.getBinaryCollection().get("ahit"), 0); + de::SharedPtr> hitShader = makeVkSharedPtr(createShaderModule(vkd, device, m_context.getBinaryCollection().get("ahit"), 0)); Move missShader = createShaderModule(vkd, device, m_context.getBinaryCollection().get("miss"), 0); Move intersectionShader = createShaderModule(vkd, device, m_context.getBinaryCollection().get("sect"), 0); rayTracingPipeline->addShader(VK_SHADER_STAGE_RAYGEN_BIT_KHR, raygenShader, 0u); -- 2.7.4