From: Timothy Arceri Date: Fri, 11 Aug 2017 04:17:24 +0000 (+1000) Subject: glsl: add has_uniform_storage() helper to shader cache X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2662269ad791141eb61c14d7a57df2800fa6d91c;p=mesa.git glsl: add has_uniform_storage() helper to shader cache Reviewed-by: Samuel Pitoiset --- diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp index 6c878dae37e..2fbab86d30c 100644 --- a/src/compiler/glsl/shader_cache.cpp +++ b/src/compiler/glsl/shader_cache.cpp @@ -596,6 +596,17 @@ read_xfb(struct blob_reader *metadata, struct gl_shader_program *shProg) MAX_FEEDBACK_BUFFERS); } +static bool +has_uniform_storage(struct gl_shader_program *prog, unsigned idx) +{ + if (!prog->data->UniformStorage[idx].builtin && + !prog->data->UniformStorage[idx].is_shader_storage && + prog->data->UniformStorage[idx].block_index == -1) + return true; + + return false; +} + static void write_uniforms(struct blob *metadata, struct gl_shader_program *prog) { @@ -638,9 +649,7 @@ write_uniforms(struct blob *metadata, struct gl_shader_program *prog) */ blob_write_uint32(metadata, prog->data->NumHiddenUniforms); for (unsigned i = 0; i < prog->data->NumUniformStorage; i++) { - if (!prog->data->UniformStorage[i].builtin && - !prog->data->UniformStorage[i].is_shader_storage && - prog->data->UniformStorage[i].block_index == -1) { + if (has_uniform_storage(prog, i)) { unsigned vec_size = prog->data->UniformStorage[i].type->component_slots() * MAX2(prog->data->UniformStorage[i].array_elements, 1); @@ -700,9 +709,7 @@ read_uniforms(struct blob_reader *metadata, struct gl_shader_program *prog) /* Restore uniform values. */ prog->data->NumHiddenUniforms = blob_read_uint32(metadata); for (unsigned i = 0; i < prog->data->NumUniformStorage; i++) { - if (!prog->data->UniformStorage[i].builtin && - !prog->data->UniformStorage[i].is_shader_storage && - prog->data->UniformStorage[i].block_index == -1) { + if (has_uniform_storage(prog, i)) { unsigned vec_size = prog->data->UniformStorage[i].type->component_slots() * MAX2(prog->data->UniformStorage[i].array_elements, 1);