summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/linker.h
diff options
context:
space:
mode:
authorPlamena Manolova <[email protected]>2016-02-11 15:00:02 +0200
committerTapani Pälli <[email protected]>2016-02-18 11:53:35 +0200
commit65dfb3048e8291675ca33581aeff8921f7ea509d (patch)
tree8a2aba1e5b5460df1eff630bfcda3ba0b4524d88 /src/compiler/glsl/linker.h
parentd335b6abc0eaa7506203df7c99898645214b4c72 (diff)
compiler/glsl: Fix uniform location counting.
This patch moves the calculation of current uniforms to link_uniforms, which makes use of UniformRemapTable which stores all the reserved uniform locations. Location assignment for implicit uniforms now tries to use any gaps left in the table after the location assignment for explicit uniforms. This gives us more space to store more uniforms. Patch is based on earlier patch with following changes/additions: 1: Move the counting of explicit locations to check_explicit_uniform_locations and then pass the number to link_assign_uniform_locations. 2: Count the number of empty slots in UniformRemapTable and store them in a list_head. 3: Try to find an empty slot for implicit locations from the list, if that fails resize UniformRemapTable. Fixes following CTS tests: ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max-array Signed-off-by: Tapani Pälli <[email protected]> Signed-off-by: Plamena Manolova <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93696
Diffstat (limited to 'src/compiler/glsl/linker.h')
-rw-r--r--src/compiler/glsl/linker.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/compiler/glsl/linker.h b/src/compiler/glsl/linker.h
index c80be1c7e22..a60bb6ed087 100644
--- a/src/compiler/glsl/linker.h
+++ b/src/compiler/glsl/linker.h
@@ -35,7 +35,9 @@ link_invalidate_variable_locations(exec_list *ir);
extern void
link_assign_uniform_locations(struct gl_shader_program *prog,
- unsigned int boolean_true);
+ unsigned int boolean_true,
+ unsigned int num_explicit_uniform_locs,
+ unsigned int max_uniform_locs);
extern void
link_set_uniform_initializers(struct gl_shader_program *prog,
@@ -202,4 +204,17 @@ linker_error(gl_shader_program *prog, const char *fmt, ...);
void
linker_warning(gl_shader_program *prog, const char *fmt, ...);
+/**
+ * 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;
+};
+
#endif /* GLSL_LINKER_H */