aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/ast_to_hir.cpp
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2015-12-30 13:31:24 +1100
committerTimothy Arceri <[email protected]>2016-03-05 19:38:34 +1100
commit9f24f42c491221a79641a0d810f9c78393d81e5c (patch)
tree82e74776fa31f1431aadf3b79cbff58067d8682e /src/compiler/glsl/ast_to_hir.cpp
parent8abed7f185329250adf9f8c90a131797feda83b6 (diff)
glsl: add offset to glsl interface type
In this patch we also copy the offset value from the ast and implement offset linking rules by adding it to the record_compare() function. From Section 4.4.5 (Uniform and Shader Storage Block Layout Qualifiers) of the GLSL 4.50 spec: "Two blocks linked together in the same program with the same block name must have the exact same set of members qualified with offset and their integral-constant-expression values must be the same, or a link-time error results." Reviewed-by: Edward O'Callaghan <[email protected]>
Diffstat (limited to 'src/compiler/glsl/ast_to_hir.cpp')
-rw-r--r--src/compiler/glsl/ast_to_hir.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index cd94fa05845..60b008c2bd5 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -6498,6 +6498,7 @@ ast_process_struct_or_iface_block_members(exec_list *instructions,
"must be a multiple of the base "
"alignment of %s", field_type->name);
}
+ fields[i].offset = qual_offset;
next_offset = glsl_align(qual_offset + size, align);
} else {
_mesa_glsl_error(&loc, state, "offset can only be used "
@@ -6505,6 +6506,7 @@ ast_process_struct_or_iface_block_members(exec_list *instructions,
}
}
} else {
+ fields[i].offset = -1;
if (align != 0 && size != 0)
next_offset = glsl_align(next_offset + size, align);
}
@@ -6883,6 +6885,8 @@ ast_interface_block::hir(exec_list *instructions,
} else {
fields[i].location =
earlier_per_vertex->fields.structure[j].location;
+ fields[i].offset =
+ earlier_per_vertex->fields.structure[j].offset;
fields[i].interpolation =
earlier_per_vertex->fields.structure[j].interpolation;
fields[i].centroid =