Mesa (master): glsl: fix varying slot allocation for blocks and structs with explicit locations
Timothy Arceri
tarceri at kemper.freedesktop.org
Wed Jan 6 22:44:42 UTC 2016
Module: Mesa
Branch: master
Commit: e58be8ac0e7ce53ed02721e1432a15f95b026b57
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e58be8ac0e7ce53ed02721e1432a15f95b026b57
Author: Timothy Arceri <timothy.arceri at collabora.com>
Date: Wed Jan 6 20:22:46 2016 +1100
glsl: fix varying slot allocation for blocks and structs with explicit locations
Previously each member was being counted as using a single slot,
count_attribute_slots() fixes the count for array and struct members.
Also don't assign a negitive to the unsigned expl_location variable.
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
---
src/glsl/ast_to_hir.cpp | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index dbf05ac..e6aec36 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -6375,12 +6375,13 @@ ast_process_struct_or_iface_block_members(exec_list *instructions,
if (process_qualifier_constant(state, &loc, "location",
qual->location, &qual_location)) {
fields[i].location = VARYING_SLOT_VAR0 + qual_location;
- expl_location = fields[i].location + 1;
+ expl_location = fields[i].location +
+ fields[i].type->count_attribute_slots(false);
}
} else {
if (layout && layout->flags.q.explicit_location) {
fields[i].location = expl_location;
- expl_location = expl_location + 1;
+ expl_location += fields[i].type->count_attribute_slots(false);
} else {
fields[i].location = -1;
}
@@ -6484,7 +6485,7 @@ ast_struct_specifier::hir(exec_list *instructions,
state->struct_specifier_depth++;
- unsigned expl_location = -1;
+ unsigned expl_location = 0;
if (layout && layout->flags.q.explicit_location) {
if (!process_qualifier_constant(state, &loc, "location",
layout->location, &expl_location)) {
@@ -6671,7 +6672,7 @@ ast_interface_block::hir(exec_list *instructions,
return NULL;
}
- unsigned expl_location = -1;
+ unsigned expl_location = 0;
if (layout.flags.q.explicit_location) {
if (!process_qualifier_constant(state, &loc, "location",
layout.location, &expl_location)) {
More information about the mesa-commit
mailing list