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 <cmath> | 9 #include <cmath> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
14 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
15 #include "gpu/command_buffer/tests/gl_manager.h" | 15 #include "gpu/command_buffer/tests/gl_manager.h" |
16 #include "gpu/command_buffer/tests/gl_test_utils.h" | 16 #include "gpu/command_buffer/tests/gl_test_utils.h" |
17 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 | 19 |
20 namespace gpu { | 20 namespace gpu { |
21 | 21 |
22 class GLReadbackTest : public testing::Test { | 22 class GLReadbackTest : public testing::Test { |
23 protected: | 23 protected: |
24 virtual void SetUp() { | 24 void SetUp() override { gl_.Initialize(GLManager::Options()); } |
25 gl_.Initialize(GLManager::Options()); | |
26 } | |
27 | 25 |
28 virtual void TearDown() { | 26 void TearDown() override { gl_.Destroy(); } |
29 gl_.Destroy(); | |
30 } | |
31 | 27 |
32 static void WaitForQueryCallback(int q, base::Closure cb) { | 28 static void WaitForQueryCallback(int q, base::Closure cb) { |
33 unsigned int done = 0; | 29 unsigned int done = 0; |
34 glGetQueryObjectuivEXT(q, GL_QUERY_RESULT_AVAILABLE_EXT, &done); | 30 glGetQueryObjectuivEXT(q, GL_QUERY_RESULT_AVAILABLE_EXT, &done); |
35 if (done) { | 31 if (done) { |
36 cb.Run(); | 32 cb.Run(); |
37 } else { | 33 } else { |
38 base::MessageLoop::current()->PostDelayedTask( | 34 base::MessageLoop::current()->PostDelayedTask( |
39 FROM_HERE, | 35 FROM_HERE, |
40 base::Bind(&WaitForQueryCallback, q, cb), | 36 base::Bind(&WaitForQueryCallback, q, cb), |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 | 309 |
314 glDeleteFramebuffers(1, &framebuffer); | 310 glDeleteFramebuffers(1, &framebuffer); |
315 glDeleteTextures(1, &texture_id); | 311 glDeleteTextures(1, &texture_id); |
316 } | 312 } |
317 | 313 |
318 glDeleteBuffers(1, &vertex_buffer); | 314 glDeleteBuffers(1, &vertex_buffer); |
319 glDeleteProgram(program); | 315 glDeleteProgram(program); |
320 } | 316 } |
321 | 317 |
322 } // namespace gpu | 318 } // namespace gpu |
OLD | NEW |