[Mesa-dev] [PATCH 19/88] glsl: cache more uniform storage values

Timothy Arceri timothy.arceri at collabora.com
Sat Sep 24 05:25:00 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 1052c67..8b33f0e 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -136,10 +136,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);
    }
 }
 
@@ -166,11 +173,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