Vulkan: limit max texture bindings by physical device limits
Already limited by IMPLEMENTATION_MAX_ACTIVE_TEXTURES,
but Nexus 5X doesn't support that many.
BUG=angleproject:2314
Change-Id: I43b530ba25e9cf7055e74525f479fb10cc7394a2
Reviewed-on: https://chromium-review.googlesource.com/882443
Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/RendererVk.cpp b/src/libANGLE/renderer/vulkan/RendererVk.cpp
index 525284e..2a442b5 100644
--- a/src/libANGLE/renderer/vulkan/RendererVk.cpp
+++ b/src/libANGLE/renderer/vulkan/RendererVk.cpp
@@ -933,12 +933,13 @@
mGraphicsDescriptorSetLayouts.push_back(std::move(uniformLayout));
}
- std::array<VkDescriptorSetLayoutBinding, gl::IMPLEMENTATION_MAX_ACTIVE_TEXTURES>
- textureBindings;
+ // TODO(lucferron): expose this limitation to GL in Context Caps
+ std::vector<VkDescriptorSetLayoutBinding> textureBindings(
+ std::min<size_t>(mPhysicalDeviceProperties.limits.maxPerStageDescriptorSamplers,
+ gl::IMPLEMENTATION_MAX_ACTIVE_TEXTURES));
// TODO(jmadill): This approach might not work well for texture arrays.
- for (uint32_t textureIndex = 0; textureIndex < gl::IMPLEMENTATION_MAX_ACTIVE_TEXTURES;
- ++textureIndex)
+ for (uint32_t textureIndex = 0; textureIndex < textureBindings.size(); ++textureIndex)
{
VkDescriptorSetLayoutBinding &layoutBinding = textureBindings[textureIndex];