Changeset 64582 in webkit
- Timestamp:
- Aug 3, 2010 12:47:46 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r64580 r64582 1 2010-08-03 James Robinson <jamesr@chromium.org> 2 3 Reviewed by Darin Fisher. 4 5 Move WebGL-specific code out of GraphicsContext3D so that G3D can be used as a generic accelerated drawing API 6 https://bugs.webkit.org/show_bug.cgi?id=43221 7 8 Changes the GraphicsContext3D API to use Platform3DObjects instead of WebGLFoo* types like WebGLTexture. 9 WebGLRenderingContext still uses WebGLFoo types and converts to Platform3DObjects internally. Other 10 consumers of the GraphicsContext3D can use the Platform3DObject APIs directly without any ties to WebGL. 11 12 The majority of this change is purely mechanical. The less obvious changes are: 13 - move all null checking on WebGLFoo types to WebGLRenderingContext, instead of mixing them 14 between WebGLRenderingContext and the various port-specific implementations of GraphicsContext3D 15 - add a GraphicsContext3D getter to CanvasRenderingContext. This is needed for the readback 16 path on Chromium/mac. It may be possible to remove this, but I would prefer to do that 17 in a follow-up patch to minimize churn. 18 - move some texture cube map logic that existed only in the Chromium port of GC3D to 19 WebGLRenderingContext behind #if PLATFORM(CHROMIUM). I think this logic should either 20 exist for all ports or exist for none, but again I would rather change the behavior 21 in a different patch from this one. 22 23 * html/canvas/CanvasRenderingContext.h: 24 (WebCore::CanvasRenderingContext::graphicsContext3D): 25 * html/canvas/WebGLProgram.cpp: 26 (WebCore::WebGLProgram::cacheActiveAttribLocations): 27 * html/canvas/WebGLRenderingContext.cpp: 28 (WebCore::WebGLRenderingContext::attachShader): 29 (WebCore::WebGLRenderingContext::bindAttribLocation): 30 (WebCore::WebGLRenderingContext::bindBuffer): 31 (WebCore::WebGLRenderingContext::bindFramebuffer): 32 (WebCore::WebGLRenderingContext::bindRenderbuffer): 33 (WebCore::WebGLRenderingContext::bindTexture): 34 (WebCore::WebGLRenderingContext::compileShader): 35 (WebCore::WebGLRenderingContext::detachShader): 36 (WebCore::WebGLRenderingContext::framebufferRenderbuffer): 37 (WebCore::WebGLRenderingContext::framebufferTexture2D): 38 (WebCore::WebGLRenderingContext::getActiveAttrib): 39 (WebCore::WebGLRenderingContext::getActiveUniform): 40 (WebCore::WebGLRenderingContext::getAttachedShaders): 41 (WebCore::WebGLRenderingContext::getAttribLocation): 42 (WebCore::WebGLRenderingContext::getProgramParameter): 43 (WebCore::WebGLRenderingContext::getProgramInfoLog): 44 (WebCore::WebGLRenderingContext::getShaderParameter): 45 (WebCore::WebGLRenderingContext::getShaderInfoLog): 46 (WebCore::WebGLRenderingContext::getShaderSource): 47 (WebCore::WebGLRenderingContext::getUniform): 48 (WebCore::WebGLRenderingContext::getUniformLocation): 49 (WebCore::WebGLRenderingContext::isBuffer): 50 (WebCore::WebGLRenderingContext::isFramebuffer): 51 (WebCore::WebGLRenderingContext::isProgram): 52 (WebCore::WebGLRenderingContext::isRenderbuffer): 53 (WebCore::WebGLRenderingContext::isShader): 54 (WebCore::WebGLRenderingContext::isTexture): 55 (WebCore::WebGLRenderingContext::linkProgram): 56 (WebCore::WebGLRenderingContext::shaderSource): 57 (WebCore::WebGLRenderingContext::useProgram): 58 (WebCore::WebGLRenderingContext::validateProgram): 59 (WebCore::WebGLRenderingContext::handleNPOTTextures): 60 (WebCore::WebGLRenderingContext::createFallbackBlackTextures1x1): 61 (WebCore::WebGLRenderingContext::initVertexAttrib0): 62 (WebCore::WebGLRenderingContext::simulateVertexAttrib0): 63 (WebCore::WebGLRenderingContext::restoreStatesAfterVertexAttrib0Simulation): 64 * html/canvas/WebGLRenderingContext.h: 65 (WebCore::WebGLRenderingContext::graphicsContext3D): 66 * platform/graphics/GraphicsContext3D.h: 67 * platform/graphics/mac/GraphicsContext3DMac.mm: 68 (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas): 69 (WebCore::GraphicsContext3D::beginPaint): 70 (WebCore::GraphicsContext3D::attachShader): 71 (WebCore::GraphicsContext3D::bindAttribLocation): 72 (WebCore::GraphicsContext3D::bindBuffer): 73 (WebCore::GraphicsContext3D::bindFramebuffer): 74 (WebCore::GraphicsContext3D::bindRenderbuffer): 75 (WebCore::GraphicsContext3D::bindTexture): 76 (WebCore::GraphicsContext3D::compileShader): 77 (WebCore::GraphicsContext3D::detachShader): 78 (WebCore::GraphicsContext3D::framebufferRenderbuffer): 79 (WebCore::GraphicsContext3D::framebufferTexture2D): 80 (WebCore::GraphicsContext3D::getActiveAttrib): 81 (WebCore::GraphicsContext3D::getActiveUniform): 82 (WebCore::GraphicsContext3D::getAttachedShaders): 83 (WebCore::GraphicsContext3D::getAttribLocation): 84 (WebCore::GraphicsContext3D::isBuffer): 85 (WebCore::GraphicsContext3D::isFramebuffer): 86 (WebCore::GraphicsContext3D::isProgram): 87 (WebCore::GraphicsContext3D::isRenderbuffer): 88 (WebCore::GraphicsContext3D::isShader): 89 (WebCore::GraphicsContext3D::isTexture): 90 (WebCore::GraphicsContext3D::linkProgram): 91 (WebCore::GraphicsContext3D::shaderSource): 92 (WebCore::GraphicsContext3D::useProgram): 93 (WebCore::GraphicsContext3D::validateProgram): 94 (WebCore::GraphicsContext3D::getProgramiv): 95 (WebCore::GraphicsContext3D::getProgramInfoLog): 96 (WebCore::GraphicsContext3D::getShaderiv): 97 (WebCore::GraphicsContext3D::getShaderInfoLog): 98 (WebCore::GraphicsContext3D::getShaderSource): 99 (WebCore::GraphicsContext3D::getUniformfv): 100 (WebCore::GraphicsContext3D::getUniformiv): 101 (WebCore::GraphicsContext3D::getUniformLocation): 102 * platform/graphics/qt/GraphicsContext3DQt.cpp: 103 (WebCore::GraphicsContext3D::beginPaint): 104 (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas): 105 (WebCore::GraphicsContext3D::attachShader): 106 (WebCore::GraphicsContext3D::bindAttribLocation): 107 (WebCore::GraphicsContext3D::bindBuffer): 108 (WebCore::GraphicsContext3D::bindFramebuffer): 109 (WebCore::GraphicsContext3D::bindRenderbuffer): 110 (WebCore::GraphicsContext3D::bindTexture): 111 (WebCore::GraphicsContext3D::compileShader): 112 (WebCore::GraphicsContext3D::detachShader): 113 (WebCore::GraphicsContext3D::framebufferRenderbuffer): 114 (WebCore::GraphicsContext3D::framebufferTexture2D): 115 (WebCore::GraphicsContext3D::getActiveAttrib): 116 (WebCore::GraphicsContext3D::getActiveUniform): 117 (WebCore::GraphicsContext3D::getAttribLocation): 118 (WebCore::GraphicsContext3D::isBuffer): 119 (WebCore::GraphicsContext3D::isFramebuffer): 120 (WebCore::GraphicsContext3D::isProgram): 121 (WebCore::GraphicsContext3D::isRenderbuffer): 122 (WebCore::GraphicsContext3D::isShader): 123 (WebCore::GraphicsContext3D::isTexture): 124 (WebCore::GraphicsContext3D::linkProgram): 125 (WebCore::GraphicsContext3D::shaderSource): 126 (WebCore::GraphicsContext3D::useProgram): 127 (WebCore::GraphicsContext3D::validateProgram): 128 (WebCore::GraphicsContext3D::getProgramiv): 129 (WebCore::GraphicsContext3D::getProgramInfoLog): 130 (WebCore::GraphicsContext3D::getShaderiv): 131 (WebCore::GraphicsContext3D::getShaderInfoLog): 132 (WebCore::GraphicsContext3D::getShaderSource): 133 (WebCore::GraphicsContext3D::getUniformfv): 134 (WebCore::GraphicsContext3D::getUniformiv): 135 (WebCore::GraphicsContext3D::getUniformLocation): 136 1 137 2010-08-03 Xan Lopez <xlopez@igalia.com> 2 138 -
trunk/WebCore/html/canvas/CanvasRenderingContext.h
r64308 r64582 32 32 33 33 class CanvasObject; 34 class GraphicsContext3D; 34 35 class HTMLCanvasElement; 35 36 … … 48 49 virtual bool is3d() const { return false; } 49 50 virtual bool isAccelerated() const { return false; } 51 52 // For accelerated canvases, returns a pointer to the underlying GraphicsContext3D. 53 // For non accelerated canvases returns 0. 54 virtual GraphicsContext3D* graphicsContext3D() const { return 0; } 50 55 51 56 private: -
trunk/WebCore/html/canvas/WebGLProgram.cpp
r62396 r64582 57 57 GraphicsContext3D* context3d = context()->graphicsContext3D(); 58 58 int linkStatus; 59 context3d->getProgramiv( this, GraphicsContext3D::LINK_STATUS, &linkStatus);59 context3d->getProgramiv(object(), GraphicsContext3D::LINK_STATUS, &linkStatus); 60 60 if (!linkStatus) 61 61 return false; 62 62 63 63 int numAttribs = 0; 64 context3d->getProgramiv( this, GraphicsContext3D::ACTIVE_ATTRIBUTES, &numAttribs);64 context3d->getProgramiv(object(), GraphicsContext3D::ACTIVE_ATTRIBUTES, &numAttribs); 65 65 m_activeAttribLocations.resize(static_cast<size_t>(numAttribs)); 66 66 for (int i = 0; i < numAttribs; ++i) { 67 67 ActiveInfo info; 68 context3d->getActiveAttrib( this, i, info);69 m_activeAttribLocations[i] = context3d->getAttribLocation( this, info.name.charactersWithNullTermination());68 context3d->getActiveAttrib(object(), i, info); 69 m_activeAttribLocations[i] = context3d->getAttribLocation(object(), info.name.charactersWithNullTermination()); 70 70 } 71 71 -
trunk/WebCore/html/canvas/WebGLRenderingContext.cpp
r63923 r64582 221 221 if (!validateWebGLObject(program) || !validateWebGLObject(shader)) 222 222 return; 223 m_context->attachShader(program , shader);223 m_context->attachShader(program ? program->object() : 0, shader ? shader->object() : 0); 224 224 cleanupAfterGraphicsCall(false); 225 225 } … … 230 230 if (!validateWebGLObject(program)) 231 231 return; 232 m_context->bindAttribLocation(program , index, name);232 m_context->bindAttribLocation(program ? program->object() : 0, index, name); 233 233 cleanupAfterGraphicsCall(false); 234 234 } … … 255 255 } 256 256 257 m_context->bindBuffer(target, buffer );257 m_context->bindBuffer(target, buffer ? buffer->object() : 0); 258 258 if (buffer) 259 259 buffer->setTarget(target); … … 274 274 } 275 275 m_framebufferBinding = buffer; 276 m_context->bindFramebuffer(target, buffer );276 m_context->bindFramebuffer(target, buffer ? buffer->object() : 0); 277 277 if (m_framebufferBinding) 278 278 m_framebufferBinding->onBind(); … … 292 292 } 293 293 m_renderbufferBinding = renderBuffer; 294 m_context->bindRenderbuffer(target, renderBuffer );294 m_context->bindRenderbuffer(target, renderBuffer ? renderBuffer->object() : 0); 295 295 cleanupAfterGraphicsCall(false); 296 296 } … … 315 315 return; 316 316 } 317 m_context->bindTexture(target, texture );317 m_context->bindTexture(target, texture ? texture->object() : 0); 318 318 if (!isGLES2Compliant() && texture) 319 319 texture->setTarget(target, maxLevel); 320 321 // FIXME: do we want to do this on all platforms? 322 #if PLATFORM(CHROMIUM) 323 // FIXME: GL_TEXTURE_WRAP_R isn't exposed in the OpenGL ES 2.0 324 // API. On desktop OpenGL implementations it seems necessary to 325 // set this wrap mode to GL_CLAMP_TO_EDGE to get correct behavior 326 // of cube maps. 327 if (texture) { 328 if (target == GraphicsContext3D::TEXTURE_CUBE_MAP) { 329 if (!texture->isCubeMapRWrapModeInitialized()) { 330 static const int textureWrapR = 0x8072; 331 texParameteri(GraphicsContext3D::TEXTURE_CUBE_MAP, textureWrapR, GraphicsContext3D::CLAMP_TO_EDGE); 332 texture->setCubeMapRWrapModeInitialized(true); 333 } 334 } else 335 texture->setCubeMapRWrapModeInitialized(false); 336 } 337 #endif 338 320 339 cleanupAfterGraphicsCall(false); 321 340 } … … 498 517 if (!validateWebGLObject(shader)) 499 518 return; 500 m_context->compileShader(shader );519 m_context->compileShader(shader ? shader->object() : 0); 501 520 cleanupAfterGraphicsCall(false); 502 521 } … … 688 707 if (!validateWebGLObject(program) || !validateWebGLObject(shader)) 689 708 return; 690 m_context->detachShader(program , shader);709 m_context->detachShader(program ? program->object() : 0, shader ? shader->object() : 0); 691 710 cleanupAfterGraphicsCall(false); 692 711 } … … 1057 1076 } 1058 1077 } 1059 m_context->framebufferRenderbuffer(target, attachment, renderbuffertarget, buffer );1078 m_context->framebufferRenderbuffer(target, attachment, renderbuffertarget, buffer ? buffer->object() : 0); 1060 1079 m_framebufferBinding->setAttachment(attachment, buffer); 1061 1080 cleanupAfterGraphicsCall(false); … … 1082 1101 return; 1083 1102 } 1084 m_context->framebufferTexture2D(target, attachment, textarget, texture , level);1103 m_context->framebufferTexture2D(target, attachment, textarget, texture ? texture->object() : 0, level); 1085 1104 m_framebufferBinding->setAttachment(attachment, texture); 1086 1105 cleanupAfterGraphicsCall(false); … … 1120 1139 if (!validateWebGLObject(program)) 1121 1140 return 0; 1122 if (!m_context->getActiveAttrib(program , index, info)) {1141 if (!m_context->getActiveAttrib(program ? program->object() : 0, index, info)) { 1123 1142 return 0; 1124 1143 } … … 1132 1151 if (!validateWebGLObject(program)) 1133 1152 return 0; 1134 if (!m_context->getActiveUniform(program , index, info)) {1153 if (!m_context->getActiveUniform(program ? program->object() : 0, index, info)) { 1135 1154 return 0; 1136 1155 } … … 1149 1168 return false; 1150 1169 int numShaders = 0; 1151 m_context->getProgramiv(program , GraphicsContext3D::ATTACHED_SHADERS, &numShaders);1170 m_context->getProgramiv(program ? program->object() : 0, GraphicsContext3D::ATTACHED_SHADERS, &numShaders); 1152 1171 if (numShaders) { 1153 1172 OwnArrayPtr<unsigned int> shaders(new unsigned int[numShaders]); 1154 1173 int count; 1155 m_context->getAttachedShaders(program , numShaders, &count, shaders.get());1174 m_context->getAttachedShaders(program ? program->object() : 0, numShaders, &count, shaders.get()); 1156 1175 if (count != numShaders) 1157 1176 return false; … … 1171 1190 int WebGLRenderingContext::getAttribLocation(WebGLProgram* program, const String& name) 1172 1191 { 1173 return m_context->getAttribLocation(program , name);1192 return m_context->getAttribLocation(program ? program->object() : 0, name); 1174 1193 } 1175 1194 … … 1449 1468 case GraphicsContext3D::DELETE_STATUS: 1450 1469 case GraphicsContext3D::VALIDATE_STATUS: 1451 m_context->getProgramiv(program , pname, &value);1470 m_context->getProgramiv(program ? program->object() : 0, pname, &value); 1452 1471 return WebGLGetInfo(static_cast<bool>(value)); 1453 1472 case GraphicsContext3D::LINK_STATUS: 1454 1473 if (program->isLinkFailureFlagSet()) 1455 1474 return WebGLGetInfo(false); 1456 m_context->getProgramiv(program , pname, &value);1475 m_context->getProgramiv(program ? program->object() : 0, pname, &value); 1457 1476 return WebGLGetInfo(static_cast<bool>(value)); 1458 1477 case GraphicsContext3D::INFO_LOG_LENGTH: … … 1462 1481 case GraphicsContext3D::ACTIVE_UNIFORMS: 1463 1482 case GraphicsContext3D::ACTIVE_UNIFORM_MAX_LENGTH: 1464 m_context->getProgramiv(program , pname, &value);1483 m_context->getProgramiv(program ? program->object() : 0, pname, &value); 1465 1484 return WebGLGetInfo(static_cast<long>(value)); 1466 1485 default: … … 1476 1495 return ""; 1477 1496 WebGLStateRestorer(this, false); 1478 return m_context->getProgramInfoLog(program );1497 return m_context->getProgramInfoLog(program ? program->object() : 0); 1479 1498 } 1480 1499 … … 1522 1541 case GraphicsContext3D::DELETE_STATUS: 1523 1542 case GraphicsContext3D::COMPILE_STATUS: 1524 m_context->getShaderiv(shader , pname, &value);1543 m_context->getShaderiv(shader ? shader->object() : 0, pname, &value); 1525 1544 return WebGLGetInfo(static_cast<bool>(value)); 1526 1545 case GraphicsContext3D::SHADER_TYPE: 1527 m_context->getShaderiv(shader , pname, &value);1546 m_context->getShaderiv(shader ? shader->object() : 0, pname, &value); 1528 1547 return WebGLGetInfo(static_cast<unsigned long>(value)); 1529 1548 case GraphicsContext3D::INFO_LOG_LENGTH: 1530 1549 case GraphicsContext3D::SHADER_SOURCE_LENGTH: 1531 m_context->getShaderiv(shader , pname, &value);1550 m_context->getShaderiv(shader ? shader->object() : 0, pname, &value); 1532 1551 return WebGLGetInfo(static_cast<long>(value)); 1533 1552 default: … … 1543 1562 return ""; 1544 1563 WebGLStateRestorer(this, false); 1545 return m_context->getShaderInfoLog(shader );1564 return m_context->getShaderInfoLog(shader ? shader->object() : 0); 1546 1565 } 1547 1566 … … 1552 1571 return ""; 1553 1572 WebGLStateRestorer(this, false); 1554 return m_context->getShaderSource(shader );1573 return m_context->getShaderSource(shader ? shader->object() : 0); 1555 1574 } 1556 1575 … … 1602 1621 // FIXME: make this more efficient using WebGLUniformLocation and caching types in it 1603 1622 int activeUniforms = 0; 1604 m_context->getProgramiv(program , GraphicsContext3D::ACTIVE_UNIFORMS, &activeUniforms);1623 m_context->getProgramiv(program ? program->object() : 0, GraphicsContext3D::ACTIVE_UNIFORMS, &activeUniforms); 1605 1624 for (int i = 0; i < activeUniforms; i++) { 1606 1625 ActiveInfo info; 1607 if (!m_context->getActiveUniform(program , i, info))1626 if (!m_context->getActiveUniform(program ? program->object() : 0, i, info)) 1608 1627 return WebGLGetInfo(); 1609 1628 // Strip "[0]" from the name if it's an array. … … 1619 1638 } 1620 1639 // Now need to look this up by name again to find its location 1621 long loc = m_context->getUniformLocation(program , name);1640 long loc = m_context->getUniformLocation(program ? program->object() : 0, name); 1622 1641 if (loc == location) { 1623 1642 // Found it. Use the type in the ActiveInfo to determine the return type. … … 1694 1713 case GraphicsContext3D::FLOAT: { 1695 1714 float value[16] = {0}; 1696 m_context->getUniformfv(program , location, value);1715 m_context->getUniformfv(program ? program->object() : 0, location, value); 1697 1716 if (length == 1) 1698 1717 return WebGLGetInfo(value[0]); … … 1701 1720 case GraphicsContext3D::INT: { 1702 1721 int value[16] = {0}; 1703 m_context->getUniformiv(program , location, value);1722 m_context->getUniformiv(program ? program->object() : 0, location, value); 1704 1723 if (length == 1) 1705 1724 return WebGLGetInfo(static_cast<long>(value[0])); … … 1708 1727 case GraphicsContext3D::BOOL: { 1709 1728 int value[16] = {0}; 1710 m_context->getUniformiv(program , location, value);1729 m_context->getUniformiv(program ? program->object() : 0, location, value); 1711 1730 if (length > 1) { 1712 1731 unsigned char boolValue[16] = {0}; … … 1734 1753 return 0; 1735 1754 WebGLStateRestorer(this, false); 1736 long uniformLocation = m_context->getUniformLocation(program , name);1755 long uniformLocation = m_context->getUniformLocation(program ? program->object() : 0, name); 1737 1756 if (uniformLocation == -1) 1738 1757 return 0; … … 1812 1831 return false; 1813 1832 1814 return m_context->isBuffer(buffer );1833 return m_context->isBuffer(buffer->object()); 1815 1834 } 1816 1835 … … 1829 1848 return false; 1830 1849 1831 return m_context->isFramebuffer(framebuffer );1850 return m_context->isFramebuffer(framebuffer->object()); 1832 1851 } 1833 1852 … … 1837 1856 return false; 1838 1857 1839 return m_context->isProgram(program );1858 return m_context->isProgram(program->object()); 1840 1859 } 1841 1860 … … 1845 1864 return false; 1846 1865 1847 return m_context->isRenderbuffer(renderbuffer );1866 return m_context->isRenderbuffer(renderbuffer->object()); 1848 1867 } 1849 1868 … … 1853 1872 return false; 1854 1873 1855 return m_context->isShader(shader );1874 return m_context->isShader(shader->object()); 1856 1875 } 1857 1876 … … 1861 1880 return false; 1862 1881 1863 return m_context->isTexture(texture );1882 return m_context->isTexture(texture->object()); 1864 1883 } 1865 1884 … … 1897 1916 } 1898 1917 1899 m_context->linkProgram(program );1918 m_context->linkProgram(program ? program->object() : 0); 1900 1919 program->cacheActiveAttribLocations(); 1901 1920 cleanupAfterGraphicsCall(false); … … 2042 2061 if (!validateWebGLObject(shader)) 2043 2062 return; 2044 m_context->shaderSource(shader , string);2063 m_context->shaderSource(shader ? shader->object() : 0, string); 2045 2064 cleanupAfterGraphicsCall(false); 2046 2065 } … … 2931 2950 } 2932 2951 m_currentProgram = program; 2933 m_context->useProgram(program );2952 m_context->useProgram(program ? program->object() : 0); 2934 2953 cleanupAfterGraphicsCall(false); 2935 2954 } … … 2940 2959 if (!validateWebGLObject(program)) 2941 2960 return; 2942 m_context->validateProgram(program );2961 m_context->validateProgram(program ? program->object() : 0); 2943 2962 cleanupAfterGraphicsCall(false); 2944 2963 } … … 3243 3262 } 3244 3263 if (m_textureUnits[ii].m_texture2DBinding && m_textureUnits[ii].m_texture2DBinding->needToUseBlackTexture()) 3245 m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, tex2D );3264 m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, tex2D->object()); 3246 3265 if (m_textureUnits[ii].m_textureCubeMapBinding && m_textureUnits[ii].m_textureCubeMapBinding->needToUseBlackTexture()) 3247 m_context->bindTexture(GraphicsContext3D::TEXTURE_CUBE_MAP, texCubeMap );3266 m_context->bindTexture(GraphicsContext3D::TEXTURE_CUBE_MAP, texCubeMap->object()); 3248 3267 } 3249 3268 } … … 3256 3275 unsigned char black[] = {0, 0, 0, 255}; 3257 3276 m_blackTexture2D = createTexture(); 3258 m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_blackTexture2D .get());3277 m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_blackTexture2D->object()); 3259 3278 m_context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, 1, 1, 3260 3279 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, black); 3261 3280 m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0); 3262 3281 m_blackTextureCubeMap = createTexture(); 3263 m_context->bindTexture(GraphicsContext3D::TEXTURE_CUBE_MAP, m_blackTextureCubeMap .get());3282 m_context->bindTexture(GraphicsContext3D::TEXTURE_CUBE_MAP, m_blackTextureCubeMap->object()); 3264 3283 m_context->texImage2D(GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_X, 0, GraphicsContext3D::RGBA, 1, 1, 3265 3284 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, black); … … 3717 3736 m_vertexAttribState.resize(1); 3718 3737 m_vertexAttrib0Buffer = createBuffer(); 3719 m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, m_vertexAttrib0Buffer .get());3738 m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, m_vertexAttrib0Buffer->object()); 3720 3739 m_context->bufferData(GraphicsContext3D::ARRAY_BUFFER, 0, GraphicsContext3D::DYNAMIC_DRAW); 3721 3740 m_context->vertexAttribPointer(0, 4, GraphicsContext3D::FLOAT, false, 0, 0); … … 3736 3755 || !m_currentProgram->isUsingVertexAttrib0()) 3737 3756 return false; 3738 m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, m_vertexAttrib0Buffer .get());3757 m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, m_vertexAttrib0Buffer->object()); 3739 3758 long bufferDataSize = (numVertex + 1) * 4 * sizeof(float); 3740 3759 if (bufferDataSize > m_vertexAttrib0BufferSize … … 3765 3784 const VertexAttribState& state = m_vertexAttribState[0]; 3766 3785 if (state.bufferBinding != m_vertexAttrib0Buffer) { 3767 m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, state.bufferBinding .get());3786 m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, state.bufferBinding->object()); 3768 3787 m_context->vertexAttribPointer(0, state.size, state.type, state.normalized, state.originalStride, state.offset); 3769 3788 } 3770 m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, m_boundArrayBuffer .get());3789 m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, m_boundArrayBuffer->object()); 3771 3790 } 3772 3791 -
trunk/WebCore/html/canvas/WebGLRenderingContext.h
r64308 r64582 304 304 void viewport(long x, long y, unsigned long width, unsigned long height); 305 305 306 GraphicsContext3D* graphicsContext3D() const { return m_context.get(); }306 virtual GraphicsContext3D* graphicsContext3D() const { return m_context.get(); } 307 307 308 308 void reshape(int width, int height); -
trunk/WebCore/platform/graphics/GraphicsContext3D.h
r63502 r64582 74 74 75 75 namespace WebCore { 76 class WebGLActiveInfo;77 76 class ArrayBuffer; 78 77 class ArrayBufferView; 79 class WebGLBuffer; 80 class Uint8Array; 78 class CanvasRenderingContext; 81 79 class Float32Array; 82 class WebGLFramebuffer; 83 class Int32Array; 84 class WebGLProgram; 85 class WebGLRenderbuffer; 86 class WebGLRenderingContext; 87 class WebGLShader; 88 class WebGLTexture; 80 class HostWindow; 89 81 class Image; 90 82 class ImageData; 91 class HostWindow; 83 class Int32Array; 84 class Uint8Array; 85 class WebGLActiveInfo; 92 86 93 87 struct ActiveInfo { … … 544 538 545 539 void activeTexture(unsigned long texture); 546 void attachShader( WebGLProgram* program, WebGLShader*shader);547 void bindAttribLocation( WebGLProgram*, unsigned long index, const String& name);548 void bindBuffer(unsigned long target, WebGLBuffer*);549 void bindFramebuffer(unsigned long target, WebGLFramebuffer*);550 void bindRenderbuffer(unsigned long target, WebGLRenderbuffer*);551 void bindTexture(unsigned long target, WebGLTexture*texture);540 void attachShader(Platform3DObject program, Platform3DObject shader); 541 void bindAttribLocation(Platform3DObject, unsigned long index, const String& name); 542 void bindBuffer(unsigned long target, Platform3DObject); 543 void bindFramebuffer(unsigned long target, Platform3DObject); 544 void bindRenderbuffer(unsigned long target, Platform3DObject); 545 void bindTexture(unsigned long target, Platform3DObject texture); 552 546 void blendColor(double red, double green, double blue, double alpha); 553 547 void blendEquation(unsigned long mode); … … 568 562 void clearStencil(long s); 569 563 void colorMask(bool red, bool green, bool blue, bool alpha); 570 void compileShader( WebGLShader*);564 void compileShader(Platform3DObject); 571 565 572 566 //void compressedTexImage2D(unsigned long target, long level, unsigned long internalformat, unsigned long width, unsigned long height, long border, unsigned long imageSize, const void* data); … … 579 573 void depthMask(bool flag); 580 574 void depthRange(double zNear, double zFar); 581 void detachShader( WebGLProgram*, WebGLShader*);575 void detachShader(Platform3DObject, Platform3DObject); 582 576 void disable(unsigned long cap); 583 577 void disableVertexAttribArray(unsigned long index); … … 589 583 void finish(); 590 584 void flush(); 591 void framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, WebGLRenderbuffer*);592 void framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, WebGLTexture*, long level);585 void framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, Platform3DObject); 586 void framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, Platform3DObject, long level); 593 587 void frontFace(unsigned long mode); 594 588 void generateMipmap(unsigned long target); 595 589 596 bool getActiveAttrib( WebGLProgram*program, unsigned long index, ActiveInfo&);597 bool getActiveUniform( WebGLProgram*program, unsigned long index, ActiveInfo&);598 599 void getAttachedShaders( WebGLProgram*program, int maxCount, int* count, unsigned int* shaders);600 601 int getAttribLocation(WebGLProgram*, const String& name);590 bool getActiveAttrib(Platform3DObject program, unsigned long index, ActiveInfo&); 591 bool getActiveUniform(Platform3DObject program, unsigned long index, ActiveInfo&); 592 593 void getAttachedShaders(Platform3DObject program, int maxCount, int* count, unsigned int* shaders); 594 595 int getAttribLocation(Platform3DObject, const String& name); 602 596 603 597 void getBooleanv(unsigned long pname, unsigned char* value); … … 615 609 void getIntegerv(unsigned long pname, int* value); 616 610 617 void getProgramiv( WebGLProgram*program, unsigned long pname, int* value);618 619 String getProgramInfoLog( WebGLProgram*);611 void getProgramiv(Platform3DObject program, unsigned long pname, int* value); 612 613 String getProgramInfoLog(Platform3DObject); 620 614 621 615 void getRenderbufferParameteriv(unsigned long target, unsigned long pname, int* value); 622 616 623 void getShaderiv( WebGLShader*, unsigned long pname, int* value);624 625 String getShaderInfoLog( WebGLShader*);617 void getShaderiv(Platform3DObject, unsigned long pname, int* value); 618 619 String getShaderInfoLog(Platform3DObject); 626 620 627 621 // TBD 628 622 // void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); 629 623 630 String getShaderSource( WebGLShader*);624 String getShaderSource(Platform3DObject); 631 625 String getString(unsigned long name); 632 626 … … 634 628 void getTexParameteriv(unsigned long target, unsigned long pname, int* value); 635 629 636 void getUniformfv( WebGLProgram*program, long location, float* value);637 void getUniformiv( WebGLProgram*program, long location, int* value);638 639 long getUniformLocation( WebGLProgram*, const String& name);630 void getUniformfv(Platform3DObject program, long location, float* value); 631 void getUniformiv(Platform3DObject program, long location, int* value); 632 633 long getUniformLocation(Platform3DObject, const String& name); 640 634 641 635 void getVertexAttribfv(unsigned long index, unsigned long pname, float* value); … … 645 639 646 640 void hint(unsigned long target, unsigned long mode); 647 bool isBuffer( WebGLBuffer*);641 bool isBuffer(Platform3DObject); 648 642 bool isEnabled(unsigned long cap); 649 bool isFramebuffer( WebGLFramebuffer*);650 bool isProgram( WebGLProgram*);651 bool isRenderbuffer( WebGLRenderbuffer*);652 bool isShader( WebGLShader*);653 bool isTexture( WebGLTexture*);643 bool isFramebuffer(Platform3DObject); 644 bool isProgram(Platform3DObject); 645 bool isRenderbuffer(Platform3DObject); 646 bool isShader(Platform3DObject); 647 bool isTexture(Platform3DObject); 654 648 void lineWidth(double); 655 void linkProgram( WebGLProgram*);649 void linkProgram(Platform3DObject); 656 650 void pixelStorei(unsigned long pname, long param); 657 651 void polygonOffset(double factor, double units); … … 663 657 void sampleCoverage(double value, bool invert); 664 658 void scissor(long x, long y, unsigned long width, unsigned long height); 665 void shaderSource( WebGLShader*, const String& string);659 void shaderSource(Platform3DObject, const String& string); 666 660 void stencilFunc(unsigned long func, long ref, unsigned long mask); 667 661 void stencilFuncSeparate(unsigned long face, unsigned long func, long ref, unsigned long mask); … … 698 692 void uniformMatrix4fv(long location, bool transpose, float* value, int size); 699 693 700 void useProgram( WebGLProgram*);701 void validateProgram( WebGLProgram*);694 void useProgram(Platform3DObject); 695 void validateProgram(Platform3DObject); 702 696 703 697 void vertexAttrib1f(unsigned long indx, float x); … … 721 715 #endif 722 716 723 void paintRenderingResultsToCanvas( WebGLRenderingContext* context);717 void paintRenderingResultsToCanvas(CanvasRenderingContext* context); 724 718 725 719 // Helpers for notification about paint events 726 void beginPaint( WebGLRenderingContext* context);720 void beginPaint(CanvasRenderingContext* context); 727 721 void endPaint(); 728 722 #if PLATFORM(QT) -
trunk/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm
r63705 r64582 31 31 32 32 #import "BlockExceptions.h" 33 #include "CanvasObject.h" 34 #include "ImageBuffer.h" 35 #include "NotImplemented.h" 36 #include "WebGLActiveInfo.h" 33 37 34 #include "ArrayBuffer.h" 38 35 #include "ArrayBufferView.h" 39 #include "WebGLBuffer.h" 36 #include "CanvasObject.h" 37 #include "CanvasRenderingContext.h" 40 38 #include "Float32Array.h" 41 #include "WebGLFramebuffer.h"42 39 #include "GraphicsContext.h" 43 40 #include "HTMLCanvasElement.h" 41 #include "ImageBuffer.h" 44 42 #include "Int32Array.h" 43 #include "NotImplemented.h" 44 #include "Uint8Array.h" 45 45 #include "WebGLLayer.h" 46 #include "WebGLProgram.h"47 #include "WebGLRenderbuffer.h"48 #include "WebGLRenderingContext.h"49 #include "WebGLShader.h"50 #include "WebGLTexture.h"51 #include "Uint8Array.h"52 46 #include <CoreGraphics/CGBitmapContext.h> 53 47 #include <OpenGL/CGLRenderers.h> … … 241 235 } 242 236 243 void GraphicsContext3D::paintRenderingResultsToCanvas( WebGLRenderingContext* context)237 void GraphicsContext3D::paintRenderingResultsToCanvas(CanvasRenderingContext* context) 244 238 { 245 239 HTMLCanvasElement* canvas = context->canvas(); … … 289 283 } 290 284 291 void GraphicsContext3D::beginPaint( WebGLRenderingContext* context)285 void GraphicsContext3D::beginPaint(CanvasRenderingContext* context) 292 286 { 293 287 UNUSED_PARAM(context); … … 462 456 } 463 457 464 void GraphicsContext3D::attachShader( WebGLProgram* program, WebGLShader*shader)458 void GraphicsContext3D::attachShader(Platform3DObject program, Platform3DObject shader) 465 459 { 466 460 ASSERT(program); 467 461 ASSERT(shader); 468 462 ensureContext(m_contextObj); 469 ::glAttachShader((GLuint) program ->object(), (GLuint) shader->object());470 } 471 472 void GraphicsContext3D::bindAttribLocation( WebGLProgram*program, unsigned long index, const String& name)463 ::glAttachShader((GLuint) program, (GLuint) shader); 464 } 465 466 void GraphicsContext3D::bindAttribLocation(Platform3DObject program, unsigned long index, const String& name) 473 467 { 474 468 ASSERT(program); 475 469 ensureContext(m_contextObj); 476 ::glBindAttribLocation((GLuint) program ->object(), index, name.utf8().data());477 } 478 479 void GraphicsContext3D::bindBuffer(unsigned long target, WebGLBuffer*buffer)480 { 481 ensureContext(m_contextObj); 482 ::glBindBuffer(target, buffer ? (GLuint) buffer->object() : 0);483 } 484 485 486 void GraphicsContext3D::bindFramebuffer(unsigned long target, WebGLFramebuffer*buffer)470 ::glBindAttribLocation((GLuint) program, index, name.utf8().data()); 471 } 472 473 void GraphicsContext3D::bindBuffer(unsigned long target, Platform3DObject buffer) 474 { 475 ensureContext(m_contextObj); 476 ::glBindBuffer(target, (GLuint) buffer); 477 } 478 479 480 void GraphicsContext3D::bindFramebuffer(unsigned long target, Platform3DObject buffer) 487 481 { 488 482 ensureContext(m_contextObj); 489 483 GLuint fbo; 490 if (buffer && buffer->object())491 fbo = (GLuint)buffer ->object();484 if (buffer) 485 fbo = (GLuint)buffer; 492 486 else 493 487 fbo = (m_attrs.antialias ? m_multisampleFBO : m_fbo); … … 498 492 } 499 493 500 void GraphicsContext3D::bindRenderbuffer(unsigned long target, WebGLRenderbuffer*renderbuffer)501 { 502 ensureContext(m_contextObj); 503 ::glBindRenderbufferEXT(target, renderbuffer ? (GLuint) renderbuffer->object() : 0);504 } 505 506 507 void GraphicsContext3D::bindTexture(unsigned long target, WebGLTexture*texture)508 { 509 ensureContext(m_contextObj); 510 ::glBindTexture(target, texture ? (GLuint) texture->object() : 0);494 void GraphicsContext3D::bindRenderbuffer(unsigned long target, Platform3DObject renderbuffer) 495 { 496 ensureContext(m_contextObj); 497 ::glBindRenderbufferEXT(target, (GLuint) renderbuffer); 498 } 499 500 501 void GraphicsContext3D::bindTexture(unsigned long target, Platform3DObject texture) 502 { 503 ensureContext(m_contextObj); 504 ::glBindTexture(target, (GLuint) texture); 511 505 } 512 506 … … 620 614 } 621 615 622 void GraphicsContext3D::compileShader( WebGLShader*shader)616 void GraphicsContext3D::compileShader(Platform3DObject shader) 623 617 { 624 618 ASSERT(shader); 625 619 ensureContext(m_contextObj); 626 ::glCompileShader((GLuint) shader ->object());620 ::glCompileShader((GLuint) shader); 627 621 } 628 622 … … 679 673 } 680 674 681 void GraphicsContext3D::detachShader( WebGLProgram* program, WebGLShader*shader)675 void GraphicsContext3D::detachShader(Platform3DObject program, Platform3DObject shader) 682 676 { 683 677 ASSERT(program); 684 678 ASSERT(shader); 685 679 ensureContext(m_contextObj); 686 ::glDetachShader((GLuint) program ->object(), (GLuint) shader->object());680 ::glDetachShader((GLuint) program, (GLuint) shader); 687 681 } 688 682 … … 735 729 } 736 730 737 void GraphicsContext3D::framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, WebGLRenderbuffer*buffer)738 { 739 ensureContext(m_contextObj); 740 GLuint renderbuffer = ( buffer ? (GLuint) buffer->object() : 0);731 void GraphicsContext3D::framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, Platform3DObject buffer) 732 { 733 ensureContext(m_contextObj); 734 GLuint renderbuffer = (GLuint) buffer; 741 735 if (attachment == DEPTH_STENCIL_ATTACHMENT) { 742 736 ::glFramebufferRenderbufferEXT(target, DEPTH_ATTACHMENT, renderbuffertarget, renderbuffer); … … 746 740 } 747 741 748 void GraphicsContext3D::framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, WebGLTexture*texture, long level)749 { 750 ensureContext(m_contextObj); 751 ::glFramebufferTexture2DEXT(target, attachment, textarget, texture ? (GLuint) texture->object() : 0, level);742 void GraphicsContext3D::framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, Platform3DObject texture, long level) 743 { 744 ensureContext(m_contextObj); 745 ::glFramebufferTexture2DEXT(target, attachment, textarget, (GLuint) texture, level); 752 746 } 753 747 … … 764 758 } 765 759 766 bool GraphicsContext3D::getActiveAttrib( WebGLProgram*program, unsigned long index, ActiveInfo& info)767 { 768 if (!program ->object()) {760 bool GraphicsContext3D::getActiveAttrib(Platform3DObject program, unsigned long index, ActiveInfo& info) 761 { 762 if (!program) { 769 763 synthesizeGLError(INVALID_VALUE); 770 764 return false; … … 772 766 ensureContext(m_contextObj); 773 767 GLint maxAttributeSize = 0; 774 ::glGetProgramiv(static_cast<GLuint>(program ->object()), GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxAttributeSize);768 ::glGetProgramiv(static_cast<GLuint>(program), GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxAttributeSize); 775 769 GLchar name[maxAttributeSize]; // GL_ACTIVE_ATTRIBUTE_MAX_LENGTH includes null termination 776 770 GLsizei nameLength = 0; 777 771 GLint size = 0; 778 772 GLenum type = 0; 779 ::glGetActiveAttrib(static_cast<GLuint>(program ->object()), index, maxAttributeSize, &nameLength, &size, &type, name);773 ::glGetActiveAttrib(static_cast<GLuint>(program), index, maxAttributeSize, &nameLength, &size, &type, name); 780 774 if (!nameLength) 781 775 return false; … … 786 780 } 787 781 788 bool GraphicsContext3D::getActiveUniform( WebGLProgram*program, unsigned long index, ActiveInfo& info)789 { 790 if (!program ->object()) {782 bool GraphicsContext3D::getActiveUniform(Platform3DObject program, unsigned long index, ActiveInfo& info) 783 { 784 if (!program) { 791 785 synthesizeGLError(INVALID_VALUE); 792 786 return false; … … 794 788 ensureContext(m_contextObj); 795 789 GLint maxUniformSize = 0; 796 ::glGetProgramiv(static_cast<GLuint>(program ->object()), GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxUniformSize);790 ::glGetProgramiv(static_cast<GLuint>(program), GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxUniformSize); 797 791 GLchar name[maxUniformSize]; // GL_ACTIVE_UNIFORM_MAX_LENGTH includes null termination 798 792 GLsizei nameLength = 0; 799 793 GLint size = 0; 800 794 GLenum type = 0; 801 ::glGetActiveUniform(static_cast<GLuint>(program ->object()), index, maxUniformSize, &nameLength, &size, &type, name);795 ::glGetActiveUniform(static_cast<GLuint>(program), index, maxUniformSize, &nameLength, &size, &type, name); 802 796 if (!nameLength) 803 797 return false; … … 808 802 } 809 803 810 void GraphicsContext3D::getAttachedShaders( WebGLProgram*program, int maxCount, int* count, unsigned int* shaders)811 { 812 if (!program || !program->object()) {804 void GraphicsContext3D::getAttachedShaders(Platform3DObject program, int maxCount, int* count, unsigned int* shaders) 805 { 806 if (!program) { 813 807 synthesizeGLError(INVALID_VALUE); 814 808 return; 815 809 } 816 810 ensureContext(m_contextObj); 817 ::glGetAttachedShaders(static_cast<GLuint>(program ->object()), maxCount, count, shaders);818 } 819 820 int GraphicsContext3D::getAttribLocation( WebGLProgram*program, const String& name)811 ::glGetAttachedShaders(static_cast<GLuint>(program), maxCount, count, shaders); 812 } 813 814 int GraphicsContext3D::getAttribLocation(Platform3DObject program, const String& name) 821 815 { 822 816 if (!program) … … 824 818 825 819 ensureContext(m_contextObj); 826 return ::glGetAttribLocation((GLuint) program ->object(), name.utf8().data());820 return ::glGetAttribLocation((GLuint) program, name.utf8().data()); 827 821 } 828 822 … … 857 851 } 858 852 859 bool GraphicsContext3D::isBuffer( WebGLBuffer*buffer)853 bool GraphicsContext3D::isBuffer(Platform3DObject buffer) 860 854 { 861 855 if (!buffer) … … 863 857 864 858 ensureContext(m_contextObj); 865 return ::glIsBuffer((GLuint) buffer ->object());859 return ::glIsBuffer((GLuint) buffer); 866 860 } 867 861 … … 872 866 } 873 867 874 bool GraphicsContext3D::isFramebuffer( WebGLFramebuffer*framebuffer)868 bool GraphicsContext3D::isFramebuffer(Platform3DObject framebuffer) 875 869 { 876 870 if (!framebuffer) … … 878 872 879 873 ensureContext(m_contextObj); 880 return ::glIsFramebufferEXT((GLuint) framebuffer ->object());881 } 882 883 bool GraphicsContext3D::isProgram( WebGLProgram*program)874 return ::glIsFramebufferEXT((GLuint) framebuffer); 875 } 876 877 bool GraphicsContext3D::isProgram(Platform3DObject program) 884 878 { 885 879 if (!program) … … 887 881 888 882 ensureContext(m_contextObj); 889 return ::glIsProgram((GLuint) program ->object());890 } 891 892 bool GraphicsContext3D::isRenderbuffer( WebGLRenderbuffer*renderbuffer)883 return ::glIsProgram((GLuint) program); 884 } 885 886 bool GraphicsContext3D::isRenderbuffer(Platform3DObject renderbuffer) 893 887 { 894 888 if (!renderbuffer) … … 896 890 897 891 ensureContext(m_contextObj); 898 return ::glIsRenderbufferEXT((GLuint) renderbuffer ->object());899 } 900 901 bool GraphicsContext3D::isShader( WebGLShader*shader)892 return ::glIsRenderbufferEXT((GLuint) renderbuffer); 893 } 894 895 bool GraphicsContext3D::isShader(Platform3DObject shader) 902 896 { 903 897 if (!shader) … … 905 899 906 900 ensureContext(m_contextObj); 907 return ::glIsShader((GLuint) shader ->object());908 } 909 910 bool GraphicsContext3D::isTexture( WebGLTexture*texture)901 return ::glIsShader((GLuint) shader); 902 } 903 904 bool GraphicsContext3D::isTexture(Platform3DObject texture) 911 905 { 912 906 if (!texture) … … 914 908 915 909 ensureContext(m_contextObj); 916 return ::glIsTexture((GLuint) texture ->object());910 return ::glIsTexture((GLuint) texture); 917 911 } 918 912 … … 923 917 } 924 918 925 void GraphicsContext3D::linkProgram( WebGLProgram*program)919 void GraphicsContext3D::linkProgram(Platform3DObject program) 926 920 { 927 921 ASSERT(program); 928 922 ensureContext(m_contextObj); 929 ::glLinkProgram((GLuint) program ->object());923 ::glLinkProgram((GLuint) program); 930 924 } 931 925 … … 1000 994 } 1001 995 1002 void GraphicsContext3D::shaderSource( WebGLShader*shader, const String& string)996 void GraphicsContext3D::shaderSource(Platform3DObject shader, const String& string) 1003 997 { 1004 998 ASSERT(shader); … … 1009 1003 1010 1004 int length = string.length(); 1011 ::glShaderSource((GLuint) shader ->object(), 1, &s, &length);1005 ::glShaderSource((GLuint) shader, 1, &s, &length); 1012 1006 } 1013 1007 … … 1183 1177 } 1184 1178 1185 void GraphicsContext3D::useProgram( WebGLProgram*program)1186 { 1187 ensureContext(m_contextObj); 1188 ::glUseProgram( program ? ((GLuint) program->object()) : 0);1189 } 1190 1191 void GraphicsContext3D::validateProgram( WebGLProgram*program)1179 void GraphicsContext3D::useProgram(Platform3DObject program) 1180 { 1181 ensureContext(m_contextObj); 1182 ::glUseProgram((GLuint) program); 1183 } 1184 1185 void GraphicsContext3D::validateProgram(Platform3DObject program) 1192 1186 { 1193 1187 ASSERT(program); 1194 1188 1195 1189 ensureContext(m_contextObj); 1196 ::glValidateProgram((GLuint) program ->object());1190 ::glValidateProgram((GLuint) program); 1197 1191 } 1198 1192 … … 1317 1311 } 1318 1312 1319 void GraphicsContext3D::getProgramiv( WebGLProgram*program, unsigned long pname, int* value)1320 { 1321 ensureContext(m_contextObj); 1322 ::glGetProgramiv((GLuint) program ->object(), pname, value);1323 } 1324 1325 String GraphicsContext3D::getProgramInfoLog( WebGLProgram*program)1313 void GraphicsContext3D::getProgramiv(Platform3DObject program, unsigned long pname, int* value) 1314 { 1315 ensureContext(m_contextObj); 1316 ::glGetProgramiv((GLuint) program, pname, value); 1317 } 1318 1319 String GraphicsContext3D::getProgramInfoLog(Platform3DObject program) 1326 1320 { 1327 1321 ASSERT(program); … … 1329 1323 ensureContext(m_contextObj); 1330 1324 GLint length; 1331 ::glGetProgramiv((GLuint) program ->object(), GL_INFO_LOG_LENGTH, &length);1325 ::glGetProgramiv((GLuint) program, GL_INFO_LOG_LENGTH, &length); 1332 1326 1333 1327 GLsizei size; … … 1336 1330 return ""; 1337 1331 1338 ::glGetProgramInfoLog((GLuint) program ->object(), length, &size, info);1332 ::glGetProgramInfoLog((GLuint) program, length, &size, info); 1339 1333 String s(info); 1340 1334 fastFree(info); … … 1348 1342 } 1349 1343 1350 void GraphicsContext3D::getShaderiv( WebGLShader*shader, unsigned long pname, int* value)1344 void GraphicsContext3D::getShaderiv(Platform3DObject shader, unsigned long pname, int* value) 1351 1345 { 1352 1346 ASSERT(shader); 1353 1347 1354 1348 ensureContext(m_contextObj); 1355 ::glGetShaderiv((GLuint) shader ->object(), pname, value);1356 } 1357 1358 String GraphicsContext3D::getShaderInfoLog( WebGLShader*shader)1349 ::glGetShaderiv((GLuint) shader, pname, value); 1350 } 1351 1352 String GraphicsContext3D::getShaderInfoLog(Platform3DObject shader) 1359 1353 { 1360 1354 ASSERT(shader); … … 1362 1356 ensureContext(m_contextObj); 1363 1357 GLint length; 1364 ::glGetShaderiv((GLuint) shader ->object(), GL_INFO_LOG_LENGTH, &length);1358 ::glGetShaderiv((GLuint) shader, GL_INFO_LOG_LENGTH, &length); 1365 1359 1366 1360 GLsizei size; … … 1369 1363 return ""; 1370 1364 1371 ::glGetShaderInfoLog((GLuint) shader ->object(), length, &size, info);1365 ::glGetShaderInfoLog((GLuint) shader, length, &size, info); 1372 1366 String s(info); 1373 1367 fastFree(info); … … 1375 1369 } 1376 1370 1377 String GraphicsContext3D::getShaderSource( WebGLShader*shader)1371 String GraphicsContext3D::getShaderSource(Platform3DObject shader) 1378 1372 { 1379 1373 ASSERT(shader); … … 1381 1375 ensureContext(m_contextObj); 1382 1376 GLint length; 1383 ::glGetShaderiv((GLuint) shader ->object(), GL_SHADER_SOURCE_LENGTH, &length);1377 ::glGetShaderiv((GLuint) shader, GL_SHADER_SOURCE_LENGTH, &length); 1384 1378 1385 1379 GLsizei size; … … 1388 1382 return ""; 1389 1383 1390 ::glGetShaderSource((GLuint) shader ->object(), length, &size, info);1384 ::glGetShaderSource((GLuint) shader, length, &size, info); 1391 1385 String s(info); 1392 1386 fastFree(info); … … 1407 1401 } 1408 1402 1409 void GraphicsContext3D::getUniformfv( WebGLProgram*program, long location, float* value)1410 { 1411 ensureContext(m_contextObj); 1412 ::glGetUniformfv((GLuint) program ->object(), location, value);1413 } 1414 1415 void GraphicsContext3D::getUniformiv( WebGLProgram*program, long location, int* value)1416 { 1417 ensureContext(m_contextObj); 1418 ::glGetUniformiv((GLuint) program ->object(), location, value);1419 } 1420 1421 long GraphicsContext3D::getUniformLocation( WebGLProgram*program, const String& name)1403 void GraphicsContext3D::getUniformfv(Platform3DObject program, long location, float* value) 1404 { 1405 ensureContext(m_contextObj); 1406 ::glGetUniformfv((GLuint) program, location, value); 1407 } 1408 1409 void GraphicsContext3D::getUniformiv(Platform3DObject program, long location, int* value) 1410 { 1411 ensureContext(m_contextObj); 1412 ::glGetUniformiv((GLuint) program, location, value); 1413 } 1414 1415 long GraphicsContext3D::getUniformLocation(Platform3DObject program, const String& name) 1422 1416 { 1423 1417 ASSERT(program); 1424 1418 1425 1419 ensureContext(m_contextObj); 1426 return ::glGetUniformLocation((GLuint) program ->object(), name.utf8().data());1420 return ::glGetUniformLocation((GLuint) program, name.utf8().data()); 1427 1421 } 1428 1422 -
trunk/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
r63502 r64582 21 21 #include "GraphicsContext3D.h" 22 22 23 #include "ArrayBufferView.h" 23 24 #include "CanvasObject.h" 25 #include "CanvasRenderingContext.h" 26 #include "Float32Array.h" 24 27 #include "GraphicsContext.h" 25 28 #include "HTMLCanvasElement.h" 26 29 #include "HostWindow.h" 27 30 #include "ImageBuffer.h" 31 #include "Int32Array.h" 28 32 #include "NotImplemented.h" 29 33 #include "QWebPageClient.h" 30 #include "WebGLActiveInfo.h"31 #include "ArrayBufferView.h"32 #include "WebGLBuffer.h"33 #include "Float32Array.h"34 #include "WebGLFramebuffer.h"35 #include "Int32Array.h"36 #include "WebGLProgram.h"37 #include "WebGLRenderbuffer.h"38 #include "WebGLRenderingContext.h"39 #include "WebGLShader.h"40 #include "WebGLTexture.h"41 34 #include "Uint8Array.h" 42 35 #include <QAbstractScrollArea> … … 520 513 } 521 514 522 void GraphicsContext3D::beginPaint( WebGLRenderingContext* context)515 void GraphicsContext3D::beginPaint(CanvasRenderingContext* context) 523 516 { 524 517 paintRenderingResultsToCanvas(); … … 529 522 } 530 523 531 void GraphicsContext3D::paintRenderingResultsToCanvas( WebGLRenderingContext* context)524 void GraphicsContext3D::paintRenderingResultsToCanvas(CanvasRenderingContext* context) 532 525 { 533 526 m_internal->m_glWidget->makeCurrent(); … … 599 592 } 600 593 601 void GraphicsContext3D::attachShader( WebGLProgram* program, WebGLShader*shader)594 void GraphicsContext3D::attachShader(PlatformGLObject program, PlatformGLObject shader) 602 595 { 603 596 ASSERT(program); 604 597 ASSERT(shader); 605 598 m_internal->m_glWidget->makeCurrent(); 606 m_internal->attachShader((GLuint) program ->object(), (GLuint) shader->object());607 } 608 609 void GraphicsContext3D::bindAttribLocation( WebGLProgram*program, unsigned long index, const String& name)599 m_internal->attachShader((GLuint) program, (GLuint) shader); 600 } 601 602 void GraphicsContext3D::bindAttribLocation(PlatformGLObject program, unsigned long index, const String& name) 610 603 { 611 604 ASSERT(program); 612 605 m_internal->m_glWidget->makeCurrent(); 613 m_internal->bindAttribLocation((GLuint) program ->object(), index, name.utf8().data());614 } 615 616 void GraphicsContext3D::bindBuffer(unsigned long target, WebGLBuffer*buffer)617 { 618 m_internal->m_glWidget->makeCurrent(); 619 m_internal->bindBuffer(target, buffer ? (GLuint) buffer->object() : 0);620 } 621 622 void GraphicsContext3D::bindFramebuffer(unsigned long target, WebGLFramebuffer*buffer)623 { 624 m_internal->m_glWidget->makeCurrent(); 625 m_internal->m_currentFbo = (buffer && buffer->object()) ? (GLuint) buffer->object(): m_internal->m_mainFbo;606 m_internal->bindAttribLocation((GLuint) program, index, name.utf8().data()); 607 } 608 609 void GraphicsContext3D::bindBuffer(unsigned long target, PlatformGLObject buffer) 610 { 611 m_internal->m_glWidget->makeCurrent(); 612 m_internal->bindBuffer(target, (GLuint) buffer->object()); 613 } 614 615 void GraphicsContext3D::bindFramebuffer(unsigned long target, PlatformGLObject buffer) 616 { 617 m_internal->m_glWidget->makeCurrent(); 618 m_internal->m_currentFbo = buffer ? (GLuint) buffer : m_internal->m_mainFbo; 626 619 m_internal->bindFramebuffer(target, m_internal->m_currentFbo); 627 620 } 628 621 629 void GraphicsContext3D::bindRenderbuffer(unsigned long target, WebGLRenderbuffer*renderbuffer)630 { 631 m_internal->m_glWidget->makeCurrent(); 632 m_internal->bindRenderbuffer(target, renderbuffer ? (GLuint) renderbuffer->object() : 0);633 } 634 635 void GraphicsContext3D::bindTexture(unsigned long target, WebGLTexture*texture)636 { 637 m_internal->m_glWidget->makeCurrent(); 638 glBindTexture(target, texture ? (GLuint) texture->object() : 0);622 void GraphicsContext3D::bindRenderbuffer(unsigned long target, PlatformGLObject renderbuffer) 623 { 624 m_internal->m_glWidget->makeCurrent(); 625 m_internal->bindRenderbuffer(target, (GLuint) renderbuffer); 626 } 627 628 void GraphicsContext3D::bindTexture(unsigned long target, PlatformGLObject texture) 629 { 630 m_internal->m_glWidget->makeCurrent(); 631 glBindTexture(target, (GLuint) texture); 639 632 } 640 633 … … 733 726 } 734 727 735 void GraphicsContext3D::compileShader( WebGLShader*shader)728 void GraphicsContext3D::compileShader(PlatformGLObject shader) 736 729 { 737 730 ASSERT(shader); 738 731 m_internal->m_glWidget->makeCurrent(); 739 m_internal->compileShader((GLuint) shader ->object());732 m_internal->compileShader((GLuint) shader); 740 733 } 741 734 … … 780 773 } 781 774 782 void GraphicsContext3D::detachShader( WebGLProgram* program, WebGLShader*shader)775 void GraphicsContext3D::detachShader(PlatformGLObject program, PlatformGLObject shader) 783 776 { 784 777 ASSERT(program); 785 778 ASSERT(shader); 786 779 m_internal->m_glWidget->makeCurrent(); 787 m_internal->detachShader((GLuint) program ->object(), (GLuint) shader->object());780 m_internal->detachShader((GLuint) program, (GLuint) shader); 788 781 } 789 782 … … 836 829 } 837 830 838 void GraphicsContext3D::framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, WebGLRenderbuffer*buffer)839 { 840 m_internal->m_glWidget->makeCurrent(); 841 m_internal->framebufferRenderbuffer(target, attachment, renderbuffertarget, buffer ? (GLuint) buffer->object() : 0);842 } 843 844 void GraphicsContext3D::framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, WebGLTexture*texture, long level)845 { 846 m_internal->m_glWidget->makeCurrent(); 847 m_internal->framebufferTexture2D(target, attachment, textarget, texture ? (GLuint) texture->object() : 0, level);831 void GraphicsContext3D::framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, PlatformGLObject buffer) 832 { 833 m_internal->m_glWidget->makeCurrent(); 834 m_internal->framebufferRenderbuffer(target, attachment, renderbuffertarget, (GLuint) buffer); 835 } 836 837 void GraphicsContext3D::framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, PlatformGLObject texture, long level) 838 { 839 m_internal->m_glWidget->makeCurrent(); 840 m_internal->framebufferTexture2D(target, attachment, textarget, (GLuint) texture, level); 848 841 } 849 842 … … 860 853 } 861 854 862 bool GraphicsContext3D::getActiveAttrib( WebGLProgram*program, unsigned long index, ActiveInfo& info)863 { 864 if (!program ->object()) {855 bool GraphicsContext3D::getActiveAttrib(PlatformGLObject program, unsigned long index, ActiveInfo& info) 856 { 857 if (!program) { 865 858 synthesizeGLError(INVALID_VALUE); 866 859 return false; … … 870 863 871 864 GLint maxLength; 872 m_internal->getProgramiv(static_cast<GLuint>(program ->object()), GraphicsContext3D::ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxLength);865 m_internal->getProgramiv(static_cast<GLuint>(program), GraphicsContext3D::ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxLength); 873 866 874 867 GLchar* name = (GLchar*) fastMalloc(maxLength); … … 877 870 GLenum type; 878 871 879 m_internal->getActiveAttrib(static_cast<GLuint>(program ->object()), index, maxLength, &nameLength, &size, &type, name);872 m_internal->getActiveAttrib(static_cast<GLuint>(program), index, maxLength, &nameLength, &size, &type, name); 880 873 881 874 if (!nameLength) { … … 892 885 } 893 886 894 bool GraphicsContext3D::getActiveUniform( WebGLProgram*program, unsigned long index, ActiveInfo& info)895 { 896 if (!program ->object()) {887 bool GraphicsContext3D::getActiveUniform(PlatformGLObject program, unsigned long index, ActiveInfo& info) 888 { 889 if (!program) { 897 890 synthesizeGLError(INVALID_VALUE); 898 891 return false; … … 902 895 903 896 GLint maxLength; 904 m_internal->getProgramiv(static_cast<GLuint>(program ->object()), GraphicsContext3D::ACTIVE_UNIFORM_MAX_LENGTH, &maxLength);897 m_internal->getProgramiv(static_cast<GLuint>(program), GraphicsContext3D::ACTIVE_UNIFORM_MAX_LENGTH, &maxLength); 905 898 906 899 GLchar* name = (GLchar*) fastMalloc(maxLength); … … 909 902 GLenum type; 910 903 911 m_internal->getActiveUniform(static_cast<GLuint>(program ->object()), index, maxLength, &nameLength, &size, &type, name);904 m_internal->getActiveUniform(static_cast<GLuint>(program), index, maxLength, &nameLength, &size, &type, name); 912 905 913 906 if (!nameLength) { … … 924 917 } 925 918 926 int GraphicsContext3D::getAttribLocation( WebGLProgram*program, const String& name)919 int GraphicsContext3D::getAttribLocation(PlatformGLObject program, const String& name) 927 920 { 928 921 if (!program) … … 930 923 931 924 m_internal->m_glWidget->makeCurrent(); 932 return m_internal->getAttribLocation((GLuint) program ->object(), name.utf8().data());925 return m_internal->getAttribLocation((GLuint) program, name.utf8().data()); 933 926 } 934 927 … … 963 956 } 964 957 965 bool GraphicsContext3D::isBuffer( WebGLBuffer*buffer)958 bool GraphicsContext3D::isBuffer(PlatformGLObject buffer) 966 959 { 967 960 if (!buffer) … … 969 962 970 963 m_internal->m_glWidget->makeCurrent(); 971 return m_internal->isBuffer((GLuint) buffer ->object());964 return m_internal->isBuffer((GLuint) buffer); 972 965 } 973 966 … … 978 971 } 979 972 980 bool GraphicsContext3D::isFramebuffer( WebGLFramebuffer*framebuffer)973 bool GraphicsContext3D::isFramebuffer(PlatformGLObject framebuffer) 981 974 { 982 975 if (!framebuffer) … … 984 977 985 978 m_internal->m_glWidget->makeCurrent(); 986 return m_internal->isFramebuffer((GLuint) framebuffer ->object());987 } 988 989 bool GraphicsContext3D::isProgram( WebGLProgram*program)979 return m_internal->isFramebuffer((GLuint) framebuffer); 980 } 981 982 bool GraphicsContext3D::isProgram(PlatformGLObject program) 990 983 { 991 984 if (!program) … … 993 986 994 987 m_internal->m_glWidget->makeCurrent(); 995 return m_internal->isProgram((GLuint) program ->object());996 } 997 998 bool GraphicsContext3D::isRenderbuffer( WebGLRenderbuffer*renderbuffer)988 return m_internal->isProgram((GLuint) program); 989 } 990 991 bool GraphicsContext3D::isRenderbuffer(PlatformGLObject renderbuffer) 999 992 { 1000 993 if (!renderbuffer) … … 1002 995 1003 996 m_internal->m_glWidget->makeCurrent(); 1004 return m_internal->isRenderbuffer((GLuint) renderbuffer ->object());1005 } 1006 1007 bool GraphicsContext3D::isShader( WebGLShader*shader)997 return m_internal->isRenderbuffer((GLuint) renderbuffer); 998 } 999 1000 bool GraphicsContext3D::isShader(PlatformGLObject shader) 1008 1001 { 1009 1002 if (!shader) … … 1011 1004 1012 1005 m_internal->m_glWidget->makeCurrent(); 1013 return m_internal->isShader((GLuint) shader ->object());1014 } 1015 1016 bool GraphicsContext3D::isTexture( WebGLTexture*texture)1006 return m_internal->isShader((GLuint) shader); 1007 } 1008 1009 bool GraphicsContext3D::isTexture(PlatformGLObject texture) 1017 1010 { 1018 1011 if (!texture) … … 1020 1013 1021 1014 m_internal->m_glWidget->makeCurrent(); 1022 return glIsTexture((GLuint) texture ->object());1015 return glIsTexture((GLuint) texture); 1023 1016 } 1024 1017 … … 1029 1022 } 1030 1023 1031 void GraphicsContext3D::linkProgram( WebGLProgram*program)1024 void GraphicsContext3D::linkProgram(PlatformGLObject program) 1032 1025 { 1033 1026 ASSERT(program); 1034 1027 m_internal->m_glWidget->makeCurrent(); 1035 m_internal->linkProgram((GLuint) program ->object());1028 m_internal->linkProgram((GLuint) program); 1036 1029 } 1037 1030 … … 1082 1075 } 1083 1076 1084 void GraphicsContext3D::shaderSource( WebGLShader*shader, const String& source)1077 void GraphicsContext3D::shaderSource(PlatformGLObject shader, const String& source) 1085 1078 { 1086 1079 ASSERT(shader); … … 1099 1092 const char* data = sourceCS.data(); 1100 1093 int length = prefixedSource.length(); 1101 m_internal->shaderSource((GLuint) shader ->object(), /* count */ 1, &data, &length);1094 m_internal->shaderSource((GLuint) shader, /* count */ 1, &data, &length); 1102 1095 } 1103 1096 … … 1264 1257 } 1265 1258 1266 void GraphicsContext3D::useProgram( WebGLProgram*program)1259 void GraphicsContext3D::useProgram(PlatformGLObject program) 1267 1260 { 1268 1261 ASSERT(program); 1269 1262 1270 1263 m_internal->m_glWidget->makeCurrent(); 1271 m_internal->useProgram((GLuint) program ->object());1272 } 1273 1274 void GraphicsContext3D::validateProgram( WebGLProgram*program)1264 m_internal->useProgram((GLuint) program); 1265 } 1266 1267 void GraphicsContext3D::validateProgram(PlatformGLObject program) 1275 1268 { 1276 1269 ASSERT(program); 1277 1270 1278 1271 m_internal->m_glWidget->makeCurrent(); 1279 m_internal->validateProgram((GLuint) program ->object());1272 m_internal->validateProgram((GLuint) program); 1280 1273 } 1281 1274 … … 1370 1363 } 1371 1364 1372 void GraphicsContext3D::getProgramiv( WebGLProgram*program, unsigned long paramName, int* value)1373 { 1374 m_internal->m_glWidget->makeCurrent(); 1375 m_internal->getProgramiv((GLuint) program ->object(), paramName, value);1376 } 1377 1378 String GraphicsContext3D::getProgramInfoLog( WebGLProgram*program)1365 void GraphicsContext3D::getProgramiv(PlatformGLObject program, unsigned long paramName, int* value) 1366 { 1367 m_internal->m_glWidget->makeCurrent(); 1368 m_internal->getProgramiv((GLuint) program, paramName, value); 1369 } 1370 1371 String GraphicsContext3D::getProgramInfoLog(PlatformGLObject program) 1379 1372 { 1380 1373 m_internal->m_glWidget->makeCurrent(); 1381 1374 1382 1375 GLint length; 1383 m_internal->getProgramiv((GLuint) program ->object(), GraphicsContext3D::INFO_LOG_LENGTH, &length);1376 m_internal->getProgramiv((GLuint) program, GraphicsContext3D::INFO_LOG_LENGTH, &length); 1384 1377 1385 1378 GLsizei size; … … 1389 1382 return ""; 1390 1383 1391 m_internal->getProgramInfoLog((GLuint) program ->object(), length, &size, info);1384 m_internal->getProgramInfoLog((GLuint) program, length, &size, info); 1392 1385 1393 1386 String result(info); … … 1403 1396 } 1404 1397 1405 void GraphicsContext3D::getShaderiv( WebGLShader*shader, unsigned long paramName, int* value)1398 void GraphicsContext3D::getShaderiv(PlatformGLObject shader, unsigned long paramName, int* value) 1406 1399 { 1407 1400 ASSERT(shader); 1408 1401 m_internal->m_glWidget->makeCurrent(); 1409 m_internal->getShaderiv((GLuint) shader ->object(), paramName, value);1410 } 1411 1412 String GraphicsContext3D::getShaderInfoLog( WebGLShader*shader)1402 m_internal->getShaderiv((GLuint) shader, paramName, value); 1403 } 1404 1405 String GraphicsContext3D::getShaderInfoLog(PlatformGLObject shader) 1413 1406 { 1414 1407 m_internal->m_glWidget->makeCurrent(); 1415 1408 1416 1409 GLint length; 1417 m_internal->getShaderiv((GLuint) shader ->object(), GraphicsContext3D::INFO_LOG_LENGTH, &length);1410 m_internal->getShaderiv((GLuint) shader, GraphicsContext3D::INFO_LOG_LENGTH, &length); 1418 1411 1419 1412 GLsizei size; … … 1422 1415 return ""; 1423 1416 1424 m_internal->getShaderInfoLog((GLuint) shader ->object(), length, &size, info);1417 m_internal->getShaderInfoLog((GLuint) shader, length, &size, info); 1425 1418 1426 1419 String result(info); … … 1430 1423 } 1431 1424 1432 String GraphicsContext3D::getShaderSource( WebGLShader*shader)1425 String GraphicsContext3D::getShaderSource(PlatformGLObject shader) 1433 1426 { 1434 1427 m_internal->m_glWidget->makeCurrent(); 1435 1428 1436 1429 GLint length; 1437 m_internal->getShaderiv((GLuint) shader ->object(), GraphicsContext3D::SHADER_SOURCE_LENGTH, &length);1430 m_internal->getShaderiv((GLuint) shader, GraphicsContext3D::SHADER_SOURCE_LENGTH, &length); 1438 1431 1439 1432 GLsizei size; … … 1442 1435 return ""; 1443 1436 1444 m_internal->getShaderSource((GLuint) shader ->object(), length, &size, info);1437 m_internal->getShaderSource((GLuint) shader, length, &size, info); 1445 1438 1446 1439 String result(info); … … 1462 1455 } 1463 1456 1464 void GraphicsContext3D::getUniformfv( WebGLProgram*program, long location, float* value)1465 { 1466 m_internal->m_glWidget->makeCurrent(); 1467 m_internal->getUniformfv((GLuint) program ->object(), location, value);1468 } 1469 1470 void GraphicsContext3D::getUniformiv( WebGLProgram*program, long location, int* value)1471 { 1472 m_internal->m_glWidget->makeCurrent(); 1473 m_internal->getUniformiv((GLuint) program ->object(), location, value);1474 } 1475 1476 long GraphicsContext3D::getUniformLocation( WebGLProgram*program, const String& name)1457 void GraphicsContext3D::getUniformfv(PlatformGLObject program, long location, float* value) 1458 { 1459 m_internal->m_glWidget->makeCurrent(); 1460 m_internal->getUniformfv((GLuint) program, location, value); 1461 } 1462 1463 void GraphicsContext3D::getUniformiv(PlatformGLObject program, long location, int* value) 1464 { 1465 m_internal->m_glWidget->makeCurrent(); 1466 m_internal->getUniformiv((GLuint) program, location, value); 1467 } 1468 1469 long GraphicsContext3D::getUniformLocation(PlatformGLObject program, const String& name) 1477 1470 { 1478 1471 ASSERT(program); 1479 1472 1480 1473 m_internal->m_glWidget->makeCurrent(); 1481 return m_internal->getUniformLocation((GLuint) program ->object(), name.utf8().data());1474 return m_internal->getUniformLocation((GLuint) program, name.utf8().data()); 1482 1475 } 1483 1476 -
trunk/WebKit/chromium/ChangeLog
r64578 r64582 1 2010-08-03 James Robinson <jamesr@chromium.org> 2 3 Reviewed by Darin Fisher. 4 5 Move WebGL-specific code out of GraphicsContext3D so that G3D can be used as a generic accelerated drawing API 6 https://bugs.webkit.org/show_bug.cgi?id=43221 7 8 Implements functions in term of Platform3DObjects instead of WebGL types. 9 10 * src/GraphicsContext3D.cpp: 11 (WebCore::GraphicsContext3DInternal::paintRenderingResultsToCanvas): 12 (WebCore::GraphicsContext3DInternal::beginPaint): 13 (WebCore::GraphicsContext3DInternal::bindAttribLocation): 14 (WebCore::GraphicsContext3DInternal::getActiveAttrib): 15 (WebCore::GraphicsContext3DInternal::getActiveUniform): 16 (WebCore::GraphicsContext3DInternal::getAttribLocation): 17 (WebCore::GraphicsContext3DInternal::getProgramInfoLog): 18 (WebCore::GraphicsContext3DInternal::getShaderInfoLog): 19 (WebCore::GraphicsContext3DInternal::getShaderSource): 20 (WebCore::GraphicsContext3DInternal::getUniformLocation): 21 (WebCore::GraphicsContext3DInternal::shaderSource): 22 1 23 2010-08-03 Dimitri Glazkov <dglazkov@chromium.org> 2 24 -
trunk/WebKit/chromium/src/GraphicsContext3D.cpp
r63502 r64582 36 36 37 37 #include "CachedImage.h" 38 #include "CanvasRenderingContext.h" 38 39 #include "Chrome.h" 39 40 #include "ChromeClientImpl.h" … … 42 43 #include "ImageBuffer.h" 43 44 #include "ImageData.h" 44 #include "WebGLBuffer.h"45 45 #include "Int8Array.h" 46 46 #include "Float32Array.h" 47 #include "WebGLFramebuffer.h"48 47 #include "Int32Array.h" 49 #include "WebGLProgram.h"50 #include "WebGLRenderbuffer.h"51 #include "WebGLRenderingContext.h"52 #include "WebGLShader.h"53 #include "WebGLTexture.h"54 48 #include "Uint8Array.h" 55 49 #include "WebGLLayerChromium.h" … … 95 89 // #define RENDER_TO_DEBUGGING_WINDOW 96 90 97 #define EXTRACT(val) (!val ? 0 : val->object())98 99 91 class GraphicsContext3DInternal { 100 92 public: … … 113 105 void reshape(int width, int height); 114 106 115 void paintRenderingResultsToCanvas( WebGLRenderingContext* context);116 void beginPaint( WebGLRenderingContext* context);107 void paintRenderingResultsToCanvas(CanvasRenderingContext* context); 108 void beginPaint(CanvasRenderingContext* context); 117 109 void endPaint(); 118 110 … … 128 120 // 129 121 void activeTexture(unsigned long texture); 130 void attachShader( WebGLProgram* program, WebGLShader*shader);131 void bindAttribLocation( WebGLProgram*, unsigned long index, const String& name);132 void bindBuffer(unsigned long target, WebGLBuffer*);133 void bindFramebuffer(unsigned long target, WebGLFramebuffer*);134 void bindRenderbuffer(unsigned long target, WebGLRenderbuffer*);135 void bindTexture(unsigned long target, WebGLTexture*texture);122 void attachShader(Platform3DObject program, Platform3DObject shader); 123 void bindAttribLocation(Platform3DObject, unsigned long index, const String& name); 124 void bindBuffer(unsigned long target, Platform3DObject); 125 void bindFramebuffer(unsigned long target, Platform3DObject); 126 void bindRenderbuffer(unsigned long target, Platform3DObject); 127 void bindTexture(unsigned long target, Platform3DObject texture); 136 128 void blendColor(double red, double green, double blue, double alpha); 137 129 void blendEquation(unsigned long mode); … … 152 144 void clearStencil(long s); 153 145 void colorMask(bool red, bool green, bool blue, bool alpha); 154 void compileShader( WebGLShader*);146 void compileShader(Platform3DObject); 155 147 156 148 void copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border); … … 160 152 void depthMask(bool flag); 161 153 void depthRange(double zNear, double zFar); 162 void detachShader( WebGLProgram*, WebGLShader*);154 void detachShader(Platform3DObject, Platform3DObject); 163 155 void disable(unsigned long cap); 164 156 void disableVertexAttribArray(unsigned long index); … … 170 162 void finish(); 171 163 void flush(); 172 void framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, WebGLRenderbuffer*);173 void framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, WebGLTexture*, long level);164 void framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, Platform3DObject); 165 void framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, Platform3DObject, long level); 174 166 void frontFace(unsigned long mode); 175 167 void generateMipmap(unsigned long target); 176 168 177 bool getActiveAttrib( WebGLProgram*program, unsigned long index, ActiveInfo&);178 bool getActiveUniform( WebGLProgram*program, unsigned long index, ActiveInfo&);179 180 void getAttachedShaders( WebGLProgram*program, int maxCount, int* count, unsigned int* shaders);181 182 int getAttribLocation(WebGLProgram*, const String& name);169 bool getActiveAttrib(Platform3DObject program, unsigned long index, ActiveInfo&); 170 bool getActiveUniform(Platform3DObject program, unsigned long index, ActiveInfo&); 171 172 void getAttachedShaders(Platform3DObject program, int maxCount, int* count, unsigned int* shaders); 173 174 int getAttribLocation(Platform3DObject, const String& name); 183 175 184 176 void getBooleanv(unsigned long pname, unsigned char* value); … … 196 188 void getIntegerv(unsigned long pname, int* value); 197 189 198 void getProgramiv( WebGLProgram*program, unsigned long pname, int* value);199 200 String getProgramInfoLog( WebGLProgram*);190 void getProgramiv(Platform3DObject program, unsigned long pname, int* value); 191 192 String getProgramInfoLog(Platform3DObject); 201 193 202 194 void getRenderbufferParameteriv(unsigned long target, unsigned long pname, int* value); 203 195 204 void getShaderiv( WebGLShader*, unsigned long pname, int* value);205 206 String getShaderInfoLog( WebGLShader*);207 208 String getShaderSource( WebGLShader*);196 void getShaderiv(Platform3DObject, unsigned long pname, int* value); 197 198 String getShaderInfoLog(Platform3DObject); 199 200 String getShaderSource(Platform3DObject); 209 201 String getString(unsigned long name); 210 202 … … 212 204 void getTexParameteriv(unsigned long target, unsigned long pname, int* value); 213 205 214 void getUniformfv( WebGLProgram*program, long location, float* value);215 void getUniformiv( WebGLProgram*program, long location, int* value);216 217 long getUniformLocation( WebGLProgram*, const String& name);206 void getUniformfv(Platform3DObject program, long location, float* value); 207 void getUniformiv(Platform3DObject program, long location, int* value); 208 209 long getUniformLocation(Platform3DObject, const String& name); 218 210 219 211 void getVertexAttribfv(unsigned long index, unsigned long pname, float* value); … … 223 215 224 216 void hint(unsigned long target, unsigned long mode); 225 bool isBuffer( WebGLBuffer*);217 bool isBuffer(Platform3DObject); 226 218 bool isEnabled(unsigned long cap); 227 bool isFramebuffer( WebGLFramebuffer*);228 bool isProgram( WebGLProgram*);229 bool isRenderbuffer( WebGLRenderbuffer*);230 bool isShader( WebGLShader*);231 bool isTexture( WebGLTexture*);219 bool isFramebuffer(Platform3DObject); 220 bool isProgram(Platform3DObject); 221 bool isRenderbuffer(Platform3DObject); 222 bool isShader(Platform3DObject); 223 bool isTexture(Platform3DObject); 232 224 void lineWidth(double); 233 void linkProgram( WebGLProgram*);225 void linkProgram(Platform3DObject); 234 226 void pixelStorei(unsigned long pname, long param); 235 227 void polygonOffset(double factor, double units); … … 241 233 void sampleCoverage(double value, bool invert); 242 234 void scissor(long x, long y, unsigned long width, unsigned long height); 243 void shaderSource( WebGLShader*, const String& string);235 void shaderSource(Platform3DObject, const String& string); 244 236 void stencilFunc(unsigned long func, long ref, unsigned long mask); 245 237 void stencilFuncSeparate(unsigned long face, unsigned long func, long ref, unsigned long mask); … … 278 270 void uniformMatrix4fv(long location, bool transpose, float* value, int size); 279 271 280 void useProgram( WebGLProgram*);281 void validateProgram( WebGLProgram*);272 void useProgram(Platform3DObject); 273 void validateProgram(Platform3DObject); 282 274 283 275 void vertexAttrib1f(unsigned long indx, float x); … … 401 393 #endif 402 394 403 void GraphicsContext3DInternal::paintRenderingResultsToCanvas( WebGLRenderingContext* context)395 void GraphicsContext3DInternal::paintRenderingResultsToCanvas(CanvasRenderingContext* context) 404 396 { 405 397 HTMLCanvasElement* canvas = context->canvas(); … … 460 452 } 461 453 462 void GraphicsContext3DInternal::beginPaint( WebGLRenderingContext* context)454 void GraphicsContext3DInternal::beginPaint(CanvasRenderingContext* context) 463 455 { 464 456 paintRenderingResultsToCanvas(context); … … 509 501 } 510 502 511 #define DELEGATE_TO_IMPL_1_X(name, t1) \512 void GraphicsContext3DInternal::name(t1 a1) \513 { \514 m_impl->name(EXTRACT(a1)); \515 }516 517 503 #define DELEGATE_TO_IMPL_1R(name, t1, rt) \ 518 504 rt GraphicsContext3DInternal::name(t1 a1) \ … … 521 507 } 522 508 523 #define DELEGATE_TO_IMPL_1R_X(name, t1, rt) \524 rt GraphicsContext3DInternal::name(t1 a1) \525 { \526 return m_impl->name(EXTRACT(a1)); \527 }528 529 509 #define DELEGATE_TO_IMPL_2(name, t1, t2) \ 530 510 void GraphicsContext3DInternal::name(t1 a1, t2 a2) \ … … 533 513 } 534 514 535 #define DELEGATE_TO_IMPL_2_X12(name, t1, t2) \536 void GraphicsContext3DInternal::name(t1 a1, t2 a2) \537 { \538 m_impl->name(EXTRACT(a1), EXTRACT(a2)); \539 }540 541 #define DELEGATE_TO_IMPL_2_X2(name, t1, t2) \542 void GraphicsContext3DInternal::name(t1 a1, t2 a2) \543 { \544 m_impl->name(a1, EXTRACT(a2)); \545 }546 547 515 #define DELEGATE_TO_IMPL_2R(name, t1, t2, rt) \ 548 516 rt GraphicsContext3DInternal::name(t1 a1, t2 a2) \ … … 557 525 } 558 526 559 #define DELEGATE_TO_IMPL_3_X1(name, t1, t2, t3) \560 void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3) \561 { \562 m_impl->name(EXTRACT(a1), a2, a3); \563 }564 565 527 #define DELEGATE_TO_IMPL_3R(name, t1, t2, t3, rt) \ 566 528 rt GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3) \ … … 575 537 } 576 538 577 #define DELEGATE_TO_IMPL_4_X1(name, t1, t2, t3, t4) \578 void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4) \579 { \580 m_impl->name(EXTRACT(a1), a2, a3, a4); \581 }582 583 #define DELEGATE_TO_IMPL_4_X4(name, t1, t2, t3, t4) \584 void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4) \585 { \586 m_impl->name(a1, a2, a3, EXTRACT(a4)); \587 }588 589 539 #define DELEGATE_TO_IMPL_5(name, t1, t2, t3, t4, t5) \ 590 540 void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) \ … … 593 543 } 594 544 595 #define DELEGATE_TO_IMPL_5_X4(name, t1, t2, t3, t4, t5) \596 void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) \597 { \598 m_impl->name(a1, a2, a3, EXTRACT(a4), a5); \599 }600 601 545 #define DELEGATE_TO_IMPL_5R(name, t1, t2, t3, t4, t5, rt) \ 602 546 rt GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) \ … … 650 594 651 595 DELEGATE_TO_IMPL_1(activeTexture, unsigned long) 652 DELEGATE_TO_IMPL_2_X12(attachShader, WebGLProgram*, WebGLShader*) 653 654 void GraphicsContext3DInternal::bindAttribLocation(WebGLProgram* program, unsigned long index, const String& name) 655 { 656 m_impl->bindAttribLocation(EXTRACT(program), index, name.utf8().data()); 657 } 658 659 DELEGATE_TO_IMPL_2_X2(bindBuffer, unsigned long, WebGLBuffer*) 660 DELEGATE_TO_IMPL_2_X2(bindFramebuffer, unsigned long, WebGLFramebuffer*) 661 DELEGATE_TO_IMPL_2_X2(bindRenderbuffer, unsigned long, WebGLRenderbuffer*) 662 663 static const int kTextureWrapR = 0x8072; 664 665 // If we didn't have to hack GL_TEXTURE_WRAP_R for cube maps, 666 // we could just use: 667 // DELEGATE_TO_IMPL_2_X2(bindTexture, unsigned long, WebGLTexture*) 668 void GraphicsContext3DInternal::bindTexture(unsigned long target, 669 WebGLTexture* texture) 670 { 671 unsigned int textureObject = EXTRACT(texture); 672 673 m_impl->bindTexture(target, textureObject); 674 675 // FIXME: GL_TEXTURE_WRAP_R isn't exposed in the OpenGL ES 2.0 676 // API. On desktop OpenGL implementations it seems necessary to 677 // set this wrap mode to GL_CLAMP_TO_EDGE to get correct behavior 678 // of cube maps. 679 if (texture) 680 if (target == GraphicsContext3D::TEXTURE_CUBE_MAP) { 681 if (!texture->isCubeMapRWrapModeInitialized()) { 682 m_impl->texParameteri(GraphicsContext3D::TEXTURE_CUBE_MAP, kTextureWrapR, GraphicsContext3D::CLAMP_TO_EDGE); 683 texture->setCubeMapRWrapModeInitialized(true); 684 } 685 } else 686 texture->setCubeMapRWrapModeInitialized(false); 687 } 688 596 DELEGATE_TO_IMPL_2(attachShader, Platform3DObject, Platform3DObject) 597 598 void GraphicsContext3DInternal::bindAttribLocation(Platform3DObject program, unsigned long index, const String& name) 599 { 600 m_impl->bindAttribLocation(program, index, name.utf8().data()); 601 } 602 603 DELEGATE_TO_IMPL_2(bindBuffer, unsigned long, Platform3DObject) 604 DELEGATE_TO_IMPL_2(bindFramebuffer, unsigned long, Platform3DObject) 605 DELEGATE_TO_IMPL_2(bindRenderbuffer, unsigned long, Platform3DObject) 606 DELEGATE_TO_IMPL_2(bindTexture, unsigned long, Platform3DObject) 689 607 DELEGATE_TO_IMPL_4(blendColor, double, double, double, double) 690 608 DELEGATE_TO_IMPL_1(blendEquation, unsigned long) … … 724 642 DELEGATE_TO_IMPL_1(clearStencil, long) 725 643 DELEGATE_TO_IMPL_4(colorMask, bool, bool, bool, bool) 726 DELEGATE_TO_IMPL_1 _X(compileShader, WebGLShader*)644 DELEGATE_TO_IMPL_1(compileShader, Platform3DObject) 727 645 728 646 DELEGATE_TO_IMPL_8(copyTexImage2D, unsigned long, long, unsigned long, long, long, unsigned long, unsigned long, long) … … 732 650 DELEGATE_TO_IMPL_1(depthMask, bool) 733 651 DELEGATE_TO_IMPL_2(depthRange, double, double) 734 DELEGATE_TO_IMPL_2 _X12(detachShader, WebGLProgram*, WebGLShader*)652 DELEGATE_TO_IMPL_2(detachShader, Platform3DObject, Platform3DObject) 735 653 DELEGATE_TO_IMPL_1(disable, unsigned long) 736 654 DELEGATE_TO_IMPL_1(disableVertexAttribArray, unsigned long) … … 742 660 DELEGATE_TO_IMPL(finish) 743 661 DELEGATE_TO_IMPL(flush) 744 DELEGATE_TO_IMPL_4 _X4(framebufferRenderbuffer, unsigned long, unsigned long, unsigned long, WebGLRenderbuffer*)745 DELEGATE_TO_IMPL_5 _X4(framebufferTexture2D, unsigned long, unsigned long, unsigned long, WebGLTexture*, long)662 DELEGATE_TO_IMPL_4(framebufferRenderbuffer, unsigned long, unsigned long, unsigned long, Platform3DObject) 663 DELEGATE_TO_IMPL_5(framebufferTexture2D, unsigned long, unsigned long, unsigned long, Platform3DObject, long) 746 664 DELEGATE_TO_IMPL_1(frontFace, unsigned long) 747 665 DELEGATE_TO_IMPL_1(generateMipmap, unsigned long) 748 666 749 bool GraphicsContext3DInternal::getActiveAttrib( WebGLProgram*program, unsigned long index, ActiveInfo& info)667 bool GraphicsContext3DInternal::getActiveAttrib(Platform3DObject program, unsigned long index, ActiveInfo& info) 750 668 { 751 669 WebKit::WebGraphicsContext3D::ActiveInfo webInfo; 752 if (!m_impl->getActiveAttrib( EXTRACT(program), index, webInfo))670 if (!m_impl->getActiveAttrib(program, index, webInfo)) 753 671 return false; 754 672 info.name = webInfo.name; … … 758 676 } 759 677 760 bool GraphicsContext3DInternal::getActiveUniform( WebGLProgram*program, unsigned long index, ActiveInfo& info)678 bool GraphicsContext3DInternal::getActiveUniform(Platform3DObject program, unsigned long index, ActiveInfo& info) 761 679 { 762 680 WebKit::WebGraphicsContext3D::ActiveInfo webInfo; 763 if (!m_impl->getActiveUniform( EXTRACT(program), index, webInfo))681 if (!m_impl->getActiveUniform(program, index, webInfo)) 764 682 return false; 765 683 info.name = webInfo.name; … … 769 687 } 770 688 771 DELEGATE_TO_IMPL_4 _X1(getAttachedShaders, WebGLProgram*, int, int*, unsigned int*)772 773 int GraphicsContext3DInternal::getAttribLocation( WebGLProgram*program, const String& name)774 { 775 return m_impl->getAttribLocation( EXTRACT(program), name.utf8().data());689 DELEGATE_TO_IMPL_4(getAttachedShaders, Platform3DObject, int, int*, unsigned int*) 690 691 int GraphicsContext3DInternal::getAttribLocation(Platform3DObject program, const String& name) 692 { 693 return m_impl->getAttribLocation(program, name.utf8().data()); 776 694 } 777 695 … … 800 718 DELEGATE_TO_IMPL_2(getIntegerv, unsigned long, int*) 801 719 802 DELEGATE_TO_IMPL_3 _X1(getProgramiv, WebGLProgram*, unsigned long, int*)803 804 String GraphicsContext3DInternal::getProgramInfoLog( WebGLProgram*program)805 { 806 return m_impl->getProgramInfoLog( EXTRACT(program));720 DELEGATE_TO_IMPL_3(getProgramiv, Platform3DObject, unsigned long, int*) 721 722 String GraphicsContext3DInternal::getProgramInfoLog(Platform3DObject program) 723 { 724 return m_impl->getProgramInfoLog(program); 807 725 } 808 726 809 727 DELEGATE_TO_IMPL_3(getRenderbufferParameteriv, unsigned long, unsigned long, int*) 810 728 811 DELEGATE_TO_IMPL_3 _X1(getShaderiv, WebGLShader*, unsigned long, int*)812 813 String GraphicsContext3DInternal::getShaderInfoLog( WebGLShader*shader)814 { 815 return m_impl->getShaderInfoLog( EXTRACT(shader));816 } 817 818 String GraphicsContext3DInternal::getShaderSource( WebGLShader*shader)819 { 820 return m_impl->getShaderSource( EXTRACT(shader));729 DELEGATE_TO_IMPL_3(getShaderiv, Platform3DObject, unsigned long, int*) 730 731 String GraphicsContext3DInternal::getShaderInfoLog(Platform3DObject shader) 732 { 733 return m_impl->getShaderInfoLog(shader); 734 } 735 736 String GraphicsContext3DInternal::getShaderSource(Platform3DObject shader) 737 { 738 return m_impl->getShaderSource(shader); 821 739 } 822 740 … … 829 747 DELEGATE_TO_IMPL_3(getTexParameteriv, unsigned long, unsigned long, int*) 830 748 831 DELEGATE_TO_IMPL_3 _X1(getUniformfv, WebGLProgram*, long, float*)832 DELEGATE_TO_IMPL_3 _X1(getUniformiv, WebGLProgram*, long, int*)833 834 long GraphicsContext3DInternal::getUniformLocation( WebGLProgram*program, const String& name)835 { 836 return m_impl->getUniformLocation( EXTRACT(program), name.utf8().data());749 DELEGATE_TO_IMPL_3(getUniformfv, Platform3DObject, long, float*) 750 DELEGATE_TO_IMPL_3(getUniformiv, Platform3DObject, long, int*) 751 752 long GraphicsContext3DInternal::getUniformLocation(Platform3DObject program, const String& name) 753 { 754 return m_impl->getUniformLocation(program, name.utf8().data()); 837 755 } 838 756 … … 843 761 844 762 DELEGATE_TO_IMPL_2(hint, unsigned long, unsigned long) 845 DELEGATE_TO_IMPL_1R _X(isBuffer, WebGLBuffer*, bool)763 DELEGATE_TO_IMPL_1R(isBuffer, Platform3DObject, bool) 846 764 DELEGATE_TO_IMPL_1R(isEnabled, unsigned long, bool) 847 DELEGATE_TO_IMPL_1R _X(isFramebuffer, WebGLFramebuffer*, bool)848 DELEGATE_TO_IMPL_1R _X(isProgram, WebGLProgram*, bool)849 DELEGATE_TO_IMPL_1R _X(isRenderbuffer, WebGLRenderbuffer*, bool)850 DELEGATE_TO_IMPL_1R _X(isShader, WebGLShader*, bool)851 DELEGATE_TO_IMPL_1R _X(isTexture, WebGLTexture*, bool)765 DELEGATE_TO_IMPL_1R(isFramebuffer, Platform3DObject, bool) 766 DELEGATE_TO_IMPL_1R(isProgram, Platform3DObject, bool) 767 DELEGATE_TO_IMPL_1R(isRenderbuffer, Platform3DObject, bool) 768 DELEGATE_TO_IMPL_1R(isShader, Platform3DObject, bool) 769 DELEGATE_TO_IMPL_1R(isTexture, Platform3DObject, bool) 852 770 DELEGATE_TO_IMPL_1(lineWidth, double) 853 DELEGATE_TO_IMPL_1 _X(linkProgram, WebGLProgram*)771 DELEGATE_TO_IMPL_1(linkProgram, Platform3DObject) 854 772 DELEGATE_TO_IMPL_2(pixelStorei, unsigned long, long) 855 773 DELEGATE_TO_IMPL_2(polygonOffset, double, double) … … 860 778 DELEGATE_TO_IMPL_4(scissor, long, long, unsigned long, unsigned long) 861 779 862 void GraphicsContext3DInternal::shaderSource( WebGLShader*shader, const String& string)863 { 864 m_impl->shaderSource( EXTRACT(shader), string.utf8().data());780 void GraphicsContext3DInternal::shaderSource(Platform3DObject shader, const String& string) 781 { 782 m_impl->shaderSource(shader, string.utf8().data()); 865 783 } 866 784 … … 958 876 } 959 877 960 DELEGATE_TO_IMPL_1 _X(useProgram, WebGLProgram*)961 DELEGATE_TO_IMPL_1 _X(validateProgram, WebGLProgram*)878 DELEGATE_TO_IMPL_1(useProgram, Platform3DObject) 879 DELEGATE_TO_IMPL_1(validateProgram, Platform3DObject) 962 880 963 881 DELEGATE_TO_IMPL_2(vertexAttrib1f, unsigned long, float) … … 1141 1059 1142 1060 DELEGATE_TO_INTERNAL_1(activeTexture, unsigned long) 1143 DELEGATE_TO_INTERNAL_2(attachShader, WebGLProgram*, WebGLShader*)1144 DELEGATE_TO_INTERNAL_3(bindAttribLocation, WebGLProgram*, unsigned long, const String&)1145 1146 DELEGATE_TO_INTERNAL_2(bindBuffer, unsigned long, WebGLBuffer*)1147 DELEGATE_TO_INTERNAL_2(bindFramebuffer, unsigned long, WebGLFramebuffer*)1148 DELEGATE_TO_INTERNAL_2(bindRenderbuffer, unsigned long, WebGLRenderbuffer*)1149 DELEGATE_TO_INTERNAL_2(bindTexture, unsigned long, WebGLTexture*)1061 DELEGATE_TO_INTERNAL_2(attachShader, Platform3DObject, Platform3DObject) 1062 DELEGATE_TO_INTERNAL_3(bindAttribLocation, Platform3DObject, unsigned long, const String&) 1063 1064 DELEGATE_TO_INTERNAL_2(bindBuffer, unsigned long, Platform3DObject) 1065 DELEGATE_TO_INTERNAL_2(bindFramebuffer, unsigned long, Platform3DObject) 1066 DELEGATE_TO_INTERNAL_2(bindRenderbuffer, unsigned long, Platform3DObject) 1067 DELEGATE_TO_INTERNAL_2(bindTexture, unsigned long, Platform3DObject) 1150 1068 DELEGATE_TO_INTERNAL_4(blendColor, double, double, double, double) 1151 1069 DELEGATE_TO_INTERNAL_1(blendEquation, unsigned long) … … 1166 1084 DELEGATE_TO_INTERNAL_1(clearStencil, long) 1167 1085 DELEGATE_TO_INTERNAL_4(colorMask, bool, bool, bool, bool) 1168 DELEGATE_TO_INTERNAL_1(compileShader, WebGLShader*)1086 DELEGATE_TO_INTERNAL_1(compileShader, Platform3DObject) 1169 1087 1170 1088 DELEGATE_TO_INTERNAL_8(copyTexImage2D, unsigned long, long, unsigned long, long, long, unsigned long, unsigned long, long) … … 1174 1092 DELEGATE_TO_INTERNAL_1(depthMask, bool) 1175 1093 DELEGATE_TO_INTERNAL_2(depthRange, double, double) 1176 DELEGATE_TO_INTERNAL_2(detachShader, WebGLProgram*, WebGLShader*)1094 DELEGATE_TO_INTERNAL_2(detachShader, Platform3DObject, Platform3DObject) 1177 1095 DELEGATE_TO_INTERNAL_1(disable, unsigned long) 1178 1096 DELEGATE_TO_INTERNAL_1(disableVertexAttribArray, unsigned long) … … 1184 1102 DELEGATE_TO_INTERNAL(finish) 1185 1103 DELEGATE_TO_INTERNAL(flush) 1186 DELEGATE_TO_INTERNAL_4(framebufferRenderbuffer, unsigned long, unsigned long, unsigned long, WebGLRenderbuffer*)1187 DELEGATE_TO_INTERNAL_5(framebufferTexture2D, unsigned long, unsigned long, unsigned long, WebGLTexture*, long)1104 DELEGATE_TO_INTERNAL_4(framebufferRenderbuffer, unsigned long, unsigned long, unsigned long, Platform3DObject) 1105 DELEGATE_TO_INTERNAL_5(framebufferTexture2D, unsigned long, unsigned long, unsigned long, Platform3DObject, long) 1188 1106 DELEGATE_TO_INTERNAL_1(frontFace, unsigned long) 1189 1107 DELEGATE_TO_INTERNAL_1(generateMipmap, unsigned long) 1190 1108 1191 DELEGATE_TO_INTERNAL_3R(getActiveAttrib, WebGLProgram*, unsigned long, ActiveInfo&, bool)1192 DELEGATE_TO_INTERNAL_3R(getActiveUniform, WebGLProgram*, unsigned long, ActiveInfo&, bool)1193 1194 DELEGATE_TO_INTERNAL_4(getAttachedShaders, WebGLProgram*, int, int*, unsigned int*)1195 1196 DELEGATE_TO_INTERNAL_2R(getAttribLocation, WebGLProgram*, const String&, int)1109 DELEGATE_TO_INTERNAL_3R(getActiveAttrib, Platform3DObject, unsigned long, ActiveInfo&, bool) 1110 DELEGATE_TO_INTERNAL_3R(getActiveUniform, Platform3DObject, unsigned long, ActiveInfo&, bool) 1111 1112 DELEGATE_TO_INTERNAL_4(getAttachedShaders, Platform3DObject, int, int*, unsigned int*) 1113 1114 DELEGATE_TO_INTERNAL_2R(getAttribLocation, Platform3DObject, const String&, int) 1197 1115 1198 1116 DELEGATE_TO_INTERNAL_2(getBooleanv, unsigned long, unsigned char*) … … 1210 1128 DELEGATE_TO_INTERNAL_2(getIntegerv, unsigned long, int*) 1211 1129 1212 DELEGATE_TO_INTERNAL_3(getProgramiv, WebGLProgram*, unsigned long, int*)1213 1214 DELEGATE_TO_INTERNAL_1R(getProgramInfoLog, WebGLProgram*, String)1130 DELEGATE_TO_INTERNAL_3(getProgramiv, Platform3DObject, unsigned long, int*) 1131 1132 DELEGATE_TO_INTERNAL_1R(getProgramInfoLog, Platform3DObject, String) 1215 1133 1216 1134 DELEGATE_TO_INTERNAL_3(getRenderbufferParameteriv, unsigned long, unsigned long, int*) 1217 1135 1218 DELEGATE_TO_INTERNAL_3(getShaderiv, WebGLShader*, unsigned long, int*)1219 1220 DELEGATE_TO_INTERNAL_1R(getShaderInfoLog, WebGLShader*, String)1221 1222 DELEGATE_TO_INTERNAL_1R(getShaderSource, WebGLShader*, String)1136 DELEGATE_TO_INTERNAL_3(getShaderiv, Platform3DObject, unsigned long, int*) 1137 1138 DELEGATE_TO_INTERNAL_1R(getShaderInfoLog, Platform3DObject, String) 1139 1140 DELEGATE_TO_INTERNAL_1R(getShaderSource, Platform3DObject, String) 1223 1141 DELEGATE_TO_INTERNAL_1R(getString, unsigned long, String) 1224 1142 … … 1226 1144 DELEGATE_TO_INTERNAL_3(getTexParameteriv, unsigned long, unsigned long, int*) 1227 1145 1228 DELEGATE_TO_INTERNAL_3(getUniformfv, WebGLProgram*, long, float*)1229 DELEGATE_TO_INTERNAL_3(getUniformiv, WebGLProgram*, long, int*)1230 1231 DELEGATE_TO_INTERNAL_2R(getUniformLocation, WebGLProgram*, const String&, long)1146 DELEGATE_TO_INTERNAL_3(getUniformfv, Platform3DObject, long, float*) 1147 DELEGATE_TO_INTERNAL_3(getUniformiv, Platform3DObject, long, int*) 1148 1149 DELEGATE_TO_INTERNAL_2R(getUniformLocation, Platform3DObject, const String&, long) 1232 1150 1233 1151 DELEGATE_TO_INTERNAL_3(getVertexAttribfv, unsigned long, unsigned long, float*) … … 1237 1155 1238 1156 DELEGATE_TO_INTERNAL_2(hint, unsigned long, unsigned long) 1239 DELEGATE_TO_INTERNAL_1R(isBuffer, WebGLBuffer*, bool)1157 DELEGATE_TO_INTERNAL_1R(isBuffer, Platform3DObject, bool) 1240 1158 DELEGATE_TO_INTERNAL_1R(isEnabled, unsigned long, bool) 1241 DELEGATE_TO_INTERNAL_1R(isFramebuffer, WebGLFramebuffer*, bool)1242 DELEGATE_TO_INTERNAL_1R(isProgram, WebGLProgram*, bool)1243 DELEGATE_TO_INTERNAL_1R(isRenderbuffer, WebGLRenderbuffer*, bool)1244 DELEGATE_TO_INTERNAL_1R(isShader, WebGLShader*, bool)1245 DELEGATE_TO_INTERNAL_1R(isTexture, WebGLTexture*, bool)1159 DELEGATE_TO_INTERNAL_1R(isFramebuffer, Platform3DObject, bool) 1160 DELEGATE_TO_INTERNAL_1R(isProgram, Platform3DObject, bool) 1161 DELEGATE_TO_INTERNAL_1R(isRenderbuffer, Platform3DObject, bool) 1162 DELEGATE_TO_INTERNAL_1R(isShader, Platform3DObject, bool) 1163 DELEGATE_TO_INTERNAL_1R(isTexture, Platform3DObject, bool) 1246 1164 DELEGATE_TO_INTERNAL_1(lineWidth, double) 1247 DELEGATE_TO_INTERNAL_1(linkProgram, WebGLProgram*)1165 DELEGATE_TO_INTERNAL_1(linkProgram, Platform3DObject) 1248 1166 DELEGATE_TO_INTERNAL_2(pixelStorei, unsigned long, long) 1249 1167 DELEGATE_TO_INTERNAL_2(polygonOffset, double, double) … … 1255 1173 DELEGATE_TO_INTERNAL_2(sampleCoverage, double, bool) 1256 1174 DELEGATE_TO_INTERNAL_4(scissor, long, long, unsigned long, unsigned long) 1257 DELEGATE_TO_INTERNAL_2(shaderSource, WebGLShader*, const String&)1175 DELEGATE_TO_INTERNAL_2(shaderSource, Platform3DObject, const String&) 1258 1176 DELEGATE_TO_INTERNAL_3(stencilFunc, unsigned long, long, unsigned long) 1259 1177 DELEGATE_TO_INTERNAL_4(stencilFuncSeparate, unsigned long, unsigned long, long, unsigned long) … … 1288 1206 DELEGATE_TO_INTERNAL_4(uniformMatrix4fv, long, bool, float*, int) 1289 1207 1290 DELEGATE_TO_INTERNAL_1(useProgram, WebGLProgram*)1291 DELEGATE_TO_INTERNAL_1(validateProgram, WebGLProgram*)1208 DELEGATE_TO_INTERNAL_1(useProgram, Platform3DObject) 1209 DELEGATE_TO_INTERNAL_1(validateProgram, Platform3DObject) 1292 1210 1293 1211 DELEGATE_TO_INTERNAL_2(vertexAttrib1f, unsigned long, float) … … 1303 1221 DELEGATE_TO_INTERNAL_4(viewport, long, long, unsigned long, unsigned long) 1304 1222 1305 DELEGATE_TO_INTERNAL_1(paintRenderingResultsToCanvas, WebGLRenderingContext*)1306 DELEGATE_TO_INTERNAL_1(beginPaint, WebGLRenderingContext*)1223 DELEGATE_TO_INTERNAL_1(paintRenderingResultsToCanvas, CanvasRenderingContext*) 1224 DELEGATE_TO_INTERNAL_1(beginPaint, CanvasRenderingContext*) 1307 1225 DELEGATE_TO_INTERNAL(endPaint) 1308 1226
Note: See TracChangeset
for help on using the changeset viewer.