aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/glsl_types.cpp
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-09-18 08:03:04 +0200
committermarha <marha@users.sourceforge.net>2013-09-18 08:03:04 +0200
commit7f669a708bd35bdf8e842f762ec68f9ad0ec0486 (patch)
tree332fc6d6e6f70503d717249e4e387bf3eea29637 /mesalib/src/glsl/glsl_types.cpp
parenta7d3f63ee5e292379ed6d6eba0c65512205a4786 (diff)
downloadvcxsrv-7f669a708bd35bdf8e842f762ec68f9ad0ec0486.tar.gz
vcxsrv-7f669a708bd35bdf8e842f762ec68f9ad0ec0486.tar.bz2
vcxsrv-7f669a708bd35bdf8e842f762ec68f9ad0ec0486.zip
libX11 mesa pixman xserver git update 18 Sep 2013
xserver commit 8010d3a48bd0b224dcb0883e39c2351ad364d846 libX11 commit 5dcb40f28d59587597d2ff6e6ac64c71cfe6ff7b pixman commit 58a79dfe6d1fd62c2b66c69fdb64f6b8ecf61da5 mesa commit a3b51a22f71819236baa6bbda9d0d050914b149d
Diffstat (limited to 'mesalib/src/glsl/glsl_types.cpp')
-rw-r--r--mesalib/src/glsl/glsl_types.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/mesalib/src/glsl/glsl_types.cpp b/mesalib/src/glsl/glsl_types.cpp
index 0c7e8eb11..3c396dd89 100644
--- a/mesalib/src/glsl/glsl_types.cpp
+++ b/mesalib/src/glsl/glsl_types.cpp
@@ -883,3 +883,38 @@ glsl_type::count_attribute_slots() const
return 0;
}
+
+int
+glsl_type::sampler_coordinate_components() const
+{
+ assert(is_sampler());
+
+ int size;
+
+ switch (sampler_dimensionality) {
+ case GLSL_SAMPLER_DIM_1D:
+ case GLSL_SAMPLER_DIM_BUF:
+ size = 1;
+ break;
+ case GLSL_SAMPLER_DIM_2D:
+ case GLSL_SAMPLER_DIM_RECT:
+ case GLSL_SAMPLER_DIM_MS:
+ case GLSL_SAMPLER_DIM_EXTERNAL:
+ size = 2;
+ break;
+ case GLSL_SAMPLER_DIM_3D:
+ case GLSL_SAMPLER_DIM_CUBE:
+ size = 3;
+ break;
+ default:
+ assert(!"Should not get here.");
+ size = 1;
+ break;
+ }
+
+ /* Array textures need an additional component for the array index. */
+ if (sampler_array)
+ size += 1;
+
+ return size;
+}