summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2010-02-10 08:22:57 -0700
committerBrian Paul <brianp@vmware.com>2010-02-10 16:14:37 -0700
commitff56f1be9d8cdc5422c35656ea6df2c00400f368 (patch)
tree4832b9ad521fe3b58a036b659ea66d845910c988
parentae1bca91a602e11c5365ebcc0cb0a82de2d0fae2 (diff)
glsl1: added tests of the #extension directive.
Note that #2 fails with Mesa/master and #3 fails with NVIDIA's 190.53 driver at this time.
-rw-r--r--src/glean/tglsl1.cpp63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/glean/tglsl1.cpp b/src/glean/tglsl1.cpp
index fe6c24a..937685e 100644
--- a/src/glean/tglsl1.cpp
+++ b/src/glean/tglsl1.cpp
@@ -94,6 +94,7 @@ static PFNGLUNIFORMMATRIX4X3FVPROC glUniformMatrix4x3fv_func = NULL;
#define FLAG_VERSION_1_20 0x8 // GLSL 1.20 test
#define FLAG_WINDING_CW 0x10 // clockwise-winding polygon
#define FLAG_VERTEX_TEXTURE 0x20
+#define FLAG_ARB_DRAW_BUFFERS 0x40
#define DONT_CARE_Z -1.0
@@ -3049,6 +3050,60 @@ static const ShaderProgram Programs[] = {
},
{
+ /* Test the #extension directive.
+ * This test will only be run if we have the GL_ARB_draw_buffers
+ * extension. Note the FLAG_ARB_DRAW_BUFFERS flag.
+ */
+ "Preprocessor test (extension test 1)",
+ NO_VERTEX_SHADER,
+ "#extension GL_ARB_draw_buffers: enable\n"
+ "void main() { \n"
+ "#if GL_ARB_draw_buffers \n"
+ " gl_FragColor = vec4(0.0, 1.0, 0.0, 0.0); \n"
+ "#else \n"
+ " gl_FragColor = vec4(1.0, 0.0, 0.0, 0.0); \n"
+ "#endif \n"
+ "} \n",
+ { 0.0, 1.0, 0.0, 0.0 },
+ DONT_CARE_Z,
+ FLAG_ARB_DRAW_BUFFERS
+ },
+
+ {
+ /* As above, but use #if defined test. */
+ "Preprocessor test (extension test 2)",
+ NO_VERTEX_SHADER,
+ "#extension GL_ARB_draw_buffers: enable\n"
+ "void main() { \n"
+ "#if defined(GL_ARB_draw_buffers) \n"
+ " gl_FragColor = vec4(0.0, 1.0, 0.0, 0.0); \n"
+ "#else \n"
+ " gl_FragColor = vec4(1.0, 0.0, 0.0, 0.0); \n"
+ "#endif \n"
+ "} \n",
+ { 0.0, 1.0, 0.0, 0.0 },
+ DONT_CARE_Z,
+ FLAG_ARB_DRAW_BUFFERS
+ },
+
+ {
+ /* Test extension disabling. */
+ "Preprocessor test (extension test 3)",
+ NO_VERTEX_SHADER,
+ "#extension GL_ARB_draw_buffers: disable\n"
+ "void main() { \n"
+ "#if defined(GL_ARB_draw_buffers) \n"
+ " gl_FragColor = vec4(1.0, 0.0, 0.0, 0.0); \n"
+ "#else \n"
+ " gl_FragColor = vec4(0.0, 1.0, 0.0, 0.0); \n"
+ "#endif \n"
+ "} \n",
+ { 0.0, 1.0, 0.0, 0.0 },
+ DONT_CARE_Z,
+ FLAG_ARB_DRAW_BUFFERS
+ },
+
+ {
"Preprocessor test (11)",
NO_VERTEX_SHADER,
"#define FOO \n"
@@ -4333,6 +4388,14 @@ GLSLTest::testProgram(const ShaderProgram &p)
GLint umat2x4, umat2x4t, umat4x3, umat4x3t;
bool retVal = false;
+ if (p.flags & FLAG_ARB_DRAW_BUFFERS &&
+ !GLUtils::haveExtensions("GL_ARB_draw_buffers")) {
+ // skip
+ retVal = true;
+ goto cleanup;
+ }
+
+
if (p.fragShaderString) {
fragShader = loadAndCompileShader(GL_FRAGMENT_SHADER,
p.fragShaderString);