[PATCH] D78037: [mlir][spirv] Add missing interface storage classes in serializer
Lei Zhang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 13 10:46:53 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG32e6cbe20320: [mlir][spirv] Add missing interface storage classes in serializer (authored by antiagainst).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D78037/new/
https://reviews.llvm.org/D78037
Files:
mlir/lib/Dialect/SPIRV/Serialization/Serializer.cpp
Index: mlir/lib/Dialect/SPIRV/Serialization/Serializer.cpp
===================================================================
--- mlir/lib/Dialect/SPIRV/Serialization/Serializer.cpp
+++ mlir/lib/Dialect/SPIRV/Serialization/Serializer.cpp
@@ -239,8 +239,8 @@
bool isVoidType(Type type) const { return type.isa<NoneType>(); }
- /// Returns true if the given type is a pointer type to a struct in Uniform or
- /// StorageBuffer storage class.
+ /// Returns true if the given type is a pointer type to a struct in some
+ /// interface storage class.
bool isInterfaceStructPtrType(Type type) const;
/// Main dispatch method for serializing a type. The result <id> of the
@@ -900,12 +900,19 @@
// Type
//===----------------------------------------------------------------------===//
+// According to the SPIR-V spec "Validation Rules for Shader Capabilities":
+// "Composite objects in the StorageBuffer, PhysicalStorageBuffer, Uniform, and
+// PushConstant Storage Classes must be explicitly laid out."
bool Serializer::isInterfaceStructPtrType(Type type) const {
if (auto ptrType = type.dyn_cast<spirv::PointerType>()) {
- auto storageClass = ptrType.getStorageClass();
- if (storageClass == spirv::StorageClass::Uniform ||
- storageClass == spirv::StorageClass::StorageBuffer) {
+ switch (ptrType.getStorageClass()) {
+ case spirv::StorageClass::PhysicalStorageBuffer:
+ case spirv::StorageClass::PushConstant:
+ case spirv::StorageClass::StorageBuffer:
+ case spirv::StorageClass::Uniform:
return ptrType.getPointeeType().isa<spirv::StructType>();
+ default:
+ break;
}
}
return false;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78037.257030.patch
Type: text/x-patch
Size: 1666 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200413/0d7520aa/attachment.bin>
More information about the llvm-commits
mailing list