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