Adding Peter Thatcher to the owners file.
[chromium-blink-merge.git] / cc / test / test_gles2_interface.cc
blob38ada9883d6b6465e9eaddf27ef7296dde34d382
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
3 // found in the LICENSE file.
5 #include "cc/test/test_gles2_interface.h"
7 #include "base/logging.h"
8 #include "cc/test/test_web_graphics_context_3d.h"
10 namespace cc {
12 TestGLES2Interface::TestGLES2Interface(TestWebGraphicsContext3D* test_context)
13 : test_context_(test_context) {
14 DCHECK(test_context_);
17 TestGLES2Interface::~TestGLES2Interface() {}
19 void TestGLES2Interface::GenTextures(GLsizei n, GLuint* textures) {
20 for (GLsizei i = 0; i < n; ++i) {
21 textures[i] = test_context_->createTexture();
25 void TestGLES2Interface::GenBuffers(GLsizei n, GLuint* buffers) {
26 for (GLsizei i = 0; i < n; ++i) {
27 buffers[i] = test_context_->createBuffer();
31 void TestGLES2Interface::GenFramebuffers(GLsizei n, GLuint* framebuffers) {
32 for (GLsizei i = 0; i < n; ++i) {
33 framebuffers[i] = test_context_->createFramebuffer();
37 void TestGLES2Interface::GenRenderbuffers(GLsizei n, GLuint* renderbuffers) {
38 for (GLsizei i = 0; i < n; ++i) {
39 renderbuffers[i] = test_context_->createRenderbuffer();
43 void TestGLES2Interface::GenQueriesEXT(GLsizei n, GLuint* queries) {
44 for (GLsizei i = 0; i < n; ++i) {
45 queries[i] = test_context_->createQueryEXT();
49 void TestGLES2Interface::DeleteTextures(GLsizei n, const GLuint* textures) {
50 for (GLsizei i = 0; i < n; ++i) {
51 test_context_->deleteTexture(textures[i]);
55 void TestGLES2Interface::DeleteBuffers(GLsizei n, const GLuint* buffers) {
56 for (GLsizei i = 0; i < n; ++i) {
57 test_context_->deleteBuffer(buffers[i]);
61 void TestGLES2Interface::DeleteFramebuffers(GLsizei n,
62 const GLuint* framebuffers) {
63 for (GLsizei i = 0; i < n; ++i) {
64 test_context_->deleteFramebuffer(framebuffers[i]);
68 void TestGLES2Interface::DeleteQueriesEXT(GLsizei n, const GLuint* queries) {
69 for (GLsizei i = 0; i < n; ++i) {
70 test_context_->deleteQueryEXT(queries[i]);
74 GLuint TestGLES2Interface::CreateShader(GLenum type) {
75 return test_context_->createShader(type);
78 GLuint TestGLES2Interface::CreateProgram() {
79 return test_context_->createProgram();
82 void TestGLES2Interface::BindTexture(GLenum target, GLuint texture) {
83 test_context_->bindTexture(target, texture);
86 void TestGLES2Interface::GetIntegerv(GLenum pname, GLint* params) {
87 test_context_->getIntegerv(pname, params);
90 void TestGLES2Interface::GetShaderiv(GLuint shader,
91 GLenum pname,
92 GLint* params) {
93 test_context_->getShaderiv(shader, pname, params);
96 void TestGLES2Interface::GetProgramiv(GLuint program,
97 GLenum pname,
98 GLint* params) {
99 test_context_->getProgramiv(program, pname, params);
102 void TestGLES2Interface::GetShaderPrecisionFormat(GLenum shadertype,
103 GLenum precisiontype,
104 GLint* range,
105 GLint* precision) {
106 test_context_->getShaderPrecisionFormat(
107 shadertype, precisiontype, range, precision);
110 void TestGLES2Interface::Viewport(GLint x,
111 GLint y,
112 GLsizei width,
113 GLsizei height) {
114 test_context_->viewport(x, y, width, height);
117 void TestGLES2Interface::ActiveTexture(GLenum target) {
118 test_context_->activeTexture(target);
121 void TestGLES2Interface::UseProgram(GLuint program) {
122 test_context_->useProgram(program);
125 GLenum TestGLES2Interface::CheckFramebufferStatus(GLenum target) {
126 return test_context_->checkFramebufferStatus(target);
129 void TestGLES2Interface::Scissor(GLint x,
130 GLint y,
131 GLsizei width,
132 GLsizei height) {
133 test_context_->scissor(x, y, width, height);
136 void TestGLES2Interface::DrawElements(GLenum mode,
137 GLsizei count,
138 GLenum type,
139 const void* indices) {
140 test_context_->drawElements(
141 mode, count, type, reinterpret_cast<intptr_t>(indices));
144 void TestGLES2Interface::ClearColor(GLclampf red,
145 GLclampf green,
146 GLclampf blue,
147 GLclampf alpha) {
148 test_context_->clearColor(red, green, blue, alpha);
151 void TestGLES2Interface::ClearStencil(GLint s) {
152 test_context_->clearStencil(s);
155 void TestGLES2Interface::Clear(GLbitfield mask) { test_context_->clear(mask); }
157 void TestGLES2Interface::Flush() { test_context_->flush(); }
159 void TestGLES2Interface::Finish() { test_context_->finish(); }
161 void TestGLES2Interface::ShallowFlushCHROMIUM() {
162 test_context_->shallowFlushCHROMIUM();
165 void TestGLES2Interface::Enable(GLenum cap) { test_context_->enable(cap); }
167 void TestGLES2Interface::Disable(GLenum cap) { test_context_->disable(cap); }
169 void TestGLES2Interface::BindRenderbuffer(GLenum target, GLuint buffer) {
170 test_context_->bindRenderbuffer(target, buffer);
173 void TestGLES2Interface::BindFramebuffer(GLenum target, GLuint buffer) {
174 test_context_->bindFramebuffer(target, buffer);
177 void TestGLES2Interface::BindBuffer(GLenum target, GLuint buffer) {
178 test_context_->bindBuffer(target, buffer);
181 void TestGLES2Interface::PixelStorei(GLenum pname, GLint param) {
182 test_context_->pixelStorei(pname, param);
185 void TestGLES2Interface::TexImage2D(GLenum target,
186 GLint level,
187 GLint internalformat,
188 GLsizei width,
189 GLsizei height,
190 GLint border,
191 GLenum format,
192 GLenum type,
193 const void* pixels) {
194 test_context_->texImage2D(target,
195 level,
196 internalformat,
197 width,
198 height,
199 border,
200 format,
201 type,
202 pixels);
205 void TestGLES2Interface::TexSubImage2D(GLenum target,
206 GLint level,
207 GLint xoffset,
208 GLint yoffset,
209 GLsizei width,
210 GLsizei height,
211 GLenum format,
212 GLenum type,
213 const void* pixels) {
214 test_context_->texSubImage2D(
215 target, level, xoffset, yoffset, width, height, format, type, pixels);
218 void TestGLES2Interface::TexStorage2DEXT(GLenum target,
219 GLsizei levels,
220 GLenum internalformat,
221 GLsizei width,
222 GLsizei height) {
223 test_context_->texStorage2DEXT(target, levels, internalformat, width, height);
226 void TestGLES2Interface::TexImageIOSurface2DCHROMIUM(GLenum target,
227 GLsizei width,
228 GLsizei height,
229 GLuint io_surface_id,
230 GLuint plane) {
231 test_context_->texImageIOSurface2DCHROMIUM(
232 target, width, height, io_surface_id, plane);
235 void TestGLES2Interface::TexParameteri(GLenum target,
236 GLenum pname,
237 GLint param) {
238 test_context_->texParameteri(target, pname, param);
241 void TestGLES2Interface::FramebufferRenderbuffer(GLenum target,
242 GLenum attachment,
243 GLenum renderbuffertarget,
244 GLuint renderbuffer) {
245 test_context_->framebufferRenderbuffer(
246 target, attachment, renderbuffertarget, renderbuffer);
248 void TestGLES2Interface::FramebufferTexture2D(GLenum target,
249 GLenum attachment,
250 GLenum textarget,
251 GLuint texture,
252 GLint level) {
253 test_context_->framebufferTexture2D(
254 target, attachment, textarget, texture, level);
257 void TestGLES2Interface::RenderbufferStorage(GLenum target,
258 GLenum internalformat,
259 GLsizei width,
260 GLsizei height) {
261 test_context_->renderbufferStorage(target, internalformat, width, height);
264 void TestGLES2Interface::AsyncTexImage2DCHROMIUM(GLenum target,
265 GLint level,
266 GLenum internalformat,
267 GLsizei width,
268 GLsizei height,
269 GLint border,
270 GLenum format,
271 GLenum type,
272 const void* pixels) {
273 test_context_->asyncTexImage2DCHROMIUM(target,
274 level,
275 internalformat,
276 width,
277 height,
278 border,
279 format,
280 type,
281 pixels);
284 void TestGLES2Interface::AsyncTexSubImage2DCHROMIUM(GLenum target,
285 GLint level,
286 GLint xoffset,
287 GLint yoffset,
288 GLsizei width,
289 GLsizei height,
290 GLenum format,
291 GLenum type,
292 const void* pixels) {
293 test_context_->asyncTexSubImage2DCHROMIUM(
294 target, level, xoffset, yoffset, width, height, format, type, pixels);
297 void TestGLES2Interface::CompressedTexImage2D(GLenum target,
298 GLint level,
299 GLenum internalformat,
300 GLsizei width,
301 GLsizei height,
302 GLint border,
303 GLsizei image_size,
304 const void* data) {
305 test_context_->compressedTexImage2D(
306 target, level, internalformat, width, height, border, image_size, data);
309 void TestGLES2Interface::WaitAsyncTexImage2DCHROMIUM(GLenum target) {
310 test_context_->waitAsyncTexImage2DCHROMIUM(target);
313 GLuint TestGLES2Interface::CreateImageCHROMIUM(ClientBuffer buffer,
314 GLsizei width,
315 GLsizei height,
316 GLenum internalformat) {
317 return test_context_->createImageCHROMIUM(
318 buffer, width, height, internalformat);
321 void TestGLES2Interface::DestroyImageCHROMIUM(GLuint image_id) {
322 test_context_->destroyImageCHROMIUM(image_id);
325 GLuint TestGLES2Interface::CreateGpuMemoryBufferImageCHROMIUM(
326 GLsizei width,
327 GLsizei height,
328 GLenum internalformat,
329 GLenum usage) {
330 return test_context_->createGpuMemoryBufferImageCHROMIUM(
331 width, height, internalformat, usage);
334 void TestGLES2Interface::BindTexImage2DCHROMIUM(GLenum target, GLint image_id) {
335 test_context_->bindTexImage2DCHROMIUM(target, image_id);
338 void TestGLES2Interface::ReleaseTexImage2DCHROMIUM(GLenum target,
339 GLint image_id) {
340 test_context_->releaseTexImage2DCHROMIUM(target, image_id);
343 void* TestGLES2Interface::MapBufferCHROMIUM(GLuint target, GLenum access) {
344 return test_context_->mapBufferCHROMIUM(target, access);
347 GLboolean TestGLES2Interface::UnmapBufferCHROMIUM(GLuint target) {
348 return test_context_->unmapBufferCHROMIUM(target);
351 void TestGLES2Interface::BufferData(GLenum target,
352 GLsizeiptr size,
353 const void* data,
354 GLenum usage) {
355 test_context_->bufferData(target, size, data, usage);
358 void TestGLES2Interface::WaitSyncPointCHROMIUM(GLuint sync_point) {
359 test_context_->waitSyncPoint(sync_point);
362 GLuint TestGLES2Interface::InsertSyncPointCHROMIUM() {
363 return test_context_->insertSyncPoint();
366 void TestGLES2Interface::BeginQueryEXT(GLenum target, GLuint id) {
367 test_context_->beginQueryEXT(target, id);
370 void TestGLES2Interface::EndQueryEXT(GLenum target) {
371 test_context_->endQueryEXT(target);
374 void TestGLES2Interface::GetQueryObjectuivEXT(GLuint id,
375 GLenum pname,
376 GLuint* params) {
377 test_context_->getQueryObjectuivEXT(id, pname, params);
380 void TestGLES2Interface::DiscardFramebufferEXT(GLenum target,
381 GLsizei count,
382 const GLenum* attachments) {
383 test_context_->discardFramebufferEXT(target, count, attachments);
386 void TestGLES2Interface::GenMailboxCHROMIUM(GLbyte* mailbox) {
387 test_context_->genMailboxCHROMIUM(mailbox);
390 void TestGLES2Interface::ProduceTextureCHROMIUM(GLenum target,
391 const GLbyte* mailbox) {
392 test_context_->produceTextureCHROMIUM(target, mailbox);
395 void TestGLES2Interface::ProduceTextureDirectCHROMIUM(GLuint texture,
396 GLenum target,
397 const GLbyte* mailbox) {
398 test_context_->produceTextureDirectCHROMIUM(texture, target, mailbox);
401 void TestGLES2Interface::ConsumeTextureCHROMIUM(GLenum target,
402 const GLbyte* mailbox) {
403 test_context_->consumeTextureCHROMIUM(target, mailbox);
406 GLuint TestGLES2Interface::CreateAndConsumeTextureCHROMIUM(
407 GLenum target,
408 const GLbyte* mailbox) {
409 return test_context_->createAndConsumeTextureCHROMIUM(target, mailbox);
412 void TestGLES2Interface::ResizeCHROMIUM(GLuint width,
413 GLuint height,
414 float device_scale) {
415 test_context_->reshapeWithScaleFactor(width, height, device_scale);
418 void TestGLES2Interface::LoseContextCHROMIUM(GLenum current, GLenum other) {
419 test_context_->loseContextCHROMIUM(current, other);
422 } // namespace cc