[Piglit] [PATCH] glsl: Add precision qualifier tests for sampler types in GLSL and GLSL ES

Anuj Phogat anuj.phogat at gmail.com
Fri Aug 30 09:55:58 PDT 2013


Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
 .../default-precision-sampler.frag                 | 58 +++++++++++++++++++
 .../default-precision-sampler.vert                 | 59 +++++++++++++++++++
 .../precision-qualifiers/precision-sampler.frag    | 66 +++++++++++++++++++++
 .../precision-qualifiers/precision-sampler.vert    | 67 ++++++++++++++++++++++
 .../glsl-es-3.00/compiler/precision-sampler.frag   | 49 ++++++++++++++++
 .../glsl-es-3.00/compiler/precision-sampler.vert   | 50 ++++++++++++++++
 6 files changed, 349 insertions(+)
 create mode 100644 tests/spec/glsl-1.30/compiler/precision-qualifiers/default-precision-sampler.frag
 create mode 100644 tests/spec/glsl-1.30/compiler/precision-qualifiers/default-precision-sampler.vert
 create mode 100644 tests/spec/glsl-1.30/compiler/precision-qualifiers/precision-sampler.frag
 create mode 100644 tests/spec/glsl-1.30/compiler/precision-qualifiers/precision-sampler.vert
 create mode 100644 tests/spec/glsl-es-3.00/compiler/precision-sampler.frag
 create mode 100644 tests/spec/glsl-es-3.00/compiler/precision-sampler.vert

diff --git a/tests/spec/glsl-1.30/compiler/precision-qualifiers/default-precision-sampler.frag b/tests/spec/glsl-1.30/compiler/precision-qualifiers/default-precision-sampler.frag
new file mode 100644
index 0000000..0210d50
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/precision-qualifiers/default-precision-sampler.frag
@@ -0,0 +1,58 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.30
+// check_link: true
+// [end config]
+//
+// From the GLSL ES 3.00 specification, section 4.5.4 ("Default
+// Precision Qualifiers"):
+//
+//     "The precision statement
+//
+//         precision precision-qualifier type;
+//
+//     can be used to establish a default precision qualifier. The
+//     type field can be int or float or any of the sampler types, and
+//     the precision-qualifier can be lowp, mediump, or highp."
+//
+// Section 4.5 (Precision and Precision Qualifiers) of the GLSL 1.30
+// spec also says:
+//
+// "Precision qualifiers are added for code portability with OpenGL
+//  ES, not for functionality. They have the same syntax as in OpenGL ES."
+//
+// From this, we infer that GLSL 1.30 (and later) should allow precision
+// qualifiers on sampler types just like float and integer types.
+//
+// This test verifies that a default precision qualifier can be used
+// on all of GLSL 1.30's sampler types.
+
+#version 130
+
+precision mediump sampler1D;
+precision mediump sampler2D;
+precision mediump sampler3D;
+precision mediump samplerCube;
+precision mediump samplerCubeShadow;
+precision mediump sampler1DShadow;
+precision mediump sampler2DShadow;
+precision mediump sampler1DArray;
+precision mediump sampler2DArray;
+precision mediump sampler1DArrayShadow;
+precision mediump sampler2DArrayShadow;
+precision mediump isampler1D;
+precision mediump isampler2D;
+precision mediump isampler3D;
+precision mediump isamplerCube;
+precision mediump isampler1DArray;
+precision mediump isampler2DArray;
+precision mediump usampler1D;
+precision mediump usampler2D;
+precision mediump usampler3D;
+precision mediump usamplerCube;
+precision mediump usampler1DArray;
+precision mediump usampler2DArray;
+
+void main()
+{
+}
diff --git a/tests/spec/glsl-1.30/compiler/precision-qualifiers/default-precision-sampler.vert b/tests/spec/glsl-1.30/compiler/precision-qualifiers/default-precision-sampler.vert
new file mode 100644
index 0000000..65020a7
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/precision-qualifiers/default-precision-sampler.vert
@@ -0,0 +1,59 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.30
+// check_link: true
+// [end config]
+//
+// From the GLSL ES 3.00 specification, section 4.5.4 ("Default
+// Precision Qualifiers"):
+//
+//     "The precision statement
+//
+//         precision precision-qualifier type;
+//
+//     can be used to establish a default precision qualifier. The
+//     type field can be int or float or any of the sampler types, and
+//     the precision-qualifier can be lowp, mediump, or highp."
+//
+// Section 4.5 (Precision and Precision Qualifiers) of the GLSL 1.30
+// spec also says:
+//
+// "Precision qualifiers are added for code portability with OpenGL
+//  ES, not for functionality. They have the same syntax as in OpenGL ES."
+//
+// From this, we infer that GLSL 1.30 (and later) should allow precision
+// qualifiers on sampler types just like float and integer types.
+//
+// This test verifies that a default precision qualifier can be used
+// on all of GLSL 1.30's sampler types.
+
+#version 130
+
+precision mediump sampler1D;
+precision mediump sampler2D;
+precision mediump sampler3D;
+precision mediump samplerCube;
+precision mediump samplerCubeShadow;
+precision mediump sampler1DShadow;
+precision mediump sampler2DShadow;
+precision mediump sampler1DArray;
+precision mediump sampler2DArray;
+precision mediump sampler1DArrayShadow;
+precision mediump sampler2DArrayShadow;
+precision mediump isampler1D;
+precision mediump isampler2D;
+precision mediump isampler3D;
+precision mediump isamplerCube;
+precision mediump isampler1DArray;
+precision mediump isampler2DArray;
+precision mediump usampler1D;
+precision mediump usampler2D;
+precision mediump usampler3D;
+precision mediump usamplerCube;
+precision mediump usampler1DArray;
+precision mediump usampler2DArray;
+
+void main()
+{
+	gl_Position = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/precision-qualifiers/precision-sampler.frag b/tests/spec/glsl-1.30/compiler/precision-qualifiers/precision-sampler.frag
new file mode 100644
index 0000000..e1d371b
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/precision-qualifiers/precision-sampler.frag
@@ -0,0 +1,66 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.30
+// check_link: true
+// [end config]
+//
+// From the GLSL ES 3.00 specification, section 4.5.4 ("Default
+// Precision Qualifiers"):
+//
+// "The precision statement
+//
+// precision precision-qualifier type;
+//
+// can be used to establish a default precision qualifier. The
+// type field can be int or float or any of the sampler types, and
+// the precision-qualifier can be lowp, mediump, or highp."
+//
+// Section 8 (Built-In Functions) of the GLSL ES 1.00 spec says:
+
+// "uniform lowp sampler2D sampler;
+//  highp vec2 coord;
+//  ...
+//  lowp vec4 col = texture2D (sampler, coord);
+//                                         // texture2D returns lowp"
+//
+// Section 4.5 (Precision and Precision Qualifiers) of the GLSL 1.30
+// spec also says:
+//
+// "Precision qualifiers are added for code portability with OpenGL
+//  ES, not for functionality. They have the same syntax as in OpenGL ES."
+//
+// From this, we infer that GLSL 1.30 (and later) should allow precision
+// qualifiers on sampler types just like float and integer types.
+//
+// This test verifies that a precision qualifier can be used on all of
+// GLSL 1.30's sampler types.
+
+#version 130
+
+uniform mediump sampler1D s1;
+uniform mediump sampler2D s2;
+uniform mediump sampler3D s3;
+uniform mediump samplerCube s4;
+uniform mediump samplerCubeShadow s5;
+uniform mediump sampler1DShadow s6;
+uniform mediump sampler2DShadow s7;
+uniform mediump sampler1DArray s8;
+uniform mediump sampler2DArray s9;
+uniform mediump sampler1DArrayShadow s10;
+uniform mediump sampler2DArrayShadow s11;
+uniform mediump isampler1D s12;
+uniform mediump isampler2D s13;
+uniform mediump isampler3D s14;
+uniform mediump isamplerCube s15;
+uniform mediump isampler1DArray s16;
+uniform mediump isampler2DArray s17;
+uniform mediump usampler1D s18;
+uniform mediump usampler2D s19;
+uniform mediump usampler3D s20;
+uniform mediump usamplerCube s21;
+uniform mediump usampler1DArray s22;
+uniform mediump usampler2DArray s23;
+
+void main()
+{
+}
diff --git a/tests/spec/glsl-1.30/compiler/precision-qualifiers/precision-sampler.vert b/tests/spec/glsl-1.30/compiler/precision-qualifiers/precision-sampler.vert
new file mode 100644
index 0000000..8970be3
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/precision-qualifiers/precision-sampler.vert
@@ -0,0 +1,67 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.30
+// check_link: true
+// [end config]
+//
+// From the GLSL ES 3.00 specification, section 4.5.4 ("Default
+// Precision Qualifiers"):
+//
+// "The precision statement
+//
+// precision precision-qualifier type;
+//
+// can be used to establish a default precision qualifier. The
+// type field can be int or float or any of the sampler types, and
+// the precision-qualifier can be lowp, mediump, or highp."
+//
+// Section 8 (Built-In Functions) of the GLSL ES 1.00 spec says:
+
+// "uniform lowp sampler2D sampler;
+//  highp vec2 coord;
+//  ...
+//  lowp vec4 col = texture2D (sampler, coord);
+//                                         // texture2D returns lowp"
+//
+// Section 4.5 (Precision and Precision Qualifiers) of the GLSL 1.30
+// spec also says:
+//
+// "Precision qualifiers are added for code portability with OpenGL
+//  ES, not for functionality. They have the same syntax as in OpenGL ES."
+//
+// From this, we infer that GLSL 1.30 (and later) should allow precision
+// qualifiers on sampler types just like float and integer types.
+//
+// This test verifies that a precision qualifier can be used on all of
+// GLSL 1.30's sampler types.
+
+#version 130
+
+uniform mediump sampler1D s1;
+uniform mediump sampler2D s2;
+uniform mediump sampler3D s3;
+uniform mediump samplerCube s4;
+uniform mediump samplerCubeShadow s5;
+uniform mediump sampler1DShadow s6;
+uniform mediump sampler2DShadow s7;
+uniform mediump sampler1DArray s8;
+uniform mediump sampler2DArray s9;
+uniform mediump sampler1DArrayShadow s10;
+uniform mediump sampler2DArrayShadow s11;
+uniform mediump isampler1D s12;
+uniform mediump isampler2D s13;
+uniform mediump isampler3D s14;
+uniform mediump isamplerCube s15;
+uniform mediump isampler1DArray s16;
+uniform mediump isampler2DArray s17;
+uniform mediump usampler1D s18;
+uniform mediump usampler2D s19;
+uniform mediump usampler3D s20;
+uniform mediump usamplerCube s21;
+uniform mediump usampler1DArray s22;
+uniform mediump usampler2DArray s23;
+
+void main()
+{
+	gl_Position = vec4(0.0);
+}
diff --git a/tests/spec/glsl-es-3.00/compiler/precision-sampler.frag b/tests/spec/glsl-es-3.00/compiler/precision-sampler.frag
new file mode 100644
index 0000000..346ebb3
--- /dev/null
+++ b/tests/spec/glsl-es-3.00/compiler/precision-sampler.frag
@@ -0,0 +1,49 @@
+// [config]
+// expect_result: pass
+// glsl_version: 3.00 es
+// check_link: true
+// [end config]
+//
+// From the GLSL ES 3.00 specification, section 4.5.4 ("Default
+// Precision Qualifiers"):
+//
+// "The precision statement
+//
+// precision precision-qualifier type;
+//
+// can be used to establish a default precision qualifier. The
+// type field can be int or float or any of the sampler types, and
+// the precision-qualifier can be lowp, mediump, or highp."
+//
+// Section 8 (Built-In Functions) of the GLSL ES 1.00 spec says:
+//
+// "uniform lowp sampler2D sampler;
+//  highp vec2 coord;
+//  ...
+//  lowp vec4 col = texture2D (sampler, coord);
+//                                         // texture2D returns lowp"
+//
+// This test verifies that a precision qualifier can be used on all of
+// GLSL ES 3.00's sampler types.
+
+#version 300 es
+
+uniform mediump sampler2D s1;
+uniform mediump sampler3D s2;
+uniform mediump samplerCube s3;
+uniform mediump samplerCubeShadow s4;
+uniform mediump sampler2DShadow s5;
+uniform mediump sampler2DArray s6;
+uniform mediump sampler2DArrayShadow s7;
+uniform mediump isampler2D s8;
+uniform mediump isampler3D s9;
+uniform mediump isamplerCube s10;
+uniform mediump isampler2DArray s11;
+uniform mediump usampler2D s12;
+uniform mediump usampler3D s13;
+uniform mediump usamplerCube s14;
+uniform mediump usampler2DArray s15;
+
+void main()
+{
+}
diff --git a/tests/spec/glsl-es-3.00/compiler/precision-sampler.vert b/tests/spec/glsl-es-3.00/compiler/precision-sampler.vert
new file mode 100644
index 0000000..a25a537
--- /dev/null
+++ b/tests/spec/glsl-es-3.00/compiler/precision-sampler.vert
@@ -0,0 +1,50 @@
+// [config]
+// expect_result: pass
+// glsl_version: 3.00 es
+// check_link: true
+// [end config]
+//
+// From the GLSL ES 3.00 specification, section 4.5.4 ("Default
+// Precision Qualifiers"):
+//
+// "The precision statement
+//
+// precision precision-qualifier type;
+//
+// can be used to establish a default precision qualifier. The
+// type field can be int or float or any of the sampler types, and
+// the precision-qualifier can be lowp, mediump, or highp."
+//
+// Section 8 (Built-In Functions) of the GLSL ES 1.00 spec says:
+
+// "uniform lowp sampler2D sampler;
+//  highp vec2 coord;
+//  ...
+//  lowp vec4 col = texture2D (sampler, coord);
+//                                         // texture2D returns lowp"
+//
+// This test verifies that a precision qualifier can be used on all of
+// GLSL ES 3.00's sampler types.
+
+#version 300 es
+
+uniform mediump sampler2D s1;
+uniform mediump sampler3D s2;
+uniform mediump samplerCube s3;
+uniform mediump samplerCubeShadow s4;
+uniform mediump sampler2DShadow s5;
+uniform mediump sampler2DArray s6;
+uniform mediump sampler2DArrayShadow s7;
+uniform mediump isampler2D s8;
+uniform mediump isampler3D s9;
+uniform mediump isamplerCube s10;
+uniform mediump isampler2DArray s11;
+uniform mediump usampler2D s12;
+uniform mediump usampler3D s13;
+uniform mediump usamplerCube s14;
+uniform mediump usampler2DArray s15;
+
+void main()
+{
+	gl_Position = vec4(0.0);
+}
-- 
1.8.1.4



More information about the Piglit mailing list