MediaCodecPlayer implementation - stage 6 (respect audio permission)
[chromium-blink-merge.git] / cc / test / test_gles2_interface.cc
blob4b03ac84a019ba546e7b79daefd465837caffef8
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::CompressedTexImage2D(GLenum target,
270 GLint level,
271 GLenum internalformat,
272 GLsizei width,
273 GLsizei height,
274 GLint border,
275 GLsizei image_size,
276 const void* data) {
277 test_context_->compressedTexImage2D(
278 target, level, internalformat, width, height, border, image_size, data);
281 GLuint TestGLES2Interface::CreateImageCHROMIUM(ClientBuffer buffer,
282 GLsizei width,
283 GLsizei height,
284 GLenum internalformat) {
285 return test_context_->createImageCHROMIUM(
286 buffer, width, height, internalformat);
289 void TestGLES2Interface::DestroyImageCHROMIUM(GLuint image_id) {
290 test_context_->destroyImageCHROMIUM(image_id);
293 GLuint TestGLES2Interface::CreateGpuMemoryBufferImageCHROMIUM(
294 GLsizei width,
295 GLsizei height,
296 GLenum internalformat,
297 GLenum usage) {
298 return test_context_->createGpuMemoryBufferImageCHROMIUM(
299 width, height, internalformat, usage);
302 void TestGLES2Interface::BindTexImage2DCHROMIUM(GLenum target, GLint image_id) {
303 test_context_->bindTexImage2DCHROMIUM(target, image_id);
306 void TestGLES2Interface::ReleaseTexImage2DCHROMIUM(GLenum target,
307 GLint image_id) {
308 test_context_->releaseTexImage2DCHROMIUM(target, image_id);
311 void* TestGLES2Interface::MapBufferCHROMIUM(GLuint target, GLenum access) {
312 return test_context_->mapBufferCHROMIUM(target, access);
315 GLboolean TestGLES2Interface::UnmapBufferCHROMIUM(GLuint target) {
316 return test_context_->unmapBufferCHROMIUM(target);
319 void TestGLES2Interface::BufferData(GLenum target,
320 GLsizeiptr size,
321 const void* data,
322 GLenum usage) {
323 test_context_->bufferData(target, size, data, usage);
326 void TestGLES2Interface::WaitSyncPointCHROMIUM(GLuint sync_point) {
327 test_context_->waitSyncPoint(sync_point);
330 GLuint TestGLES2Interface::InsertSyncPointCHROMIUM() {
331 return test_context_->insertSyncPoint();
334 void TestGLES2Interface::BeginQueryEXT(GLenum target, GLuint id) {
335 test_context_->beginQueryEXT(target, id);
338 void TestGLES2Interface::EndQueryEXT(GLenum target) {
339 test_context_->endQueryEXT(target);
342 void TestGLES2Interface::GetQueryObjectuivEXT(GLuint id,
343 GLenum pname,
344 GLuint* params) {
345 test_context_->getQueryObjectuivEXT(id, pname, params);
348 void TestGLES2Interface::DiscardFramebufferEXT(GLenum target,
349 GLsizei count,
350 const GLenum* attachments) {
351 test_context_->discardFramebufferEXT(target, count, attachments);
354 void TestGLES2Interface::GenMailboxCHROMIUM(GLbyte* mailbox) {
355 test_context_->genMailboxCHROMIUM(mailbox);
358 void TestGLES2Interface::ProduceTextureCHROMIUM(GLenum target,
359 const GLbyte* mailbox) {
360 test_context_->produceTextureCHROMIUM(target, mailbox);
363 void TestGLES2Interface::ProduceTextureDirectCHROMIUM(GLuint texture,
364 GLenum target,
365 const GLbyte* mailbox) {
366 test_context_->produceTextureDirectCHROMIUM(texture, target, mailbox);
369 void TestGLES2Interface::ConsumeTextureCHROMIUM(GLenum target,
370 const GLbyte* mailbox) {
371 test_context_->consumeTextureCHROMIUM(target, mailbox);
374 GLuint TestGLES2Interface::CreateAndConsumeTextureCHROMIUM(
375 GLenum target,
376 const GLbyte* mailbox) {
377 return test_context_->createAndConsumeTextureCHROMIUM(target, mailbox);
380 void TestGLES2Interface::ResizeCHROMIUM(GLuint width,
381 GLuint height,
382 float device_scale) {
383 test_context_->reshapeWithScaleFactor(width, height, device_scale);
386 void TestGLES2Interface::LoseContextCHROMIUM(GLenum current, GLenum other) {
387 test_context_->loseContextCHROMIUM(current, other);
390 GLenum TestGLES2Interface::GetGraphicsResetStatusKHR() {
391 if (test_context_->isContextLost())
392 return GL_UNKNOWN_CONTEXT_RESET_KHR;
393 return GL_NO_ERROR;
396 } // namespace cc