arb_framebuffer_object: add missing MSAA alpha-to-coverage and alpha-to-one tests
[piglit.git] / tests / general / vao-02.c
blobe5809bef9095a711d2584eea4bcef102177019f4
1 /*
2 * (C) Copyright IBM Corporation 2006
3 * All Rights Reserved.
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * on the rights to use, copy, modify, merge, publish, distribute, sub
9 * license, and/or sell copies of the Software, and to permit persons to whom
10 * the Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
19 * IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
25 /**
26 * \file vao-02.c
28 * Simple test of APPLE_vertex_array_object functionality. This test creates
29 * a VAO, pushed it (via \c glPushClientAttrib), deletes the VAO, then pops
30 * it (via \c glPopClientAttrib). After popping, the state of the VAO is
31 * examined.
33 * According to the APPLE_vertex_array_object spec, the contents of the VAO
34 * should be restored to the values that they had when pushed.
36 * \author Ian Romanick <idr@us.ibm.com>
39 #include "piglit-util-gl.h"
41 PIGLIT_GL_TEST_CONFIG_BEGIN
43 config.supports_gl_compat_version = 10;
45 config.window_width = 400;
46 config.window_height = 200;
47 config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
48 config.khr_no_error_support = PIGLIT_NO_ERRORS;
50 PIGLIT_GL_TEST_CONFIG_END
52 enum piglit_result
53 piglit_display(void)
55 return PIGLIT_PASS;
58 void
59 piglit_init(int argc, char **argv)
61 GLuint obj;
62 int pass = 1;
63 void * ptr;
64 GLenum err;
66 piglit_require_extension("GL_APPLE_vertex_array_object");
68 glGenVertexArraysAPPLE(1, & obj);
69 glBindVertexArrayAPPLE(obj);
70 glVertexPointer(4, GL_FLOAT, sizeof(GLfloat) * 4, (void *) 0xDEADBEEF);
71 glEnableClientState(GL_VERTEX_ARRAY);
73 glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
75 glDeleteVertexArraysAPPLE(1, & obj);
77 err = glGetError();
78 if (err) {
79 printf("glGetError incorrectly returned 0x%04x.\n", err);
80 pass = 0;
83 if ((*glIsVertexArrayAPPLE)(obj)) {
84 printf("Array object is incorrectly still valid.\n");
85 pass = 0;
88 err = glGetError();
89 if (err) {
90 printf("glGetError incorrectly returned 0x%04x.\n", err);
91 pass = 0;
94 glPopClientAttrib();
96 err = glGetError();
97 if (err) {
98 printf("glGetError incorrectly returned 0x%04x.\n", err);
99 pass = 0;
102 if (! glIsVertexArrayAPPLE(obj)) {
103 printf("Array object is incorrectly invalid.\n");
104 pass = 0;
107 if (! glIsEnabled(GL_VERTEX_ARRAY)) {
108 printf("Array state is incorrectly disabled.\n");
109 pass = 0;
112 glGetPointerv(GL_VERTEX_ARRAY_POINTER, & ptr);
113 if (ptr != (void *) 0xDEADBEEF) {
114 printf("Array pointer is incorrectly set to 0x%p.\n", ptr);
115 pass = 0;
118 if (! pass) {
119 piglit_report_result(PIGLIT_FAIL);
120 } else {
121 piglit_report_result(PIGLIT_PASS);