[Mesa-dev] [PATCH 28/87] glsl: add cache support for encoding subroutine type

Timothy Arceri timothy.arceri at collabora.com
Wed Jul 13 02:47:23 UTC 2016


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

diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp
index 3ed46f3..5cdb59c 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -79,6 +79,11 @@ encode_type_to_blob(struct blob *blob, const glsl_type *type)
          (type->sampler_array << 2) |
          (type->sampled_type);
       break;
+   case GLSL_TYPE_SUBROUTINE:
+      encoding = type->base_type << 24;
+      blob_write_uint32(blob, encoding);
+      blob_write_string(blob, type->name);
+      return;
    case GLSL_TYPE_IMAGE:
    case GLSL_TYPE_ATOMIC_UINT:
    case GLSL_TYPE_STRUCT:
@@ -112,6 +117,8 @@ decode_type_from_blob(struct blob_reader *blob)
                                              (u >> 3) & 0x01,
                                              (u >> 2) & 0x01,
                                              (glsl_base_type) ((u >> 0) & 0x03));
+   case GLSL_TYPE_SUBROUTINE:
+      return glsl_type::get_subroutine_instance(blob_read_string(blob));
    case GLSL_TYPE_IMAGE:
    case GLSL_TYPE_ATOMIC_UINT:
    case GLSL_TYPE_STRUCT:
-- 
2.7.4



More information about the mesa-dev mailing list