Update V8 to version 4.6.62.
[chromium-blink-merge.git] / cc / test / test_gles2_interface.cc
blob38b1d2014797665dea5105a779a359d3f859a036
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"
9 #include "gpu/GLES2/gl2extchromium.h"
11 namespace cc {
13 TestGLES2Interface::TestGLES2Interface(TestWebGraphicsContext3D* test_context)
14 : test_context_(test_context) {
15 DCHECK(test_context_);
18 TestGLES2Interface::~TestGLES2Interface() {}
20 void TestGLES2Interface::GenTextures(GLsizei n, GLuint* textures) {
21 for (GLsizei i = 0; i < n; ++i) {
22 textures[i] = test_context_->createTexture();
26 void TestGLES2Interface::GenBuffers(GLsizei n, GLuint* buffers) {
27 for (GLsizei i = 0; i < n; ++i) {
28 buffers[i] = test_context_->createBuffer();
32 void TestGLES2Interface::GenFramebuffers(GLsizei n, GLuint* framebuffers) {
33 for (GLsizei i = 0; i < n; ++i) {
34 framebuffers[i] = test_context_->createFramebuffer();
38 void TestGLES2Interface::GenRenderbuffers(GLsizei n, GLuint* renderbuffers) {
39 for (GLsizei i = 0; i < n; ++i) {
40 renderbuffers[i] = test_context_->createRenderbuffer();
44 void TestGLES2Interface::GenQueriesEXT(GLsizei n, GLuint* queries) {
45 for (GLsizei i = 0; i < n; ++i) {
46 queries[i] = test_context_->createQueryEXT();
50 void TestGLES2Interface::DeleteTextures(GLsizei n, const GLuint* textures) {
51 for (GLsizei i = 0; i < n; ++i) {
52 test_context_->deleteTexture(textures[i]);
56 void TestGLES2Interface::DeleteBuffers(GLsizei n, const GLuint* buffers) {
57 for (GLsizei i = 0; i < n; ++i) {
58 test_context_->deleteBuffer(buffers[i]);
62 void TestGLES2Interface::DeleteFramebuffers(GLsizei n,
63 const GLuint* framebuffers) {
64 for (GLsizei i = 0; i < n; ++i) {
65 test_context_->deleteFramebuffer(framebuffers[i]);
69 void TestGLES2Interface::DeleteQueriesEXT(GLsizei n, const GLuint* queries) {
70 for (GLsizei i = 0; i < n; ++i) {
71 test_context_->deleteQueryEXT(queries[i]);
75 GLuint TestGLES2Interface::CreateShader(GLenum type) {
76 return test_context_->createShader(type);
79 GLuint TestGLES2Interface::CreateProgram() {
80 return test_context_->createProgram();
83 void TestGLES2Interface::BindTexture(GLenum target, GLuint texture) {
84 test_context_->bindTexture(target, texture);
87 void TestGLES2Interface::GetIntegerv(GLenum pname, GLint* params) {
88 test_context_->getIntegerv(pname, params);
91 void TestGLES2Interface::GetShaderiv(GLuint shader,
92 GLenum pname,
93 GLint* params) {
94 test_context_->getShaderiv(shader, pname, params);
97 void TestGLES2Interface::GetProgramiv(GLuint program,
98 GLenum pname,
99 GLint* params) {
100 test_context_->getProgramiv(program, pname, params);
103 void TestGLES2Interface::GetShaderPrecisionFormat(GLenum shadertype,
104 GLenum precisiontype,
105 GLint* range,
106 GLint* precision) {
107 test_context_->getShaderPrecisionFormat(
108 shadertype, precisiontype, range, precision);
111 void TestGLES2Interface::Viewport(GLint x,
112 GLint y,
113 GLsizei width,
114 GLsizei height) {
115 test_context_->viewport(x, y, width, height);
118 void TestGLES2Interface::ActiveTexture(GLenum target) {
119 test_context_->activeTexture(target);
122 void TestGLES2Interface::UseProgram(GLuint program) {
123 test_context_->useProgram(program);
126 GLenum TestGLES2Interface::CheckFramebufferStatus(GLenum target) {
127 return test_context_->checkFramebufferStatus(target);
130 void TestGLES2Interface::Scissor(GLint x,
131 GLint y,
132 GLsizei width,
133 GLsizei height) {
134 test_context_->scissor(x, y, width, height);
137 void TestGLES2Interface::DrawElements(GLenum mode,
138 GLsizei count,
139 GLenum type,
140 const void* indices) {
141 test_context_->drawElements(
142 mode, count, type, reinterpret_cast<intptr_t>(indices));
145 void TestGLES2Interface::ClearColor(GLclampf red,
146 GLclampf green,
147 GLclampf blue,
148 GLclampf alpha) {
149 test_context_->clearColor(red, green, blue, alpha);
152 void TestGLES2Interface::ClearStencil(GLint s) {
153 test_context_->clearStencil(s);
156 void TestGLES2Interface::Clear(GLbitfield mask) { test_context_->clear(mask); }
158 void TestGLES2Interface::Flush() { test_context_->flush(); }
160 void TestGLES2Interface::Finish() { test_context_->finish(); }
162 void TestGLES2Interface::ShallowFinishCHROMIUM() {
163 test_context_->shallowFinishCHROMIUM();
166 void TestGLES2Interface::ShallowFlushCHROMIUM() {
167 test_context_->shallowFlushCHROMIUM();
170 void TestGLES2Interface::Enable(GLenum cap) { test_context_->enable(cap); }
172 void TestGLES2Interface::Disable(GLenum cap) { test_context_->disable(cap); }
174 void TestGLES2Interface::BindRenderbuffer(GLenum target, GLuint buffer) {
175 test_context_->bindRenderbuffer(target, buffer);
178 void TestGLES2Interface::BindFramebuffer(GLenum target, GLuint buffer) {
179 test_context_->bindFramebuffer(target, buffer);
182 void TestGLES2Interface::BindBuffer(GLenum target, GLuint buffer) {
183 test_context_->bindBuffer(target, buffer);
186 void TestGLES2Interface::PixelStorei(GLenum pname, GLint param) {
187 test_context_->pixelStorei(pname, param);
190 void TestGLES2Interface::TexImage2D(GLenum target,
191 GLint level,
192 GLint internalformat,
193 GLsizei width,
194 GLsizei height,
195 GLint border,
196 GLenum format,
197 GLenum type,
198 const void* pixels) {
199 test_context_->texImage2D(target,
200 level,
201 internalformat,
202 width,
203 height,
204 border,
205 format,
206 type,
207 pixels);
210 void TestGLES2Interface::TexSubImage2D(GLenum target,
211 GLint level,
212 GLint xoffset,
213 GLint yoffset,
214 GLsizei width,
215 GLsizei height,
216 GLenum format,
217 GLenum type,
218 const void* pixels) {
219 test_context_->texSubImage2D(
220 target, level, xoffset, yoffset, width, height, format, type, pixels);
223 void TestGLES2Interface::TexStorage2DEXT(GLenum target,
224 GLsizei levels,
225 GLenum internalformat,
226 GLsizei width,
227 GLsizei height) {
228 test_context_->texStorage2DEXT(target, levels, internalformat, width, height);
231 void TestGLES2Interface::TexImageIOSurface2DCHROMIUM(GLenum target,
232 GLsizei width,
233 GLsizei height,
234 GLuint io_surface_id,
235 GLuint plane) {
236 test_context_->texImageIOSurface2DCHROMIUM(
237 target, width, height, io_surface_id, plane);
240 void TestGLES2Interface::TexParameteri(GLenum target,
241 GLenum pname,
242 GLint param) {
243 test_context_->texParameteri(target, pname, param);
246 void TestGLES2Interface::FramebufferRenderbuffer(GLenum target,
247 GLenum attachment,
248 GLenum renderbuffertarget,
249 GLuint renderbuffer) {
250 test_context_->framebufferRenderbuffer(
251 target, attachment, renderbuffertarget, renderbuffer);
253 void TestGLES2Interface::FramebufferTexture2D(GLenum target,
254 GLenum attachment,
255 GLenum textarget,
256 GLuint texture,
257 GLint level) {
258 test_context_->framebufferTexture2D(
259 target, attachment, textarget, texture, level);
262 void TestGLES2Interface::RenderbufferStorage(GLenum target,
263 GLenum internalformat,
264 GLsizei width,
265 GLsizei height) {
266 test_context_->renderbufferStorage(target, internalformat, width, height);
269 void TestGLES2Interface::AsyncTexImage2DCHROMIUM(GLenum target,
270 GLint level,
271 GLenum internalformat,
272 GLsizei width,
273 GLsizei height,
274 GLint border,
275 GLenum format,
276 GLenum type,
277 const void* pixels) {
278 test_context_->asyncTexImage2DCHROMIUM(target,
279 level,
280 internalformat,
281 width,
282 height,
283 border,
284 format,
285 type,
286 pixels);
289 void TestGLES2Interface::AsyncTexSubImage2DCHROMIUM(GLenum target,
290 GLint level,
291 GLint xoffset,
292 GLint yoffset,
293 GLsizei width,
294 GLsizei height,
295 GLenum format,
296 GLenum type,
297 const void* pixels) {
298 test_context_->asyncTexSubImage2DCHROMIUM(
299 target, level, xoffset, yoffset, width, height, format, type, pixels);
302 void TestGLES2Interface::CompressedTexImage2D(GLenum target,
303 GLint level,
304 GLenum internalformat,
305 GLsizei width,
306 GLsizei height,
307 GLint border,
308 GLsizei image_size,
309 const void* data) {
310 test_context_->compressedTexImage2D(
311 target, level, internalformat, width, height, border, image_size, data);
314 void TestGLES2Interface::WaitAsyncTexImage2DCHROMIUM(GLenum target) {
315 test_context_->waitAsyncTexImage2DCHROMIUM(target);
318 GLuint TestGLES2Interface::CreateImageCHROMIUM(ClientBuffer buffer,
319 GLsizei width,
320 GLsizei height,
321 GLenum internalformat) {
322 return test_context_->createImageCHROMIUM(
323 buffer, width, height, internalformat);
326 void TestGLES2Interface::DestroyImageCHROMIUM(GLuint image_id) {
327 test_context_->destroyImageCHROMIUM(image_id);
330 GLuint TestGLES2Interface::CreateGpuMemoryBufferImageCHROMIUM(
331 GLsizei width,
332 GLsizei height,
333 GLenum internalformat,
334 GLenum usage) {
335 return test_context_->createGpuMemoryBufferImageCHROMIUM(
336 width, height, internalformat, usage);
339 void TestGLES2Interface::BindTexImage2DCHROMIUM(GLenum target, GLint image_id) {
340 test_context_->bindTexImage2DCHROMIUM(target, image_id);
343 void TestGLES2Interface::ReleaseTexImage2DCHROMIUM(GLenum target,
344 GLint image_id) {
345 test_context_->releaseTexImage2DCHROMIUM(target, image_id);
348 void* TestGLES2Interface::MapBufferCHROMIUM(GLuint target, GLenum access) {
349 return test_context_->mapBufferCHROMIUM(target, access);
352 GLboolean TestGLES2Interface::UnmapBufferCHROMIUM(GLuint target) {
353 return test_context_->unmapBufferCHROMIUM(target);
356 void TestGLES2Interface::BufferData(GLenum target,
357 GLsizeiptr size,
358 const void* data,
359 GLenum usage) {
360 test_context_->bufferData(target, size, data, usage);
363 void TestGLES2Interface::WaitSyncPointCHROMIUM(GLuint sync_point) {
364 test_context_->waitSyncPoint(sync_point);
367 GLuint TestGLES2Interface::InsertSyncPointCHROMIUM() {
368 return test_context_->insertSyncPoint();
371 void TestGLES2Interface::BeginQueryEXT(GLenum target, GLuint id) {
372 test_context_->beginQueryEXT(target, id);
375 void TestGLES2Interface::EndQueryEXT(GLenum target) {
376 test_context_->endQueryEXT(target);
379 void TestGLES2Interface::GetQueryObjectuivEXT(GLuint id,
380 GLenum pname,
381 GLuint* params) {
382 test_context_->getQueryObjectuivEXT(id, pname, params);
385 void TestGLES2Interface::DiscardFramebufferEXT(GLenum target,
386 GLsizei count,
387 const GLenum* attachments) {
388 test_context_->discardFramebufferEXT(target, count, attachments);
391 void TestGLES2Interface::GenMailboxCHROMIUM(GLbyte* mailbox) {
392 test_context_->genMailboxCHROMIUM(mailbox);
395 void TestGLES2Interface::ProduceTextureCHROMIUM(GLenum target,
396 const GLbyte* mailbox) {
397 test_context_->produceTextureCHROMIUM(target, mailbox);
400 void TestGLES2Interface::ProduceTextureDirectCHROMIUM(GLuint texture,
401 GLenum target,
402 const GLbyte* mailbox) {
403 test_context_->produceTextureDirectCHROMIUM(texture, target, mailbox);
406 void TestGLES2Interface::ConsumeTextureCHROMIUM(GLenum target,
407 const GLbyte* mailbox) {
408 test_context_->consumeTextureCHROMIUM(target, mailbox);
411 GLuint TestGLES2Interface::CreateAndConsumeTextureCHROMIUM(
412 GLenum target,
413 const GLbyte* mailbox) {
414 return test_context_->createAndConsumeTextureCHROMIUM(target, mailbox);
417 void TestGLES2Interface::ResizeCHROMIUM(GLuint width,
418 GLuint height,
419 float device_scale) {
420 test_context_->reshapeWithScaleFactor(width, height, device_scale);
423 void TestGLES2Interface::LoseContextCHROMIUM(GLenum current, GLenum other) {
424 test_context_->loseContextCHROMIUM(current, other);
427 GLenum TestGLES2Interface::GetGraphicsResetStatusKHR() {
428 if (test_context_->isContextLost())
429 return GL_UNKNOWN_CONTEXT_RESET_KHR;
430 return GL_NO_ERROR;
433 } // namespace cc