[Mesa-dev] [RFC PATCH 25/26] glsl: encode (and decode) bindless samplers/images
Samuel Pitoiset
samuel.pitoiset at gmail.com
Tue Apr 11 16:48:36 UTC 2017
This adds support to the GLSL shader cache.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
src/compiler/glsl/shader_cache.cpp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp
index 06d772e2f4..19e274b1b2 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -91,6 +91,7 @@ encode_type_to_blob(struct blob *blob, const glsl_type *type)
(type->vector_elements << 4) |
(type->matrix_columns);
break;
+ case GLSL_TYPE_BINDLESS_SAMPLER:
case GLSL_TYPE_SAMPLER:
encoding = (type->base_type) << 24 |
(type->sampler_dimensionality << 4) |
@@ -103,6 +104,7 @@ encode_type_to_blob(struct blob *blob, const glsl_type *type)
blob_write_uint32(blob, encoding);
blob_write_string(blob, type->name);
return;
+ case GLSL_TYPE_BINDLESS_IMAGE:
case GLSL_TYPE_IMAGE:
encoding = (type->base_type) << 24 |
(type->sampler_dimensionality << 3) |
@@ -160,19 +162,21 @@ decode_type_from_blob(struct blob_reader *blob)
case GLSL_TYPE_UINT64:
case GLSL_TYPE_INT64:
return glsl_type::get_instance(base_type, (u >> 4) & 0x0f, u & 0x0f);
+ case GLSL_TYPE_BINDLESS_SAMPLER:
case GLSL_TYPE_SAMPLER:
return glsl_type::get_sampler_instance((enum glsl_sampler_dim) ((u >> 4) & 0x07),
(u >> 3) & 0x01,
(u >> 2) & 0x01,
(glsl_base_type) ((u >> 0) & 0x03),
- false);
+ base_type == GLSL_TYPE_BINDLESS_SAMPLER);
case GLSL_TYPE_SUBROUTINE:
return glsl_type::get_subroutine_instance(blob_read_string(blob));
+ case GLSL_TYPE_BINDLESS_IMAGE:
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),
- false);
+ base_type == GLSL_TYPE_BINDLESS_IMAGE);
case GLSL_TYPE_ATOMIC_UINT:
return glsl_type::atomic_uint_type;
case GLSL_TYPE_ARRAY: {
--
2.12.2
More information about the mesa-dev
mailing list