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/fake_web_graphics_context_3d.h"
7 #include "base/logging.h"
8 #include "third_party/khronos/GLES2/gl2.h"
12 FakeWebGraphicsContext3D::FakeWebGraphicsContext3D() {}
14 FakeWebGraphicsContext3D::~FakeWebGraphicsContext3D() {}
16 bool FakeWebGraphicsContext3D::makeContextCurrent() {
20 bool FakeWebGraphicsContext3D::isGLES2Compliant() {
24 GLuint FakeWebGraphicsContext3D::getPlatformTextureId() {
28 bool FakeWebGraphicsContext3D::isContextLost() {
32 void* FakeWebGraphicsContext3D::mapBufferSubDataCHROMIUM(
40 void* FakeWebGraphicsContext3D::mapTexSubImage2DCHROMIUM(
53 GLenum FakeWebGraphicsContext3D::checkFramebufferStatus(
55 return GL_FRAMEBUFFER_COMPLETE;
58 GLint FakeWebGraphicsContext3D::getAttribLocation(
64 GLenum FakeWebGraphicsContext3D::getError() {
68 void FakeWebGraphicsContext3D::getIntegerv(
71 if (pname == GL_MAX_TEXTURE_SIZE)
73 else if (pname == GL_ACTIVE_TEXTURE)
77 void FakeWebGraphicsContext3D::getProgramiv(
81 if (pname == GL_LINK_STATUS)
85 void FakeWebGraphicsContext3D::getShaderiv(
89 if (pname == GL_COMPILE_STATUS)
93 void FakeWebGraphicsContext3D::getShaderPrecisionFormat(
98 // Return the minimum precision requirements of the GLES specificatin.
99 switch (precisiontype) {
120 case GL_MEDIUM_FLOAT:
136 GLint FakeWebGraphicsContext3D::getUniformLocation(
138 const GLchar* name) {
142 GLsizeiptr FakeWebGraphicsContext3D::getVertexAttribOffset(
148 GLboolean FakeWebGraphicsContext3D::isBuffer(
153 GLboolean FakeWebGraphicsContext3D::isEnabled(
158 GLboolean FakeWebGraphicsContext3D::isFramebuffer(
159 GLuint framebuffer) {
163 GLboolean FakeWebGraphicsContext3D::isProgram(
168 GLboolean FakeWebGraphicsContext3D::isRenderbuffer(
169 GLuint renderbuffer) {
173 GLboolean FakeWebGraphicsContext3D::isShader(
178 GLboolean FakeWebGraphicsContext3D::isTexture(
183 void FakeWebGraphicsContext3D::genBuffers(GLsizei count, GLuint* ids) {
184 for (int i = 0; i < count; ++i)
188 void FakeWebGraphicsContext3D::genFramebuffers(
189 GLsizei count, GLuint* ids) {
190 for (int i = 0; i < count; ++i)
194 void FakeWebGraphicsContext3D::genRenderbuffers(
195 GLsizei count, GLuint* ids) {
196 for (int i = 0; i < count; ++i)
200 void FakeWebGraphicsContext3D::genTextures(GLsizei count, GLuint* ids) {
201 for (int i = 0; i < count; ++i)
205 void FakeWebGraphicsContext3D::deleteBuffers(GLsizei count, GLuint* ids) {
208 void FakeWebGraphicsContext3D::deleteFramebuffers(
209 GLsizei count, GLuint* ids) {
212 void FakeWebGraphicsContext3D::deleteRenderbuffers(
213 GLsizei count, GLuint* ids) {
216 void FakeWebGraphicsContext3D::deleteTextures(GLsizei count, GLuint* ids) {
219 GLuint FakeWebGraphicsContext3D::createBuffer() {
223 GLuint FakeWebGraphicsContext3D::createFramebuffer() {
227 GLuint FakeWebGraphicsContext3D::createRenderbuffer() {
231 GLuint FakeWebGraphicsContext3D::createTexture() {
235 void FakeWebGraphicsContext3D::deleteBuffer(GLuint id) {
238 void FakeWebGraphicsContext3D::deleteFramebuffer(GLuint id) {
241 void FakeWebGraphicsContext3D::deleteRenderbuffer(GLuint id) {
244 void FakeWebGraphicsContext3D::deleteTexture(GLuint texture_id) {
247 GLuint FakeWebGraphicsContext3D::createProgram() {
251 GLuint FakeWebGraphicsContext3D::createShader(GLenum) {
255 void FakeWebGraphicsContext3D::deleteProgram(GLuint id) {
258 void FakeWebGraphicsContext3D::deleteShader(GLuint id) {
261 void FakeWebGraphicsContext3D::attachShader(GLuint program, GLuint shader) {
264 void FakeWebGraphicsContext3D::useProgram(GLuint program) {
267 void FakeWebGraphicsContext3D::bindBuffer(GLenum target, GLuint buffer) {
270 void FakeWebGraphicsContext3D::bindFramebuffer(
271 GLenum target, GLuint framebuffer) {
274 void FakeWebGraphicsContext3D::bindRenderbuffer(
275 GLenum target, GLuint renderbuffer) {
278 void FakeWebGraphicsContext3D::bindTexture(
279 GLenum target, GLuint texture_id) {
282 GLuint FakeWebGraphicsContext3D::createQueryEXT() {
286 GLboolean FakeWebGraphicsContext3D::isQueryEXT(GLuint query) {
290 void FakeWebGraphicsContext3D::endQueryEXT(GLenum target) {
293 void FakeWebGraphicsContext3D::getQueryObjectuivEXT(
299 void FakeWebGraphicsContext3D::loseContextCHROMIUM(GLenum current,
303 GLuint FakeWebGraphicsContext3D::createImageCHROMIUM(
304 GLsizei width, GLsizei height,
305 GLenum internalformat) {
309 void* FakeWebGraphicsContext3D::mapImageCHROMIUM(GLuint image_id,