[Mesa-dev] [PATCH 36/68] glsl: add support for serialising atomic and array types

Timothy Arceri timothy.arceri at collabora.com
Wed Jun 1 06:23:17 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 217ba75..6773787 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -91,9 +91,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:
@@ -129,9 +135,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.5.5



More information about the mesa-dev mailing list