[Mesa-dev] [PATCH 17/77] glsl: cache more uniform storage values

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


---
 src/compiler/glsl/shader_cache.cpp | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp
index 2fb8330..b0a7876 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -137,10 +137,17 @@ write_uniforms(struct blob *metadata, struct gl_shader_program *prog)
 
    for (i = 0; i < prog->NumUniformStorage; i++) {
       encode_type_to_blob(metadata, prog->UniformStorage[i].type);
+      blob_write_uint32(metadata, prog->UniformStorage[i].array_elements);
       blob_write_string(metadata, prog->UniformStorage[i].name);
       blob_write_uint32(metadata, prog->UniformStorage[i].storage -
                                   prog->UniformDataSlots);
       blob_write_uint32(metadata, prog->UniformStorage[i].remap_location);
+      blob_write_uint32(metadata, prog->UniformStorage[i].block_index);
+      blob_write_uint32(metadata, prog->UniformStorage[i].atomic_buffer_index);
+      blob_write_uint32(metadata, prog->UniformStorage[i].offset);
+      blob_write_uint32(metadata, prog->UniformStorage[i].array_stride);
+      blob_write_uint32(metadata, prog->UniformStorage[i].matrix_stride);
+      blob_write_uint32(metadata, prog->UniformStorage[i].row_major);
    }
 }
 
@@ -167,11 +174,16 @@ read_uniforms(struct blob_reader *metadata, struct gl_shader_program *prog)
 
    for (i = 0; i < prog->NumUniformStorage; i++) {
       uniforms[i].type = decode_type_from_blob(metadata);
+      uniforms[i].array_elements = blob_read_uint32(metadata);
       uniforms[i].name = ralloc_strdup(prog, blob_read_string (metadata));
       uniforms[i].storage = data + blob_read_uint32(metadata);
       uniforms[i].remap_location = blob_read_uint32(metadata);
-      uniforms[i].block_index = -1;
-      uniforms[i].atomic_buffer_index = -1;
+      uniforms[i].block_index = blob_read_uint32(metadata);
+      uniforms[i].atomic_buffer_index = blob_read_uint32(metadata);
+      uniforms[i].offset = blob_read_uint32(metadata);
+      uniforms[i].array_stride = blob_read_uint32(metadata);
+      uniforms[i].matrix_stride = blob_read_uint32(metadata);
+      uniforms[i].row_major = blob_read_uint32(metadata);
       prog->UniformHash->put(i, uniforms[i].name);
    }
 }
-- 
2.7.4



More information about the mesa-dev mailing list