[Mesa-dev] [PATCH 31/77] glsl: add support for serialising atomic and array types
Timothy Arceri
timothy.arceri at collabora.com
Mon Oct 3 06:04:50 UTC 2016
---
src/compiler/glsl/shader_cache.cpp | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp
index a64f6e5..0937accd 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -92,9 +92,15 @@ encode_type_to_blob(struct blob *blob, const glsl_type *type)
(type->sampled_type);
break;
case GLSL_TYPE_ATOMIC_UINT:
+ encoding = (type->base_type << 24);
+ break;
+ case GLSL_TYPE_ARRAY:
+ blob_write_uint32(blob, (type->base_type) << 24);
+ blob_write_uint32(blob, type->length);
+ encode_type_to_blob(blob, type->fields.array);
+ return;
case GLSL_TYPE_STRUCT:
case GLSL_TYPE_INTERFACE:
- case GLSL_TYPE_ARRAY:
case GLSL_TYPE_VOID:
case GLSL_TYPE_ERROR:
default:
@@ -130,9 +136,14 @@ decode_type_from_blob(struct blob_reader *blob)
(u >> 2) & 0x01,
(glsl_base_type) ((u >> 0) & 0x03));
case GLSL_TYPE_ATOMIC_UINT:
+ return glsl_type::atomic_uint_type;
+ case GLSL_TYPE_ARRAY: {
+ unsigned length = blob_read_uint32(blob);
+ return glsl_type::get_array_instance(decode_type_from_blob(blob),
+ length);
+ }
case GLSL_TYPE_STRUCT:
case GLSL_TYPE_INTERFACE:
- case GLSL_TYPE_ARRAY:
case GLSL_TYPE_VOID:
case GLSL_TYPE_ERROR:
default:
--
2.7.4
More information about the mesa-dev
mailing list