Skip to content

Commit 92089dc

Browse files
timvpGoogleAngle LUCI CQ
authored andcommitted
Vulkan: Limit maxPerStageTextures to 4096
Many devices support a huge number of samplers (millions) and every one needs a uniform location, either generated by ANGLE or assigned by the user. Limit the number of samplers per stage to something reasonable, which in turn also lowers the number of uniform locations. This isn't expected to have any practical effect on real apps/users, but is instead to keep tests for these limits (e.g., dEQP, end2end) within reason in terms of shader program sizes and compilation times. Test: KHR-GLES31.core.explicit_uniform_location.uniform-loc-mix-with-implicit-max Test: angle_end2end_tests --gtest_filter=GLSLTest.VerifyMaxVertexUniformVectorsWithSamplers* Bug: b/434763439 Change-Id: I378483fd869b9f5ebee21760eec4dec2dd793b92 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6798920 Reviewed-by: Charlie Lao <[email protected]> Commit-Queue: Tim Van Patten <[email protected]> Reviewed-by: Shahbaz Youssefi <[email protected]>
1 parent cd969c3 commit 92089dc

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/libANGLE/renderer/vulkan/vk_caps_utils.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -765,8 +765,18 @@ void Renderer::ensureCapsInitialized() const
765765

766766
// Note that Vulkan currently implements textures as combined image+samplers, so the limit is
767767
// the minimum of supported samplers and sampled images.
768-
const uint32_t maxPerStageTextures = std::min(limitsVk.maxPerStageDescriptorSamplers,
769-
limitsVk.maxPerStageDescriptorSampledImages);
768+
uint32_t maxPerStageTextures = std::min(limitsVk.maxPerStageDescriptorSamplers,
769+
limitsVk.maxPerStageDescriptorSampledImages);
770+
771+
// Many devices support a huge number of samplers (millions) and every one needs a uniform
772+
// location, either generated by ANGLE or assigned by the user. Limit the number of samplers per
773+
// stage to something reasonable, which in turn also lowers the number of uniform locations.
774+
// This isn't expected to have any practical effect on real apps/users, but is instead to keep
775+
// tests for these limits (e.g., dEQP, end2end) within reason in terms of shader program sizes
776+
// and compilation times.
777+
constexpr uint32_t kMaximumSamplersPerStage = 4096;
778+
maxPerStageTextures = std::min(kMaximumSamplersPerStage, maxPerStageTextures);
779+
770780
const uint32_t maxCombinedTextures =
771781
std::min(limitsVk.maxDescriptorSetSamplers, limitsVk.maxDescriptorSetSampledImages);
772782
for (gl::ShaderType shaderType : gl::AllShaderTypes())

0 commit comments

Comments
 (0)