[Mesa-dev] [PATCH 22/65] glsl: cache more uniform storage values
Timothy Arceri
timothy.arceri at collabora.com
Fri Apr 29 13:33:21 UTC 2016
---
src/compiler/glsl/shader_cache.cpp | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp
index 8f2e1ef..092e6e3 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -138,10 +138,19 @@ write_uniforms(struct blob *metadata, struct gl_shader_program *prog)
printf("uniform %s %s\n",
prog->UniformStorage[i].type->name,
prog->UniformStorage[i].name);
+ 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);
+
encode_type_to_blob(metadata, prog->UniformStorage[i].type);
}
}
@@ -168,11 +177,16 @@ read_uniforms(struct blob_reader *metadata, struct gl_shader_program *prog)
prog->UniformHash = new string_to_uint_map;
for (i = 0; i < prog->NumUniformStorage; i++) {
+ 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);
uniforms[i].type = decode_type_from_blob(metadata);
prog->UniformHash->put(i, uniforms[i].name);
--
2.5.5
More information about the mesa-dev
mailing list