OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ppapi/tests/test_graphics_3d.h" | 5 #include "ppapi/tests/test_graphics_3d.h" |
6 | 6 |
7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
8 #include <GLES2/gl2ext.h> | 8 #include <GLES2/gl2ext.h> |
9 #include <stdio.h> | 9 #include <stdio.h> |
10 #include <stdlib.h> | 10 #include <stdlib.h> |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 glClearColor(1.0f, 1.0f, 1.0f, 1.0f); | 107 glClearColor(1.0f, 1.0f, 1.0f, 1.0f); |
108 glClear(GL_COLOR_BUFFER_BIT); | 108 glClear(GL_COLOR_BUFFER_BIT); |
109 | 109 |
110 // Ask about a couple of extensions via glGetString. If an extension is | 110 // Ask about a couple of extensions via glGetString. If an extension is |
111 // available, try a couple of trivial calls. This test is not intended | 111 // available, try a couple of trivial calls. This test is not intended |
112 // to be exhaustive; check the source can compile, link, and run without | 112 // to be exhaustive; check the source can compile, link, and run without |
113 // crashing. | 113 // crashing. |
114 ASSERT_NE(NULL, glGetString(GL_VERSION)); | 114 ASSERT_NE(NULL, glGetString(GL_VERSION)); |
115 const char* ext = reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)); | 115 const char* ext = reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)); |
116 if (strstr(ext, "GL_EXT_occlusion_query_boolean")) { | 116 if (strstr(ext, "GL_EXT_occlusion_query_boolean")) { |
117 GLuint a_query; | 117 GLuint a_query = 0; |
118 GLboolean is_a_query; | |
119 glGenQueriesEXT(1, &a_query); | 118 glGenQueriesEXT(1, &a_query); |
120 ASSERT_NE(0, a_query); | 119 ASSERT_NE(0, a_query); |
121 glBeginQueryEXT(GL_ANY_SAMPLES_PASSED_EXT, a_query); | 120 glBeginQueryEXT(GL_ANY_SAMPLES_PASSED_EXT, a_query); |
122 is_a_query = glIsQueryEXT(a_query); | 121 GLboolean is_a_query = glIsQueryEXT(a_query); |
123 ASSERT_EQ(is_a_query, GL_TRUE); | 122 ASSERT_EQ(is_a_query, GL_TRUE); |
124 glEndQueryEXT(GL_ANY_SAMPLES_PASSED_EXT); | 123 glEndQueryEXT(GL_ANY_SAMPLES_PASSED_EXT); |
125 glDeleteQueriesEXT(1, &a_query); | 124 glDeleteQueriesEXT(1, &a_query); |
126 } | 125 } |
127 if (strstr(ext, "GL_ANGLE_instanced_arrays")) { | 126 if (strstr(ext, "GL_ANGLE_instanced_arrays")) { |
128 glDrawArraysInstancedANGLE(GL_TRIANGLE_STRIP, 0, 0, 0); | 127 glDrawArraysInstancedANGLE(GL_TRIANGLE_STRIP, 0, 0, 0); |
129 } | 128 } |
| 129 if (strstr(ext, "GL_OES_vertex_array_object")) { |
| 130 GLuint a_vertex_array = 0; |
| 131 glGenVertexArraysOES(1, &a_vertex_array); |
| 132 ASSERT_NE(0, a_vertex_array); |
| 133 glBindVertexArrayOES(a_vertex_array); |
| 134 GLboolean is_a_vertex_array = glIsVertexArrayOES(a_vertex_array); |
| 135 ASSERT_EQ(is_a_vertex_array, GL_TRUE); |
| 136 glBindVertexArrayOES(0); |
| 137 glDeleteVertexArraysOES(1, &a_vertex_array); |
| 138 } |
130 glSetCurrentContextPPAPI(kInvalidContext); | 139 glSetCurrentContextPPAPI(kInvalidContext); |
131 | 140 |
132 int32_t rv = SwapBuffersSync(&context); | 141 int32_t rv = SwapBuffersSync(&context); |
133 ASSERT_EQ(PP_OK, rv); | 142 ASSERT_EQ(PP_OK, rv); |
134 | 143 |
135 PASS(); | 144 PASS(); |
136 } | 145 } |
137 | 146 |
138 int32_t TestGraphics3D::SwapBuffersSync(pp::Graphics3D* context) { | 147 int32_t TestGraphics3D::SwapBuffersSync(pp::Graphics3D* context) { |
139 TestCompletionCallback callback(instance_->pp_instance(), callback_type()); | 148 TestCompletionCallback callback(instance_->pp_instance(), callback_type()); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 ASSERT_EQ(NULL, glGetString(GL_VERSION)); | 198 ASSERT_EQ(NULL, glGetString(GL_VERSION)); |
190 ASSERT_EQ(-1, glGetUniformLocation(0, NULL)); | 199 ASSERT_EQ(-1, glGetUniformLocation(0, NULL)); |
191 ASSERT_EQ(GL_FALSE, glIsBuffer(0)); | 200 ASSERT_EQ(GL_FALSE, glIsBuffer(0)); |
192 ASSERT_EQ(0, glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER)); | 201 ASSERT_EQ(0, glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER)); |
193 glClearColor(1.0f, 1.0f, 1.0f, 1.0f); | 202 glClearColor(1.0f, 1.0f, 1.0f, 1.0f); |
194 glClear(GL_COLOR_BUFFER_BIT); | 203 glClear(GL_COLOR_BUFFER_BIT); |
195 | 204 |
196 PASS(); | 205 PASS(); |
197 } | 206 } |
198 | 207 |
OLD | NEW |