From be7084466521cb1b09e4d3bf39f5014e9e73d176 Mon Sep 17 00:00:00 2001 From: Shahbaz Youssefi Date: Mon, 25 Jul 2022 15:24:52 -0400 Subject: [PATCH] Vulkan: Remove the bindEmptyForUnusedDescriptorSets workaround Only applied to older Qualcomm-based phones. Bug: angleproject:2727 Change-Id: I37a611e2ff79d898eff9401467407543f3c690b8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3785290 Reviewed-by: Charlie Lao Auto-Submit: Shahbaz Youssefi Reviewed-by: Yuxin Hu Commit-Queue: Yuxin Hu --- include/platform/FeaturesVk_autogen.h | 5 ----- include/platform/vk_features.json | 8 -------- .../ANGLE_features.json | 8 ++++---- .../renderer/vulkan/ProgramExecutableVk.cpp | 20 ++----------------- .../renderer/vulkan/ProgramExecutableVk.h | 1 - src/libANGLE/renderer/vulkan/RendererVk.cpp | 3 --- src/libANGLE/renderer/vulkan/vk_helpers.cpp | 18 ----------------- util/angle_features_autogen.cpp | 1 - util/angle_features_autogen.h | 1 - 9 files changed, 6 insertions(+), 59 deletions(-) diff --git a/include/platform/FeaturesVk_autogen.h b/include/platform/FeaturesVk_autogen.h index 1f76a16a5..f467af338 100644 --- a/include/platform/FeaturesVk_autogen.h +++ b/include/platform/FeaturesVk_autogen.h @@ -221,11 +221,6 @@ struct FeaturesVk : FeatureSetBase "disableFifoPresentMode", FeatureCategory::VulkanWorkarounds, "VK_PRESENT_MODE_FIFO_KHR causes random timeouts", &members, "http://anglebug.com/3153"}; - FeatureInfo bindEmptyForUnusedDescriptorSets = { - "bindEmptyForUnusedDescriptorSets", FeatureCategory::VulkanWorkarounds, - "Gaps in bound descriptor set indices causes the post-gap sets to misbehave", &members, - "http://anglebug.com/2727"}; - FeatureInfo forceD16TexFilter = { "forceD16TexFilter", FeatureCategory::VulkanWorkarounds, "VK_FORMAT_D16_UNORM does not support VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT, " diff --git a/include/platform/vk_features.json b/include/platform/vk_features.json index b6ea639f4..682cf403e 100644 --- a/include/platform/vk_features.json +++ b/include/platform/vk_features.json @@ -264,14 +264,6 @@ ], "issue": "http://anglebug.com/3153" }, - { - "name": "bind_empty_for_unused_descriptor_sets", - "category": "Workarounds", - "description": [ - "Gaps in bound descriptor set indices causes the post-gap sets to misbehave" - ], - "issue": "http://anglebug.com/2727" - }, { "name": "force_D16_tex_filter", "category": "Workarounds", diff --git a/scripts/code_generation_hashes/ANGLE_features.json b/scripts/code_generation_hashes/ANGLE_features.json index 2dd66b3db..3e433206f 100644 --- a/scripts/code_generation_hashes/ANGLE_features.json +++ b/scripts/code_generation_hashes/ANGLE_features.json @@ -6,7 +6,7 @@ "include/platform/FeaturesMtl_autogen.h": "6b6d49c35bc9246361f8dac0a5445a02", "include/platform/FeaturesVk_autogen.h": - "98df364d7ba96f4aaa6c5f6940492eab", + "816ce4ef901605dbe0d03edf3eb4f3b5", "include/platform/FrontendFeatures_autogen.h": "1781e4fa6efb552bca2ce5a5164eb374", "include/platform/d3d_features.json": @@ -20,9 +20,9 @@ "include/platform/mtl_features.json": "1fabfe4d5c2eb3683a5b567ab60ad83c", "include/platform/vk_features.json": - "1cc54c85cf96d60167fc6ed2c2a8817b", + "3574d1618307a49d242a424c0d79a8a3", "util/angle_features_autogen.cpp": - "4918af5e120a0f41176ce2d3c9d487db", + "4c8feb678e0aff9c853d4aec094c2528", "util/angle_features_autogen.h": - "5044ccab750c63f3cd6414cf45241abb" + "7d9d5092bb61cc298733a6c9a2dfd598" } \ No newline at end of file diff --git a/src/libANGLE/renderer/vulkan/ProgramExecutableVk.cpp b/src/libANGLE/renderer/vulkan/ProgramExecutableVk.cpp index 22b3d7247..21d8a24c7 100644 --- a/src/libANGLE/renderer/vulkan/ProgramExecutableVk.cpp +++ b/src/libANGLE/renderer/vulkan/ProgramExecutableVk.cpp @@ -344,8 +344,7 @@ void ProgramInfo::release(ContextVk *contextVk) } ProgramExecutableVk::ProgramExecutableVk() - : mEmptyDescriptorSets{}, - mNumDefaultUniformDescriptors(0), + : mNumDefaultUniformDescriptors(0), mImmutableSamplersMaxDescriptorCount(1), mUniformBufferDescriptorType(VK_DESCRIPTOR_TYPE_MAX_ENUM), mDynamicUniformDescriptorOffsets{} @@ -372,7 +371,6 @@ void ProgramExecutableVk::resetLayout(ContextVk *contextVk) mPipelineLayout.reset(); mDescriptorSets.fill(VK_NULL_HANDLE); - mEmptyDescriptorSets.fill(VK_NULL_HANDLE); mNumDefaultUniformDescriptors = 0; for (vk::RefCountedDescriptorPoolBinding &binding : mDescriptorPoolBindings) @@ -1455,21 +1453,7 @@ angle::Result ProgramExecutableVk::bindDescriptorSets( VkDescriptorSet descSet = mDescriptorSets[descriptorSetIndex]; if (descSet == VK_NULL_HANDLE) { - if (!context->getRenderer()->getFeatures().bindEmptyForUnusedDescriptorSets.enabled) - { - continue; - } - - // Workaround a driver bug where missing (though unused) descriptor sets indices cause - // later sets to misbehave. - if (mEmptyDescriptorSets[descriptorSetIndex] == VK_NULL_HANDLE) - { - ANGLE_TRY(mDescriptorPools[descriptorSetIndex].get().allocateDescriptorSet( - context, commandBufferHelper, mDescriptorSetLayouts[descriptorSetIndex].get(), - &mDescriptorPoolBindings[descriptorSetIndex], - &mEmptyDescriptorSets[descriptorSetIndex])); - } - descSet = mEmptyDescriptorSets[descriptorSetIndex]; + continue; } // Default uniforms are encompassed in a block per shader stage, and they are assigned diff --git a/src/libANGLE/renderer/vulkan/ProgramExecutableVk.h b/src/libANGLE/renderer/vulkan/ProgramExecutableVk.h index 2e986c02e..f8159804c 100644 --- a/src/libANGLE/renderer/vulkan/ProgramExecutableVk.h +++ b/src/libANGLE/renderer/vulkan/ProgramExecutableVk.h @@ -336,7 +336,6 @@ class ProgramExecutableVk // Descriptor sets and pools for shader resources for this program. vk::DescriptorSetArray mDescriptorSets; - vk::DescriptorSetArray mEmptyDescriptorSets; vk::DescriptorSetArray mDescriptorPools; vk::DescriptorSetArray mDescriptorPoolBindings; uint32_t mNumDefaultUniformDescriptors; diff --git a/src/libANGLE/renderer/vulkan/RendererVk.cpp b/src/libANGLE/renderer/vulkan/RendererVk.cpp index 3b963f862..ef7438c68 100644 --- a/src/libANGLE/renderer/vulkan/RendererVk.cpp +++ b/src/libANGLE/renderer/vulkan/RendererVk.cpp @@ -3362,9 +3362,6 @@ void RendererVk::initFeatures(DisplayVk *displayVk, ANGLE_FEATURE_CONDITION(&mFeatures, disableFifoPresentMode, IsLinux() && isIntel); - ANGLE_FEATURE_CONDITION(&mFeatures, bindEmptyForUnusedDescriptorSets, - IsAndroid() && isQualcommProprietary); - ANGLE_FEATURE_CONDITION(&mFeatures, perFrameWindowSizeQuery, IsAndroid() || isIntel || (IsWindows() && isAMD) || IsFuchsia() || isSamsung || displayVk->isWayland()); diff --git a/src/libANGLE/renderer/vulkan/vk_helpers.cpp b/src/libANGLE/renderer/vulkan/vk_helpers.cpp index 30e839f7b..27514a8f3 100644 --- a/src/libANGLE/renderer/vulkan/vk_helpers.cpp +++ b/src/libANGLE/renderer/vulkan/vk_helpers.cpp @@ -903,24 +903,6 @@ angle::Result InitDynamicDescriptorPool(Context *context, } } - if (descriptorPoolSizes.empty()) - { - if (context->getRenderer()->getFeatures().bindEmptyForUnusedDescriptorSets.enabled) - { - // For this workaround, we have to create an empty descriptor set for each descriptor - // set index, so make sure their pools are initialized. - VkDescriptorPoolSize poolSize = {}; - // The type doesn't matter, since it's not actually used for anything. - poolSize.type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; - poolSize.descriptorCount = 1; - descriptorPoolSizes.emplace_back(poolSize); - } - else - { - return angle::Result::Continue; - } - } - if (!descriptorPoolSizes.empty()) { ANGLE_TRY(poolToInit->init(context, descriptorPoolSizes.data(), descriptorPoolSizes.size(), diff --git a/util/angle_features_autogen.cpp b/util/angle_features_autogen.cpp index 3c0df86d5..06696e260 100644 --- a/util/angle_features_autogen.cpp +++ b/util/angle_features_autogen.cpp @@ -41,7 +41,6 @@ constexpr PackedEnumMap kFeatureNames = {{ {Feature::AsyncCommandQueue, "asyncCommandQueue"}, {Feature::Avoid1BitAlphaTextureFormats, "avoid1BitAlphaTextureFormats"}, {Feature::BasicGLLineRasterization, "basicGLLineRasterization"}, - {Feature::BindEmptyForUnusedDescriptorSets, "bindEmptyForUnusedDescriptorSets"}, {Feature::BindTransformFeedbackBufferBeforeBindBufferRange, "bindTransformFeedbackBufferBeforeBindBufferRange"}, {Feature::BottomLeftOriginPresentRegionRectangles, "bottomLeftOriginPresentRegionRectangles"}, diff --git a/util/angle_features_autogen.h b/util/angle_features_autogen.h index c67a1f3bb..36e332215 100644 --- a/util/angle_features_autogen.h +++ b/util/angle_features_autogen.h @@ -40,7 +40,6 @@ enum class Feature AsyncCommandQueue, Avoid1BitAlphaTextureFormats, BasicGLLineRasterization, - BindEmptyForUnusedDescriptorSets, BindTransformFeedbackBufferBeforeBindBufferRange, BottomLeftOriginPresentRegionRectangles, BresenhamLineRasterization,