[Piglit] [PATCH] GL_EXT_transform_feedback/discard-*: New tests for GL_RASTERIZER_DISCARD
Eric Anholt
eric at anholt.net
Thu Sep 29 23:41:18 PDT 2011
---
tests/all.tests | 6 ++
.../spec/ext_transform_feedback/CMakeLists.gl.txt | 6 ++
tests/spec/ext_transform_feedback/discard-api.c | 75 ++++++++++++++++
tests/spec/ext_transform_feedback/discard-bitmap.c | 88 +++++++++++++++++++
tests/spec/ext_transform_feedback/discard-clear.c | 72 +++++++++++++++
.../ext_transform_feedback/discard-copypixels.c | 83 ++++++++++++++++++
.../ext_transform_feedback/discard-drawarrays.c | 73 ++++++++++++++++
.../ext_transform_feedback/discard-drawpixels.c | 92 ++++++++++++++++++++
8 files changed, 495 insertions(+), 0 deletions(-)
create mode 100644 tests/spec/ext_transform_feedback/discard-api.c
create mode 100644 tests/spec/ext_transform_feedback/discard-bitmap.c
create mode 100644 tests/spec/ext_transform_feedback/discard-clear.c
create mode 100644 tests/spec/ext_transform_feedback/discard-copypixels.c
create mode 100644 tests/spec/ext_transform_feedback/discard-drawarrays.c
create mode 100644 tests/spec/ext_transform_feedback/discard-drawpixels.c
diff --git a/tests/all.tests b/tests/all.tests
index 507601c..ea3fa3e 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1228,6 +1228,12 @@ ext_texture_srgb['invalid formats'].runConcurrent = True
ext_transform_feedback = Group()
spec['EXT_transform_feedback'] = ext_transform_feedback
+ext_transform_feedback['discard-api'] = concurrent_test('ext_transform_feedback-discard-api')
+ext_transform_feedback['discard-bitmap'] = concurrent_test('ext_transform_feedback-discard-bitmap')
+ext_transform_feedback['discard-clear'] = concurrent_test('ext_transform_feedback-discard-clear')
+ext_transform_feedback['discard-copypixels'] = concurrent_test('ext_transform_feedback-discard-copypixels')
+ext_transform_feedback['discard-drawarrays'] = concurrent_test('ext_transform_feedback-discard-drawarrays')
+ext_transform_feedback['discard-drawpixels'] = concurrent_test('ext_transform_feedback-discard-drawpixels')
ext_transform_feedback['position-readback-bufferbase'] = PlainExecTest(['ext_transform_feedback-position', '-auto'])
ext_transform_feedback['position-readback-bufferbase-discard'] = PlainExecTest(['ext_transform_feedback-position', '-auto', 'discard'])
ext_transform_feedback['position-readback-bufferoffset'] = PlainExecTest(['ext_transform_feedback-position', '-auto', 'offset'])
diff --git a/tests/spec/ext_transform_feedback/CMakeLists.gl.txt b/tests/spec/ext_transform_feedback/CMakeLists.gl.txt
index 739efa1..fd8856d 100644
--- a/tests/spec/ext_transform_feedback/CMakeLists.gl.txt
+++ b/tests/spec/ext_transform_feedback/CMakeLists.gl.txt
@@ -12,6 +12,12 @@ link_libraries (
${GLUT_glut_LIBRARY}
)
+add_executable (ext_transform_feedback-discard-api discard-api.c)
+add_executable (ext_transform_feedback-discard-bitmap discard-bitmap.c)
+add_executable (ext_transform_feedback-discard-clear discard-clear.c)
+add_executable (ext_transform_feedback-discard-copypixels discard-copypixels.c)
+add_executable (ext_transform_feedback-discard-drawarrays discard-drawarrays.c)
+add_executable (ext_transform_feedback-discard-drawpixels discard-drawpixels.c)
add_executable (ext_transform_feedback-position position.c)
add_executable (ext_transform_feedback-interleaved interleaved.c)
add_executable (ext_transform_feedback-separate separate.c)
diff --git a/tests/spec/ext_transform_feedback/discard-api.c b/tests/spec/ext_transform_feedback/discard-api.c
new file mode 100644
index 0000000..e21b28c
--- /dev/null
+++ b/tests/spec/ext_transform_feedback/discard-api.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright © 2011 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 "piglit-util.h"
+
+/**
+ * @file discard-api.c
+ *
+ * Tests basic API support for GL_RASTERIZER_DISCARD.
+ *
+ * From the EXT_transform_feedback spec:
+ *
+ * "Accepted by the <cap> parameter of Enable, Disable, and
+ * IsEnabled, and by the <pname> parameter of GetBooleanv,
+ * GetIntegerv, GetFloatv, and GetDoublev:
+ *
+ * RASTERIZER_DISCARD_EXT 0x8C89"
+ */
+
+int piglit_width = 32;
+int piglit_height = 32;
+int piglit_window_mode = GLUT_DOUBLE | GLUT_RGB | GLUT_ALPHA;
+
+enum piglit_result
+piglit_display(void)
+{
+ /* UNREACHED */
+ return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ GLint enabled;
+
+ piglit_require_extension("GL_EXT_transform_feedback");
+
+ glEnable(GL_RASTERIZER_DISCARD);
+ if (!glIsEnabled(GL_RASTERIZER_DISCARD))
+ piglit_report_result(PIGLIT_FAIL);
+ glGetIntegerv(GL_RASTERIZER_DISCARD, &enabled);
+ if (!enabled)
+ piglit_report_result(PIGLIT_FAIL);
+ piglit_check_gl_error(GL_NO_ERROR, PIGLIT_FAIL);
+
+ glDisable(GL_RASTERIZER_DISCARD);
+ if (glIsEnabled(GL_RASTERIZER_DISCARD))
+ piglit_report_result(PIGLIT_FAIL);
+ glGetIntegerv(GL_RASTERIZER_DISCARD, &enabled);
+ if (enabled)
+ piglit_report_result(PIGLIT_FAIL);
+ piglit_check_gl_error(GL_NO_ERROR, PIGLIT_FAIL);
+
+ piglit_report_result(PIGLIT_PASS);
+}
diff --git a/tests/spec/ext_transform_feedback/discard-bitmap.c b/tests/spec/ext_transform_feedback/discard-bitmap.c
new file mode 100644
index 0000000..c524b84
--- /dev/null
+++ b/tests/spec/ext_transform_feedback/discard-bitmap.c
@@ -0,0 +1,88 @@
+/*
+ * Copyright © 2011 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 "piglit-util.h"
+
+/**
+ * @file discard-bitmap.c
+ *
+ * Tests that GL_RASTERIZER_DISCARD appropriately affects glBitmap().
+ *
+ * From the EXT_transform_feedback spec:
+ *
+ * "Primitives can be optionally discarded before rasterization by
+ * calling Enable and Disable with RASTERIZER_DISCARD_EXT. When
+ * enabled, primitives are discared right before the
+ * rasterization stage, but after the optional transform feedback
+ * stage. When disabled, primitives are passed through to the
+ * rasterization stage to be processed
+ * normally. RASTERIZER_DISCARD_EXT applies to the DrawPixels,
+ * CopyPixels, Bitmap, Clear and Accum commands as well."
+ */
+
+int piglit_width = 32;
+int piglit_height = 32;
+int piglit_window_mode = GLUT_DOUBLE | GLUT_RGB | GLUT_ALPHA;
+
+enum piglit_result
+piglit_display(void)
+{
+ bool pass = true;
+ float green[4] = {0.0, 1.0, 0.0, 0.0};
+ void *buf;
+
+ /* Massively overallocate the bitmap, and set it to all on */
+ buf = malloc(piglit_width * piglit_height);
+ memset(buf, 0xff, piglit_width * piglit_height);
+
+ glClearColor(0.5, 0.5, 0.5, 0.5);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ /* Bitmap render that should draw the whole screen. */
+ glDisable(GL_RASTERIZER_DISCARD);
+ glColor4f(0.0, 1.0, 0.0, 0.0);
+ glRasterPos2i(-1, -1);
+ glBitmap(piglit_width, piglit_height, 0, 0, 0, 0, buf);
+
+ /* Bitmap render that should not draw full screen. */
+ glEnable(GL_RASTERIZER_DISCARD);
+ glColor4f(1.0, 0.0, 0.0, 0.0);
+ glRasterPos2i(-1, -1);
+ glBitmap(piglit_width, piglit_height, 0, 0, 0, 0, buf);
+
+ glDisable(GL_RASTERIZER_DISCARD);
+
+ pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, green);
+
+ piglit_present_results();
+
+ free(buf);
+
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ piglit_require_extension("GL_EXT_transform_feedback");
+}
diff --git a/tests/spec/ext_transform_feedback/discard-clear.c b/tests/spec/ext_transform_feedback/discard-clear.c
new file mode 100644
index 0000000..bfc50e3
--- /dev/null
+++ b/tests/spec/ext_transform_feedback/discard-clear.c
@@ -0,0 +1,72 @@
+/*
+ * Copyright © 2011 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 "piglit-util.h"
+
+/**
+ * @file discard-clear.c
+ *
+ * Tests that GL_RASTERIZER_DISCARD appropriately affects glClear().
+ *
+ * From the EXT_transform_feedback spec:
+ *
+ * "Primitives can be optionally discarded before rasterization by
+ * calling Enable and Disable with RASTERIZER_DISCARD_EXT. When
+ * enabled, primitives are discared right before the
+ * rasterization stage, but after the optional transform feedback
+ * stage. When disabled, primitives are passed through to the
+ * rasterization stage to be processed
+ * normally. RASTERIZER_DISCARD_EXT applies to the DrawPixels,
+ * CopyPixels, Bitmap, Clear and Accum commands as well."
+ */
+
+int piglit_width = 32;
+int piglit_height = 32;
+int piglit_window_mode = GLUT_DOUBLE | GLUT_RGB | GLUT_ALPHA;
+
+enum piglit_result
+piglit_display(void)
+{
+ bool pass = true;
+ float green[4] = {0.0, 1.0, 0.0, 0.0};
+
+ glDisable(GL_RASTERIZER_DISCARD);
+ glClearColor(0.0, 1.0, 0.0, 0.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ glEnable(GL_RASTERIZER_DISCARD);
+ glClearColor(1.0, 0.0, 0.0, 0.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, green);
+
+ piglit_present_results();
+
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ piglit_require_extension("GL_EXT_transform_feedback");
+}
diff --git a/tests/spec/ext_transform_feedback/discard-copypixels.c b/tests/spec/ext_transform_feedback/discard-copypixels.c
new file mode 100644
index 0000000..7c5cf78
--- /dev/null
+++ b/tests/spec/ext_transform_feedback/discard-copypixels.c
@@ -0,0 +1,83 @@
+/*
+ * Copyright © 2011 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 "piglit-util.h"
+
+/**
+ * @file discard-copypixels.c
+ *
+ * Tests that GL_RASTERIZER_DISCARD appropriately affects glCopyPixels().
+ *
+ * From the EXT_transform_feedback spec:
+ *
+ * "Primitives can be optionally discarded before rasterization by
+ * calling Enable and Disable with RASTERIZER_DISCARD_EXT. When
+ * enabled, primitives are discared right before the
+ * rasterization stage, but after the optional transform feedback
+ * stage. When disabled, primitives are passed through to the
+ * rasterization stage to be processed
+ * normally. RASTERIZER_DISCARD_EXT applies to the DrawPixels,
+ * CopyPixels, Bitmap, Clear and Accum commands as well."
+ */
+
+int piglit_width = 32;
+int piglit_height = 32;
+int piglit_window_mode = GLUT_DOUBLE | GLUT_RGB | GLUT_ALPHA;
+
+enum piglit_result
+piglit_display(void)
+{
+ bool pass = true;
+ float green[4] = {0.0, 1.0, 0.0, 0.0};
+
+ /* Clear red. */
+ glClearColor(1.0, 0.0, 0.0, 0.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ /* Draw top half of screen green. */
+ glColor4f(0.0, 1.0, 0.0, 0.0);
+ piglit_draw_rect(-1, 0, 2, 1);
+
+ /* Discard a copy over the bottom red over the top green. */
+ glEnable(GL_RASTERIZER_DISCARD);
+ glRasterPos2i(-1, 0);
+ glCopyPixels(0, 0, piglit_width, piglit_height / 2, GL_COLOR);
+
+ /* Don't discard a copy of the green over the remaining red. */
+ glDisable(GL_RASTERIZER_DISCARD);
+ glRasterPos2i(-1, -1);
+ glCopyPixels(0, piglit_height / 2, piglit_width, piglit_height / 2,
+ GL_COLOR);
+
+ pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, green);
+
+ piglit_present_results();
+
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ piglit_require_extension("GL_EXT_transform_feedback");
+}
diff --git a/tests/spec/ext_transform_feedback/discard-drawarrays.c b/tests/spec/ext_transform_feedback/discard-drawarrays.c
new file mode 100644
index 0000000..7ee03da
--- /dev/null
+++ b/tests/spec/ext_transform_feedback/discard-drawarrays.c
@@ -0,0 +1,73 @@
+/*
+ * Copyright © 2011 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 "piglit-util.h"
+
+/**
+ * @file discard-drawarrays.c
+ *
+ * Tests that GL_RASTERIZER_DISCARD appropriately affects a basic
+ * glDrawArrays().
+ *
+ * From the EXT_transform_feedback spec:
+ *
+ * "Primitives can be optionally discarded before rasterization by
+ * calling Enable and Disable with RASTERIZER_DISCARD_EXT. When
+ * enabled, primitives are discared right before the
+ * rasterization stage, but after the optional transform feedback
+ * stage. When disabled, primitives are passed through to the
+ * rasterization stage to be processed
+ * normally. RASTERIZER_DISCARD_EXT applies to the DrawPixels,
+ * CopyPixels, Bitmap, Clear and Accum commands as well."
+ */
+
+int piglit_width = 32;
+int piglit_height = 32;
+int piglit_window_mode = GLUT_DOUBLE | GLUT_RGB | GLUT_ALPHA;
+
+enum piglit_result
+piglit_display(void)
+{
+ bool pass = true;
+ float green[4] = {0.0, 1.0, 0.0, 0.0};
+
+ glDisable(GL_RASTERIZER_DISCARD);
+ glColor4f(0.0, 1.0, 0.0, 0.0);
+ piglit_draw_rect(-1, -1, 2, 2);
+
+ glEnable(GL_RASTERIZER_DISCARD);
+ glColor4f(1.0, 0.0, 0.0, 0.0);
+ piglit_draw_rect(-1, -1, 2, 2);
+
+ pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, green);
+
+ piglit_present_results();
+
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ piglit_require_extension("GL_EXT_transform_feedback");
+}
diff --git a/tests/spec/ext_transform_feedback/discard-drawpixels.c b/tests/spec/ext_transform_feedback/discard-drawpixels.c
new file mode 100644
index 0000000..69c4010
--- /dev/null
+++ b/tests/spec/ext_transform_feedback/discard-drawpixels.c
@@ -0,0 +1,92 @@
+/*
+ * Copyright © 2011 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 "piglit-util.h"
+
+/**
+ * @file discard-drawpixels.c
+ *
+ * Tests that GL_RASTERIZER_DISCARD appropriately affects glDrawPixels().
+ *
+ * From the EXT_transform_feedback spec:
+ *
+ * "Primitives can be optionally discarded before rasterization by
+ * calling Enable and Disable with RASTERIZER_DISCARD_EXT. When
+ * enabled, primitives are discared right before the
+ * rasterization stage, but after the optional transform feedback
+ * stage. When disabled, primitives are passed through to the
+ * rasterization stage to be processed
+ * normally. RASTERIZER_DISCARD_EXT applies to the DrawPixels,
+ * CopyPixels, Bitmap, Clear and Accum commands as well."
+ */
+
+int piglit_width = 32;
+int piglit_height = 32;
+int piglit_window_mode = GLUT_DOUBLE | GLUT_RGB | GLUT_ALPHA;
+
+enum piglit_result
+piglit_display(void)
+{
+ bool pass = true;
+ float green[4] = {0.0, 1.0, 0.0, 0.0};
+ float *buf;
+ int i;
+
+ buf = malloc(sizeof(float) * 4 * piglit_width * piglit_height);
+
+ /* should draw full screen. */
+ for (i = 0; i < piglit_width * piglit_height; i++) {
+ buf[i * 4 + 0] = 0.0;
+ buf[i * 4 + 1] = 1.0;
+ buf[i * 4 + 2] = 0.0;
+ buf[i * 4 + 3] = 0.0;
+ }
+ glDisable(GL_RASTERIZER_DISCARD);
+ glRasterPos2i(-1, -1);
+ glDrawPixels(piglit_width, piglit_height, GL_RGBA, GL_FLOAT, buf);
+
+ /* should not draw full screen. */
+ for (i = 0; i < piglit_width * piglit_height; i++) {
+ buf[i * 4 + 0] = 1.0;
+ buf[i * 4 + 1] = 0.0;
+ buf[i * 4 + 2] = 0.0;
+ buf[i * 4 + 3] = 0.0;
+ }
+ glEnable(GL_RASTERIZER_DISCARD);
+ glRasterPos2i(-1, -1);
+ glDrawPixels(piglit_width, piglit_height, GL_RGBA, GL_FLOAT, buf);
+
+ pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, green);
+
+ piglit_present_results();
+
+ free(buf);
+
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ piglit_require_extension("GL_EXT_transform_feedback");
+}
--
1.7.6.3
More information about the Piglit
mailing list