Vulkan: Use one pipeline layout for all Programs.
This simplifies the pipeline state object caching. We will not need
to use any extra bits to cache based on program properties - instead
all programs will be compatible. The pipeline layout strucutre is
described in the design docs. It currently only has two bind groups:
the first for default uniforms, and the second for Textures. In the
future we might re-organize this to handle driver uniforms, dynamic
push constants, and/or program uniform buffers with ES 3.0.
Instead of storing only the Textures that are required by a Program,
we reserve space for the maximum possible Texture units. We might have
to revisit this very simple design in the future to support texture
arrays, which are handled specially in Vulkan.
Bug: angleproject:2163
Change-Id: I3e1656c2c73045aed56838a5f1267b246a623362
Reviewed-on: https://chromium-review.googlesource.com/837943
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/ProgramVk.h b/src/libANGLE/renderer/vulkan/ProgramVk.h
index 4da6d38..e26c516 100644
--- a/src/libANGLE/renderer/vulkan/ProgramVk.h
+++ b/src/libANGLE/renderer/vulkan/ProgramVk.h
@@ -101,7 +101,6 @@
const vk::ShaderModule &getLinkedVertexModule() const;
const vk::ShaderModule &getLinkedFragmentModule() const;
- const vk::PipelineLayout &getPipelineLayout() const;
vk::Error updateUniforms(ContextVk *contextVk);
@@ -111,14 +110,15 @@
// However, it's valid to leave them in an undefined, unbound state, if they are never used.
// This means when we want to ignore a descriptor set index, we need to pass in an offset
// parameter to BindDescriptorSets, which is an offset into the getDescriptorSets array.
- uint32_t getDescriptorSetOffset() const;
+ // This allows us to skip binding blank descriptor sets when the Program doesn't use Uniforms
+ // or Textures.
+ const gl::RangeUI &getUsedDescriptorSetRange() const;
void updateTexturesDescriptorSet(ContextVk *contextVk);
void invalidateTextures();
private:
void reset(VkDevice device);
- vk::Error initPipelineLayout(ContextVk *context);
vk::Error initDescriptorSets(ContextVk *contextVk);
gl::Error initDefaultUniformBlocks(const gl::Context *glContext);
vk::Error updateDefaultUniformsDescriptorSet(ContextVk *contextVk);
@@ -128,8 +128,6 @@
vk::ShaderModule mLinkedVertexModule;
vk::ShaderModule mLinkedFragmentModule;
- vk::PipelineLayout mPipelineLayout;
- std::vector<vk::DescriptorSetLayout> mDescriptorSetLayouts;
// State for the default uniform blocks.
struct DefaultUniformBlock final : private angle::NonCopyable
@@ -157,7 +155,7 @@
// Descriptor sets for uniform blocks and textures for this program.
std::vector<VkDescriptorSet> mDescriptorSets;
- uint32_t mDescriptorSetOffset;
+ gl::RangeUI mUsedDescriptorSetRange;
bool mDirtyTextures;
template <typename T>