diff options
author | Alejandro Piñeiro <[email protected]> | 2018-06-26 16:28:59 +0200 |
---|---|---|
committer | Alejandro Piñeiro <[email protected]> | 2018-07-03 12:37:32 +0200 |
commit | b0712df6cfbc40ce770077a12e7e2beccd692019 (patch) | |
tree | c6c7e27dd27f695e3dfec62492a6991392c4cfb5 /src/compiler/glsl/linker_util.h | |
parent | 995d9937103771d9318124b91adfd20d7c6d5fed (diff) |
compiler/glsl: refactor empty_uniform_block utilities to linker_util
This includes:
* Move the defition of empty_uniform_block to linker_util.h
* Move find_empty_block (with a rename) to linker_util.h
* Refactor some code at linker.cpp to a new method at linker_util.h
(link_util_update_empty_uniform_locations)
So all that code could be used by the GLSL linker and the NIR linker
used for ARB_gl_spirv.
v2: include just "ir_uniform.h" (Timothy Arceri)
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/compiler/glsl/linker_util.h')
-rw-r--r-- | src/compiler/glsl/linker_util.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/compiler/glsl/linker_util.h b/src/compiler/glsl/linker_util.h index 17da92fca99..1c3674f35a5 100644 --- a/src/compiler/glsl/linker_util.h +++ b/src/compiler/glsl/linker_util.h @@ -25,11 +25,25 @@ #define GLSL_LINKER_UTIL_H struct gl_shader_program; +struct gl_uniform_storage; #ifdef __cplusplus extern "C" { #endif +/** + * Sometimes there are empty slots left over in UniformRemapTable after we + * allocate slots to explicit locations. This struct represents a single + * continouous block of empty slots in UniformRemapTable. + */ +struct empty_uniform_block { + struct exec_node link; + /* The start location of the block */ + unsigned start; + /* The number of slots in the block */ + unsigned slots; +}; + void linker_error(struct gl_shader_program *prog, const char *fmt, ...); @@ -41,6 +55,13 @@ link_util_add_program_resource(struct gl_shader_program *prog, struct set *resource_set, GLenum type, const void *data, uint8_t stages); +int +link_util_find_empty_block(struct gl_shader_program *prog, + struct gl_uniform_storage *uniform); + +void +link_util_update_empty_uniform_locations(struct gl_shader_program *prog); + #ifdef __cplusplus } #endif |