[Mesa-dev] [PATCH 32/40] glsl: reserve parameter storage on cache restore

Timothy Arceri tarceri at itsqueeze.com
Tue Feb 7 03:42:36 UTC 2017


From: Timothy Arceri <timothy.arceri at collabora.com>

Since we know how big the list will be we can allocate the storage
upfront.
---
 src/compiler/glsl/shader_cache.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp
index 33f903e..44ca5a4 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -1109,6 +1109,7 @@ read_shader_parameters(struct blob_reader *metadata,
    uint32_t i = 0;
    uint32_t num_parameters = blob_read_uint32(metadata);
 
+   _mesa_reserve_parameter_storage(params, num_parameters);
    while (i < num_parameters) {
       gl_register_file type = (gl_register_file) blob_read_uint32(metadata);
       const char *name = blob_read_string(metadata);
-- 
2.9.3



More information about the mesa-dev mailing list