Vulkan: Add PipelineLayout and DescriptorSetLayout caches.
This will be necessary to support more than one PipelineLayout per
instance of ANGLE. Sampler array handling requires different layouts
for different sampler uses.
Bug: angleproject:2462
Change-Id: I1d8b4919eed1a589002ad1898b05186f420061c7
Reviewed-on: https://chromium-review.googlesource.com/1089806
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Luc Ferron <lucferron@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/ProgramVk.cpp b/src/libANGLE/renderer/vulkan/ProgramVk.cpp
index 6334ae4..36a809e 100644
--- a/src/libANGLE/renderer/vulkan/ProgramVk.cpp
+++ b/src/libANGLE/renderer/vulkan/ProgramVk.cpp
@@ -705,7 +705,6 @@
// Write out to a new a descriptor set.
vk::DynamicDescriptorPool *dynamicDescriptorPool = contextVk->getDynamicDescriptorPool();
- const auto &descriptorSetLayouts = renderer->getGraphicsDescriptorSetLayouts();
uint32_t potentialNewCount = descriptorSetIndex + 1;
if (potentialNewCount > mDescriptorSets.size())
@@ -713,10 +712,10 @@
mDescriptorSets.resize(potentialNewCount, VK_NULL_HANDLE);
}
- const VkDescriptorSetLayout *descriptorSetLayout =
- descriptorSetLayouts[descriptorSetIndex].ptr();
+ const vk::DescriptorSetLayout &descriptorSetLayout =
+ renderer->getGraphicsDescriptorSetLayout(descriptorSetIndex);
- ANGLE_TRY(dynamicDescriptorPool->allocateDescriptorSets(contextVk, descriptorSetLayout, 1,
+ ANGLE_TRY(dynamicDescriptorPool->allocateDescriptorSets(contextVk, descriptorSetLayout.ptr(), 1,
&mDescriptorSets[descriptorSetIndex]));
return vk::NoError();
}
@@ -772,7 +771,7 @@
{
// We need to reinitialize the descriptor sets if we newly allocated buffers since we can't
// modify the descriptor sets once initialized.
- ANGLE_TRY(allocateDescriptorSet(contextVk, vk::UniformBufferIndex));
+ ANGLE_TRY(allocateDescriptorSet(contextVk, kUniformsDescriptorSetIndex));
ANGLE_TRY(updateDefaultUniformsDescriptorSet(contextVk));
}
@@ -857,10 +856,10 @@
}
ContextVk *contextVk = GetImplAs<ContextVk>(context);
- ANGLE_TRY(allocateDescriptorSet(contextVk, vk::TextureIndex));
+ ANGLE_TRY(allocateDescriptorSet(contextVk, kTextureDescriptorSetIndex));
ASSERT(mUsedDescriptorSetRange.contains(1));
- VkDescriptorSet descriptorSet = mDescriptorSets[1];
+ VkDescriptorSet descriptorSet = mDescriptorSets[kTextureDescriptorSetIndex];
// TODO(jmadill): Don't hard-code the texture limit.
ShaderTextureArray<VkDescriptorImageInfo> descriptorImageInfo;