glsl: reserve parameter storage on cache restore
authorTimothy Arceri <timothy.arceri@collabora.com>
Wed, 8 Jun 2016 00:18:33 +0000 (10:18 +1000)
committerTimothy Arceri <tarceri@itsqueeze.com>
Fri, 17 Feb 2017 00:18:43 +0000 (11:18 +1100)
Since we know how big the list will be we can allocate the storage
upfront.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/compiler/glsl/shader_cache.cpp

index 92417e8eb302fc19401ea60ee333b0ae6f6ba68e..d95f136074e36b96cf0f26874f952129e3603918 100644 (file)
@@ -1101,6 +1101,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);