Vulkan: Add PipelineDesc.
The PipelineDesc class is a 512-byte packed description of the entire
Vulkan pipeline state. It uses the alignas keyword and some static
asserts to verify that the structures are packed. This ensures that
when ANGLE uses MurmurHash to hash the entire struct, and memcmp to
check for identity, that there are no garbage padding bits.
This CL does not implement the Pipeline cache, but it will help, since
now we have a packed type that can be used as the key to a hash map.
Bug: angleproject:2163
Change-Id: I16efa927f08d30d89a9c4c8943edd211c6878ac8
Reviewed-on: https://chromium-review.googlesource.com/829893
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
diff --git a/src/libANGLE/renderer/renderer_utils.h b/src/libANGLE/renderer/renderer_utils.h
index 5a1cb38..8a60307 100644
--- a/src/libANGLE/renderer/renderer_utils.h
+++ b/src/libANGLE/renderer/renderer_utils.h
@@ -71,6 +71,10 @@
{
return mValue != kInvalid && mValue == other.mValue;
}
+ constexpr bool operator==(uint32_t value) const
+ {
+ return mValue != kInvalid && mValue == static_cast<uint64_t>(value);
+ }
constexpr bool operator!=(const Serial &other) const
{
return mValue == kInvalid || mValue != other.mValue;
@@ -80,6 +84,11 @@
constexpr bool operator<(const Serial &other) const { return mValue < other.mValue; }
constexpr bool operator<=(const Serial &other) const { return mValue <= other.mValue; }
+ constexpr bool operator<(uint32_t value) const { return mValue < static_cast<uint64_t>(value); }
+
+ // Useful for serialization.
+ constexpr uint64_t getValue() const { return mValue; }
+
private:
friend class SerialFactory;
constexpr explicit Serial(uint64_t value) : mValue(value) {}