1 // Copyright (c) 2012 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 "ui/compositor/test_web_graphics_context_3d.h"
7 #include "ui/gl/gl_bindings.h"
8 #include "ui/gl/gl_context_stub.h"
9 #include "ui/gl/gl_surface_stub.h"
13 TestWebGraphicsContext3D::TestWebGraphicsContext3D()
14 : next_texture_id_(1) {}
16 TestWebGraphicsContext3D::~TestWebGraphicsContext3D() {}
18 void TestWebGraphicsContext3D::Initialize() {
19 gl_surface_
= new gfx::GLSurfaceStub
;
20 gl_context_
= new gfx::GLContextStub
;
21 gl_context_
->MakeCurrent(gl_surface_
.get());
24 bool TestWebGraphicsContext3D::makeContextCurrent() {
28 int TestWebGraphicsContext3D::width() {
32 int TestWebGraphicsContext3D::height() {
36 bool TestWebGraphicsContext3D::isGLES2Compliant() {
40 bool TestWebGraphicsContext3D::readBackFramebuffer(
41 unsigned char* pixels
,
43 WebKit::WebGLId framebuffer
,
49 WebKit::WebGLId
TestWebGraphicsContext3D::getPlatformTextureId() {
53 bool TestWebGraphicsContext3D::isContextLost() {
57 void* TestWebGraphicsContext3D::mapBufferSubDataCHROMIUM(
58 WebKit::WGC3Denum target
,
59 WebKit::WGC3Dintptr offset
,
60 WebKit::WGC3Dsizeiptr size
,
61 WebKit::WGC3Denum access
) {
65 void* TestWebGraphicsContext3D::mapTexSubImage2DCHROMIUM(
66 WebKit::WGC3Denum target
,
67 WebKit::WGC3Dint level
,
68 WebKit::WGC3Dint xoffset
,
69 WebKit::WGC3Dint yoffset
,
70 WebKit::WGC3Dsizei width
,
71 WebKit::WGC3Dsizei height
,
72 WebKit::WGC3Denum format
,
73 WebKit::WGC3Denum type
,
74 WebKit::WGC3Denum access
) {
78 WebKit::WebString
TestWebGraphicsContext3D::getRequestableExtensionsCHROMIUM() {
79 return WebKit::WebString();
82 WebKit::WGC3Denum
TestWebGraphicsContext3D::checkFramebufferStatus(
83 WebKit::WGC3Denum target
) {
84 return GL_FRAMEBUFFER_COMPLETE
;
87 bool TestWebGraphicsContext3D::getActiveAttrib(WebKit::WebGLId program
,
88 WebKit::WGC3Duint index
,
93 bool TestWebGraphicsContext3D::getActiveUniform(WebKit::WebGLId program
,
94 WebKit::WGC3Duint index
,
99 WebKit::WGC3Dint
TestWebGraphicsContext3D::getAttribLocation(
100 WebKit::WebGLId program
,
101 const WebKit::WGC3Dchar
* name
) {
105 TestWebGraphicsContext3D::Attributes
106 TestWebGraphicsContext3D::getContextAttributes() {
110 WebKit::WGC3Denum
TestWebGraphicsContext3D::getError() {
114 void TestWebGraphicsContext3D::getIntegerv(WebKit::WGC3Denum pname
,
115 WebKit::WGC3Dint
* value
) {
116 if (pname
== GL_MAX_TEXTURE_SIZE
)
120 void TestWebGraphicsContext3D::getProgramiv(WebKit::WebGLId program
,
121 WebKit::WGC3Denum pname
,
122 WebKit::WGC3Dint
* value
) {
123 if (pname
== GL_LINK_STATUS
)
127 WebKit::WebString
TestWebGraphicsContext3D::getProgramInfoLog(
128 WebKit::WebGLId program
) {
129 return WebKit::WebString();
132 void TestWebGraphicsContext3D::getShaderiv(WebKit::WebGLId shader
,
133 WebKit::WGC3Denum pname
,
134 WebKit::WGC3Dint
* value
) {
135 if (pname
== GL_COMPILE_STATUS
)
139 WebKit::WebString
TestWebGraphicsContext3D::getShaderInfoLog(
140 WebKit::WebGLId shader
) {
141 return WebKit::WebString();
144 WebKit::WebString
TestWebGraphicsContext3D::getShaderSource(
145 WebKit::WebGLId shader
) {
146 return WebKit::WebString();
149 WebKit::WebString
TestWebGraphicsContext3D::getString(WebKit::WGC3Denum name
) {
150 return WebKit::WebString();
153 WebKit::WGC3Dint
TestWebGraphicsContext3D::getUniformLocation(
154 WebKit::WebGLId program
,
155 const WebKit::WGC3Dchar
* name
) {
159 WebKit::WGC3Dsizeiptr
TestWebGraphicsContext3D::getVertexAttribOffset(
160 WebKit::WGC3Duint index
,
161 WebKit::WGC3Denum pname
) {
165 WebKit::WGC3Dboolean
TestWebGraphicsContext3D::isBuffer(
166 WebKit::WebGLId buffer
) {
170 WebKit::WGC3Dboolean
TestWebGraphicsContext3D::isEnabled(
171 WebKit::WGC3Denum cap
) {
175 WebKit::WGC3Dboolean
TestWebGraphicsContext3D::isFramebuffer(
176 WebKit::WebGLId framebuffer
) {
180 WebKit::WGC3Dboolean
TestWebGraphicsContext3D::isProgram(
181 WebKit::WebGLId program
) {
185 WebKit::WGC3Dboolean
TestWebGraphicsContext3D::isRenderbuffer(
186 WebKit::WebGLId renderbuffer
) {
190 WebKit::WGC3Dboolean
TestWebGraphicsContext3D::isShader(
191 WebKit::WebGLId shader
) {
195 WebKit::WGC3Dboolean
TestWebGraphicsContext3D::isTexture(
196 WebKit::WebGLId texture
) {
200 WebKit::WebGLId
TestWebGraphicsContext3D::createBuffer() {
204 WebKit::WebGLId
TestWebGraphicsContext3D::createFramebuffer() {
208 WebKit::WebGLId
TestWebGraphicsContext3D::createProgram() {
212 WebKit::WebGLId
TestWebGraphicsContext3D::createRenderbuffer() {
216 WebKit::WebGLId
TestWebGraphicsContext3D::createShader(
217 WebKit::WGC3Denum value
) {
221 WebKit::WebGLId
TestWebGraphicsContext3D::createTexture() {
222 return next_texture_id_
++;
225 WebKit::WebGLId
TestWebGraphicsContext3D::createQueryEXT()
230 WebKit::WGC3Dboolean
TestWebGraphicsContext3D::isQueryEXT(WebKit::WebGLId
)