| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 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 | 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. | 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 | 27 |
| 28 #include "core/platform/graphics/Extensions3D.h" | 28 #include "core/platform/graphics/Extensions3D.h" |
| 29 | 29 |
| 30 #include "core/platform/NotImplemented.h" | 30 #include "core/platform/NotImplemented.h" |
| 31 #include "core/platform/chromium/support/GraphicsContext3DPrivate.h" | |
| 32 #include "core/platform/graphics/GraphicsContext3D.h" | 31 #include "core/platform/graphics/GraphicsContext3D.h" |
| 33 #include <public/WebGraphicsContext3D.h> | 32 #include <public/WebGraphicsContext3D.h> |
| 34 #include <wtf/text/CString.h> | 33 #include <wtf/text/CString.h> |
| 35 | 34 |
| 36 namespace WebCore { | 35 namespace WebCore { |
| 37 | 36 |
| 38 Extensions3D::Extensions3D(GraphicsContext3DPrivate* priv) | 37 Extensions3D::Extensions3D(GraphicsContext3D* context) |
| 39 : m_private(priv) | 38 : m_context(context) |
| 40 { | 39 { |
| 41 } | 40 } |
| 42 | 41 |
| 43 Extensions3D::~Extensions3D() | 42 Extensions3D::~Extensions3D() |
| 44 { | 43 { |
| 45 } | 44 } |
| 46 | 45 |
| 47 bool Extensions3D::supports(const String& name) | 46 bool Extensions3D::supports(const String& name) |
| 48 { | 47 { |
| 49 return m_private->supportsExtension(name); | 48 return m_context->supportsExtension(name); |
| 50 } | 49 } |
| 51 | 50 |
| 52 void Extensions3D::ensureEnabled(const String& name) | 51 void Extensions3D::ensureEnabled(const String& name) |
| 53 { | 52 { |
| 54 bool result = m_private->ensureExtensionEnabled(name); | 53 bool result = m_context->ensureExtensionEnabled(name); |
| 55 ASSERT_UNUSED(result, result); | 54 ASSERT_UNUSED(result, result); |
| 56 } | 55 } |
| 57 | 56 |
| 58 bool Extensions3D::isEnabled(const String& name) | 57 bool Extensions3D::isEnabled(const String& name) |
| 59 { | 58 { |
| 60 return m_private->isExtensionEnabled(name); | 59 return m_context->isExtensionEnabled(name); |
| 61 } | 60 } |
| 62 | 61 |
| 63 int Extensions3D::getGraphicsResetStatusARB() | 62 int Extensions3D::getGraphicsResetStatusARB() |
| 64 { | 63 { |
| 65 return static_cast<int>(m_private->webContext()->getGraphicsResetStatusARB()
); | 64 return static_cast<int>(m_context->webContext()->getGraphicsResetStatusARB()
); |
| 66 } | 65 } |
| 67 | 66 |
| 68 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 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) |
| 69 { | 68 { |
| 70 m_private->webContext()->blitFramebufferCHROMIUM(srcX0, srcY0, srcX1, srcY1,
dstX0, dstY0, dstX1, dstY1, mask, filter); | 69 m_context->webContext()->blitFramebufferCHROMIUM(srcX0, srcY0, srcX1, srcY1,
dstX0, dstY0, dstX1, dstY1, mask, filter); |
| 71 } | 70 } |
| 72 | 71 |
| 73 void Extensions3D::renderbufferStorageMultisample(unsigned long target, unsigned
long samples, unsigned long internalformat, unsigned long width, unsigned long
height) | 72 void Extensions3D::renderbufferStorageMultisample(unsigned long target, unsigned
long samples, unsigned long internalformat, unsigned long width, unsigned long
height) |
| 74 { | 73 { |
| 75 m_private->webContext()->renderbufferStorageMultisampleCHROMIUM(target, samp
les, internalformat, width, height); | 74 m_context->webContext()->renderbufferStorageMultisampleCHROMIUM(target, samp
les, internalformat, width, height); |
| 76 } | 75 } |
| 77 | 76 |
| 78 void* Extensions3D::mapBufferSubDataCHROMIUM(unsigned target, int offset, int si
ze, unsigned access) | 77 void* Extensions3D::mapBufferSubDataCHROMIUM(unsigned target, int offset, int si
ze, unsigned access) |
| 79 { | 78 { |
| 80 return m_private->webContext()->mapBufferSubDataCHROMIUM(target, offset, siz
e, access); | 79 return m_context->webContext()->mapBufferSubDataCHROMIUM(target, offset, siz
e, access); |
| 81 } | 80 } |
| 82 | 81 |
| 83 void Extensions3D::unmapBufferSubDataCHROMIUM(const void* data) | 82 void Extensions3D::unmapBufferSubDataCHROMIUM(const void* data) |
| 84 { | 83 { |
| 85 m_private->webContext()->unmapBufferSubDataCHROMIUM(data); | 84 m_context->webContext()->unmapBufferSubDataCHROMIUM(data); |
| 86 } | 85 } |
| 87 | 86 |
| 88 void* Extensions3D::mapTexSubImage2DCHROMIUM(unsigned target, int level, int xof
fset, int yoffset, int width, int height, unsigned format, unsigned type, unsign
ed access) | 87 void* Extensions3D::mapTexSubImage2DCHROMIUM(unsigned target, int level, int xof
fset, int yoffset, int width, int height, unsigned format, unsigned type, unsign
ed access) |
| 89 { | 88 { |
| 90 return m_private->webContext()->mapTexSubImage2DCHROMIUM(target, level, xoff
set, yoffset, width, height, format, type, access); | 89 return m_context->webContext()->mapTexSubImage2DCHROMIUM(target, level, xoff
set, yoffset, width, height, format, type, access); |
| 91 } | 90 } |
| 92 | 91 |
| 93 void Extensions3D::unmapTexSubImage2DCHROMIUM(const void* data) | 92 void Extensions3D::unmapTexSubImage2DCHROMIUM(const void* data) |
| 94 { | 93 { |
| 95 m_private->webContext()->unmapTexSubImage2DCHROMIUM(data); | 94 m_context->webContext()->unmapTexSubImage2DCHROMIUM(data); |
| 96 } | 95 } |
| 97 | 96 |
| 98 Platform3DObject Extensions3D::createVertexArrayOES() | 97 Platform3DObject Extensions3D::createVertexArrayOES() |
| 99 { | 98 { |
| 100 return m_private->webContext()->createVertexArrayOES(); | 99 return m_context->webContext()->createVertexArrayOES(); |
| 101 } | 100 } |
| 102 | 101 |
| 103 void Extensions3D::deleteVertexArrayOES(Platform3DObject array) | 102 void Extensions3D::deleteVertexArrayOES(Platform3DObject array) |
| 104 { | 103 { |
| 105 m_private->webContext()->deleteVertexArrayOES(array); | 104 m_context->webContext()->deleteVertexArrayOES(array); |
| 106 } | 105 } |
| 107 | 106 |
| 108 GC3Dboolean Extensions3D::isVertexArrayOES(Platform3DObject array) | 107 GC3Dboolean Extensions3D::isVertexArrayOES(Platform3DObject array) |
| 109 { | 108 { |
| 110 return m_private->webContext()->isVertexArrayOES(array); | 109 return m_context->webContext()->isVertexArrayOES(array); |
| 111 } | 110 } |
| 112 | 111 |
| 113 void Extensions3D::bindVertexArrayOES(Platform3DObject array) | 112 void Extensions3D::bindVertexArrayOES(Platform3DObject array) |
| 114 { | 113 { |
| 115 m_private->webContext()->bindVertexArrayOES(array); | 114 m_context->webContext()->bindVertexArrayOES(array); |
| 116 } | 115 } |
| 117 | 116 |
| 118 String Extensions3D::getTranslatedShaderSourceANGLE(Platform3DObject shader) | 117 String Extensions3D::getTranslatedShaderSourceANGLE(Platform3DObject shader) |
| 119 { | 118 { |
| 120 return m_private->webContext()->getTranslatedShaderSourceANGLE(shader); | 119 return m_context->webContext()->getTranslatedShaderSourceANGLE(shader); |
| 121 } | 120 } |
| 122 | 121 |
| 123 void Extensions3D::rateLimitOffscreenContextCHROMIUM() | 122 void Extensions3D::rateLimitOffscreenContextCHROMIUM() |
| 124 { | 123 { |
| 125 m_private->webContext()->rateLimitOffscreenContextCHROMIUM(); | 124 m_context->webContext()->rateLimitOffscreenContextCHROMIUM(); |
| 126 } | 125 } |
| 127 | 126 |
| 128 void Extensions3D::paintFramebufferToCanvas(int framebuffer, int width, int heig
ht, bool premultiplyAlpha, ImageBuffer* imageBuffer) | 127 void Extensions3D::paintFramebufferToCanvas(int framebuffer, int width, int heig
ht, bool premultiplyAlpha, ImageBuffer* imageBuffer) |
| 129 { | 128 { |
| 130 m_private->paintFramebufferToCanvas(framebuffer, width, height, premultiplyA
lpha, imageBuffer); | 129 m_context->paintFramebufferToCanvas(framebuffer, width, height, premultiplyA
lpha, imageBuffer); |
| 131 } | 130 } |
| 132 | 131 |
| 133 void Extensions3D::texImageIOSurface2DCHROMIUM(unsigned target, int width, int h
eight, uint32_t ioSurfaceId, unsigned plane) | 132 void Extensions3D::texImageIOSurface2DCHROMIUM(unsigned target, int width, int h
eight, uint32_t ioSurfaceId, unsigned plane) |
| 134 { | 133 { |
| 135 m_private->webContext()->texImageIOSurface2DCHROMIUM(target, width, height,
ioSurfaceId, plane); | 134 m_context->webContext()->texImageIOSurface2DCHROMIUM(target, width, height,
ioSurfaceId, plane); |
| 136 } | 135 } |
| 137 | 136 |
| 138 void Extensions3D::texStorage2DEXT(unsigned int target, int levels, unsigned int
internalFormat, int width, int height) | 137 void Extensions3D::texStorage2DEXT(unsigned int target, int levels, unsigned int
internalFormat, int width, int height) |
| 139 { | 138 { |
| 140 m_private->webContext()->texStorage2DEXT(target, levels, internalFormat, wid
th, height); | 139 m_context->webContext()->texStorage2DEXT(target, levels, internalFormat, wid
th, height); |
| 141 } | 140 } |
| 142 | 141 |
| 143 Platform3DObject Extensions3D::createQueryEXT() | 142 Platform3DObject Extensions3D::createQueryEXT() |
| 144 { | 143 { |
| 145 return m_private->webContext()->createQueryEXT(); | 144 return m_context->webContext()->createQueryEXT(); |
| 146 } | 145 } |
| 147 | 146 |
| 148 void Extensions3D::deleteQueryEXT(Platform3DObject query) | 147 void Extensions3D::deleteQueryEXT(Platform3DObject query) |
| 149 { | 148 { |
| 150 m_private->webContext()->deleteQueryEXT(query); | 149 m_context->webContext()->deleteQueryEXT(query); |
| 151 } | 150 } |
| 152 | 151 |
| 153 GC3Dboolean Extensions3D::isQueryEXT(Platform3DObject query) | 152 GC3Dboolean Extensions3D::isQueryEXT(Platform3DObject query) |
| 154 { | 153 { |
| 155 return m_private->webContext()->isQueryEXT(query); | 154 return m_context->webContext()->isQueryEXT(query); |
| 156 } | 155 } |
| 157 | 156 |
| 158 void Extensions3D::beginQueryEXT(GC3Denum target, Platform3DObject query) | 157 void Extensions3D::beginQueryEXT(GC3Denum target, Platform3DObject query) |
| 159 { | 158 { |
| 160 m_private->webContext()->beginQueryEXT(target, query); | 159 m_context->webContext()->beginQueryEXT(target, query); |
| 161 } | 160 } |
| 162 | 161 |
| 163 void Extensions3D::endQueryEXT(GC3Denum target) | 162 void Extensions3D::endQueryEXT(GC3Denum target) |
| 164 { | 163 { |
| 165 m_private->webContext()->endQueryEXT(target); | 164 m_context->webContext()->endQueryEXT(target); |
| 166 } | 165 } |
| 167 | 166 |
| 168 void Extensions3D::getQueryivEXT(GC3Denum target, GC3Denum pname, GC3Dint* param
s) | 167 void Extensions3D::getQueryivEXT(GC3Denum target, GC3Denum pname, GC3Dint* param
s) |
| 169 { | 168 { |
| 170 m_private->webContext()->getQueryivEXT(target, pname, params); | 169 m_context->webContext()->getQueryivEXT(target, pname, params); |
| 171 } | 170 } |
| 172 | 171 |
| 173 void Extensions3D::getQueryObjectuivEXT(Platform3DObject query, GC3Denum pname,
GC3Duint* params) | 172 void Extensions3D::getQueryObjectuivEXT(Platform3DObject query, GC3Denum pname,
GC3Duint* params) |
| 174 { | 173 { |
| 175 m_private->webContext()->getQueryObjectuivEXT(query, pname, params); | 174 m_context->webContext()->getQueryObjectuivEXT(query, pname, params); |
| 176 } | 175 } |
| 177 | 176 |
| 178 bool Extensions3D::canUseCopyTextureCHROMIUM(GC3Denum destFormat, GC3Denum destT
ype, GC3Dint level) | 177 bool Extensions3D::canUseCopyTextureCHROMIUM(GC3Denum destFormat, GC3Denum destT
ype, GC3Dint level) |
| 179 { | 178 { |
| 180 // FIXME: restriction of (RGB || RGBA)/UNSIGNED_BYTE/(Level 0) should be lif
ted when | 179 // FIXME: restriction of (RGB || RGBA)/UNSIGNED_BYTE/(Level 0) should be lif
ted when |
| 181 // WebGraphicsContext3D::copyTextureCHROMIUM(...) are fully functional. | 180 // WebGraphicsContext3D::copyTextureCHROMIUM(...) are fully functional. |
| 182 if ((destFormat == GraphicsContext3D::RGB || destFormat == GraphicsContext3D
::RGBA) | 181 if ((destFormat == GraphicsContext3D::RGB || destFormat == GraphicsContext3D
::RGBA) |
| 183 && destType == GraphicsContext3D::UNSIGNED_BYTE | 182 && destType == GraphicsContext3D::UNSIGNED_BYTE |
| 184 && !level) | 183 && !level) |
| 185 return true; | 184 return true; |
| 186 return false; | 185 return false; |
| 187 } | 186 } |
| 188 | 187 |
| 189 void Extensions3D::copyTextureCHROMIUM(GC3Denum target, Platform3DObject sourceI
d, Platform3DObject destId, GC3Dint level, GC3Denum internalFormat, GC3Denum des
tType) | 188 void Extensions3D::copyTextureCHROMIUM(GC3Denum target, Platform3DObject sourceI
d, Platform3DObject destId, GC3Dint level, GC3Denum internalFormat, GC3Denum des
tType) |
| 190 { | 189 { |
| 191 m_private->webContext()->copyTextureCHROMIUM(target, sourceId, destId, level
, internalFormat, destType); | 190 m_context->webContext()->copyTextureCHROMIUM(target, sourceId, destId, level
, internalFormat, destType); |
| 192 } | 191 } |
| 193 | 192 |
| 194 void Extensions3D::shallowFlushCHROMIUM() | 193 void Extensions3D::shallowFlushCHROMIUM() |
| 195 { | 194 { |
| 196 return m_private->webContext()->shallowFlushCHROMIUM(); | 195 return m_context->webContext()->shallowFlushCHROMIUM(); |
| 197 } | 196 } |
| 198 | 197 |
| 199 void Extensions3D::readnPixelsEXT(int x, int y, GC3Dsizei width, GC3Dsizei heigh
t, GC3Denum format, GC3Denum type, GC3Dsizei bufSize, void *data) | 198 void Extensions3D::readnPixelsEXT(int x, int y, GC3Dsizei width, GC3Dsizei heigh
t, GC3Denum format, GC3Denum type, GC3Dsizei bufSize, void *data) |
| 200 { | 199 { |
| 201 notImplemented(); | 200 notImplemented(); |
| 202 } | 201 } |
| 203 | 202 |
| 204 void Extensions3D::getnUniformfvEXT(GC3Duint program, int location, GC3Dsizei bu
fSize, float *params) | 203 void Extensions3D::getnUniformfvEXT(GC3Duint program, int location, GC3Dsizei bu
fSize, float *params) |
| 205 { | 204 { |
| 206 notImplemented(); | 205 notImplemented(); |
| 207 } | 206 } |
| 208 | 207 |
| 209 void Extensions3D::getnUniformivEXT(GC3Duint program, int location, GC3Dsizei bu
fSize, int *params) | 208 void Extensions3D::getnUniformivEXT(GC3Duint program, int location, GC3Dsizei bu
fSize, int *params) |
| 210 { | 209 { |
| 211 notImplemented(); | 210 notImplemented(); |
| 212 } | 211 } |
| 213 | 212 |
| 214 void Extensions3D::insertEventMarkerEXT(const String& marker) | 213 void Extensions3D::insertEventMarkerEXT(const String& marker) |
| 215 { | 214 { |
| 216 m_private->webContext()->insertEventMarkerEXT(marker.utf8().data()); | 215 m_context->webContext()->insertEventMarkerEXT(marker.utf8().data()); |
| 217 } | 216 } |
| 218 | 217 |
| 219 void Extensions3D::pushGroupMarkerEXT(const String& marker) | 218 void Extensions3D::pushGroupMarkerEXT(const String& marker) |
| 220 { | 219 { |
| 221 m_private->webContext()->pushGroupMarkerEXT(marker.utf8().data()); | 220 m_context->webContext()->pushGroupMarkerEXT(marker.utf8().data()); |
| 222 } | 221 } |
| 223 | 222 |
| 224 void Extensions3D::popGroupMarkerEXT(void) | 223 void Extensions3D::popGroupMarkerEXT(void) |
| 225 { | 224 { |
| 226 m_private->webContext()->popGroupMarkerEXT(); | 225 m_context->webContext()->popGroupMarkerEXT(); |
| 227 } | 226 } |
| 228 | 227 |
| 229 void Extensions3D::drawBuffersEXT(GC3Dsizei n, const GC3Denum* bufs) | 228 void Extensions3D::drawBuffersEXT(GC3Dsizei n, const GC3Denum* bufs) |
| 230 { | 229 { |
| 231 m_private->webContext()->drawBuffersEXT(n, bufs); | 230 m_context->webContext()->drawBuffersEXT(n, bufs); |
| 232 } | 231 } |
| 233 | 232 |
| 234 } // namespace WebCore | 233 } // namespace WebCore |
| OLD | NEW |