Vulkan: Rework layout block storage conversion
Previously, a pass over the shader was made, converting shared and
packed interface blocks with block storage to std140. This resulted in
link success between interface blocks with different storage as they
were all translated to std140.
With this change, this pass is removed. The link step proceeds with the
block storage specifiers as seen by GLES, and only upon Vulkan GLSL
shader generation "shared" and "packed" are converted to std140.
Bug: angleproject:3199
Change-Id: I069415ab9c9b4e1034bc00f64cd2d9e2d73f5956
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1605262
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/ProgramVk.cpp b/src/libANGLE/renderer/vulkan/ProgramVk.cpp
index 2bc5050..e5b6e2e 100644
--- a/src/libANGLE/renderer/vulkan/ProgramVk.cpp
+++ b/src/libANGLE/renderer/vulkan/ProgramVk.cpp
@@ -165,6 +165,12 @@
return arraySize;
}
+
+class Std140BlockLayoutEncoderFactory : public gl::CustomBlockLayoutEncoderFactory
+{
+ public:
+ sh::BlockLayoutEncoder *makeEncoder() override { return new sh::Std140BlockEncoder(); }
+};
} // anonymous namespace
// ProgramVk::ShaderInfo implementation.
@@ -366,7 +372,8 @@
void ProgramVk::linkResources(const gl::ProgramLinkedResources &resources)
{
- gl::ProgramLinkedResourcesLinker linker(nullptr);
+ Std140BlockLayoutEncoderFactory std140EncoderFactory;
+ gl::ProgramLinkedResourcesLinker linker(&std140EncoderFactory);
linker.linkResources(mState, resources);
}