From e7e7c4ff1b8a3c6f25527c82e92f67a9a7c49481 Mon Sep 17 00:00:00 2001 From: Joe Withers Date: Wed, 15 Nov 2023 17:46:25 +0000 Subject: [PATCH 1/4] Fix for render_to_image exceeding maxResourceSize Fixes an issue seen in render_to_image tests, where image creation may fail due to exceeding the maxResourceSize for the corresponding VkImageFormatProperties. Affects: dEQP-VK.pipeline.*.render_to_image.*.huge.* Components: Vulkan VK-GL-CTS issue: 4793 Change-Id: Idb5ec9fd5bb778d437a1e96b34c5cdc423490920 --- .../vktPipelineRenderToImageTests.cpp | 289 ++++++++++++------ 1 file changed, 202 insertions(+), 87 deletions(-) diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineRenderToImageTests.cpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineRenderToImageTests.cpp index 2854a10d96..e691de6bfa 100644 --- a/external/vulkancts/modules/vulkan/pipeline/vktPipelineRenderToImageTests.cpp +++ b/external/vulkancts/modules/vulkan/pipeline/vktPipelineRenderToImageTests.cpp @@ -642,38 +642,6 @@ IVec4 getMaxImageSize (const VkImageViewType viewType, const IVec4& sizeHint) return size; } -deUint32 getMemoryTypeNdx (Context& context, const CaseDef& caseDef) -{ - const DeviceInterface& vk = context.getDeviceInterface(); - const InstanceInterface& vki = context.getInstanceInterface(); - const VkDevice device = context.getDevice(); - const VkPhysicalDevice physDevice = context.getPhysicalDevice(); - - const VkPhysicalDeviceMemoryProperties memoryProperties = getPhysicalDeviceMemoryProperties(vki, physDevice); - Move colorImage; - VkMemoryRequirements memReqs; - - const VkImageUsageFlags imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT; - const IVec4 imageSize = getMaxImageSize(caseDef.viewType, caseDef.imageSizeHint); - - //create image, don't bind any memory to it - colorImage = makeImage(vk, device, getImageCreateFlags(caseDef.viewType), getImageType(caseDef.viewType), caseDef.colorFormat, - imageSize.swizzle(0, 1, 2), 1u, imageSize.w(), imageUsage); - - vk.getImageMemoryRequirements(device, *colorImage, &memReqs); - return selectMatchingMemoryType(memoryProperties, memReqs.memoryTypeBits, MemoryRequirement::Any); -} - -VkDeviceSize getMaxDeviceHeapSize (Context& context, const CaseDef& caseDef) -{ - const InstanceInterface& vki = context.getInstanceInterface(); - const VkPhysicalDevice physDevice = context.getPhysicalDevice(); - const VkPhysicalDeviceMemoryProperties memoryProperties = getPhysicalDeviceMemoryProperties(vki, physDevice); - const deUint32 memoryTypeNdx = getMemoryTypeNdx (context, caseDef); - - return memoryProperties.memoryHeaps[memoryProperties.memoryTypes[memoryTypeNdx].heapIndex].size; -} - //! Get a smaller image size. Returns a vector of zeroes, if it can't reduce more. IVec4 getReducedImageSize (const CaseDef& caseDef, IVec4 size) { @@ -703,6 +671,41 @@ IVec4 getReducedImageSize (const CaseDef& caseDef, IVec4 size) return size; } +//! Get the image memory requirements for the image size under test, expecting potential image +//! creation failure if the required size is larger than the device's maxResourceSize, returning +//! false if creation failed. +bool getSupportedImageMemoryRequirements(Context& context, const CaseDef& caseDef, const VkFormat format, const IVec4 size, const VkImageUsageFlags usage, VkMemoryRequirements& imageMemoryRequiements) +{ + const DeviceInterface& vk = context.getDeviceInterface(); + const VkDevice device = context.getDevice(); + bool imageCreationPossible = true; + + try + { + Move image = makeImage( + vk, + device, + getImageCreateFlags(caseDef.viewType), + getImageType(caseDef.viewType), + format, + size.swizzle(0, 1, 2), + 1u, + size.w(), + usage + ); + + vk.getImageMemoryRequirements(device, *image, &imageMemoryRequiements); + } + // vkCreateImage is allowed to return VK_ERROR_OUT_OF_HOST_MEMORY if the image's + // memory requirements will exceed maxResourceSize. + catch (const vk::OutOfMemoryError& e) + { + imageCreationPossible = false; + } + + return imageCreationPossible; +} + bool isDepthStencilFormatSupported (const InstanceInterface& vki, const VkPhysicalDevice physDevice, const VkFormat format) { const VkFormatProperties properties = getPhysicalDeviceFormatProperties(vki, physDevice, format); @@ -791,72 +794,150 @@ tcu::TestStatus testWithSizeReduction (Context& context, const CaseDef& caseDef) const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex(); Allocator& allocator = context.getDefaultAllocator(); - // The memory might be too small to allocate a largest possible attachment, so try to account for that. - const bool useDepthStencil = (caseDef.depthStencilFormat != VK_FORMAT_UNDEFINED); - IVec4 imageSize = getMaxImageSize(caseDef.viewType, caseDef.imageSizeHint); - VkDeviceSize colorSize = product(imageSize) * tcu::getPixelSize(mapVkFormat(caseDef.colorFormat)); - VkDeviceSize depthStencilSize = (useDepthStencil ? product(imageSize) * tcu::getPixelSize(mapVkFormat(caseDef.depthStencilFormat)) : 0ull); - - const VkDeviceSize reserveForChecking = 500ull * 1024ull; //left 512KB - const float additionalMemory = 1.15f; //left some free memory on device (15%) - VkDeviceSize neededMemory = static_cast(static_cast(colorSize + depthStencilSize) * additionalMemory) + reserveForChecking; - VkDeviceSize maxMemory = getMaxDeviceHeapSize(context, caseDef) >> 2; - tcu::PlatformMemoryLimits memoryLimits; - context.getTestContext().getPlatform().getMemoryLimits(memoryLimits); - maxMemory = std::min(maxMemory, VkDeviceSize(memoryLimits.totalSystemMemory)); + const VkImageUsageFlags colorImageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT; + const VkImageUsageFlags depthStencilImageUsage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; + const bool useDepthStencil = (caseDef.depthStencilFormat != VK_FORMAT_UNDEFINED); - const VkDeviceSize deviceMemoryBudget = std::min(neededMemory, maxMemory); - bool allocationPossible = false; - - // Keep reducing the size, if image size is too big - while (neededMemory > deviceMemoryBudget) { - imageSize = getReducedImageSize(caseDef, imageSize); - - if (imageSize == IVec4()) - return tcu::TestStatus::fail("Couldn't create an image with required size"); + VkImageFormatProperties colorImageFormatProperties; + const auto result = vki.getPhysicalDeviceImageFormatProperties( + physDevice, + caseDef.colorFormat, + getImageType(caseDef.viewType), + VK_IMAGE_TILING_OPTIMAL, + colorImageUsage, + getImageCreateFlags(caseDef.viewType), + &colorImageFormatProperties + ); + + VK_CHECK(result); + + imageSize.x() = std::min(static_cast(imageSize.x()), colorImageFormatProperties.maxExtent.width); + imageSize.y() = std::min(static_cast(imageSize.y()), colorImageFormatProperties.maxExtent.height); + imageSize.z() = std::min(static_cast(imageSize.z()), colorImageFormatProperties.maxExtent.depth); + imageSize.w() = std::min(static_cast(imageSize.w()), colorImageFormatProperties.maxArrayLayers); + } - colorSize = product(imageSize) * tcu::getPixelSize(mapVkFormat(caseDef.colorFormat)); - depthStencilSize = (useDepthStencil ? product(imageSize) * tcu::getPixelSize(mapVkFormat(caseDef.depthStencilFormat)) : 0ull); - neededMemory = static_cast(static_cast(colorSize + depthStencilSize) * additionalMemory); + if (useDepthStencil) + { + VkImageFormatProperties depthStencilImageFormatProperties; + const auto result = vki.getPhysicalDeviceImageFormatProperties( + physDevice, + caseDef.depthStencilFormat, + getImageType(caseDef.viewType), + VK_IMAGE_TILING_OPTIMAL, + depthStencilImageUsage, + getImageCreateFlags(caseDef.viewType), + &depthStencilImageFormatProperties + ); + + VK_CHECK(result); + + imageSize.x() = std::min(static_cast(imageSize.x()), depthStencilImageFormatProperties.maxExtent.width); + imageSize.y() = std::min(static_cast(imageSize.y()), depthStencilImageFormatProperties.maxExtent.height); + imageSize.z() = std::min(static_cast(imageSize.z()), depthStencilImageFormatProperties.maxExtent.depth); + imageSize.w() = std::min(static_cast(imageSize.w()), depthStencilImageFormatProperties.maxArrayLayers); } - // Keep reducing the size, if allocation return out of any memory + bool allocationPossible = false; while (!allocationPossible) { - VkDeviceMemory object = 0; - const VkMemoryAllocateInfo allocateInfo = - { - VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, //VkStructureType sType; - DE_NULL, //const void* pNext; - neededMemory, //VkDeviceSize allocationSize; - getMemoryTypeNdx(context, caseDef) //deUint32 memoryTypeIndex; - }; + // Get the image memory requirements + VkMemoryRequirements colorImageMemReqs; + VkDeviceSize neededMemory = 0; + deUint32 memoryTypeNdx = 0; - const VkResult result = vk.allocateMemory(device, &allocateInfo, DE_NULL, &object); - - if (VK_ERROR_OUT_OF_DEVICE_MEMORY == result || VK_ERROR_OUT_OF_HOST_MEMORY == result) + if (!getSupportedImageMemoryRequirements(context, caseDef, caseDef.colorFormat, imageSize, colorImageUsage, colorImageMemReqs)) { + // Try again with reduced image size imageSize = getReducedImageSize(caseDef, imageSize); - if (imageSize == IVec4()) return tcu::TestStatus::fail("Couldn't create an image with required size"); + else + continue; + } + + neededMemory = colorImageMemReqs.size; + + if (useDepthStencil) + { + VkMemoryRequirements depthStencilImageMemReqs; + + if (!getSupportedImageMemoryRequirements(context, caseDef, caseDef.depthStencilFormat, imageSize, depthStencilImageUsage, depthStencilImageMemReqs)) + { + // Try again with reduced image size + imageSize = getReducedImageSize(caseDef, imageSize); + if (imageSize == IVec4()) + return tcu::TestStatus::fail("Couldn't create an image with required size"); + else + continue; + } - colorSize = product(imageSize) * tcu::getPixelSize(mapVkFormat(caseDef.colorFormat)); - depthStencilSize = (useDepthStencil ? product(imageSize) * tcu::getPixelSize(mapVkFormat(caseDef.depthStencilFormat)) : 0ull); - neededMemory = static_cast(static_cast(colorSize + depthStencilSize) * additionalMemory) + reserveForChecking; + neededMemory += depthStencilImageMemReqs.size; } - else if (VK_SUCCESS != result) + + // Reserve an additional 15% device memory, plus the 512KB for checking results { - return tcu::TestStatus::fail("Couldn't allocate memory"); + const VkDeviceSize reserveForChecking = 500ull * 1024ull; + const float additionalMemory = 1.15f; + neededMemory = static_cast(static_cast(neededMemory) * additionalMemory) + reserveForChecking; } - else + + // Query the available memory in the corresponding memory heap + { + const VkPhysicalDeviceMemoryProperties memoryProperties = getPhysicalDeviceMemoryProperties(vki, physDevice); + // Use the color image memory requirements, assume depth stencil uses the same memory type + memoryTypeNdx = selectMatchingMemoryType(memoryProperties, colorImageMemReqs.memoryTypeBits, MemoryRequirement::Any); + tcu::PlatformMemoryLimits memoryLimits; + context.getTestContext().getPlatform().getMemoryLimits(memoryLimits); + VkDeviceSize maxMemory = std::min( + memoryProperties.memoryHeaps[memoryProperties.memoryTypes[memoryTypeNdx].heapIndex].size, + VkDeviceSize(memoryLimits.totalSystemMemory) + ); + + if (neededMemory > maxMemory) + { + // Try again with reduced image size + imageSize = getReducedImageSize(caseDef, imageSize); + if (imageSize == IVec4()) + return tcu::TestStatus::fail("Couldn't create an image with required size"); + else + continue; + } + } + + // Attempt a memory allocation { - //free memory using Move pointer - Move memoryAllocated (check(object), Deleter(vk, device, DE_NULL)); - allocationPossible = true; + VkDeviceMemory object = 0; + const VkMemoryAllocateInfo allocateInfo = + { + VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, //VkStructureType sType; + DE_NULL, //const void* pNext; + neededMemory, //VkDeviceSize allocationSize; + memoryTypeNdx //deUint32 memoryTypeIndex; + }; + + const VkResult result = vk.allocateMemory(device, &allocateInfo, DE_NULL, &object); + + if (VK_ERROR_OUT_OF_DEVICE_MEMORY == result || VK_ERROR_OUT_OF_HOST_MEMORY == result) + { + // Try again with reduced image size + imageSize = getReducedImageSize(caseDef, imageSize); + if (imageSize == IVec4()) + return tcu::TestStatus::fail("Couldn't create an image with required size"); + } + else if (VK_SUCCESS != result) + { + return tcu::TestStatus::fail("Couldn't allocate memory"); + } + else + { + //free memory using Move pointer + Move memoryAllocated (check(object), Deleter(vk, device, DE_NULL)); + allocationPossible = true; + } } } @@ -904,20 +985,16 @@ tcu::TestStatus testWithSizeReduction (Context& context, const CaseDef& caseDef) // Create a color image { - const VkImageUsageFlags imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT; - colorImage = makeImage(vk, device, getImageCreateFlags(caseDef.viewType), getImageType(caseDef.viewType), caseDef.colorFormat, - imageSize.swizzle(0, 1, 2), 1u, imageSize.w(), imageUsage); + imageSize.swizzle(0, 1, 2), 1u, imageSize.w(), colorImageUsage); colorImageAlloc = bindImage(vki, vk, physDevice, device, *colorImage, MemoryRequirement::Any, allocator, caseDef.allocationKind); } // Create a depth/stencil image (always a 2D image, optionally layered) if (useDepthStencil) { - const VkImageUsageFlags imageUsage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; - depthStencilImage = makeImage(vk, device, (VkImageCreateFlags)0, VK_IMAGE_TYPE_2D, caseDef.depthStencilFormat, - IVec3(imageSize.x(), imageSize.y(), 1), 1u, numSlices, imageUsage); + IVec3(imageSize.x(), imageSize.y(), 1), 1u, numSlices, depthStencilImageUsage); depthStencilImageAlloc = bindImage(vki, vk, physDevice, device, *depthStencilImage, MemoryRequirement::Any, allocator, caseDef.allocationKind); } @@ -1147,13 +1224,51 @@ void checkImageViewTypeRequirements (Context& context, const VkImageViewType vie void checkSupportAttachmentSize (Context& context, const CaseDef caseDef) { + const InstanceInterface& vki = context.getInstanceInterface(); + const VkPhysicalDevice physDevice = context.getPhysicalDevice(); + checkImageViewTypeRequirements(context, caseDef.viewType); if (caseDef.allocationKind == ALLOCATION_KIND_DEDICATED) context.requireDeviceFunctionality("VK_KHR_dedicated_allocation"); - if (caseDef.depthStencilFormat != VK_FORMAT_UNDEFINED && !isDepthStencilFormatSupported(context.getInstanceInterface(), context.getPhysicalDevice(), caseDef.depthStencilFormat)) - TCU_THROW(NotSupportedError, "Unsupported depth/stencil format"); + { + VkImageFormatProperties colorImageFormatProperties; + const auto result = vki.getPhysicalDeviceImageFormatProperties( + physDevice, + caseDef.colorFormat, + getImageType(caseDef.viewType), + VK_IMAGE_TILING_OPTIMAL, + (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT), + getImageCreateFlags(caseDef.viewType), + &colorImageFormatProperties + ); + + if (result != VK_SUCCESS) + { + TCU_THROW(NotSupportedError, "Unsupported color attachment format"); + } + } + + if (caseDef.depthStencilFormat != VK_FORMAT_UNDEFINED) + { + + VkImageFormatProperties depthStencilImageFormatProperties; + const auto result = vki.getPhysicalDeviceImageFormatProperties( + physDevice, + caseDef.depthStencilFormat, + getImageType(caseDef.viewType), + VK_IMAGE_TILING_OPTIMAL, + VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, + getImageCreateFlags(caseDef.viewType), + &depthStencilImageFormatProperties + ); + + if (result != VK_SUCCESS) + { + TCU_THROW(NotSupportedError, "Unsupported depth/stencil attachment format"); + } + } checkPipelineLibraryRequirements(context.getInstanceInterface(), context.getPhysicalDevice(), caseDef.pipelineConstructionType); } From 0f22146c5907acd1b28ea112aa8f0f55b826ecce Mon Sep 17 00:00:00 2001 From: ziga-lunarg Date: Sun, 3 Dec 2023 22:19:36 +0100 Subject: [PATCH 2/4] Remove invalid graphics fuzz undefined array element test The tests is reading outside an array which is undefined behaviour Components: Vulkan VK-GL-CTS issue: 4833 Removed tests: dEQP-VK.graphicsfuzz.cov-loop-copy-previous-array-element-first-undefined Change-Id: Iec5441a44465ca77df517868a832ee5f88a90024 --- .../vk-master-2022-03-01/graphicsfuzz.txt | 1 - android/cts/main/vk-master/graphicsfuzz.txt | 1 - ...evious-array-element-first-undefined.amber | 279 ------------------ .../data/vulkan/amber/graphicsfuzz/index.txt | 1 - .../mustpass/main/vk-default/graphicsfuzz.txt | 1 - 5 files changed, 283 deletions(-) delete mode 100644 external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-loop-copy-previous-array-element-first-undefined.amber diff --git a/android/cts/main/vk-master-2022-03-01/graphicsfuzz.txt b/android/cts/main/vk-master-2022-03-01/graphicsfuzz.txt index d290b26717..1ecf89d426 100644 --- a/android/cts/main/vk-master-2022-03-01/graphicsfuzz.txt +++ b/android/cts/main/vk-master-2022-03-01/graphicsfuzz.txt @@ -187,7 +187,6 @@ dEQP-VK.graphicsfuzz.cov-loop-condition-filter-some-iterations-never-discard dEQP-VK.graphicsfuzz.cov-loop-condition-increment-integer-fallback-global-counter dEQP-VK.graphicsfuzz.cov-loop-condition-logical-or-never-iterated dEQP-VK.graphicsfuzz.cov-loop-construct-vec4-from-vec4-clamp-same-min-max -dEQP-VK.graphicsfuzz.cov-loop-copy-previous-array-element-first-undefined dEQP-VK.graphicsfuzz.cov-loop-decrease-integer-never-break dEQP-VK.graphicsfuzz.cov-loop-decrease-vector-component-only-first-iteration dEQP-VK.graphicsfuzz.cov-loop-decrease-vector-components-assign-multiple-times diff --git a/android/cts/main/vk-master/graphicsfuzz.txt b/android/cts/main/vk-master/graphicsfuzz.txt index e1f92f854d..fbfad20253 100644 --- a/android/cts/main/vk-master/graphicsfuzz.txt +++ b/android/cts/main/vk-master/graphicsfuzz.txt @@ -346,7 +346,6 @@ dEQP-VK.graphicsfuzz.cov-loop-condition-filter-some-iterations-never-discard dEQP-VK.graphicsfuzz.cov-loop-condition-increment-integer-fallback-global-counter dEQP-VK.graphicsfuzz.cov-loop-condition-logical-or-never-iterated dEQP-VK.graphicsfuzz.cov-loop-construct-vec4-from-vec4-clamp-same-min-max -dEQP-VK.graphicsfuzz.cov-loop-copy-previous-array-element-first-undefined dEQP-VK.graphicsfuzz.cov-loop-decrease-integer-never-break dEQP-VK.graphicsfuzz.cov-loop-decrease-vector-component-only-first-iteration dEQP-VK.graphicsfuzz.cov-loop-decrease-vector-components-assign-multiple-times diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-loop-copy-previous-array-element-first-undefined.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-loop-copy-previous-array-element-first-undefined.amber deleted file mode 100644 index 2f5ef79b4e..0000000000 --- a/external/vulkancts/data/vulkan/amber/graphicsfuzz/cov-loop-copy-previous-array-element-first-undefined.amber +++ /dev/null @@ -1,279 +0,0 @@ -#!amber - -# Copyright 2022 Google LLC -# -# 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. - - -# A test for a coverage-gap found by the GraphicsFuzz project. - -# Short description: A fragment shader that covers specific LLVM code paths - -# The test passes because the shader always writes red. - -SHADER vertex variant_vertex_shader PASSTHROUGH - -# variant_fragment_shader is derived from the following GLSL: -# #version 320 es -# #define _int_1 _GLF_uniform_int_values[0] -# #define _int_3 _GLF_uniform_int_values[1] -# -# precision highp float; -# precision highp int; -# -# // Contents of _GLF_uniform_int_values: [1, 3] -# layout(set = 0, binding = 0) uniform buf0 -# { -# int _GLF_uniform_int_values[2]; -# }; -# -# // Contents of zero: 0 -# layout(set = 0, binding = 1) uniform buf1 -# { -# int zero; -# }; -# -# layout(location = 0) out vec4 _GLF_color; -# -# void main() -# { -# int a = zero; -# int b = _int_1; -# -# // Iterated once. -# do -# { -# // Always false. -# if(b > _int_3) -# { -# break; -# } -# -# -# int arr[10] = int[10](_int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1, _int_1); -# -# // Makes indices 0..4 undefined as the first iteration reads outside the array -# // and other iterations copy that value. -# for(int i = 0; i < 5; i++) -# { -# arr[i] += arr[i - 1]; -# } -# -# b++; -# // Use an array element that still contains a defined value (one). -# a += arr[5]; -# } -# while(a != _int_1); -# -# if (b == 2) -# _GLF_color = vec4(1, 0, 0, 1); -# else -# _GLF_color = vec4(0); -# } -SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 -; SPIR-V -; Version: 1.0 -; Generator: Khronos Glslang Reference Front End; 10 -; Bound: 107 -; Schema: 0 - OpCapability Shader - %1 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %4 "main" %101 - OpExecutionMode %4 OriginUpperLeft - OpSource ESSL 320 - OpName %4 "main" - OpName %8 "a" - OpName %9 "buf1" - OpMemberName %9 0 "zero" - OpName %11 "" - OpName %16 "b" - OpName %20 "buf0" - OpMemberName %20 0 "_GLF_uniform_int_values" - OpName %22 "" - OpName %41 "arr" - OpName %63 "i" - OpName %101 "_GLF_color" - OpMemberDecorate %9 0 Offset 0 - OpDecorate %9 Block - OpDecorate %11 DescriptorSet 0 - OpDecorate %11 Binding 1 - OpDecorate %19 ArrayStride 16 - OpMemberDecorate %20 0 Offset 0 - OpDecorate %20 Block - OpDecorate %22 DescriptorSet 0 - OpDecorate %22 Binding 0 - OpDecorate %101 Location 0 - %2 = OpTypeVoid - %3 = OpTypeFunction %2 - %6 = OpTypeInt 32 1 - %7 = OpTypePointer Function %6 - %9 = OpTypeStruct %6 - %10 = OpTypePointer Uniform %9 - %11 = OpVariable %10 Uniform - %12 = OpConstant %6 0 - %13 = OpTypePointer Uniform %6 - %17 = OpTypeInt 32 0 - %18 = OpConstant %17 2 - %19 = OpTypeArray %6 %18 - %20 = OpTypeStruct %19 - %21 = OpTypePointer Uniform %20 - %22 = OpVariable %21 Uniform - %30 = OpConstant %6 1 - %33 = OpTypeBool - %38 = OpConstant %17 10 - %39 = OpTypeArray %6 %38 - %40 = OpTypePointer Function %39 - %70 = OpConstant %6 5 - %94 = OpConstant %6 2 - %98 = OpTypeFloat 32 - %99 = OpTypeVector %98 4 - %100 = OpTypePointer Output %99 - %101 = OpVariable %100 Output - %102 = OpConstant %98 1 - %103 = OpConstant %98 0 - %104 = OpConstantComposite %99 %102 %103 %103 %102 - %106 = OpConstantComposite %99 %103 %103 %103 %103 - %4 = OpFunction %2 None %3 - %5 = OpLabel - %8 = OpVariable %7 Function - %16 = OpVariable %7 Function - %41 = OpVariable %40 Function - %63 = OpVariable %7 Function - %14 = OpAccessChain %13 %11 %12 - %15 = OpLoad %6 %14 - OpStore %8 %15 - %23 = OpAccessChain %13 %22 %12 %12 - %24 = OpLoad %6 %23 - OpStore %16 %24 - OpBranch %25 - %25 = OpLabel - OpLoopMerge %27 %28 None - OpBranch %26 - %26 = OpLabel - %29 = OpLoad %6 %16 - %31 = OpAccessChain %13 %22 %12 %30 - %32 = OpLoad %6 %31 - %34 = OpSGreaterThan %33 %29 %32 - OpSelectionMerge %36 None - OpBranchConditional %34 %35 %36 - %35 = OpLabel - OpBranch %27 - %36 = OpLabel - %42 = OpAccessChain %13 %22 %12 %12 - %43 = OpLoad %6 %42 - %44 = OpAccessChain %13 %22 %12 %12 - %45 = OpLoad %6 %44 - %46 = OpAccessChain %13 %22 %12 %12 - %47 = OpLoad %6 %46 - %48 = OpAccessChain %13 %22 %12 %12 - %49 = OpLoad %6 %48 - %50 = OpAccessChain %13 %22 %12 %12 - %51 = OpLoad %6 %50 - %52 = OpAccessChain %13 %22 %12 %12 - %53 = OpLoad %6 %52 - %54 = OpAccessChain %13 %22 %12 %12 - %55 = OpLoad %6 %54 - %56 = OpAccessChain %13 %22 %12 %12 - %57 = OpLoad %6 %56 - %58 = OpAccessChain %13 %22 %12 %12 - %59 = OpLoad %6 %58 - %60 = OpAccessChain %13 %22 %12 %12 - %61 = OpLoad %6 %60 - %62 = OpCompositeConstruct %39 %43 %45 %47 %49 %51 %53 %55 %57 %59 %61 - OpStore %41 %62 - OpStore %63 %12 - OpBranch %64 - %64 = OpLabel - OpLoopMerge %66 %67 None - OpBranch %68 - %68 = OpLabel - %69 = OpLoad %6 %63 - %71 = OpSLessThan %33 %69 %70 - OpBranchConditional %71 %65 %66 - %65 = OpLabel - %72 = OpLoad %6 %63 - %73 = OpLoad %6 %63 - %74 = OpISub %6 %73 %30 - %75 = OpAccessChain %7 %41 %74 - %76 = OpLoad %6 %75 - %77 = OpAccessChain %7 %41 %72 - %78 = OpLoad %6 %77 - %79 = OpIAdd %6 %78 %76 - %80 = OpAccessChain %7 %41 %72 - OpStore %80 %79 - OpBranch %67 - %67 = OpLabel - %81 = OpLoad %6 %63 - %82 = OpIAdd %6 %81 %30 - OpStore %63 %82 - OpBranch %64 - %66 = OpLabel - %83 = OpLoad %6 %16 - %84 = OpIAdd %6 %83 %30 - OpStore %16 %84 - %85 = OpAccessChain %7 %41 %70 - %86 = OpLoad %6 %85 - %87 = OpLoad %6 %8 - %88 = OpIAdd %6 %87 %86 - OpStore %8 %88 - OpBranch %28 - %28 = OpLabel - %89 = OpLoad %6 %8 - %90 = OpAccessChain %13 %22 %12 %12 - %91 = OpLoad %6 %90 - %92 = OpINotEqual %33 %89 %91 - OpBranchConditional %92 %25 %27 - %27 = OpLabel - %93 = OpLoad %6 %16 - %95 = OpIEqual %33 %93 %94 - OpSelectionMerge %97 None - OpBranchConditional %95 %96 %105 - %96 = OpLabel - OpStore %101 %104 - OpBranch %97 - %105 = OpLabel - OpStore %101 %106 - OpBranch %97 - %97 = OpLabel - OpReturn - OpFunctionEnd -END - -# uniforms for variant - -# zero -BUFFER variant_zero DATA_TYPE int32 STD140 DATA - 0 -END -# _GLF_uniform_int_values -BUFFER variant__GLF_uniform_int_values DATA_TYPE int32[] STD140 DATA - 1 3 -END - -BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM - -PIPELINE graphics variant_pipeline - ATTACH variant_vertex_shader - ATTACH variant_fragment_shader - FRAMEBUFFER_SIZE 32 32 - BIND BUFFER variant_framebuffer AS color LOCATION 0 - BIND BUFFER variant_zero AS uniform DESCRIPTOR_SET 0 BINDING 1 - BIND BUFFER variant__GLF_uniform_int_values AS uniform DESCRIPTOR_SET 0 BINDING 0 -END -CLEAR_COLOR variant_pipeline 0 0 0 255 - -CLEAR variant_pipeline -RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 32 32 - -EXPECT variant_framebuffer IDX 0 0 SIZE 32 32 EQ_RGBA 255 0 0 255 diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/index.txt b/external/vulkancts/data/vulkan/amber/graphicsfuzz/index.txt index 09699f2da9..a96562f413 100644 --- a/external/vulkancts/data/vulkan/amber/graphicsfuzz/index.txt +++ b/external/vulkancts/data/vulkan/amber/graphicsfuzz/index.txt @@ -347,7 +347,6 @@ { "cov-loop-condition-logical-or-never-iterated.amber", "cov-loop-condition-logical-or-never-iterated", "A fragment shader that covers specific LLVM code paths" }, { "cov-loop-decrease-integer-never-break.amber", "cov-loop-decrease-integer-never-break", "A fragment shader that covers specific LLVM code paths" }, { "cov-loop-construct-vec4-from-vec4-clamp-same-min-max.amber", "cov-loop-construct-vec4-from-vec4-clamp-same-min-max", "A fragment shader that covers specific LLVM code paths" }, -{ "cov-loop-copy-previous-array-element-first-undefined.amber", "cov-loop-copy-previous-array-element-first-undefined", "A fragment shader that covers specific LLVM code paths" }, { "cov-loop-decrease-vector-components-assign-multiple-times.amber", "cov-loop-decrease-vector-components-assign-multiple-times", "A fragment shader that covers specific LLVM code paths" }, { "cov-loop-decrease-vector-component-only-first-iteration.amber", "cov-loop-decrease-vector-component-only-first-iteration", "A fragment shader that covers specific LLVM code paths" }, { "cov-loop-dfdx-constant-divide.amber", "cov-loop-dfdx-constant-divide", "A fragment shader that covers specific patch optimization code paths" }, diff --git a/external/vulkancts/mustpass/main/vk-default/graphicsfuzz.txt b/external/vulkancts/mustpass/main/vk-default/graphicsfuzz.txt index e1f92f854d..fbfad20253 100644 --- a/external/vulkancts/mustpass/main/vk-default/graphicsfuzz.txt +++ b/external/vulkancts/mustpass/main/vk-default/graphicsfuzz.txt @@ -346,7 +346,6 @@ dEQP-VK.graphicsfuzz.cov-loop-condition-filter-some-iterations-never-discard dEQP-VK.graphicsfuzz.cov-loop-condition-increment-integer-fallback-global-counter dEQP-VK.graphicsfuzz.cov-loop-condition-logical-or-never-iterated dEQP-VK.graphicsfuzz.cov-loop-construct-vec4-from-vec4-clamp-same-min-max -dEQP-VK.graphicsfuzz.cov-loop-copy-previous-array-element-first-undefined dEQP-VK.graphicsfuzz.cov-loop-decrease-integer-never-break dEQP-VK.graphicsfuzz.cov-loop-decrease-vector-component-only-first-iteration dEQP-VK.graphicsfuzz.cov-loop-decrease-vector-components-assign-multiple-times From f77544356315bc2fcfc7fe37b3c8c577daba2d45 Mon Sep 17 00:00:00 2001 From: Amber Date: Thu, 7 Dec 2023 10:46:39 +0100 Subject: [PATCH 3/4] Use vertex output in provoking vertex tests This allows the tests to catch issues in triangle strip provoking vertex mode. Components: Vulkan VK-GL-CTS issue: 4579 Affected tests: dEQP-VK.rasterization.provoking_vertex.transform_feedback.* Change-Id: I8e108eecf37acce6e54e2aa125365ad7bbad828a --- .../vktRasterizationProvokingVertexTests.cpp | 75 ++++++++++++++++--- 1 file changed, 66 insertions(+), 9 deletions(-) diff --git a/external/vulkancts/modules/vulkan/rasterization/vktRasterizationProvokingVertexTests.cpp b/external/vulkancts/modules/vulkan/rasterization/vktRasterizationProvokingVertexTests.cpp index a518cdd1b1..ba70fdc7eb 100644 --- a/external/vulkancts/modules/vulkan/rasterization/vktRasterizationProvokingVertexTests.cpp +++ b/external/vulkancts/modules/vulkan/rasterization/vktRasterizationProvokingVertexTests.cpp @@ -24,6 +24,8 @@ #include "vktRasterizationProvokingVertexTests.hpp" +#include "deDefs.h" +#include "deStringUtil.hpp" #include "vkBarrierUtil.hpp" #include "vkCmdUtil.hpp" #include "vkImageUtil.hpp" @@ -90,6 +92,8 @@ static VkDeviceSize getXfbBufferSize (deUint32 vertexCount, VkPrimitiveTopology } static bool verifyXfbBuffer (const tcu::Vec4* const xfbResults, + const std::vector& vertices, + const std::vector& provoking, deUint32 count, VkPrimitiveTopology topology, ProvokingVertexMode mode, @@ -102,23 +106,28 @@ static bool verifyXfbBuffer (const tcu::Vec4* const xfbResults, ? 2 : 3; - const tcu::Vec4 expected (1.0f, 0.0f, 0.0f, 1.0f); const deUint32 start = (mode == PROVOKING_VERTEX_LAST) ? primitiveSize - 1 : 0; + const uint32_t provStart = (mode == PROVOKING_VERTEX_LAST) ? + ((topology == VK_PRIMITIVE_TOPOLOGY_LINE_LIST) || + (topology == VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST) || + (topology == VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY) || + (topology == VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY)) ? 2 : 3 : 0; DE_ASSERT(count % primitiveSize == 0); + uint32_t i = 0; for (deUint32 ndx = start; ndx < count; ndx += primitiveSize) { - if (xfbResults[ndx] != expected) + if (xfbResults[ndx] != vertices[provoking[i + provStart]]) { errorMessage = "Vertex " + de::toString(ndx) + - ": Expected red, got " + de::toString(xfbResults[ndx]); + ": Expected " + de::toString(vertices[provoking[i + start]]) + ", got " + de::toString(xfbResults[ndx]); return false; } + i++; } - errorMessage = ""; return true; } @@ -178,7 +187,7 @@ void ProvokingVertexTestCase::initPrograms (SourceCollections& programCollection << "{\n"; if (m_params.transformFeedback) - vertShader << " out_xfb = in_color;\n"; + vertShader << " out_xfb = in_position;\n"; vertShader << " out_color = in_color;\n" << " gl_Position = in_position;\n" @@ -468,6 +477,8 @@ tcu::TestStatus ProvokingVertexTestInstance::iterate (void) } } + std::vector vertices; + std::vector provoking; // Vertex buffer { const tcu::Vec4 red (1.0f, 0.0f, 0.0f, 1.0f); @@ -476,123 +487,161 @@ tcu::TestStatus ProvokingVertexTestInstance::iterate (void) const tcu::Vec4 yellow (1.0f, 1.0f, 0.0f, 1.0f); const tcu::Vec4 white (1.0f, 1.0f, 1.0f, 1.0f); - std::vector vertices; switch (m_params.primitiveTopology) { case VK_PRIMITIVE_TOPOLOGY_LINE_LIST: // Position //Color vertices.push_back(tcu::Vec4(-1.0f,-0.5f, 0.0f, 1.0f)); vertices.push_back(red); // line 0 + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 1.0f,-0.5f, 0.0f, 1.0f)); vertices.push_back(blue); vertices.push_back(tcu::Vec4(-1.0f, 0.5f, 0.0f, 1.0f)); vertices.push_back(red); // line 1 + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 1.0f, 0.5f, 0.0f, 1.0f)); vertices.push_back(blue); vertices.push_back(tcu::Vec4(-0.5f,-1.0f, 0.0f, 1.0f)); vertices.push_back(blue); // line 1 reverse vertices.push_back(tcu::Vec4(-0.5f, 1.0f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 0.5f,-1.0f, 0.0f, 1.0f)); vertices.push_back(blue); // line 0 reverse vertices.push_back(tcu::Vec4( 0.5f, 1.0f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); break; case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP: // Position // Color vertices.push_back(tcu::Vec4(-1.0f,-0.5f, 0.0f, 1.0f)); vertices.push_back(red); // line strip + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 1.0f,-0.5f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4(-1.0f, 0.5f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 1.0f, 0.5f, 0.0f, 1.0f)); vertices.push_back(green); vertices.push_back(tcu::Vec4(-0.5f,-1.0f, 0.0f, 1.0f)); vertices.push_back(green); // line strip reverse vertices.push_back(tcu::Vec4(-0.5f, 1.0f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 0.5f,-1.0f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 0.5f, 1.0f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); break; case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST: // Position // Color vertices.push_back(tcu::Vec4( 1.0f, 1.0f, 0.0f, 1.0f)); vertices.push_back(red); // triangle 0 + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4(-0.6f,-1.0f, 0.0f, 1.0f)); vertices.push_back(green); vertices.push_back(tcu::Vec4(-0.2f, 1.0f, 0.0f, 1.0f)); vertices.push_back(blue); vertices.push_back(tcu::Vec4( 0.2f, 1.0f, 0.0f, 1.0f)); vertices.push_back(red); // triangle 1 + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 0.6f,-1.0f, 0.0f, 1.0f)); vertices.push_back(green); vertices.push_back(tcu::Vec4( 1.0f, 1.0f, 0.0f, 1.0f)); vertices.push_back(blue); vertices.push_back(tcu::Vec4(-1.0f,-1.0f, 0.0f, 1.0f)); vertices.push_back(blue); // triangle 1 reverse vertices.push_back(tcu::Vec4(-0.6f, 1.0f, 0.0f, 1.0f)); vertices.push_back(green); vertices.push_back(tcu::Vec4(-0.2f,-1.0f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 0.2f,-1.0f, 0.0f, 1.0f)); vertices.push_back(blue); // triangle 0 reverse vertices.push_back(tcu::Vec4( 0.6f, 1.0f, 0.0f, 1.0f)); vertices.push_back(green); vertices.push_back(tcu::Vec4(-1.0f,-1.0f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); break; case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP: // Position // Color vertices.push_back(tcu::Vec4(-1.0f, 1.0f, 0.0f, 1.0f)); vertices.push_back(red); // triangle strip + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4(-0.5f,-1.0f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 0.0f, 1.0f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 0.5f,-1.0f, 0.0f, 1.0f)); vertices.push_back(green); vertices.push_back(tcu::Vec4( 1.0f, 1.0f, 0.0f, 1.0f)); vertices.push_back(blue); vertices.push_back(tcu::Vec4(-1.0f,-1.0f, 0.0f, 1.0f)); vertices.push_back(blue); // triangle strip reverse vertices.push_back(tcu::Vec4(-0.5f, 1.0f, 0.0f, 1.0f)); vertices.push_back(green); vertices.push_back(tcu::Vec4( 0.0f,-1.0f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 0.5f, 1.0f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 1.0f,-1.0f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); + break; case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN: // Position // Color vertices.push_back(tcu::Vec4( 0.0f, 1.0f, 0.0f, 1.0f)); vertices.push_back(green); // triangle fan vertices.push_back(tcu::Vec4(-1.0f, 1.0f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4(-0.5f,-1.0f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 0.5f,-1.0f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 1.0f, 1.0f, 0.0f, 1.0f)); vertices.push_back(blue); vertices.push_back(tcu::Vec4( 0.0f,-1.0f, 0.0f, 1.0f)); vertices.push_back(green); // triangle fan reverse vertices.push_back(tcu::Vec4(-1.0f,-1.0f, 0.0f, 1.0f)); vertices.push_back(blue); vertices.push_back(tcu::Vec4(-0.5f, 1.0f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 0.5f, 1.0f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 1.0f,-1.0f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); break; case VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY: // Position // Color vertices.push_back(tcu::Vec4(-1.0f,-0.5f, 0.0f, 1.0f)); vertices.push_back(green); // line 0 vertices.push_back(tcu::Vec4(-0.5f,-0.5f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 0.5f,-0.5f, 0.0f, 1.0f)); vertices.push_back(blue); vertices.push_back(tcu::Vec4( 1.0f,-0.5f, 0.0f, 1.0f)); vertices.push_back(yellow); vertices.push_back(tcu::Vec4(-1.0f, 0.5f, 0.0f, 1.0f)); vertices.push_back(green); // line 1 vertices.push_back(tcu::Vec4(-0.5f, 0.5f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 0.5f, 0.5f, 0.0f, 1.0f)); vertices.push_back(blue); vertices.push_back(tcu::Vec4( 1.0f, 0.5f, 0.0f, 1.0f)); vertices.push_back(yellow); vertices.push_back(tcu::Vec4(-0.5f,-1.0f, 0.0f, 1.0f)); vertices.push_back(yellow); // line 1 reverse vertices.push_back(tcu::Vec4(-0.5f,-0.5f, 0.0f, 1.0f)); vertices.push_back(blue); vertices.push_back(tcu::Vec4(-0.5f, 0.5f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4(-0.5f, 1.0f, 0.0f, 1.0f)); vertices.push_back(green); vertices.push_back(tcu::Vec4( 0.5f,-1.0f, 0.0f, 1.0f)); vertices.push_back(yellow); // line 0 reverse vertices.push_back(tcu::Vec4( 0.5f,-0.5f, 0.0f, 1.0f)); vertices.push_back(blue); vertices.push_back(tcu::Vec4( 0.5f, 0.5f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 0.5f, 1.0f, 0.0f, 1.0f)); vertices.push_back(green); break; case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY: // Position // Color vertices.push_back(tcu::Vec4(-1.0f,-0.5f, 0.0f, 1.0f)); vertices.push_back(green); // line strip vertices.push_back(tcu::Vec4(-0.5f,-0.5f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 0.5f,-0.5f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4(-0.5f, 0.5f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 0.5f, 0.5f, 0.0f, 1.0f)); vertices.push_back(blue); vertices.push_back(tcu::Vec4( 1.0f, 0.5f, 0.0f, 1.0f)); vertices.push_back(yellow); vertices.push_back(tcu::Vec4(-0.5f,-1.0f, 0.0f, 1.0f)); vertices.push_back(yellow); // line strip reverse vertices.push_back(tcu::Vec4(-0.5f,-0.5f, 0.0f, 1.0f)); vertices.push_back(blue); vertices.push_back(tcu::Vec4(-0.5f, 0.5f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 0.5f,-0.5f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 0.5f, 0.5f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 0.5f, 1.0f, 0.0f, 1.0f)); vertices.push_back(green); break; case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY: // Position // Color vertices.push_back(tcu::Vec4(-1.0f, 1.0f, 0.0f, 1.0f)); vertices.push_back(red); // triangle 0 + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 0.0f, 0.0f, 0.0f, 1.0f)); vertices.push_back(white); vertices.push_back(tcu::Vec4(-0.6f,-1.0f, 0.0f, 1.0f)); vertices.push_back(green); vertices.push_back(tcu::Vec4( 0.0f, 0.0f, 0.0f, 1.0f)); vertices.push_back(white); vertices.push_back(tcu::Vec4(-0.2f, 1.0f, 0.0f, 1.0f)); vertices.push_back(blue); vertices.push_back(tcu::Vec4( 0.0f, 0.0f, 0.0f, 1.0f)); vertices.push_back(white); vertices.push_back(tcu::Vec4( 0.2f, 1.0f, 0.0f, 1.0f)); vertices.push_back(red); // triangle 1 + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 0.0f, 0.0f, 0.0f, 1.0f)); vertices.push_back(white); vertices.push_back(tcu::Vec4( 0.6f,-1.0f, 0.0f, 1.0f)); vertices.push_back(green); vertices.push_back(tcu::Vec4( 0.0f, 0.0f, 0.0f, 1.0f)); vertices.push_back(white); @@ -604,21 +653,26 @@ tcu::TestStatus ProvokingVertexTestInstance::iterate (void) vertices.push_back(tcu::Vec4(-0.6f, 1.0f, 0.0f, 1.0f)); vertices.push_back(green); vertices.push_back(tcu::Vec4( 0.0f, 0.0f, 0.0f, 1.0f)); vertices.push_back(white); vertices.push_back(tcu::Vec4(-0.2f,-1.0f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 0.0f, 0.0f, 0.0f, 1.0f)); vertices.push_back(white); vertices.push_back(tcu::Vec4( 0.2f,-1.0f, 0.0f, 1.0f)); vertices.push_back(blue); // triangle 0 reverse vertices.push_back(tcu::Vec4( 0.0f, 0.0f, 0.0f, 1.0f)); vertices.push_back(white); vertices.push_back(tcu::Vec4( 0.6f, 1.0f, 0.0f, 1.0f)); vertices.push_back(green); vertices.push_back(tcu::Vec4( 0.0f, 0.0f, 0.0f, 1.0f)); vertices.push_back(white); vertices.push_back(tcu::Vec4( 1.0f,-1.0f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 0.0f, 0.0f, 0.0f, 1.0f)); vertices.push_back(white); break; case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY: // Position // Color vertices.push_back(tcu::Vec4(-1.0f, 1.0f, 0.0f, 1.0f)); vertices.push_back(red); // triangle strip + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 0.0f, 0.0f, 0.0f, 1.0f)); vertices.push_back(white); vertices.push_back(tcu::Vec4(-0.5f,-1.0f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 0.0f, 0.0f, 0.0f, 1.0f)); vertices.push_back(white); vertices.push_back(tcu::Vec4( 0.0f, 1.0f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 0.0f, 0.0f, 0.0f, 1.0f)); vertices.push_back(white); vertices.push_back(tcu::Vec4( 0.5f,-1.0f, 0.0f, 1.0f)); vertices.push_back(green); vertices.push_back(tcu::Vec4( 0.0f, 0.0f, 0.0f, 1.0f)); vertices.push_back(white); @@ -630,10 +684,13 @@ tcu::TestStatus ProvokingVertexTestInstance::iterate (void) vertices.push_back(tcu::Vec4(-0.5f, 1.0f, 0.0f, 1.0f)); vertices.push_back(green); vertices.push_back(tcu::Vec4( 0.0f, 0.0f, 0.0f, 1.0f)); vertices.push_back(white); vertices.push_back(tcu::Vec4( 0.0f,-1.0f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 0.0f, 0.0f, 0.0f, 1.0f)); vertices.push_back(white); vertices.push_back(tcu::Vec4( 0.5f, 1.0f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 0.0f, 0.0f, 0.0f, 1.0f)); vertices.push_back(white); vertices.push_back(tcu::Vec4( 1.0f,-1.0f, 0.0f, 1.0f)); vertices.push_back(red); + provoking.push_back(vertices.size() - 2); vertices.push_back(tcu::Vec4( 0.0f, 0.0f, 0.0f, 1.0f)); vertices.push_back(white); break; default: @@ -808,17 +865,17 @@ tcu::TestStatus ProvokingVertexTestInstance::iterate (void) if (m_params.provokingVertexMode != PROVOKING_VERTEX_PER_PIPELINE) { - if (!verifyXfbBuffer(xfbResults, count, m_params.primitiveTopology, m_params.provokingVertexMode, errorMessage)) + if (!verifyXfbBuffer(xfbResults, vertices, provoking, count, m_params.primitiveTopology, m_params.provokingVertexMode, errorMessage)) return tcu::TestStatus::fail(errorMessage); } else { const deUint32 halfCount = count / 2; - if (!verifyXfbBuffer(xfbResults, halfCount, m_params.primitiveTopology, PROVOKING_VERTEX_FIRST, errorMessage)) + if (!verifyXfbBuffer(xfbResults, vertices, provoking, halfCount, m_params.primitiveTopology, PROVOKING_VERTEX_FIRST, errorMessage)) return tcu::TestStatus::fail(errorMessage); - if (!verifyXfbBuffer(&xfbResults[halfCount], halfCount, m_params.primitiveTopology, PROVOKING_VERTEX_LAST, errorMessage)) + if (!verifyXfbBuffer(&xfbResults[halfCount], vertices, provoking, halfCount, m_params.primitiveTopology, PROVOKING_VERTEX_LAST, errorMessage)) return tcu::TestStatus::fail(errorMessage); } } From 628a1fbee4dfa65b4587895e9925e9f624f2cc7d Mon Sep 17 00:00:00 2001 From: Trevor David Black Date: Tue, 5 Dec 2023 19:32:17 +0000 Subject: [PATCH 4/4] Add user_type extension to no_unknown_extensions The android.no_unknown_extensions helps to make sure the device doesn't expose any unknown extensions. We have a device (cuttlefish) that exposes VK_GOOGLE_user_type and is causing problems. Affects: dEQP-VK.api.info.android.no_unknown_extensions Components: Vulkan, AOSP Google bug: 304204466 VK-GL-CTS issue: 4838 Change-Id: I91411b58fcd705c489cb6d447496ab2124c651bc --- external/vulkancts/modules/vulkan/api/vktApiFeatureInfo.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/external/vulkancts/modules/vulkan/api/vktApiFeatureInfo.cpp b/external/vulkancts/modules/vulkan/api/vktApiFeatureInfo.cpp index c4184a39e8..bede74e3d5 100644 --- a/external/vulkancts/modules/vulkan/api/vktApiFeatureInfo.cpp +++ b/external/vulkancts/modules/vulkan/api/vktApiFeatureInfo.cpp @@ -6750,6 +6750,7 @@ tcu::TestStatus testNoUnknownExtensions (Context& context) allowedDeviceExtensions.insert("VK_GOOGLE_display_timing"); allowedDeviceExtensions.insert("VK_GOOGLE_decorate_string"); allowedDeviceExtensions.insert("VK_GOOGLE_hlsl_functionality1"); + allowedDeviceExtensions.insert("VK_GOOGLE_user_type"); allowedInstanceExtensions.insert("VK_GOOGLE_surfaceless_query"); // Instance extensions