Fix accidentally considering Workgroup to be explicit layout
!IsStorageInterleavedByLane is not quite the same as IsExplicitLayout--
workgroup memory is the exception.
Bug: b/133509497
Change-Id: I4dd055109c0e0f70fa415a75ee383e251cbd509c
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/31929
Reviewed-by: Ben Clayton <bclayton@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
diff --git a/src/Pipeline/SpirvShader.cpp b/src/Pipeline/SpirvShader.cpp
index e2362b2..4d49fa5 100644
--- a/src/Pipeline/SpirvShader.cpp
+++ b/src/Pipeline/SpirvShader.cpp
@@ -1235,6 +1235,19 @@
}
}
+ bool SpirvShader::IsExplicitLayout(spv::StorageClass storageClass)
+ {
+ switch (storageClass)
+ {
+ case spv::StorageClassUniform:
+ case spv::StorageClassStorageBuffer:
+ case spv::StorageClassPushConstant:
+ return true;
+ default:
+ return false;
+ }
+ }
+
bool SpirvShader::IsStorageInterleavedByLane(spv::StorageClass storageClass)
{
switch (storageClass)
@@ -1407,7 +1420,7 @@
{
auto typeId = getObject(id).type;
auto const & type = getType(typeId);
- if (!IsStorageInterleavedByLane(type.storageClass)) // TODO: really "is explicit layout"
+ if (IsExplicitLayout(type.storageClass))
{
Decorations d{};
ApplyDecorationsForId(&d, id);
diff --git a/src/Pipeline/SpirvShader.hpp b/src/Pipeline/SpirvShader.hpp
index cad734d..f7eaa1d 100644
--- a/src/Pipeline/SpirvShader.hpp
+++ b/src/Pipeline/SpirvShader.hpp
@@ -803,6 +803,7 @@
// LaneOffset=3: | Word[3] | Word[3] | Word[3] | Word[3]
//
static bool IsStorageInterleavedByLane(spv::StorageClass storageClass);
+ static bool IsExplicitLayout(spv::StorageClass storageClass);
template<typename F>
int VisitInterfaceInner(Type::ID id, Decorations d, F f) const;