OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "cc/test/test_gles2_interface.h" | 5 #include "cc/test/test_gles2_interface.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "cc/test/test_web_graphics_context_3d.h" | 8 #include "cc/test/test_web_graphics_context_3d.h" |
9 #include "gpu/GLES2/gl2extchromium.h" | 9 #include "gpu/GLES2/gl2extchromium.h" |
10 | 10 |
11 namespace cc { | 11 namespace cc { |
12 | 12 |
13 TestGLES2Interface::TestGLES2Interface(TestWebGraphicsContext3D* test_context) | 13 TestGLES2Interface::TestGLES2Interface() = default; |
14 : test_context_(test_context) { | 14 TestGLES2Interface::~TestGLES2Interface() = default; |
15 DCHECK(test_context_); | |
16 } | |
17 | |
18 TestGLES2Interface::~TestGLES2Interface() {} | |
19 | 15 |
20 void TestGLES2Interface::GenTextures(GLsizei n, GLuint* textures) { | 16 void TestGLES2Interface::GenTextures(GLsizei n, GLuint* textures) { |
21 for (GLsizei i = 0; i < n; ++i) { | 17 for (GLsizei i = 0; i < n; ++i) { |
22 textures[i] = test_context_->createTexture(); | 18 textures[i] = test_context_->createTexture(); |
23 } | 19 } |
24 } | 20 } |
25 | 21 |
26 void TestGLES2Interface::GenBuffers(GLsizei n, GLuint* buffers) { | 22 void TestGLES2Interface::GenBuffers(GLsizei n, GLuint* buffers) { |
27 for (GLsizei i = 0; i < n; ++i) { | 23 for (GLsizei i = 0; i < n; ++i) { |
28 buffers[i] = test_context_->createBuffer(); | 24 buffers[i] = test_context_->createBuffer(); |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 void TestGLES2Interface::LoseContextCHROMIUM(GLenum current, GLenum other) { | 389 void TestGLES2Interface::LoseContextCHROMIUM(GLenum current, GLenum other) { |
394 test_context_->loseContextCHROMIUM(current, other); | 390 test_context_->loseContextCHROMIUM(current, other); |
395 } | 391 } |
396 | 392 |
397 GLenum TestGLES2Interface::GetGraphicsResetStatusKHR() { | 393 GLenum TestGLES2Interface::GetGraphicsResetStatusKHR() { |
398 if (test_context_->isContextLost()) | 394 if (test_context_->isContextLost()) |
399 return GL_UNKNOWN_CONTEXT_RESET_KHR; | 395 return GL_UNKNOWN_CONTEXT_RESET_KHR; |
400 return GL_NO_ERROR; | 396 return GL_NO_ERROR; |
401 } | 397 } |
402 | 398 |
| 399 void TestGLES2Interface::set_test_context(TestWebGraphicsContext3D* context) { |
| 400 DCHECK(!test_context_); |
| 401 test_context_ = context; |
| 402 InitializeTestContext(test_context_); |
| 403 } |
| 404 |
403 } // namespace cc | 405 } // namespace cc |
OLD | NEW |