From 6304730e39bf2b9ae19d415aa4e34888b0cf7e20 Mon Sep 17 00:00:00 2001 From: Ricardo Garcia Date: Fri, 13 Jan 2023 12:20:12 +0100 Subject: [PATCH] Fix vertex and primitive count in mesh shader query tests They were using fixed constants instead of taking into account the image width and the type of primitive. In addition, the commit fixes invalid usage of gl_DrawID from the mesh shader when task shaders were present. Affects: dEQP-VK.mesh_shader.ext.query.* Components: Vulkan VK-GL-CTS issue: 2991 Change-Id: Iac2b848e801219748bcf52cb443f5bad757abd5f --- .../mesh_shader/vktMeshShaderQueryTestsEXT.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/external/vulkancts/modules/vulkan/mesh_shader/vktMeshShaderQueryTestsEXT.cpp b/external/vulkancts/modules/vulkan/mesh_shader/vktMeshShaderQueryTestsEXT.cpp index 7c54e93..2392c06 100644 --- a/external/vulkancts/modules/vulkan/mesh_shader/vktMeshShaderQueryTestsEXT.cpp +++ b/external/vulkancts/modules/vulkan/mesh_shader/vktMeshShaderQueryTestsEXT.cpp @@ -380,6 +380,7 @@ void MeshQueryCase::initPrograms (vk::SourceCollections &programCollection) cons const std::string taskDataDecl = "struct TaskData {\n" " uint branch[" + std::to_string(kTaskLocalInvocations) + "];\n" + " uint drawIndex;\n" "};\n" "taskPayloadSharedEXT TaskData td;\n" ; @@ -429,12 +430,12 @@ void MeshQueryCase::initPrograms (vk::SourceCollections &programCollection) cons << " const float horDelta = pixWidth / 4.0;\n" << " const float verDelta = pixHeight / 4.0;\n" << "\n" - << " const uint DrawIndex = uint(gl_DrawID);\n" + << " const uint DrawIndex = " << (m_params.useTaskShader ? "td.drawIndex" : "uint(gl_DrawID)") << ";\n" << " const uint currentWGIndex = (" << (m_params.useTaskShader ? "2u * td.branch[min(gl_LocalInvocationIndex, " + std::to_string(kTaskLocalInvocations - 1u) + ")] + " : "") << "gl_WorkGroupID.x + gl_WorkGroupID.y + gl_WorkGroupID.z);\n" << " const uint row = (pc.prevDrawCalls + DrawIndex) * rowsPerDraw + currentWGIndex;\n" << " const uint vertsPerPrimitive = " << vertsPerPrimitive(m_params.geometry) << ";\n" << "\n" - << " SetMeshOutputsEXT(32u, 32u);\n" + << " SetMeshOutputsEXT(colCount * vertsPerPrimitive, colCount);\n" << "\n" << " const uint col = atomicAdd(currentCol, 1);\n" << " if (col < colCount)\n" @@ -501,6 +502,7 @@ void MeshQueryCase::initPrograms (vk::SourceCollections &programCollection) cons << "void main ()\n" << "{\n" << " td.branch[gl_LocalInvocationIndex] = gl_WorkGroupID.x + gl_WorkGroupID.y + gl_WorkGroupID.z;\n" + << " td.drawIndex = uint(gl_DrawID);\n" << " EmitMeshTasksEXT(" << meshTaskCount.at(0) << ", " << meshTaskCount.at(1) << ", " << meshTaskCount.at(2) << ");\n" << "}\n" ; @@ -755,12 +757,9 @@ void verifyQueryCounter (uint64_t readVal, uint64_t expectedMinVal, uint64_t exp if (!wasReset) { - if (!params.waitBit || wasReset) + if (!params.waitBit) minVal = 0ull; - if (wasReset) - maxVal = 0ull; - if (!de::inRange(readVal, minVal, maxVal)) { std::ostringstream msg; @@ -842,14 +841,15 @@ tcu::TestStatus MeshQueryInstance::iterate (void) const auto colorFormat = VK_FORMAT_R8G8B8A8_UNORM; const auto colorTcuFormat = mapVkFormat(colorFormat); - const auto colorExtent = makeExtent3D(kImageWidth, std::max(m_params->getImageHeight(), 1u), 1u); + const auto imageHeight = m_params->getImageHeight(); + const auto colorExtent = makeExtent3D(kImageWidth, std::max(imageHeight, 1u), 1u); const auto viewCount = m_params->getViewCount(); const tcu::IVec3 colorTcuExtent (static_cast(colorExtent.width), static_cast(colorExtent.height), static_cast(viewCount)); const auto colorUsage = (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT); const tcu::Vec4 clearColor (0.0f, 0.0f, 0.0f, 1.0f); - const auto expectedPrims = (m_params->getImageHeight() * kImageWidth); - const auto expectedTaskInv = (m_params->useTaskShader ? (m_params->getImageHeight() * kTaskLocalInvocations / 2u) : 0u); - const auto expectedMeshInv = m_params->getImageHeight() * kMeshLocalInvocations; + const auto expectedPrims = (imageHeight * kImageWidth); + const auto expectedTaskInv = (m_params->useTaskShader ? (imageHeight * kTaskLocalInvocations / 2u) : 0u); + const auto expectedMeshInv = imageHeight * kMeshLocalInvocations; const auto imageViewType = ((viewCount > 1u) ? VK_IMAGE_VIEW_TYPE_2D_ARRAY : VK_IMAGE_VIEW_TYPE_2D); // Color buffer. -- 2.7.4