summaryrefslogtreecommitdiffstats
path: root/src/glsl/link_uniforms.cpp
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2012-12-13 02:25:34 -0800
committerIan Romanick <[email protected]>2013-01-25 09:07:33 -0500
commitb226a058dbb59a24254a149be182a08bcb10bee3 (patch)
tree16e4d361fbeffdbaac116fdf92a916241947d188 /src/glsl/link_uniforms.cpp
parent9a971ab695d8f3c58a5fb0f359443b6b053f0b97 (diff)
linker: Refactor intra-stage block compatabililty testing
Also slightly change the compatibility test. Instead of comparing the offsets of the block variables, compare the packing mode of the blocks. Ideally we don't want to assign the offsets until a later stage of linking. This is put in a new file called link_uniform_blocks.cpp. Some new functions related to uniform blocks are going to live in that file as well. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Carl Worth <[email protected]> Reviewed-by: Chad Versace <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/link_uniforms.cpp')
-rw-r--r--src/glsl/link_uniforms.cpp22
1 files changed, 3 insertions, 19 deletions
diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
index 07d9c18dea0..25bba15bdbe 100644
--- a/src/glsl/link_uniforms.cpp
+++ b/src/glsl/link_uniforms.cpp
@@ -399,26 +399,10 @@ link_cross_validate_uniform_block(void *mem_ctx,
{
for (unsigned int i = 0; i < *num_linked_blocks; i++) {
struct gl_uniform_block *old_block = &(*linked_blocks)[i];
- if (strcmp(old_block->Name, new_block->Name) == 0) {
- if (old_block->NumUniforms != new_block->NumUniforms) {
- return -1;
- }
-
- for (unsigned j = 0; j < old_block->NumUniforms; j++) {
- if (strcmp(old_block->Uniforms[j].Name,
- new_block->Uniforms[j].Name) != 0)
- return -1;
-
- if (old_block->Uniforms[j].Offset !=
- new_block->Uniforms[j].Offset)
- return -1;
- if (old_block->Uniforms[j].RowMajor !=
- new_block->Uniforms[j].RowMajor)
- return -1;
- }
- return i;
- }
+ if (strcmp(old_block->Name, new_block->Name) == 0)
+ return link_uniform_blocks_are_compatible(old_block, new_block)
+ ? i : -1;
}
*linked_blocks = reralloc(mem_ctx, *linked_blocks,