summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancisco Jerez <[email protected]>2014-11-19 18:22:07 +0200
committerFrancisco Jerez <[email protected]>2015-02-10 15:49:43 +0200
commitc4111dfa0a54238510a0c6374d6eb421c296d64f (patch)
tree675b1dbb7c416d6bd54850543428ee7a597de812
parentfcc2fd53df2d57a335856ebd7e01878d7a0d4de2 (diff)
glsl: Return correct number of coordinate components for cubemap array images.
Cubemap array images are unlike cubemap array samplers in that they don't need an additional coordinate to index individual cubemaps in the array, instead they behave like a 2D array of 6n layers, with n the number of cubemaps in the array. Take this exception into account. Reviewed-by: Ian Romanick <[email protected]>
-rw-r--r--src/glsl/glsl_types.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
index b4223f4f06e..2dfa2ba7404 100644
--- a/src/glsl/glsl_types.cpp
+++ b/src/glsl/glsl_types.cpp
@@ -1225,8 +1225,13 @@ glsl_type::coordinate_components() const
break;
}
- /* Array textures need an additional component for the array index. */
- if (sampler_array)
+ /* Array textures need an additional component for the array index, except
+ * for cubemap array images that behave like a 2D array of interleaved
+ * cubemap faces.
+ */
+ if (sampler_array &&
+ !(base_type == GLSL_TYPE_IMAGE &&
+ sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE))
size += 1;
return size;