From df27d0f83e55a0ed7b41a2bd0dce7c7534a0863b Mon Sep 17 00:00:00 2001From: Corbin Simpson <MostAwesomeDude@gmail.com>Date: Thu, 6 Nov 2008 01:11:46 -0800Subject: [PATCH] Add occlusion query test.--- src/Makefile.am | 2 + src/Makefile.in | 17 ++++++++------ src/gl_occlusion_query.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++ src/gl_occlusion_query.h | 27 ++++++++++++++++++++++ src/revenge_test.c | 2 + 5 files changed, 96 insertions(+), 7 deletions(-) create mode 100644 src/gl_occlusion_query.c create mode 100644 src/gl_occlusion_query.hdiff --git a/src/Makefile.am b/src/Makefile.amindex 756de9d..75757cd 100644--- a/src/Makefile.am+++ b/src/Makefile.am@@ -33,6 +33,8 @@ revenge_SOURCES = \ gl_line_width.h \ gl_null.c \ gl_null.h \+ gl_occlusion_query.c \+ gl_occlusion_query.h \ gl_point_size.c \ gl_point_size.h \ gl_primitives.c \diff --git a/src/Makefile.in b/src/Makefile.inindex 1b38317..a1d5c2b 100644--- a/src/Makefile.in+++ b/src/Makefile.in@@ -51,12 +51,13 @@ am_revenge_OBJECTS = gl_alpha_test.$(OBJEXT) gl_blend.$(OBJEXT) \ gl_ext_texture_filter_anisotropic.$(OBJEXT) \ gl_front_face.$(OBJEXT) gl_line_smooth.$(OBJEXT) \ gl_line_smooth_hint.$(OBJEXT) gl_line_width.$(OBJEXT) \- gl_null.$(OBJEXT) gl_point_size.$(OBJEXT) \- gl_primitives.$(OBJEXT) gl_render_mode.$(OBJEXT) \- gl_scissor_test.$(OBJEXT) gl_shade_model.$(OBJEXT) \- gl_stencil_func.$(OBJEXT) gl_stencil_mask.$(OBJEXT) \- gl_stencil_op.$(OBJEXT) gl_stencil_test.$(OBJEXT) \- gl_texture.$(OBJEXT) gl_texture_mag_filter.$(OBJEXT) \+ gl_null.$(OBJEXT) gl_occlusion_query.$(OBJEXT) \+ gl_point_size.$(OBJEXT) gl_primitives.$(OBJEXT) \+ gl_render_mode.$(OBJEXT) gl_scissor_test.$(OBJEXT) \+ gl_shade_model.$(OBJEXT) gl_stencil_func.$(OBJEXT) \+ gl_stencil_mask.$(OBJEXT) gl_stencil_op.$(OBJEXT) \+ gl_stencil_test.$(OBJEXT) gl_texture.$(OBJEXT) \+ gl_texture_mag_filter.$(OBJEXT) \ gl_texture_min_filter.$(OBJEXT) gl_texture_wrap_s.$(OBJEXT) \ gl_texture_wrap_t.$(OBJEXT) revenge_detect.$(OBJEXT) \ revenge_dump.$(OBJEXT) revenge_dump_misc.$(OBJEXT) \@@ -158,7 +159,6 @@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@-top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CFLAGS = -DGL_GLEXT_PROTOTYPES -Wall `sdl-config --cflags`@@ -193,6 +193,8 @@ revenge_SOURCES = \ gl_line_width.h \ gl_null.c \ gl_null.h \+ gl_occlusion_query.c \+ gl_occlusion_query.h \ gl_point_size.c \ gl_point_size.h \ gl_primitives.c \@@ -317,6 +319,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_line_smooth_hint.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_line_width.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_null.Po@am__quote@+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_occlusion_query.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_point_size.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_primitives.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_render_mode.Po@am__quote@diff --git a/src/gl_occlusion_query.c b/src/gl_occlusion_query.cnew file mode 100644index 0000000..32c5ea4--- /dev/null+++ b/src/gl_occlusion_query.c@@ -0,0 +1,55 @@+/*+ * $Id$+ * Copyright (C) 2007 Oliver McFadden <z3ro.geek@gmail.com>+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU General Public License as published by+ * the Free Software Foundation, either version 3 of the License, or+ * (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU General Public License for more details.+ *+ * You should have received a copy of the GNU General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */++#include <GL/gl.h>+#include <GL/glext.h>+#include <stdbool.h>+#include <stdio.h>+#include <stdlib.h>++#include <revenge_test.h>++void+gl_occlusion_query (void)+{+ GLuint q[1];+ GLuint count;++ test_prologue (NULL);++ glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);+ glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);+ glDepthMask(GL_FALSE);++ glGenQueriesARB(1, q);++ glBeginQueryARB(GL_SAMPLES_PASSED_ARB, q[0]);+ glBegin(GL_QUADS);+ glVertex3i(-1, -1, 0);+ glVertex3i( 1, -1, 0);+ glVertex3i( 1, 1, 0);+ glVertex3i(-1, 1, 0);+ glEnd();+ glEndQueryARB(GL_SAMPLES_PASSED_ARB);++ glFlush();++ glGetQueryObjectuivARB(q[0], GL_QUERY_RESULT_ARB, &count);++ test_epilogue (false);+}diff --git a/src/gl_occlusion_query.h b/src/gl_occlusion_query.hnew file mode 100644index 0000000..898bd8f--- /dev/null+++ b/src/gl_occlusion_query.h@@ -0,0 +1,27 @@+/*+ * $Id$+ * Copyright (C) 2007 Oliver McFadden <z3ro.geek@gmail.com>+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU General Public License as published by+ * the Free Software Foundation, either version 3 of the License, or+ * (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU General Public License for more details.+ *+ * You should have received a copy of the GNU General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */++#ifndef __GL_OCCLUSION_QUERY_H__+#define __GL_OCCLUSION_QUERY_H__++#include <stdio.h>+#include <stdlib.h>++void gl_occlusion_query (void);++#endifdiff --git a/src/revenge_test.c b/src/revenge_test.cindex 02ea6a3..1626d87 100644--- a/src/revenge_test.c+++ b/src/revenge_test.c@@ -49,6 +49,7 @@ #include <gl_line_smooth_hint.h> #include <gl_line_width.h> #include <gl_null.h>+#include <gl_occlusion_query.h> #include <gl_point_size.h> #include <gl_primitives.h> #include <gl_render_mode.h>@@ -207,6 +208,7 @@ static struct test_t tests[] = { {_(gl_line_smooth_hint)}, {_(gl_line_width)}, {_(gl_null)},+ {_(gl_occlusion_query)}, {_(gl_point_size)}, {_(gl_primitives)}, {_(gl_render_mode_feedback)},-- 1.5.6.5