Chromium Code Reviews| 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) { | |
|
jamesr
2013/12/05 23:59:40
fyi: i've expanded all of these forwarding calls o
| |
| 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, | |
| 132 count, | |
| 133 type, | |
| 134 reinterpret_cast<intptr_t>(const_cast<void*>(indices))); | |
| 135 } | |
| 136 | |
| 137 void TestGLES2Interface::ClearColor(GLclampf red, | |
| 138 GLclampf green, | |
| 139 GLclampf blue, | |
| 140 GLclampf alpha) { | |
| 141 test_context_->clearColor(red, green, blue, alpha); | |
| 142 } | |
| 143 | |
| 144 void TestGLES2Interface::ClearStencil(GLint s) { | |
| 145 test_context_->clearStencil(s); | |
| 146 } | |
| 147 | |
| 148 void TestGLES2Interface::Clear(GLbitfield mask) { test_context_->clear(mask); } | |
| 149 | |
| 150 void TestGLES2Interface::Flush() { test_context_->flush(); } | |
| 151 | |
| 152 void TestGLES2Interface::Finish() { test_context_->finish(); } | |
| 153 | |
| 154 void TestGLES2Interface::Enable(GLenum cap) { test_context_->enable(cap); } | |
| 155 | |
| 156 void TestGLES2Interface::Disable(GLenum cap) { test_context_->disable(cap); } | |
| 157 | |
| 158 void TestGLES2Interface::BindFramebuffer(GLenum target, GLuint buffer) { | |
| 159 test_context_->bindFramebuffer(target, buffer); | |
| 160 } | |
| 161 | |
| 162 void TestGLES2Interface::BindBuffer(GLenum target, GLuint buffer) { | |
| 163 test_context_->bindBuffer(target, buffer); | |
| 164 } | |
| 165 | |
| 166 void* TestGLES2Interface::MapBufferCHROMIUM(GLuint target, GLenum access) { | |
| 167 return test_context_->mapBufferCHROMIUM(target, access); | |
| 168 } | |
| 169 | |
| 170 GLboolean TestGLES2Interface::UnmapBufferCHROMIUM(GLuint target) { | |
| 171 return test_context_->unmapBufferCHROMIUM(target); | |
| 172 } | |
| 173 | |
| 174 void TestGLES2Interface::BufferData(GLenum target, | |
| 175 GLsizeiptr size, | |
| 176 const void* data, | |
| 177 GLenum usage) { | |
| 178 test_context_->bufferData(target, size, data, usage); | |
| 179 } | |
| 180 | |
| 181 void TestGLES2Interface::WaitSyncPointCHROMIUM(GLuint sync_point) { | |
| 182 test_context_->waitSyncPoint(sync_point); | |
| 183 } | |
| 184 | |
| 185 GLuint TestGLES2Interface::InsertSyncPointCHROMIUM() { | |
| 186 return test_context_->insertSyncPoint(); | |
| 187 } | |
| 188 | |
| 189 void TestGLES2Interface::BeginQueryEXT(GLenum target, GLuint id) { | |
| 190 test_context_->beginQueryEXT(target, id); | |
| 191 } | |
| 192 | |
| 193 void TestGLES2Interface::EndQueryEXT(GLenum target) { | |
| 194 test_context_->endQueryEXT(target); | |
| 195 } | |
| 196 | |
| 197 void TestGLES2Interface::DiscardFramebufferEXT(GLenum target, | |
| 198 GLsizei count, | |
| 199 const GLenum* attachments) { | |
| 200 test_context_->discardFramebufferEXT(target, count, attachments); | |
| 201 } | |
| 202 | |
| 203 void TestGLES2Interface::GenMailboxCHROMIUM(GLbyte* mailbox) { | |
| 204 test_context_->genMailboxCHROMIUM(mailbox); | |
| 205 } | |
| 206 | |
| 51 } // namespace cc | 207 } // namespace cc |
| OLD | NEW |