summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Arceri <timothy.arceri@collabora.com>2016-06-10 15:12:34 +1000
committerTimothy Arceri <timothy.arceri@collabora.com>2016-06-12 21:56:32 +1000
commit30df78236c14ca9470fd591a0978625490c010b2 (patch)
treeccb1814c58859305dc9c8b23530b8f84774ebd0a
parentad3def919e8bdb4f01db0f06d54961175a1910c4 (diff)
glsl: fix component overlap validation for doubles
This change makes sure to remove arrays when checking if type is a double. The check for the end of the first slot of a multi-slot double is also fixed by bumping the check to 4 rather than 3. Previously we were we not reserving the last component. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
-rw-r--r--src/compiler/glsl/link_varyings.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp
index 230c11fc87b..534393a3e6a 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -397,15 +397,15 @@ cross_validate_outputs_to_inputs(struct gl_shader_program *prog,
unsigned slot_limit = idx + num_elements;
unsigned last_comp;
- if (var->type->without_array()->is_record()) {
+ if (type->without_array()->is_record()) {
/* The component qualifier can't be used on structs so just treat
* all component slots as used.
*/
last_comp = 4;
} else {
- unsigned dmul = var->type->is_64bit() ? 2 : 1;
+ unsigned dmul = type->without_array()->is_64bit() ? 2 : 1;
last_comp = var->data.location_frac +
- var->type->without_array()->vector_elements * dmul;
+ type->without_array()->vector_elements * dmul;
}
while (idx < slot_limit) {
@@ -425,7 +425,7 @@ cross_validate_outputs_to_inputs(struct gl_shader_program *prog,
for (unsigned j = 0; j < 4; j++) {
if (explicit_locations[idx][j] &&
(explicit_locations[idx][j]->type->without_array()
- ->base_type != var->type->without_array()->base_type)) {
+ ->base_type != type->without_array()->base_type)) {
linker_error(prog,
"Varyings sharing the same location must "
"have the same underlying numerical type. "
@@ -443,7 +443,7 @@ cross_validate_outputs_to_inputs(struct gl_shader_program *prog,
* worry about components beginning at anything other than 0 as
* the spec does not allow this for dvec3 and dvec4.
*/
- if (i == 3 && last_comp > 4) {
+ if (i == 4 && last_comp > 4) {
last_comp = last_comp - 4;
/* Bump location index and reset the component index */
idx++;