From c5cc2dee2595300da421e9d08157ed81a2022db9 Mon Sep 17 00:00:00 2001 From: Greg Daniel Date: Mon, 20 Mar 2017 11:40:58 -0400 Subject: [PATCH] Set maxVertexAttrib limit for Vulkan BUG=skia:6396 Change-Id: If31507816ca9978a64d3bd25b282b373d292e7aa Reviewed-on: https://skia-review.googlesource.com/9856 Commit-Queue: Greg Daniel Reviewed-by: Brian Salomon --- infra/bots/recipe_modules/sktest/api.py | 1 - ...0-MSVC-AlphaR2-GPU-RadeonR9M470X-x86_64-Debug-Vulkan.json | 1 - src/gpu/vk/GrVkCaps.cpp | 12 +++++++++++- src/gpu/vk/GrVkCaps.h | 5 +++-- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/infra/bots/recipe_modules/sktest/api.py b/infra/bots/recipe_modules/sktest/api.py index e6a11a8..e2ebbf6 100644 --- a/infra/bots/recipe_modules/sktest/api.py +++ b/infra/bots/recipe_modules/sktest/api.py @@ -392,7 +392,6 @@ def dm_flags(bot): if 'Vulkan' in bot and 'RadeonR9M470X' in bot and 'Win' in bot: # skia:6396 - match.append('~VertexAttributeCount') match.append('~ComposedImageFilterBounds_Gpu') match.append('~CopySurface') match.append('~ImageFilterZeroBlurSigma_Gpu') diff --git a/infra/bots/recipe_modules/sktest/example.expected/Test-Win10-MSVC-AlphaR2-GPU-RadeonR9M470X-x86_64-Debug-Vulkan.json b/infra/bots/recipe_modules/sktest/example.expected/Test-Win10-MSVC-AlphaR2-GPU-RadeonR9M470X-x86_64-Debug-Vulkan.json index f080e22..42a0173 100644 --- a/infra/bots/recipe_modules/sktest/example.expected/Test-Win10-MSVC-AlphaR2-GPU-RadeonR9M470X-x86_64-Debug-Vulkan.json +++ b/infra/bots/recipe_modules/sktest/example.expected/Test-Win10-MSVC-AlphaR2-GPU-RadeonR9M470X-x86_64-Debug-Vulkan.json @@ -370,7 +370,6 @@ "_", ".SRW", "--match", - "~VertexAttributeCount", "~ComposedImageFilterBounds_Gpu", "~CopySurface", "~ImageFilterZeroBlurSigma_Gpu", diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp index 16a91c1..d185b17 100644 --- a/src/gpu/vk/GrVkCaps.cpp +++ b/src/gpu/vk/GrVkCaps.cpp @@ -145,7 +145,17 @@ void GrVkCaps::initSampleCount(const VkPhysicalDeviceProperties& properties) { void GrVkCaps::initGrCaps(const VkPhysicalDeviceProperties& properties, const VkPhysicalDeviceMemoryProperties& memoryProperties, uint32_t featureFlags) { - fMaxVertexAttributes = SkTMin(properties.limits.maxVertexInputAttributes, (uint32_t)INT_MAX); + // So GPUs, like AMD, are reporting MAX_INT support vertex attributes. In general, there is no + // need for us ever to support that amount, and it makes tests which tests all the vertex + // attribs timeout looping over that many. For now, we'll cap this at 64 max and can raise it if + // we ever find that need. + static const uint32_t kMaxVertexAttributes = 64; + fMaxVertexAttributes = SkTMin(properties.limits.maxVertexInputAttributes, kMaxVertexAttributes); + // AMD advertises support for MAX_UINT vertex input attributes, but in reality only supports 32. + if (kAMD_VkVendor == properties.vendorID) { + fMaxVertexAttributes = SkTMin(fMaxVertexAttributes, 32); + } + // We could actually query and get a max size for each config, however maxImageDimension2D will // give the minimum max size across all configs. So for simplicity we will use that for now. fMaxRenderTargetSize = SkTMin(properties.limits.maxImageDimension2D, (uint32_t)INT_MAX); diff --git a/src/gpu/vk/GrVkCaps.h b/src/gpu/vk/GrVkCaps.h index 6ef0796..e04bc16 100644 --- a/src/gpu/vk/GrVkCaps.h +++ b/src/gpu/vk/GrVkCaps.h @@ -91,9 +91,10 @@ public: private: enum VkVendor { - kQualcomm_VkVendor = 20803, - kNvidia_VkVendor = 4318, + kAMD_VkVendor = 4098, kImagination_VkVendor = 4112, + kNvidia_VkVendor = 4318, + kQualcomm_VkVendor = 20803, }; void init(const GrContextOptions& contextOptions, const GrVkInterface* vkInterface, -- 2.7.4