diff options
author | Timothy Arceri <[email protected]> | 2017-08-11 14:17:24 +1000 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2017-08-24 11:18:48 +1000 |
commit | 2662269ad791141eb61c14d7a57df2800fa6d91c (patch) | |
tree | a55cb762d719971cbff50fbd02c6b951b7f462e5 /src/compiler/glsl/shader_cache.cpp | |
parent | 073a84ff60dbaef6331e2bcd8f5ca2de0b2ff7d2 (diff) |
glsl: add has_uniform_storage() helper to shader cache
Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src/compiler/glsl/shader_cache.cpp')
-rw-r--r-- | src/compiler/glsl/shader_cache.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
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); |