[Mesa-dev] [PATCH 3/7] glsl/tests: Add unit test for glsl_type::get_sampler_instance

Kenneth Graunke kenneth at whitecape.org
Fri Jul 27 10:49:21 PDT 2012


From: Ian Romanick <ian.d.romanick at intel.com>

The table logic in the previous commit is somewhat fragile.  Adding a
unit test will ensure that it remains in sync.

v2/Kayden: Use NULL instead of (void *) 0 in pointer checks.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/glsl/tests/Makefile.am                   |  15 +-
 src/glsl/tests/get_sampler_instance_test.cpp | 500 +++++++++++++++++++++++++++
 2 files changed, 513 insertions(+), 2 deletions(-)
 create mode 100644 src/glsl/tests/get_sampler_instance_test.cpp

diff --git a/src/glsl/tests/Makefile.am b/src/glsl/tests/Makefile.am
index 33e634d..86742b8 100644
--- a/src/glsl/tests/Makefile.am
+++ b/src/glsl/tests/Makefile.am
@@ -14,11 +14,13 @@ TESTS_ENVIRONMENT= \
 TESTS = \
 	optimization-test \
 	ralloc-test \
-	uniform-initializer-test
+	uniform-initializer-test \
+	get-sampler-instance-test
 
 check_PROGRAMS = 				\
 	ralloc-test				\
-	uniform-initializer-test
+	uniform-initializer-test		\
+	get-sampler-instance-test
 
 uniform_initializer_test_SOURCES =		\
 	copy_constant_to_storage_tests.cpp	\
@@ -33,3 +35,12 @@ uniform_initializer_test_LDADD =		\
 
 ralloc_test_SOURCES = ralloc_test.cpp $(top_builddir)/src/glsl/ralloc.c
 ralloc_test_LDADD = $(top_builddir)/src/gtest/libgtest.la -lpthread
+
+get_sampler_instance_test_SOURCES =		\
+	get_sampler_instance_test.cpp
+
+get_sampler_instance_test_LDADD =		\
+	$(top_builddir)/src/gtest/libgtest.la	\
+	$(top_builddir)/src/glsl/libglsl.la	\
+	$(top_builddir)/src/mesa/libmesa.la	\
+	 -lpthread
diff --git a/src/glsl/tests/get_sampler_instance_test.cpp b/src/glsl/tests/get_sampler_instance_test.cpp
new file mode 100644
index 0000000..b284edb
--- /dev/null
+++ b/src/glsl/tests/get_sampler_instance_test.cpp
@@ -0,0 +1,500 @@
+/*
+ * Copyright © 2012 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+#include "gtest/gtest.h"
+#include "glsl_types.h"
+
+TEST(get_sampler_instance, sampler2D)
+{
+   const glsl_type *const t =
+      glsl_type::get_sampler_instance(GLSL_SAMPLER_DIM_2D,
+				      false,
+				      false,
+				      GLSL_TYPE_FLOAT);
+
+   ASSERT_NE(t, NULL);
+   EXPECT_EQ(t->base_type, GLSL_TYPE_SAMPLER);
+   EXPECT_EQ(t->sampler_dimensionality, GLSL_SAMPLER_DIM_2D);
+   EXPECT_FALSE(t->sampler_shadow);
+   EXPECT_FALSE(t->sampler_array);
+   EXPECT_EQ(t->sampler_type, GLSL_TYPE_FLOAT);
+   EXPECT_STREQ("sampler2D", t->name);
+}
+
+TEST(get_sampler_instance, samplerCube)
+{
+   const glsl_type *const t =
+      glsl_type::get_sampler_instance(GLSL_SAMPLER_DIM_CUBE,
+				      false,
+				      false,
+				      GLSL_TYPE_FLOAT);
+
+   ASSERT_NE(t, NULL);
+   EXPECT_EQ(t->base_type, GLSL_TYPE_SAMPLER);
+   EXPECT_EQ(t->sampler_dimensionality, GLSL_SAMPLER_DIM_CUBE);
+   EXPECT_FALSE(t->sampler_shadow);
+   EXPECT_FALSE(t->sampler_array);
+   EXPECT_EQ(t->sampler_type, GLSL_TYPE_FLOAT);
+   EXPECT_STREQ("samplerCube", t->name);
+}
+
+TEST(get_sampler_instance, sampler1D)
+{
+   const glsl_type *const t =
+      glsl_type::get_sampler_instance(GLSL_SAMPLER_DIM_1D,
+				      false,
+				      false,
+				      GLSL_TYPE_FLOAT);
+
+   ASSERT_NE(t, NULL);
+   EXPECT_EQ(t->base_type, GLSL_TYPE_SAMPLER);
+   EXPECT_EQ(t->sampler_dimensionality, GLSL_SAMPLER_DIM_1D);
+   EXPECT_FALSE(t->sampler_shadow);
+   EXPECT_FALSE(t->sampler_array);
+   EXPECT_EQ(t->sampler_type, GLSL_TYPE_FLOAT);
+   EXPECT_STREQ("sampler1D", t->name);
+}
+
+TEST(get_sampler_instance, sampler1DShadow)
+{
+   const glsl_type *const t =
+      glsl_type::get_sampler_instance(GLSL_SAMPLER_DIM_1D,
+				      true,
+				      false,
+				      GLSL_TYPE_FLOAT);
+
+   ASSERT_NE(t, NULL);
+   EXPECT_EQ(t->base_type, GLSL_TYPE_SAMPLER);
+   EXPECT_EQ(t->sampler_dimensionality, GLSL_SAMPLER_DIM_1D);
+   EXPECT_TRUE(t->sampler_shadow);
+   EXPECT_FALSE(t->sampler_array);
+   EXPECT_EQ(t->sampler_type, GLSL_TYPE_FLOAT);
+   EXPECT_STREQ("sampler1DShadow", t->name);
+}
+
+TEST(get_sampler_instance, sampler2DShadow)
+{
+   const glsl_type *const t =
+      glsl_type::get_sampler_instance(GLSL_SAMPLER_DIM_2D,
+				      true,
+				      false,
+				      GLSL_TYPE_FLOAT);
+
+   ASSERT_NE(t, NULL);
+   EXPECT_EQ(t->base_type, GLSL_TYPE_SAMPLER);
+   EXPECT_EQ(t->sampler_dimensionality, GLSL_SAMPLER_DIM_2D);
+   EXPECT_TRUE(t->sampler_shadow);
+   EXPECT_FALSE(t->sampler_array);
+   EXPECT_EQ(t->sampler_type, GLSL_TYPE_FLOAT);
+   EXPECT_STREQ("sampler2DShadow", t->name);
+}
+
+TEST(get_sampler_instance, isampler1DArray)
+{
+   const glsl_type *const t =
+      glsl_type::get_sampler_instance(GLSL_SAMPLER_DIM_1D,
+				      false,
+				      true,
+				      GLSL_TYPE_INT);
+
+   ASSERT_NE(t, NULL);
+   EXPECT_EQ(t->base_type, GLSL_TYPE_SAMPLER);
+   EXPECT_EQ(t->sampler_dimensionality, GLSL_SAMPLER_DIM_1D);
+   EXPECT_FALSE(t->sampler_shadow);
+   EXPECT_TRUE(t->sampler_array);
+   EXPECT_EQ(t->sampler_type, GLSL_TYPE_INT);
+   EXPECT_STREQ("isampler1DArray", t->name);
+}
+
+TEST(get_sampler_instance, usampler1DArray)
+{
+   const glsl_type *const t =
+      glsl_type::get_sampler_instance(GLSL_SAMPLER_DIM_1D,
+				      false,
+				      true,
+				      GLSL_TYPE_UINT);
+
+   ASSERT_NE(t, NULL);
+   EXPECT_EQ(t->base_type, GLSL_TYPE_SAMPLER);
+   EXPECT_EQ(t->sampler_dimensionality, GLSL_SAMPLER_DIM_1D);
+   EXPECT_FALSE(t->sampler_shadow);
+   EXPECT_TRUE(t->sampler_array);
+   EXPECT_EQ(t->sampler_type, GLSL_TYPE_UINT);
+   EXPECT_STREQ("usampler1DArray", t->name);
+}
+
+TEST(get_sampler_instance, isampler2DArray)
+{
+   const glsl_type *const t =
+      glsl_type::get_sampler_instance(GLSL_SAMPLER_DIM_2D,
+				      false,
+				      true,
+				      GLSL_TYPE_INT);
+
+   ASSERT_NE(t, NULL);
+   EXPECT_EQ(t->base_type, GLSL_TYPE_SAMPLER);
+   EXPECT_EQ(t->sampler_dimensionality, GLSL_SAMPLER_DIM_2D);
+   EXPECT_FALSE(t->sampler_shadow);
+   EXPECT_TRUE(t->sampler_array);
+   EXPECT_EQ(t->sampler_type, GLSL_TYPE_INT);
+   EXPECT_STREQ("isampler2DArray", t->name);
+}
+
+TEST(get_sampler_instance, usampler2DArray)
+{
+   const glsl_type *const t =
+      glsl_type::get_sampler_instance(GLSL_SAMPLER_DIM_2D,
+				      false,
+				      true,
+				      GLSL_TYPE_UINT);
+
+   ASSERT_NE(t, NULL);
+   EXPECT_EQ(t->base_type, GLSL_TYPE_SAMPLER);
+   EXPECT_EQ(t->sampler_dimensionality, GLSL_SAMPLER_DIM_2D);
+   EXPECT_FALSE(t->sampler_shadow);
+   EXPECT_TRUE(t->sampler_array);
+   EXPECT_EQ(t->sampler_type, GLSL_TYPE_UINT);
+   EXPECT_STREQ("usampler2DArray", t->name);
+}
+
+TEST(get_sampler_instance, samplerCubeShadow)
+{
+   const glsl_type *const t =
+      glsl_type::get_sampler_instance(GLSL_SAMPLER_DIM_CUBE,
+				      true,
+				      false,
+				      GLSL_TYPE_FLOAT);
+
+   ASSERT_NE(t, NULL);
+   EXPECT_EQ(t->base_type, GLSL_TYPE_SAMPLER);
+   EXPECT_EQ(t->sampler_dimensionality, GLSL_SAMPLER_DIM_CUBE);
+   EXPECT_TRUE(t->sampler_shadow);
+   EXPECT_FALSE(t->sampler_array);
+   EXPECT_EQ(t->sampler_type, GLSL_TYPE_FLOAT);
+   EXPECT_STREQ("samplerCubeShadow", t->name);
+}
+
+TEST(get_sampler_instance, isampler1D)
+{
+   const glsl_type *const t =
+      glsl_type::get_sampler_instance(GLSL_SAMPLER_DIM_1D,
+				      false,
+				      false,
+				      GLSL_TYPE_INT);
+
+   ASSERT_NE(t, NULL);
+   EXPECT_EQ(t->base_type, GLSL_TYPE_SAMPLER);
+   EXPECT_EQ(t->sampler_dimensionality, GLSL_SAMPLER_DIM_1D);
+   EXPECT_FALSE(t->sampler_shadow);
+   EXPECT_FALSE(t->sampler_array);
+   EXPECT_EQ(t->sampler_type, GLSL_TYPE_INT);
+   EXPECT_STREQ("isampler1D", t->name);
+}
+
+TEST(get_sampler_instance, usampler1D)
+{
+   const glsl_type *const t =
+      glsl_type::get_sampler_instance(GLSL_SAMPLER_DIM_1D,
+				      false,
+				      false,
+				      GLSL_TYPE_UINT);
+
+   ASSERT_NE(t, NULL);
+   EXPECT_EQ(t->base_type, GLSL_TYPE_SAMPLER);
+   EXPECT_EQ(t->sampler_dimensionality, GLSL_SAMPLER_DIM_1D);
+   EXPECT_FALSE(t->sampler_shadow);
+   EXPECT_FALSE(t->sampler_array);
+   EXPECT_EQ(t->sampler_type, GLSL_TYPE_UINT);
+   EXPECT_STREQ("usampler1D", t->name);
+}
+
+TEST(get_sampler_instance, isampler2D)
+{
+   const glsl_type *const t =
+      glsl_type::get_sampler_instance(GLSL_SAMPLER_DIM_2D,
+				      false,
+				      false,
+				      GLSL_TYPE_INT);
+
+   ASSERT_NE(t, NULL);
+   EXPECT_EQ(t->base_type, GLSL_TYPE_SAMPLER);
+   EXPECT_EQ(t->sampler_dimensionality, GLSL_SAMPLER_DIM_2D);
+   EXPECT_FALSE(t->sampler_shadow);
+   EXPECT_FALSE(t->sampler_array);
+   EXPECT_EQ(t->sampler_type, GLSL_TYPE_INT);
+   EXPECT_STREQ("isampler2D", t->name);
+}
+
+TEST(get_sampler_instance, usampler2D)
+{
+   const glsl_type *const t =
+      glsl_type::get_sampler_instance(GLSL_SAMPLER_DIM_2D,
+				      false,
+				      false,
+				      GLSL_TYPE_UINT);
+
+   ASSERT_NE(t, NULL);
+   EXPECT_EQ(t->base_type, GLSL_TYPE_SAMPLER);
+   EXPECT_EQ(t->sampler_dimensionality, GLSL_SAMPLER_DIM_2D);
+   EXPECT_FALSE(t->sampler_shadow);
+   EXPECT_FALSE(t->sampler_array);
+   EXPECT_EQ(t->sampler_type, GLSL_TYPE_UINT);
+   EXPECT_STREQ("usampler2D", t->name);
+}
+
+TEST(get_sampler_instance, isampler3D)
+{
+   const glsl_type *const t =
+      glsl_type::get_sampler_instance(GLSL_SAMPLER_DIM_3D,
+				      false,
+				      false,
+				      GLSL_TYPE_INT);
+
+   ASSERT_NE(t, NULL);
+   EXPECT_EQ(t->base_type, GLSL_TYPE_SAMPLER);
+   EXPECT_EQ(t->sampler_dimensionality, GLSL_SAMPLER_DIM_3D);
+   EXPECT_FALSE(t->sampler_shadow);
+   EXPECT_FALSE(t->sampler_array);
+   EXPECT_EQ(t->sampler_type, GLSL_TYPE_INT);
+   EXPECT_STREQ("isampler3D", t->name);
+}
+
+TEST(get_sampler_instance, usampler3D)
+{
+   const glsl_type *const t =
+      glsl_type::get_sampler_instance(GLSL_SAMPLER_DIM_3D,
+				      false,
+				      false,
+				      GLSL_TYPE_UINT);
+
+   ASSERT_NE(t, NULL);
+   EXPECT_EQ(t->base_type, GLSL_TYPE_SAMPLER);
+   EXPECT_EQ(t->sampler_dimensionality, GLSL_SAMPLER_DIM_3D);
+   EXPECT_FALSE(t->sampler_shadow);
+   EXPECT_FALSE(t->sampler_array);
+   EXPECT_EQ(t->sampler_type, GLSL_TYPE_UINT);
+   EXPECT_STREQ("usampler3D", t->name);
+}
+
+TEST(get_sampler_instance, isamplerCube)
+{
+   const glsl_type *const t =
+      glsl_type::get_sampler_instance(GLSL_SAMPLER_DIM_CUBE,
+				      false,
+				      false,
+				      GLSL_TYPE_INT);
+
+   ASSERT_NE(t, NULL);
+   EXPECT_EQ(t->base_type, GLSL_TYPE_SAMPLER);
+   EXPECT_EQ(t->sampler_dimensionality, GLSL_SAMPLER_DIM_CUBE);
+   EXPECT_FALSE(t->sampler_shadow);
+   EXPECT_FALSE(t->sampler_array);
+   EXPECT_EQ(t->sampler_type, GLSL_TYPE_INT);
+   EXPECT_STREQ("isamplerCube", t->name);
+}
+
+TEST(get_sampler_instance, usamplerCube)
+{
+   const glsl_type *const t =
+      glsl_type::get_sampler_instance(GLSL_SAMPLER_DIM_CUBE,
+				      false,
+				      false,
+				      GLSL_TYPE_UINT);
+
+   ASSERT_NE(t, NULL);
+   EXPECT_EQ(t->base_type, GLSL_TYPE_SAMPLER);
+   EXPECT_EQ(t->sampler_dimensionality, GLSL_SAMPLER_DIM_CUBE);
+   EXPECT_FALSE(t->sampler_shadow);
+   EXPECT_FALSE(t->sampler_array);
+   EXPECT_EQ(t->sampler_type, GLSL_TYPE_UINT);
+   EXPECT_STREQ("usamplerCube", t->name);
+}
+
+TEST(get_sampler_instance, sampler2DRect)
+{
+   const glsl_type *const t =
+      glsl_type::get_sampler_instance(GLSL_SAMPLER_DIM_RECT,
+				      false,
+				      false,
+				      GLSL_TYPE_FLOAT);
+
+   ASSERT_NE(t, NULL);
+   EXPECT_EQ(t->base_type, GLSL_TYPE_SAMPLER);
+   EXPECT_EQ(t->sampler_dimensionality, GLSL_SAMPLER_DIM_RECT);
+   EXPECT_FALSE(t->sampler_shadow);
+   EXPECT_FALSE(t->sampler_array);
+   EXPECT_EQ(t->sampler_type, GLSL_TYPE_FLOAT);
+   EXPECT_STREQ("sampler2DRect", t->name);
+}
+
+TEST(get_sampler_instance, sampler2DRectShadow)
+{
+   const glsl_type *const t =
+      glsl_type::get_sampler_instance(GLSL_SAMPLER_DIM_RECT,
+				      true,
+				      false,
+				      GLSL_TYPE_FLOAT);
+
+   ASSERT_NE(t, NULL);
+   EXPECT_EQ(t->base_type, GLSL_TYPE_SAMPLER);
+   EXPECT_EQ(t->sampler_dimensionality, GLSL_SAMPLER_DIM_RECT);
+   EXPECT_TRUE(t->sampler_shadow);
+   EXPECT_FALSE(t->sampler_array);
+   EXPECT_EQ(t->sampler_type, GLSL_TYPE_FLOAT);
+   EXPECT_STREQ("sampler2DRectShadow", t->name);
+}
+
+TEST(get_sampler_instance, sampler1DArray)
+{
+   const glsl_type *const t =
+      glsl_type::get_sampler_instance(GLSL_SAMPLER_DIM_1D,
+				      false,
+				      true,
+				      GLSL_TYPE_FLOAT);
+
+   ASSERT_NE(t, NULL);
+   EXPECT_EQ(t->base_type, GLSL_TYPE_SAMPLER);
+   EXPECT_EQ(t->sampler_dimensionality, GLSL_SAMPLER_DIM_1D);
+   EXPECT_FALSE(t->sampler_shadow);
+   EXPECT_TRUE(t->sampler_array);
+   EXPECT_EQ(t->sampler_type, GLSL_TYPE_FLOAT);
+   EXPECT_STREQ("sampler1DArray", t->name);
+}
+
+TEST(get_sampler_instance, sampler2DArray)
+{
+   const glsl_type *const t =
+      glsl_type::get_sampler_instance(GLSL_SAMPLER_DIM_2D,
+				      false,
+				      true,
+				      GLSL_TYPE_FLOAT);
+
+   ASSERT_NE(t, NULL);
+   EXPECT_EQ(t->base_type, GLSL_TYPE_SAMPLER);
+   EXPECT_EQ(t->sampler_dimensionality, GLSL_SAMPLER_DIM_2D);
+   EXPECT_FALSE(t->sampler_shadow);
+   EXPECT_TRUE(t->sampler_array);
+   EXPECT_EQ(t->sampler_type, GLSL_TYPE_FLOAT);
+   EXPECT_STREQ("sampler2DArray", t->name);
+}
+
+TEST(get_sampler_instance, sampler1DArrayShadow)
+{
+   const glsl_type *const t =
+      glsl_type::get_sampler_instance(GLSL_SAMPLER_DIM_1D,
+				      true,
+				      true,
+				      GLSL_TYPE_FLOAT);
+
+   ASSERT_NE(t, NULL);
+   EXPECT_EQ(t->base_type, GLSL_TYPE_SAMPLER);
+   EXPECT_EQ(t->sampler_dimensionality, GLSL_SAMPLER_DIM_1D);
+   EXPECT_TRUE(t->sampler_shadow);
+   EXPECT_TRUE(t->sampler_array);
+   EXPECT_EQ(t->sampler_type, GLSL_TYPE_FLOAT);
+   EXPECT_STREQ("sampler1DArrayShadow", t->name);
+}
+
+TEST(get_sampler_instance, sampler2DArrayShadow)
+{
+   const glsl_type *const t =
+      glsl_type::get_sampler_instance(GLSL_SAMPLER_DIM_2D,
+				      true,
+				      true,
+				      GLSL_TYPE_FLOAT);
+
+   ASSERT_NE(t, NULL);
+   EXPECT_EQ(t->base_type, GLSL_TYPE_SAMPLER);
+   EXPECT_EQ(t->sampler_dimensionality, GLSL_SAMPLER_DIM_2D);
+   EXPECT_TRUE(t->sampler_shadow);
+   EXPECT_TRUE(t->sampler_array);
+   EXPECT_EQ(t->sampler_type, GLSL_TYPE_FLOAT);
+   EXPECT_STREQ("sampler2DArrayShadow", t->name);
+}
+
+TEST(get_sampler_instance, samplerBuffer)
+{
+   const glsl_type *const t =
+      glsl_type::get_sampler_instance(GLSL_SAMPLER_DIM_BUF,
+				      false,
+				      false,
+				      GLSL_TYPE_FLOAT);
+
+   ASSERT_NE(t, NULL);
+   EXPECT_EQ(t->base_type, GLSL_TYPE_SAMPLER);
+   EXPECT_EQ(t->sampler_dimensionality, GLSL_SAMPLER_DIM_BUF);
+   EXPECT_FALSE(t->sampler_shadow);
+   EXPECT_FALSE(t->sampler_array);
+   EXPECT_EQ(t->sampler_type, GLSL_TYPE_FLOAT);
+   EXPECT_STREQ("samplerBuffer", t->name);
+}
+
+TEST(get_sampler_instance, isamplerBuffer)
+{
+   const glsl_type *const t =
+      glsl_type::get_sampler_instance(GLSL_SAMPLER_DIM_BUF,
+				      false,
+				      false,
+				      GLSL_TYPE_INT);
+
+   ASSERT_NE(t, NULL);
+   EXPECT_EQ(t->base_type, GLSL_TYPE_SAMPLER);
+   EXPECT_EQ(t->sampler_dimensionality, GLSL_SAMPLER_DIM_BUF);
+   EXPECT_FALSE(t->sampler_shadow);
+   EXPECT_FALSE(t->sampler_array);
+   EXPECT_EQ(t->sampler_type, GLSL_TYPE_INT);
+   EXPECT_STREQ("isamplerBuffer", t->name);
+}
+
+TEST(get_sampler_instance, usamplerBuffer)
+{
+   const glsl_type *const t =
+      glsl_type::get_sampler_instance(GLSL_SAMPLER_DIM_BUF,
+				      false,
+				      false,
+				      GLSL_TYPE_UINT);
+
+   ASSERT_NE(t, NULL);
+   EXPECT_EQ(t->base_type, GLSL_TYPE_SAMPLER);
+   EXPECT_EQ(t->sampler_dimensionality, GLSL_SAMPLER_DIM_BUF);
+   EXPECT_FALSE(t->sampler_shadow);
+   EXPECT_FALSE(t->sampler_array);
+   EXPECT_EQ(t->sampler_type, GLSL_TYPE_UINT);
+   EXPECT_STREQ("usamplerBuffer", t->name);
+}
+
+TEST(get_sampler_instance, samplerExternalOES)
+{
+   const glsl_type *const t =
+      glsl_type::get_sampler_instance(GLSL_SAMPLER_DIM_EXTERNAL,
+				      false,
+				      false,
+				      GLSL_TYPE_FLOAT);
+
+   ASSERT_NE(t, NULL);
+   EXPECT_EQ(t->base_type, GLSL_TYPE_SAMPLER);
+   EXPECT_EQ(t->sampler_dimensionality, GLSL_SAMPLER_DIM_EXTERNAL);
+   EXPECT_FALSE(t->sampler_shadow);
+   EXPECT_FALSE(t->sampler_array);
+   EXPECT_EQ(t->sampler_type, GLSL_TYPE_FLOAT);
+   EXPECT_STREQ("samplerExternalOES", t->name);
+}
-- 
1.7.11.3



More information about the mesa-dev mailing list