1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "platform/graphics/Extensions3D.h"
#include "platform/graphics/GraphicsContext3D.h"
#include "public/platform/WebGraphicsContext3D.h"
#include "wtf/text/CString.h"
namespace WebCore {
Extensions3D::Extensions3D(GraphicsContext3D* context)
: m_context(context)
{
}
Extensions3D::~Extensions3D()
{
}
bool Extensions3D::supports(const String& name)
{
return m_context->supportsExtension(name);
}
void Extensions3D::ensureEnabled(const String& name)
{
bool result = m_context->ensureExtensionEnabled(name);
ASSERT_UNUSED(result, result);
}
bool Extensions3D::isEnabled(const String& name)
{
return m_context->isExtensionEnabled(name);
}
int Extensions3D::getGraphicsResetStatusARB()
{
return static_cast<int>(m_context->webContext()->getGraphicsResetStatusARB());
}
void Extensions3D::blitFramebuffer(long srcX0, long srcY0, long srcX1, long srcY1, long dstX0, long dstY0, long dstX1, long dstY1, unsigned long mask, unsigned long filter)
{
m_context->webContext()->blitFramebufferCHROMIUM(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
}
void Extensions3D::renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height)
{
m_context->webContext()->renderbufferStorageMultisampleCHROMIUM(target, samples, internalformat, width, height);
}
void* Extensions3D::mapBufferSubDataCHROMIUM(unsigned target, int offset, int size, unsigned access)
{
return m_context->webContext()->mapBufferSubDataCHROMIUM(target, offset, size, access);
}
void Extensions3D::unmapBufferSubDataCHROMIUM(const void* data)
{
m_context->webContext()->unmapBufferSubDataCHROMIUM(data);
}
void* Extensions3D::mapTexSubImage2DCHROMIUM(unsigned target, int level, int xoffset, int yoffset, int width, int height, unsigned format, unsigned type, unsigned access)
{
return m_context->webContext()->mapTexSubImage2DCHROMIUM(target, level, xoffset, yoffset, width, height, format, type, access);
}
void Extensions3D::unmapTexSubImage2DCHROMIUM(const void* data)
{
m_context->webContext()->unmapTexSubImage2DCHROMIUM(data);
}
Platform3DObject Extensions3D::createVertexArrayOES()
{
return m_context->webContext()->createVertexArrayOES();
}
void Extensions3D::deleteVertexArrayOES(Platform3DObject array)
{
m_context->webContext()->deleteVertexArrayOES(array);
}
GC3Dboolean Extensions3D::isVertexArrayOES(Platform3DObject array)
{
return m_context->webContext()->isVertexArrayOES(array);
}
void Extensions3D::bindVertexArrayOES(Platform3DObject array)
{
m_context->webContext()->bindVertexArrayOES(array);
}
String Extensions3D::getTranslatedShaderSourceANGLE(Platform3DObject shader)
{
return m_context->webContext()->getTranslatedShaderSourceANGLE(shader);
}
void Extensions3D::rateLimitOffscreenContextCHROMIUM()
{
m_context->webContext()->rateLimitOffscreenContextCHROMIUM();
}
void Extensions3D::paintFramebufferToCanvas(int framebuffer, int width, int height, bool premultiplyAlpha, ImageBuffer* imageBuffer)
{
m_context->paintFramebufferToCanvas(framebuffer, width, height, premultiplyAlpha, imageBuffer);
}
void Extensions3D::texImageIOSurface2DCHROMIUM(unsigned target, int width, int height, uint32_t ioSurfaceId, unsigned plane)
{
m_context->webContext()->texImageIOSurface2DCHROMIUM(target, width, height, ioSurfaceId, plane);
}
void Extensions3D::texStorage2DEXT(unsigned int target, int levels, unsigned int internalFormat, int width, int height)
{
m_context->webContext()->texStorage2DEXT(target, levels, internalFormat, width, height);
}
Platform3DObject Extensions3D::createQueryEXT()
{
return m_context->webContext()->createQueryEXT();
}
void Extensions3D::deleteQueryEXT(Platform3DObject query)
{
m_context->webContext()->deleteQueryEXT(query);
}
GC3Dboolean Extensions3D::isQueryEXT(Platform3DObject query)
{
return m_context->webContext()->isQueryEXT(query);
}
void Extensions3D::beginQueryEXT(GC3Denum target, Platform3DObject query)
{
m_context->webContext()->beginQueryEXT(target, query);
}
void Extensions3D::endQueryEXT(GC3Denum target)
{
m_context->webContext()->endQueryEXT(target);
}
void Extensions3D::getQueryivEXT(GC3Denum target, GC3Denum pname, GC3Dint* params)
{
m_context->webContext()->getQueryivEXT(target, pname, params);
}
void Extensions3D::getQueryObjectuivEXT(Platform3DObject query, GC3Denum pname, GC3Duint* params)
{
m_context->webContext()->getQueryObjectuivEXT(query, pname, params);
}
bool Extensions3D::canUseCopyTextureCHROMIUM(GC3Denum destFormat, GC3Denum destType, GC3Dint level)
{
// FIXME: restriction of (RGB || RGBA)/UNSIGNED_BYTE/(Level 0) should be lifted when
// WebGraphicsContext3D::copyTextureCHROMIUM(...) are fully functional.
if ((destFormat == GL_RGB || destFormat == GL_RGBA)
&& destType == GL_UNSIGNED_BYTE
&& !level)
return true;
return false;
}
void Extensions3D::copyTextureCHROMIUM(GC3Denum target, Platform3DObject sourceId, Platform3DObject destId, GC3Dint level, GC3Denum internalFormat, GC3Denum destType)
{
m_context->webContext()->copyTextureCHROMIUM(target, sourceId, destId, level, internalFormat, destType);
}
void Extensions3D::shallowFlushCHROMIUM()
{
return m_context->webContext()->shallowFlushCHROMIUM();
}
void Extensions3D::insertEventMarkerEXT(const String& marker)
{
m_context->webContext()->insertEventMarkerEXT(marker.utf8().data());
}
void Extensions3D::pushGroupMarkerEXT(const String& marker)
{
m_context->webContext()->pushGroupMarkerEXT(marker.utf8().data());
}
void Extensions3D::popGroupMarkerEXT(void)
{
m_context->webContext()->popGroupMarkerEXT();
}
void Extensions3D::drawBuffersEXT(GC3Dsizei n, const GC3Denum* bufs)
{
m_context->webContext()->drawBuffersEXT(n, bufs);
}
void Extensions3D::drawArraysInstancedANGLE(GC3Denum mode, GC3Dint first, GC3Dsizei count, GC3Dsizei primcount)
{
m_context->webContext()->drawArraysInstancedANGLE(mode, first, count, primcount);
}
void Extensions3D::drawElementsInstancedANGLE(GC3Denum mode, GC3Dsizei count, GC3Denum type, GC3Dintptr offset, GC3Dsizei primcount)
{
m_context->webContext()->drawElementsInstancedANGLE(mode, count, type, offset, primcount);
}
void Extensions3D::vertexAttribDivisorANGLE(GC3Duint index, GC3Duint divisor)
{
m_context->webContext()->vertexAttribDivisorANGLE(index, divisor);
}
void Extensions3D::loseContextCHROMIUM(GC3Denum current, GC3Denum other)
{
m_context->webContext()->loseContextCHROMIUM(current, other);
}
} // namespace WebCore
|