| 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 | 9 |
| 10 namespace cc { | 10 namespace cc { |
| 11 | 11 |
| 12 TestGLES2Interface::TestGLES2Interface(TestWebGraphicsContext3D* test_context) | 12 TestGLES2Interface::TestGLES2Interface(TestWebGraphicsContext3D* test_context) |
| 13 : test_context_(test_context) { | 13 : test_context_(test_context) { |
| 14 DCHECK(test_context_); | 14 DCHECK(test_context_); |
| 15 } | 15 } |
| 16 | 16 |
| 17 TestGLES2Interface::~TestGLES2Interface() {} | 17 TestGLES2Interface::~TestGLES2Interface() {} |
| 18 | 18 |
| 19 void TestGLES2Interface::GenTextures(GLsizei n, GLuint* textures) { |
| 20 for (GLsizei i = 0; i < n; ++i) { |
| 21 textures[i] = test_context_->createTexture(); |
| 22 } |
| 23 } |
| 24 |
| 25 void TestGLES2Interface::GenBuffers(GLsizei n, GLuint* buffers) { |
| 26 for (GLsizei i = 0; i < n; ++i) { |
| 27 buffers[i] = test_context_->createBuffer(); |
| 28 } |
| 29 } |
| 30 |
| 31 void TestGLES2Interface::GenFramebuffers(GLsizei n, GLuint* framebuffers) { |
| 32 for (GLsizei i = 0; i < n; ++i) { |
| 33 framebuffers[i] = test_context_->createFramebuffer(); |
| 34 } |
| 35 } |
| 36 |
| 37 void TestGLES2Interface::GenQueriesEXT(GLsizei n, GLuint* queries) { |
| 38 for (GLsizei i = 0; i < n; ++i) { |
| 39 queries[i] = test_context_->createQueryEXT(); |
| 40 } |
| 41 } |
| 42 |
| 43 void TestGLES2Interface::DeleteTextures(GLsizei n, const GLuint* textures) { |
| 44 for (GLsizei i = 0; i < n; ++i) { |
| 45 test_context_->deleteTexture(textures[i]); |
| 46 } |
| 47 } |
| 48 |
| 49 void TestGLES2Interface::DeleteBuffers(GLsizei n, const GLuint* buffers) { |
| 50 for (GLsizei i = 0; i < n; ++i) { |
| 51 test_context_->deleteBuffer(buffers[i]); |
| 52 } |
| 53 } |
| 54 |
| 55 void TestGLES2Interface::DeleteFramebuffers(GLsizei n, |
| 56 const GLuint* framebuffers) { |
| 57 for (GLsizei i = 0; i < n; ++i) { |
| 58 test_context_->deleteFramebuffer(framebuffers[i]); |
| 59 } |
| 60 } |
| 61 |
| 62 void TestGLES2Interface::DeleteQueriesEXT(GLsizei n, const GLuint* queries) { |
| 63 for (GLsizei i = 0; i < n; ++i) { |
| 64 test_context_->deleteQueryEXT(queries[i]); |
| 65 } |
| 66 } |
| 67 |
| 19 GLuint TestGLES2Interface::CreateShader(GLenum type) { | 68 GLuint TestGLES2Interface::CreateShader(GLenum type) { |
| 20 return test_context_->createShader(type); | 69 return test_context_->createShader(type); |
| 21 } | 70 } |
| 22 | 71 |
| 23 GLuint TestGLES2Interface::CreateProgram() { | 72 GLuint TestGLES2Interface::CreateProgram() { |
| 24 return test_context_->createProgram(); | 73 return test_context_->createProgram(); |
| 25 } | 74 } |
| 26 | 75 |
| 76 void TestGLES2Interface::BindTexture(GLenum target, GLuint texture) { |
| 77 test_context_->bindTexture(target, texture); |
| 78 } |
| 79 |
| 27 void TestGLES2Interface::GetShaderiv(GLuint shader, | 80 void TestGLES2Interface::GetShaderiv(GLuint shader, |
| 28 GLenum pname, | 81 GLenum pname, |
| 29 GLint* params) { | 82 GLint* params) { |
| 30 test_context_->getShaderiv(shader, pname, params); | 83 test_context_->getShaderiv(shader, pname, params); |
| 31 } | 84 } |
| 32 | 85 |
| 33 void TestGLES2Interface::GetProgramiv(GLuint program, | 86 void TestGLES2Interface::GetProgramiv(GLuint program, |
| 34 GLenum pname, | 87 GLenum pname, |
| 35 GLint* params) { | 88 GLint* params) { |
| 36 test_context_->getProgramiv(program, pname, params); | 89 test_context_->getProgramiv(program, pname, params); |
| 37 } | 90 } |
| 38 | 91 |
| 39 void TestGLES2Interface::GetShaderPrecisionFormat(GLenum shadertype, | 92 void TestGLES2Interface::GetShaderPrecisionFormat(GLenum shadertype, |
| 40 GLenum precisiontype, | 93 GLenum precisiontype, |
| 41 GLint* range, | 94 GLint* range, |
| 42 GLint* precision) { | 95 GLint* precision) { |
| 43 test_context_->getShaderPrecisionFormat( | 96 test_context_->getShaderPrecisionFormat( |
| 44 shadertype, precisiontype, range, precision); | 97 shadertype, precisiontype, range, precision); |
| 45 } | 98 } |
| 46 | 99 |
| 100 void TestGLES2Interface::Viewport(GLint x, |
| 101 GLint y, |
| 102 GLsizei width, |
| 103 GLsizei height) { |
| 104 test_context_->viewport(x, y, width, height); |
| 105 } |
| 106 |
| 107 void TestGLES2Interface::ActiveTexture(GLenum target) { |
| 108 test_context_->activeTexture(target); |
| 109 } |
| 110 |
| 47 void TestGLES2Interface::UseProgram(GLuint program) { | 111 void TestGLES2Interface::UseProgram(GLuint program) { |
| 48 test_context_->useProgram(program); | 112 test_context_->useProgram(program); |
| 49 } | 113 } |
| 50 | 114 |
| 115 GLenum TestGLES2Interface::CheckFramebufferStatus(GLenum target) { |
| 116 return test_context_->checkFramebufferStatus(target); |
| 117 } |
| 118 |
| 119 void TestGLES2Interface::Scissor(GLint x, |
| 120 GLint y, |
| 121 GLsizei width, |
| 122 GLsizei height) { |
| 123 test_context_->scissor(x, y, width, height); |
| 124 } |
| 125 |
| 126 void TestGLES2Interface::DrawElements(GLenum mode, |
| 127 GLsizei count, |
| 128 GLenum type, |
| 129 const void* indices) { |
| 130 test_context_->drawElements( |
| 131 mode, count, type, reinterpret_cast<intptr_t>(indices)); |
| 132 } |
| 133 |
| 134 void TestGLES2Interface::ClearColor(GLclampf red, |
| 135 GLclampf green, |
| 136 GLclampf blue, |
| 137 GLclampf alpha) { |
| 138 test_context_->clearColor(red, green, blue, alpha); |
| 139 } |
| 140 |
| 141 void TestGLES2Interface::ClearStencil(GLint s) { |
| 142 test_context_->clearStencil(s); |
| 143 } |
| 144 |
| 145 void TestGLES2Interface::Clear(GLbitfield mask) { test_context_->clear(mask); } |
| 146 |
| 147 void TestGLES2Interface::Flush() { test_context_->flush(); } |
| 148 |
| 149 void TestGLES2Interface::Finish() { test_context_->finish(); } |
| 150 |
| 151 void TestGLES2Interface::Enable(GLenum cap) { test_context_->enable(cap); } |
| 152 |
| 153 void TestGLES2Interface::Disable(GLenum cap) { test_context_->disable(cap); } |
| 154 |
| 155 void TestGLES2Interface::BindFramebuffer(GLenum target, GLuint buffer) { |
| 156 test_context_->bindFramebuffer(target, buffer); |
| 157 } |
| 158 |
| 159 void TestGLES2Interface::BindBuffer(GLenum target, GLuint buffer) { |
| 160 test_context_->bindBuffer(target, buffer); |
| 161 } |
| 162 |
| 163 void* TestGLES2Interface::MapBufferCHROMIUM(GLuint target, GLenum access) { |
| 164 return test_context_->mapBufferCHROMIUM(target, access); |
| 165 } |
| 166 |
| 167 GLboolean TestGLES2Interface::UnmapBufferCHROMIUM(GLuint target) { |
| 168 return test_context_->unmapBufferCHROMIUM(target); |
| 169 } |
| 170 |
| 171 void TestGLES2Interface::BufferData(GLenum target, |
| 172 GLsizeiptr size, |
| 173 const void* data, |
| 174 GLenum usage) { |
| 175 test_context_->bufferData(target, size, data, usage); |
| 176 } |
| 177 |
| 178 void TestGLES2Interface::WaitSyncPointCHROMIUM(GLuint sync_point) { |
| 179 test_context_->waitSyncPoint(sync_point); |
| 180 } |
| 181 |
| 182 GLuint TestGLES2Interface::InsertSyncPointCHROMIUM() { |
| 183 return test_context_->insertSyncPoint(); |
| 184 } |
| 185 |
| 186 void TestGLES2Interface::BeginQueryEXT(GLenum target, GLuint id) { |
| 187 test_context_->beginQueryEXT(target, id); |
| 188 } |
| 189 |
| 190 void TestGLES2Interface::EndQueryEXT(GLenum target) { |
| 191 test_context_->endQueryEXT(target); |
| 192 } |
| 193 |
| 194 void TestGLES2Interface::DiscardFramebufferEXT(GLenum target, |
| 195 GLsizei count, |
| 196 const GLenum* attachments) { |
| 197 test_context_->discardFramebufferEXT(target, count, attachments); |
| 198 } |
| 199 |
| 200 void TestGLES2Interface::GenMailboxCHROMIUM(GLbyte* mailbox) { |
| 201 test_context_->genMailboxCHROMIUM(mailbox); |
| 202 } |
| 203 |
| 51 } // namespace cc | 204 } // namespace cc |
| OLD | NEW |