summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/linker.cpp
diff options
context:
space:
mode:
authorAlejandro Piñeiro <[email protected]>2018-06-26 16:28:59 +0200
committerAlejandro Piñeiro <[email protected]>2018-07-03 12:37:32 +0200
commitb0712df6cfbc40ce770077a12e7e2beccd692019 (patch)
treec6c7e27dd27f695e3dfec62492a6991392c4cfb5 /src/compiler/glsl/linker.cpp
parent995d9937103771d9318124b91adfd20d7c6d5fed (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.cpp')
-rw-r--r--src/compiler/glsl/linker.cpp19
1 files changed, 2 insertions, 17 deletions
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 95e7c3c5e99..6a9d19e8695 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -76,6 +76,7 @@
#include "util/set.h"
#include "string_to_uint_map.h"
#include "linker.h"
+#include "linker_util.h"
#include "link_varyings.h"
#include "ir_optimization.h"
#include "ir_rvalue_visitor.h"
@@ -3527,23 +3528,7 @@ check_explicit_uniform_locations(struct gl_context *ctx,
}
}
- struct empty_uniform_block *current_block = NULL;
-
- for (unsigned i = 0; i < prog->NumUniformRemapTable; i++) {
- /* We found empty space in UniformRemapTable. */
- if (prog->UniformRemapTable[i] == NULL) {
- /* We've found the beginning of a new continous block of empty slots */
- if (!current_block || current_block->start + current_block->slots != i) {
- current_block = rzalloc(prog, struct empty_uniform_block);
- current_block->start = i;
- exec_list_push_tail(&prog->EmptyUniformLocations,
- &current_block->link);
- }
-
- /* The current block continues, so we simply increment its slots */
- current_block->slots++;
- }
- }
+ link_util_update_empty_uniform_locations(prog);
delete uniform_map;
prog->NumExplicitUniformLocations = entries_total;