[Mesa-dev] [PATCH 30/77] glsl: add support for serialising image types

Timothy Arceri timothy.arceri at collabora.com
Mon Oct 3 06:04:49 UTC 2016


---
 src/compiler/glsl/shader_cache.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp
index 1c5c4f5..a64f6e5 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -86,6 +86,11 @@ encode_type_to_blob(struct blob *blob, const glsl_type *type)
       blob_write_string(blob, type->name);
       return;
    case GLSL_TYPE_IMAGE:
+      encoding = (type->base_type) << 24 |
+         (type->sampler_dimensionality << 3) |
+         (type->sampler_array << 2) |
+         (type->sampled_type);
+      break;
    case GLSL_TYPE_ATOMIC_UINT:
    case GLSL_TYPE_STRUCT:
    case GLSL_TYPE_INTERFACE:
@@ -121,6 +126,9 @@ decode_type_from_blob(struct blob_reader *blob)
    case GLSL_TYPE_SUBROUTINE:
       return glsl_type::get_subroutine_instance(blob_read_string(blob));
    case GLSL_TYPE_IMAGE:
+      return glsl_type::get_image_instance((enum glsl_sampler_dim) ((u >> 3) & 0x07),
+                                             (u >> 2) & 0x01,
+                                             (glsl_base_type) ((u >> 0) & 0x03));
    case GLSL_TYPE_ATOMIC_UINT:
    case GLSL_TYPE_STRUCT:
    case GLSL_TYPE_INTERFACE:
-- 
2.7.4



More information about the mesa-dev mailing list