OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <GLES2/gl2.h> | 5 #include <GLES2/gl2.h> |
6 #include <GLES2/gl2ext.h> | 6 #include <GLES2/gl2ext.h> |
7 #include <GLES2/gl2extchromium.h> | 7 #include <GLES2/gl2extchromium.h> |
8 | 8 |
9 #include "base/threading/platform_thread.h" | 9 #include "base/threading/platform_thread.h" |
10 #include "gpu/command_buffer/tests/gl_manager.h" | 10 #include "gpu/command_buffer/tests/gl_manager.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 query_result = 0; | 144 query_result = 0; |
145 available = 0; | 145 available = 0; |
146 glGetQueryObjectuivEXT(query, GL_QUERY_RESULT_AVAILABLE_EXT, &available); | 146 glGetQueryObjectuivEXT(query, GL_QUERY_RESULT_AVAILABLE_EXT, &available); |
147 EXPECT_TRUE(available); | 147 EXPECT_TRUE(available); |
148 glGetQueryObjectuivEXT(query, GL_QUERY_RESULT_EXT, &query_result); | 148 glGetQueryObjectuivEXT(query, GL_QUERY_RESULT_EXT, &query_result); |
149 | 149 |
150 EXPECT_LE(query_result, kTimePrecisionMicroseconds); | 150 EXPECT_LE(query_result, kTimePrecisionMicroseconds); |
151 } | 151 } |
152 | 152 |
| 153 TEST_F(QueryTest, CommandsCompleted) { |
| 154 if (!GLTestHelper::HasExtension("GL_CHROMIUM_sync_query")) { |
| 155 LOG(INFO) << "GL_CHROMIUM_sync_query not supported. Skipping test..."; |
| 156 return; |
| 157 } |
| 158 |
| 159 GLuint query; |
| 160 glGenQueriesEXT(1, &query); |
| 161 glBeginQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM, query); |
| 162 glClearColor(0.0, 0.0, 1.0, 1.0); |
| 163 glClear(GL_COLOR_BUFFER_BIT); |
| 164 glEndQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM); |
| 165 glFlush(); |
| 166 GLuint result = 0; |
| 167 glGetQueryObjectuivEXT(query, GL_QUERY_RESULT_EXT, &result); |
| 168 EXPECT_EQ(0u, result); |
| 169 glDeleteQueriesEXT(1, &query); |
| 170 GLTestHelper::CheckGLError("no errors", __LINE__); |
| 171 } |
| 172 |
| 173 TEST_F(QueryTest, CommandsCompletedWithFinish) { |
| 174 if (!GLTestHelper::HasExtension("GL_CHROMIUM_sync_query")) { |
| 175 LOG(INFO) << "GL_CHROMIUM_sync_query not supported. Skipping test..."; |
| 176 return; |
| 177 } |
| 178 |
| 179 GLuint query; |
| 180 glGenQueriesEXT(1, &query); |
| 181 glBeginQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM, query); |
| 182 glClearColor(0.0, 0.0, 1.0, 1.0); |
| 183 glClear(GL_COLOR_BUFFER_BIT); |
| 184 glEndQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM); |
| 185 glFinish(); |
| 186 GLuint result = 0; |
| 187 glGetQueryObjectuivEXT(query, GL_QUERY_RESULT_AVAILABLE_EXT, &result); |
| 188 EXPECT_EQ(1u, result); |
| 189 glDeleteQueriesEXT(1, &query); |
| 190 GLTestHelper::CheckGLError("no errors", __LINE__); |
| 191 } |
| 192 |
153 } // namespace gpu | 193 } // namespace gpu |
154 | 194 |
155 | 195 |
OLD | NEW |