Changeset 164026 in webkit
- Timestamp:
- Feb 13, 2014 4:58:54 AM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r164024 r164026 1 2014-02-13 ChangSeok Oh <changseok.oh@collabora.com> 2 3 Support ANGLE_instanced_arrays for GLES backend. 4 https://bugs.webkit.org/show_bug.cgi?id=128579 5 6 Reviewed by Dean Jackson. 7 8 Add some APIs to Extensions3D to support ANGLE_instanced_arrays for GLES backend. 9 At the same time, drawArraysInstanced, drawElementsInstanced and vertexAttribDivisor 10 are moved from GC3DOpenGL.cpp to GC3DOpenGLCommon.cpp since they could be shareable 11 through Extensions3D. 12 13 Covered by fast/canvas/webgl/angle-instanced-arrays.html 14 15 * platform/graphics/Extensions3D.h: 16 * platform/graphics/opengl/Extensions3DOpenGL.cpp: 17 (WebCore::Extensions3DOpenGL::drawArraysInstanced): 18 (WebCore::Extensions3DOpenGL::drawElementsInstanced): 19 (WebCore::Extensions3DOpenGL::vertexAttribDivisor): 20 * platform/graphics/opengl/Extensions3DOpenGL.h: 21 * platform/graphics/opengl/Extensions3DOpenGLES.cpp: 22 (WebCore::Extensions3DOpenGLES::Extensions3DOpenGLES): 23 (WebCore::Extensions3DOpenGLES::drawArraysInstanced): 24 (WebCore::Extensions3DOpenGLES::drawElementsInstanced): 25 (WebCore::Extensions3DOpenGLES::vertexAttribDivisor): 26 (WebCore::Extensions3DOpenGLES::supportsExtension): 27 * platform/graphics/opengl/Extensions3DOpenGLES.h: 28 * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp: 29 * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: 30 (WebCore::GraphicsContext3D::drawArraysInstanced): 31 (WebCore::GraphicsContext3D::drawElementsInstanced): 32 (WebCore::GraphicsContext3D::vertexAttribDivisor): 33 * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp: 34 1 35 2014-02-13 Xabier Rodriguez Calvar <calvaris@igalia.com> 2 36 -
trunk/Source/WebCore/platform/graphics/Extensions3D.h
r161688 r164026 75 75 // GL_CHROMIUM_flipy 76 76 // GL_ARB_draw_buffers / GL_EXT_draw_buffers 77 // GL_ANGLE_instanced_arrays 77 78 78 79 // Takes full name of extension; for example, … … 239 240 virtual void drawBuffersEXT(GC3Dsizei n, const GC3Denum* bufs) = 0; 240 241 242 // GL_ANGLE_instanced_arrays 243 virtual void drawArraysInstanced(GC3Denum mode, GC3Dint first, GC3Dsizei count, GC3Dsizei primcount) = 0; 244 virtual void drawElementsInstanced(GC3Denum mode, GC3Dsizei count, GC3Denum type, long long offset, GC3Dsizei primcount) = 0; 245 virtual void vertexAttribDivisor(GC3Duint index, GC3Duint divisor) = 0; 246 241 247 virtual bool isNVIDIA() = 0; 242 248 virtual bool isAMD() = 0; -
trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp
r163858 r164026 237 237 } 238 238 239 void Extensions3DOpenGL::drawArraysInstanced(GC3Denum mode, GC3Dint first, GC3Dsizei count, GC3Dsizei primcount) 240 { 241 #if ENABLE(GTK) 242 m_context->makeContextCurrent(); 243 ::glDrawArraysInstanced(mode, first, count, primcount); 244 #else 245 UNUSED_PARAM(mode); 246 UNUSED_PARAM(first); 247 UNUSED_PARAM(count); 248 UNUSED_PARAM(primcount); 249 #endif 250 } 251 252 void Extensions3DOpenGL::drawElementsInstanced(GC3Denum mode, GC3Dsizei count, GC3Denum type, long long offset, GC3Dsizei primcount) 253 { 254 #if ENABLE(GTK) 255 m_context->makeContextCurrent(); 256 ::glDrawElementsInstanced(mode, count, type, reinterpret_cast<GLvoid*>(static_cast<intptr_t>(offset)), primcount); 257 #else 258 UNUSED_PARAM(mode); 259 UNUSED_PARAM(count); 260 UNUSED_PARAM(type); 261 UNUSED_PARAM(offset); 262 UNUSED_PARAM(primcount); 263 #endif 264 } 265 266 void Extensions3DOpenGL::vertexAttribDivisor(GC3Duint index, GC3Duint divisor) 267 { 268 #if ENABLE(GTK) 269 m_context->makeContextCurrent(); 270 ::glVertexAttribDivisor(index, divisor); 271 #else 272 UNUSED_PARAM(index); 273 UNUSED_PARAM(divisor); 274 #endif 275 } 276 239 277 String Extensions3DOpenGL::getExtensions() 240 278 { -
trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.h
r162451 r164026 54 54 virtual void drawBuffersEXT(GC3Dsizei, const GC3Denum*); 55 55 56 virtual void drawArraysInstanced(GC3Denum mode, GC3Dint first, GC3Dsizei count, GC3Dsizei primcount); 57 virtual void drawElementsInstanced(GC3Denum mode, GC3Dsizei count, GC3Denum type, long long offset, GC3Dsizei primcount); 58 virtual void vertexAttribDivisor(GC3Duint index, GC3Duint divisor); 59 56 60 protected: 57 61 // This class only needs to be instantiated by GraphicsContext3D implementations. -
trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp
r161699 r164026 2 2 * Copyright (C) 2011 Google Inc. All rights reserved. 3 3 * Copyright (C) 2012 Research In Motion Limited. All rights reserved. 4 * Copyright (C) 2014 Collabora Ltd. All rights reserved. 4 5 * 5 6 * Redistribution and use in source and binary forms, with or without … … 41 42 , m_supportsOESvertexArrayObject(false) 42 43 , m_supportsIMGMultisampledRenderToTexture(false) 44 , m_supportsANGLEinstancedArrays(false) 43 45 , m_glFramebufferTexture2DMultisampleIMG(0) 44 46 , m_glRenderbufferStorageMultisampleIMG(0) … … 51 53 , m_glGetnUniformfvEXT(0) 52 54 , m_glGetnUniformivEXT(0) 55 , m_glVertexAttribDivisorANGLE(nullptr) 56 , m_glDrawArraysInstancedANGLE(nullptr) 57 , m_glDrawElementsInstancedANGLE(nullptr) 53 58 { 54 59 } … … 227 232 228 233 m_context->synthesizeGLError(GL_INVALID_OPERATION); 234 } 235 236 void Extensions3DOpenGLES::drawArraysInstanced(GC3Denum mode, GC3Dint first, GC3Dsizei count, GC3Dsizei primcount) 237 { 238 if (!m_glDrawArraysInstancedANGLE) { 239 m_context->synthesizeGLError(GL_INVALID_OPERATION); 240 return; 241 } 242 243 m_context->makeContextCurrent(); 244 m_glDrawArraysInstancedANGLE(mode, first, count, primcount); 245 } 246 247 void Extensions3DOpenGLES::drawElementsInstanced(GC3Denum mode, GC3Dsizei count, GC3Denum type, long long offset, GC3Dsizei primcount) 248 { 249 if (!m_glDrawElementsInstancedANGLE) { 250 m_context->synthesizeGLError(GL_INVALID_OPERATION); 251 return; 252 } 253 254 m_context->makeContextCurrent(); 255 m_glDrawElementsInstancedANGLE(mode, count, type, reinterpret_cast<GLvoid*>(static_cast<intptr_t>(offset)), primcount); 256 } 257 258 void Extensions3DOpenGLES::vertexAttribDivisor(GC3Duint index, GC3Duint divisor) 259 { 260 if (!m_glVertexAttribDivisorANGLE) { 261 m_context->synthesizeGLError(GL_INVALID_OPERATION); 262 return; 263 } 264 265 m_context->makeContextCurrent(); 266 m_glVertexAttribDivisorANGLE(index, divisor); 229 267 } 230 268 … … 247 285 m_glGetnUniformfvEXT = reinterpret_cast<PFNGLGETNUNIFORMFVEXTPROC>(eglGetProcAddress("glGetnUniformfvEXT")); 248 286 m_glGetnUniformivEXT = reinterpret_cast<PFNGLGETNUNIFORMIVEXTPROC>(eglGetProcAddress("glGetnUniformivEXT")); 287 } else if (!m_supportsANGLEinstancedArrays && name == "GL_ANGLE_instanced_arrays") { 288 m_glVertexAttribDivisorANGLE = reinterpret_cast<PFNGLVERTEXATTRIBDIVISORANGLEPROC>(eglGetProcAddress("glVertexAttribDivisorANGLE")); 289 m_glDrawArraysInstancedANGLE = reinterpret_cast<PFNGLDRAWARRAYSINSTANCEDANGLEPROC >(eglGetProcAddress("glDrawArraysInstancedANGLE")); 290 m_glDrawElementsInstancedANGLE = reinterpret_cast<PFNGLDRAWELEMENTSINSTANCEDANGLEPROC >(eglGetProcAddress("glDrawElementsInstancedANGLE")); 291 m_supportsANGLEinstancedArrays = true; 249 292 } else if (name == "GL_EXT_draw_buffers") { 250 293 // FIXME: implement the support. -
trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.h
r162451 r164026 81 81 virtual void drawBuffersEXT(GC3Dsizei, const GC3Denum*); 82 82 83 virtual void drawArraysInstanced(GC3Denum mode, GC3Dint first, GC3Dsizei count, GC3Dsizei primcount); 84 virtual void drawElementsInstanced(GC3Denum mode, GC3Dsizei count, GC3Denum type, long long offset, GC3Dsizei primcount); 85 virtual void vertexAttribDivisor(GC3Duint index, GC3Duint divisor); 86 83 87 // EXT Robustness - reset 84 88 virtual int getGraphicsResetStatusARB(); … … 102 106 bool m_supportsOESvertexArrayObject; 103 107 bool m_supportsIMGMultisampledRenderToTexture; 108 bool m_supportsANGLEinstancedArrays; 104 109 105 110 PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMG m_glFramebufferTexture2DMultisampleIMG; … … 113 118 PFNGLGETNUNIFORMFVEXTPROC m_glGetnUniformfvEXT; 114 119 PFNGLGETNUNIFORMIVEXTPROC m_glGetnUniformivEXT; 120 PFNGLVERTEXATTRIBDIVISORANGLEPROC m_glVertexAttribDivisorANGLE; 121 PFNGLDRAWARRAYSINSTANCEDANGLEPROC m_glDrawArraysInstancedANGLE; 122 PFNGLDRAWELEMENTSINSTANCEDANGLEPROC m_glDrawElementsInstancedANGLE; 123 115 124 116 125 OwnPtr<GraphicsContext3D::ContextLostCallback> m_contextLostCallback; -
trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp
r163858 r164026 352 352 } 353 353 354 #if !PLATFORM(COCOA)355 void GraphicsContext3D::drawArraysInstanced(GC3Denum mode, GC3Dint first, GC3Dsizei count, GC3Dsizei primcount)356 {357 makeContextCurrent();358 ::glDrawArraysInstanced(mode, first, count, primcount);359 }360 361 void GraphicsContext3D::drawElementsInstanced(GC3Denum mode, GC3Dsizei count, GC3Denum type, GC3Dintptr offset, GC3Dsizei primcount)362 {363 makeContextCurrent();364 ::glDrawElementsInstanced(mode, count, type, reinterpret_cast<GLvoid*>(static_cast<intptr_t>(offset)), primcount);365 }366 367 void GraphicsContext3D::vertexAttribDivisor(GC3Duint index, GC3Duint divisor)368 {369 makeContextCurrent();370 ::glVertexAttribDivisor(index, divisor);371 }372 #endif373 374 354 } 375 355 -
trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp
r162691 r164026 1631 1631 } 1632 1632 1633 #if !PLATFORM(COCOA) 1634 void GraphicsContext3D::drawArraysInstanced(GC3Denum mode, GC3Dint first, GC3Dsizei count, GC3Dsizei primcount) 1635 { 1636 getExtensions()->drawArraysInstanced(mode, first, count, primcount); 1637 } 1638 1639 void GraphicsContext3D::drawElementsInstanced(GC3Denum mode, GC3Dsizei count, GC3Denum type, GC3Dintptr offset, GC3Dsizei primcount) 1640 { 1641 getExtensions()->drawElementsInstanced(mode, count, type, offset, primcount); 1642 } 1643 1644 void GraphicsContext3D::vertexAttribDivisor(GC3Duint index, GC3Duint divisor) 1645 { 1646 getExtensions()->vertexAttribDivisor(index, divisor); 1647 } 1648 #endif 1649 1633 1650 } 1634 1651 -
trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp
r162600 r164026 207 207 } 208 208 209 void GraphicsContext3D::drawArraysInstanced(GC3Denum mode, GC3Dint first, GC3Dsizei count, GC3Dsizei primcount)210 {211 UNUSED_PARAM(mode);212 UNUSED_PARAM(first);213 UNUSED_PARAM(count);214 UNUSED_PARAM(primcount);215 }216 217 void GraphicsContext3D::drawElementsInstanced(GC3Denum mode, GC3Dsizei count, GC3Denum type, GC3Dintptr offset, GC3Dsizei primcount)218 {219 UNUSED_PARAM(mode);220 UNUSED_PARAM(count);221 UNUSED_PARAM(type);222 UNUSED_PARAM(offset);223 UNUSED_PARAM(primcount);224 }225 226 void GraphicsContext3D::vertexAttribDivisor(GC3Duint index, GC3Duint divisor)227 {228 UNUSED_PARAM(index);229 UNUSED_PARAM(divisor);230 }231 232 209 Extensions3D* GraphicsContext3D::getExtensions() 233 210 {
Note: See TracChangeset
for help on using the changeset viewer.