| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "modules/webgl/WebGL2RenderingContextBase.h" | 6 #include "modules/webgl/WebGL2RenderingContextBase.h" |
| 7 | 7 |
| 8 #include "bindings/modules/v8/WebGLAny.h" | 8 #include "bindings/modules/v8/WebGLAny.h" |
| 9 #include "core/html/HTMLCanvasElement.h" | 9 #include "core/html/HTMLCanvasElement.h" |
| 10 #include "core/html/HTMLImageElement.h" | 10 #include "core/html/HTMLImageElement.h" |
| (...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1114 } | 1114 } |
| 1115 | 1115 |
| 1116 void WebGL2RenderingContextBase::clearBufferfi(GLenum buffer, GLint drawbuffer,
GLfloat depth, GLint stencil) | 1116 void WebGL2RenderingContextBase::clearBufferfi(GLenum buffer, GLint drawbuffer,
GLfloat depth, GLint stencil) |
| 1117 { | 1117 { |
| 1118 if (isContextLost()) | 1118 if (isContextLost()) |
| 1119 return; | 1119 return; |
| 1120 | 1120 |
| 1121 webContext()->clearBufferfi(buffer, drawbuffer, depth, stencil); | 1121 webContext()->clearBufferfi(buffer, drawbuffer, depth, stencil); |
| 1122 } | 1122 } |
| 1123 | 1123 |
| 1124 PassRefPtrWillBeRawPtr<WebGLQuery> WebGL2RenderingContextBase::createQuery() | 1124 WebGLQuery* WebGL2RenderingContextBase::createQuery() |
| 1125 { | 1125 { |
| 1126 if (isContextLost()) | 1126 if (isContextLost()) |
| 1127 return nullptr; | 1127 return nullptr; |
| 1128 RefPtrWillBeRawPtr<WebGLQuery> o = WebGLQuery::create(this); | 1128 WebGLQuery* o = WebGLQuery::create(this); |
| 1129 addSharedObject(o.get()); | 1129 addSharedObject(o); |
| 1130 return o; | 1130 return o; |
| 1131 } | 1131 } |
| 1132 | 1132 |
| 1133 void WebGL2RenderingContextBase::deleteQuery(WebGLQuery* query) | 1133 void WebGL2RenderingContextBase::deleteQuery(WebGLQuery* query) |
| 1134 { | 1134 { |
| 1135 if (m_currentBooleanOcclusionQuery == query) { | 1135 if (m_currentBooleanOcclusionQuery == query) { |
| 1136 webContext()->endQueryEXT(m_currentBooleanOcclusionQuery->getTarget()); | 1136 webContext()->endQueryEXT(m_currentBooleanOcclusionQuery->getTarget()); |
| 1137 m_currentBooleanOcclusionQuery = nullptr; | 1137 m_currentBooleanOcclusionQuery = nullptr; |
| 1138 } | 1138 } |
| 1139 | 1139 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1227 } | 1227 } |
| 1228 break; | 1228 break; |
| 1229 default: | 1229 default: |
| 1230 synthesizeGLError(GL_INVALID_ENUM, "endQuery", "invalid target"); | 1230 synthesizeGLError(GL_INVALID_ENUM, "endQuery", "invalid target"); |
| 1231 return; | 1231 return; |
| 1232 } | 1232 } |
| 1233 | 1233 |
| 1234 webContext()->endQueryEXT(target); | 1234 webContext()->endQueryEXT(target); |
| 1235 } | 1235 } |
| 1236 | 1236 |
| 1237 PassRefPtrWillBeRawPtr<WebGLQuery> WebGL2RenderingContextBase::getQuery(GLenum t
arget, GLenum pname) | 1237 WebGLQuery* WebGL2RenderingContextBase::getQuery(GLenum target, GLenum pname) |
| 1238 { | 1238 { |
| 1239 if (isContextLost()) | 1239 if (isContextLost()) |
| 1240 return nullptr; | 1240 return nullptr; |
| 1241 | 1241 |
| 1242 if (pname != GL_CURRENT_QUERY) { | 1242 if (pname != GL_CURRENT_QUERY) { |
| 1243 synthesizeGLError(GL_INVALID_ENUM, "getQuery", "invalid parameter name")
; | 1243 synthesizeGLError(GL_INVALID_ENUM, "getQuery", "invalid parameter name")
; |
| 1244 return nullptr; | 1244 return nullptr; |
| 1245 } | 1245 } |
| 1246 | 1246 |
| 1247 switch (target) { | 1247 switch (target) { |
| 1248 case GL_ANY_SAMPLES_PASSED: | 1248 case GL_ANY_SAMPLES_PASSED: |
| 1249 case GL_ANY_SAMPLES_PASSED_CONSERVATIVE: | 1249 case GL_ANY_SAMPLES_PASSED_CONSERVATIVE: |
| 1250 if (m_currentBooleanOcclusionQuery && m_currentBooleanOcclusionQuery->ge
tTarget() == target) | 1250 if (m_currentBooleanOcclusionQuery && m_currentBooleanOcclusionQuery->ge
tTarget() == target) |
| 1251 return PassRefPtrWillBeRawPtr<WebGLQuery>(m_currentBooleanOcclusionQ
uery.get()); | 1251 return m_currentBooleanOcclusionQuery; |
| 1252 break; | 1252 break; |
| 1253 case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: | 1253 case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: |
| 1254 return PassRefPtrWillBeRawPtr<WebGLQuery>(m_currentTransformFeedbackPrim
itivesWrittenQuery.get()); | 1254 return m_currentTransformFeedbackPrimitivesWrittenQuery; |
| 1255 default: | 1255 default: |
| 1256 synthesizeGLError(GL_INVALID_ENUM, "getQuery", "invalid target"); | 1256 synthesizeGLError(GL_INVALID_ENUM, "getQuery", "invalid target"); |
| 1257 return nullptr; | 1257 return nullptr; |
| 1258 } | 1258 } |
| 1259 return nullptr; | 1259 return nullptr; |
| 1260 } | 1260 } |
| 1261 | 1261 |
| 1262 ScriptValue WebGL2RenderingContextBase::getQueryParameter(ScriptState* scriptSta
te, WebGLQuery* query, GLenum pname) | 1262 ScriptValue WebGL2RenderingContextBase::getQueryParameter(ScriptState* scriptSta
te, WebGLQuery* query, GLenum pname) |
| 1263 { | 1263 { |
| 1264 if (isContextLost() || !validateWebGLObject("getQueryParameter", query)) | 1264 if (isContextLost() || !validateWebGLObject("getQueryParameter", query)) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1276 GLuint value; | 1276 GLuint value; |
| 1277 webContext()->getQueryObjectuivEXT(objectOrZero(query), pname, &valu
e); | 1277 webContext()->getQueryObjectuivEXT(objectOrZero(query), pname, &valu
e); |
| 1278 return WebGLAny(scriptState, value == GL_TRUE); | 1278 return WebGLAny(scriptState, value == GL_TRUE); |
| 1279 } | 1279 } |
| 1280 default: | 1280 default: |
| 1281 synthesizeGLError(GL_INVALID_ENUM, "getQueryParameter", "invalid paramet
er name"); | 1281 synthesizeGLError(GL_INVALID_ENUM, "getQueryParameter", "invalid paramet
er name"); |
| 1282 return ScriptValue::createNull(scriptState); | 1282 return ScriptValue::createNull(scriptState); |
| 1283 } | 1283 } |
| 1284 } | 1284 } |
| 1285 | 1285 |
| 1286 PassRefPtrWillBeRawPtr<WebGLSampler> WebGL2RenderingContextBase::createSampler() | 1286 WebGLSampler* WebGL2RenderingContextBase::createSampler() |
| 1287 { | 1287 { |
| 1288 if (isContextLost()) | 1288 if (isContextLost()) |
| 1289 return nullptr; | 1289 return nullptr; |
| 1290 RefPtrWillBeRawPtr<WebGLSampler> o = WebGLSampler::create(this); | 1290 WebGLSampler* o = WebGLSampler::create(this); |
| 1291 addSharedObject(o.get()); | 1291 addSharedObject(o); |
| 1292 return o; | 1292 return o; |
| 1293 } | 1293 } |
| 1294 | 1294 |
| 1295 void WebGL2RenderingContextBase::deleteSampler(WebGLSampler* sampler) | 1295 void WebGL2RenderingContextBase::deleteSampler(WebGLSampler* sampler) |
| 1296 { | 1296 { |
| 1297 for (size_t i = 0; i < m_samplerUnits.size(); ++i) { | 1297 for (size_t i = 0; i < m_samplerUnits.size(); ++i) { |
| 1298 if (sampler == m_samplerUnits[i]) { | 1298 if (sampler == m_samplerUnits[i]) { |
| 1299 m_samplerUnits[i] = nullptr; | 1299 m_samplerUnits[i] = nullptr; |
| 1300 webContext()->bindSampler(i, 0); | 1300 webContext()->bindSampler(i, 0); |
| 1301 } | 1301 } |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1372 GLfloat value = 0.f; | 1372 GLfloat value = 0.f; |
| 1373 webContext()->getSamplerParameterfv(objectOrZero(sampler), pname, &v
alue); | 1373 webContext()->getSamplerParameterfv(objectOrZero(sampler), pname, &v
alue); |
| 1374 return WebGLAny(scriptState, value); | 1374 return WebGLAny(scriptState, value); |
| 1375 } | 1375 } |
| 1376 default: | 1376 default: |
| 1377 synthesizeGLError(GL_INVALID_ENUM, "getSamplerParameter", "invalid param
eter name"); | 1377 synthesizeGLError(GL_INVALID_ENUM, "getSamplerParameter", "invalid param
eter name"); |
| 1378 return ScriptValue::createNull(scriptState); | 1378 return ScriptValue::createNull(scriptState); |
| 1379 } | 1379 } |
| 1380 } | 1380 } |
| 1381 | 1381 |
| 1382 PassRefPtrWillBeRawPtr<WebGLSync> WebGL2RenderingContextBase::fenceSync(GLenum c
ondition, GLbitfield flags) | 1382 WebGLSync* WebGL2RenderingContextBase::fenceSync(GLenum condition, GLbitfield fl
ags) |
| 1383 { | 1383 { |
| 1384 if (isContextLost()) | 1384 if (isContextLost()) |
| 1385 return nullptr; | 1385 return nullptr; |
| 1386 | 1386 |
| 1387 RefPtrWillBeRawPtr<WebGLSync> o = WebGLFenceSync::create(this, condition, fl
ags); | 1387 WebGLSync* o = WebGLFenceSync::create(this, condition, flags); |
| 1388 addSharedObject(o.get()); | 1388 addSharedObject(o); |
| 1389 return o.release(); | 1389 return o; |
| 1390 } | 1390 } |
| 1391 | 1391 |
| 1392 GLboolean WebGL2RenderingContextBase::isSync(WebGLSync* sync) | 1392 GLboolean WebGL2RenderingContextBase::isSync(WebGLSync* sync) |
| 1393 { | 1393 { |
| 1394 if (isContextLost() || !sync) | 1394 if (isContextLost() || !sync) |
| 1395 return 0; | 1395 return 0; |
| 1396 | 1396 |
| 1397 return webContext()->isSync(sync->object()); | 1397 return webContext()->isSync(sync->object()); |
| 1398 } | 1398 } |
| 1399 | 1399 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1445 GLsizei length = -1; | 1445 GLsizei length = -1; |
| 1446 webContext()->getSynciv(syncObjectOrZero(sync), pname, 1, &length, &
value); | 1446 webContext()->getSynciv(syncObjectOrZero(sync), pname, 1, &length, &
value); |
| 1447 return WebGLAny(scriptState, static_cast<unsigned>(value)); | 1447 return WebGLAny(scriptState, static_cast<unsigned>(value)); |
| 1448 } | 1448 } |
| 1449 default: | 1449 default: |
| 1450 synthesizeGLError(GL_INVALID_ENUM, "getSyncParameter", "invalid paramete
r name"); | 1450 synthesizeGLError(GL_INVALID_ENUM, "getSyncParameter", "invalid paramete
r name"); |
| 1451 return ScriptValue::createNull(scriptState); | 1451 return ScriptValue::createNull(scriptState); |
| 1452 } | 1452 } |
| 1453 } | 1453 } |
| 1454 | 1454 |
| 1455 PassRefPtrWillBeRawPtr<WebGLTransformFeedback> WebGL2RenderingContextBase::creat
eTransformFeedback() | 1455 WebGLTransformFeedback* WebGL2RenderingContextBase::createTransformFeedback() |
| 1456 { | 1456 { |
| 1457 if (isContextLost()) | 1457 if (isContextLost()) |
| 1458 return nullptr; | 1458 return nullptr; |
| 1459 RefPtrWillBeRawPtr<WebGLTransformFeedback> o = WebGLTransformFeedback::creat
e(this); | 1459 WebGLTransformFeedback* o = WebGLTransformFeedback::create(this); |
| 1460 addSharedObject(o.get()); | 1460 addSharedObject(o); |
| 1461 return o; | 1461 return o; |
| 1462 } | 1462 } |
| 1463 | 1463 |
| 1464 void WebGL2RenderingContextBase::deleteTransformFeedback(WebGLTransformFeedback*
feedback) | 1464 void WebGL2RenderingContextBase::deleteTransformFeedback(WebGLTransformFeedback*
feedback) |
| 1465 { | 1465 { |
| 1466 if (feedback == m_transformFeedbackBinding) | 1466 if (feedback == m_transformFeedbackBinding) |
| 1467 m_transformFeedbackBinding = nullptr; | 1467 m_transformFeedbackBinding = nullptr; |
| 1468 | 1468 |
| 1469 deleteObject(feedback); | 1469 deleteObject(feedback); |
| 1470 } | 1470 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1526 Vector<CString> keepAlive; // Must keep these instances alive while looking
at their data | 1526 Vector<CString> keepAlive; // Must keep these instances alive while looking
at their data |
| 1527 Vector<const char*> varyingStrings; | 1527 Vector<const char*> varyingStrings; |
| 1528 for (size_t i = 0; i < varyings.size(); ++i) { | 1528 for (size_t i = 0; i < varyings.size(); ++i) { |
| 1529 keepAlive.append(varyings[i].ascii()); | 1529 keepAlive.append(varyings[i].ascii()); |
| 1530 varyingStrings.append(keepAlive.last().data()); | 1530 varyingStrings.append(keepAlive.last().data()); |
| 1531 } | 1531 } |
| 1532 | 1532 |
| 1533 webContext()->transformFeedbackVaryings(objectOrZero(program), varyings.size
(), varyingStrings.data(), bufferMode); | 1533 webContext()->transformFeedbackVaryings(objectOrZero(program), varyings.size
(), varyingStrings.data(), bufferMode); |
| 1534 } | 1534 } |
| 1535 | 1535 |
| 1536 PassRefPtrWillBeRawPtr<WebGLActiveInfo> WebGL2RenderingContextBase::getTransform
FeedbackVarying(WebGLProgram* program, GLuint index) | 1536 WebGLActiveInfo* WebGL2RenderingContextBase::getTransformFeedbackVarying(WebGLPr
ogram* program, GLuint index) |
| 1537 { | 1537 { |
| 1538 if (isContextLost() || !validateWebGLObject("getTransformFeedbackVarying", p
rogram)) | 1538 if (isContextLost() || !validateWebGLObject("getTransformFeedbackVarying", p
rogram)) |
| 1539 return nullptr; | 1539 return nullptr; |
| 1540 | 1540 |
| 1541 notImplemented(); | 1541 notImplemented(); |
| 1542 return nullptr; | 1542 return nullptr; |
| 1543 } | 1543 } |
| 1544 | 1544 |
| 1545 void WebGL2RenderingContextBase::pauseTransformFeedback() | 1545 void WebGL2RenderingContextBase::pauseTransformFeedback() |
| 1546 { | 1546 { |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1703 } | 1703 } |
| 1704 | 1704 |
| 1705 void WebGL2RenderingContextBase::uniformBlockBinding(WebGLProgram* program, GLui
nt uniformBlockIndex, GLuint uniformBlockBinding) | 1705 void WebGL2RenderingContextBase::uniformBlockBinding(WebGLProgram* program, GLui
nt uniformBlockIndex, GLuint uniformBlockBinding) |
| 1706 { | 1706 { |
| 1707 if (isContextLost() || !validateWebGLObject("uniformBlockBinding", program)) | 1707 if (isContextLost() || !validateWebGLObject("uniformBlockBinding", program)) |
| 1708 return; | 1708 return; |
| 1709 | 1709 |
| 1710 webContext()->uniformBlockBinding(objectOrZero(program), uniformBlockIndex,
uniformBlockBinding); | 1710 webContext()->uniformBlockBinding(objectOrZero(program), uniformBlockIndex,
uniformBlockBinding); |
| 1711 } | 1711 } |
| 1712 | 1712 |
| 1713 PassRefPtrWillBeRawPtr<WebGLVertexArrayObject> WebGL2RenderingContextBase::creat
eVertexArray() | 1713 WebGLVertexArrayObject* WebGL2RenderingContextBase::createVertexArray() |
| 1714 { | 1714 { |
| 1715 if (isContextLost()) | 1715 if (isContextLost()) |
| 1716 return nullptr; | 1716 return nullptr; |
| 1717 | 1717 |
| 1718 RefPtrWillBeRawPtr<WebGLVertexArrayObject> o = WebGLVertexArrayObject::creat
e(this, WebGLVertexArrayObjectBase::VaoTypeUser); | 1718 WebGLVertexArrayObject* o = WebGLVertexArrayObject::create(this, WebGLVertex
ArrayObjectBase::VaoTypeUser); |
| 1719 addContextObject(o.get()); | 1719 addContextObject(o); |
| 1720 return o.release(); | 1720 return o; |
| 1721 } | 1721 } |
| 1722 | 1722 |
| 1723 void WebGL2RenderingContextBase::deleteVertexArray(WebGLVertexArrayObject* verte
xArray) | 1723 void WebGL2RenderingContextBase::deleteVertexArray(WebGLVertexArrayObject* verte
xArray) |
| 1724 { | 1724 { |
| 1725 if (isContextLost() || !vertexArray) | 1725 if (isContextLost() || !vertexArray) |
| 1726 return; | 1726 return; |
| 1727 | 1727 |
| 1728 if (!vertexArray->isDefaultObject() && vertexArray == m_boundVertexArrayObje
ct) | 1728 if (!vertexArray->isDefaultObject() && vertexArray == m_boundVertexArrayObje
ct) |
| 1729 setBoundVertexArrayObject(nullptr); | 1729 setBoundVertexArrayObject(nullptr); |
| 1730 | 1730 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1816 { | 1816 { |
| 1817 if (isContextLost()) | 1817 if (isContextLost()) |
| 1818 return ScriptValue::createNull(scriptState); | 1818 return ScriptValue::createNull(scriptState); |
| 1819 switch (pname) { | 1819 switch (pname) { |
| 1820 case GL_SHADING_LANGUAGE_VERSION: | 1820 case GL_SHADING_LANGUAGE_VERSION: |
| 1821 return WebGLAny(scriptState, "WebGL GLSL ES 3.00 (" + String(webContext(
)->getString(GL_SHADING_LANGUAGE_VERSION)) + ")"); | 1821 return WebGLAny(scriptState, "WebGL GLSL ES 3.00 (" + String(webContext(
)->getString(GL_SHADING_LANGUAGE_VERSION)) + ")"); |
| 1822 case GL_VERSION: | 1822 case GL_VERSION: |
| 1823 return WebGLAny(scriptState, "WebGL 2.0 (" + String(webContext()->getStr
ing(GL_VERSION)) + ")"); | 1823 return WebGLAny(scriptState, "WebGL 2.0 (" + String(webContext()->getStr
ing(GL_VERSION)) + ")"); |
| 1824 | 1824 |
| 1825 case GL_COPY_READ_BUFFER_BINDING: | 1825 case GL_COPY_READ_BUFFER_BINDING: |
| 1826 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_bound
CopyReadBuffer.get())); | 1826 return WebGLAny(scriptState, m_boundCopyReadBuffer.get()); |
| 1827 case GL_COPY_WRITE_BUFFER_BINDING: | 1827 case GL_COPY_WRITE_BUFFER_BINDING: |
| 1828 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_bound
CopyWriteBuffer.get())); | 1828 return WebGLAny(scriptState, m_boundCopyWriteBuffer.get()); |
| 1829 case GL_DRAW_FRAMEBUFFER_BINDING: | 1829 case GL_DRAW_FRAMEBUFFER_BINDING: |
| 1830 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_frame
bufferBinding.get())); | 1830 return WebGLAny(scriptState, m_framebufferBinding.get()); |
| 1831 case GL_FRAGMENT_SHADER_DERIVATIVE_HINT: | 1831 case GL_FRAGMENT_SHADER_DERIVATIVE_HINT: |
| 1832 return getUnsignedIntParameter(scriptState, pname); | 1832 return getUnsignedIntParameter(scriptState, pname); |
| 1833 case GL_MAX_3D_TEXTURE_SIZE: | 1833 case GL_MAX_3D_TEXTURE_SIZE: |
| 1834 return getIntParameter(scriptState, pname); | 1834 return getIntParameter(scriptState, pname); |
| 1835 case GL_MAX_ARRAY_TEXTURE_LAYERS: | 1835 case GL_MAX_ARRAY_TEXTURE_LAYERS: |
| 1836 return getIntParameter(scriptState, pname); | 1836 return getIntParameter(scriptState, pname); |
| 1837 case GC3D_MAX_CLIENT_WAIT_TIMEOUT_WEBGL: | 1837 case GC3D_MAX_CLIENT_WAIT_TIMEOUT_WEBGL: |
| 1838 return WebGLAny(scriptState, 0u); | 1838 return WebGLAny(scriptState, 0u); |
| 1839 case GL_MAX_COLOR_ATTACHMENTS: | 1839 case GL_MAX_COLOR_ATTACHMENTS: |
| 1840 return getIntParameter(scriptState, pname); | 1840 return getIntParameter(scriptState, pname); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1886 return getIntParameter(scriptState, pname); | 1886 return getIntParameter(scriptState, pname); |
| 1887 case GL_MIN_PROGRAM_TEXEL_OFFSET: | 1887 case GL_MIN_PROGRAM_TEXEL_OFFSET: |
| 1888 return getIntParameter(scriptState, pname); | 1888 return getIntParameter(scriptState, pname); |
| 1889 case GL_PACK_ROW_LENGTH: | 1889 case GL_PACK_ROW_LENGTH: |
| 1890 return getIntParameter(scriptState, pname); | 1890 return getIntParameter(scriptState, pname); |
| 1891 case GL_PACK_SKIP_PIXELS: | 1891 case GL_PACK_SKIP_PIXELS: |
| 1892 return getIntParameter(scriptState, pname); | 1892 return getIntParameter(scriptState, pname); |
| 1893 case GL_PACK_SKIP_ROWS: | 1893 case GL_PACK_SKIP_ROWS: |
| 1894 return getIntParameter(scriptState, pname); | 1894 return getIntParameter(scriptState, pname); |
| 1895 case GL_PIXEL_PACK_BUFFER_BINDING: | 1895 case GL_PIXEL_PACK_BUFFER_BINDING: |
| 1896 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_bound
PixelPackBuffer.get())); | 1896 return WebGLAny(scriptState, m_boundPixelPackBuffer.get()); |
| 1897 case GL_PIXEL_UNPACK_BUFFER_BINDING: | 1897 case GL_PIXEL_UNPACK_BUFFER_BINDING: |
| 1898 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_bound
PixelUnpackBuffer.get())); | 1898 return WebGLAny(scriptState, m_boundPixelUnpackBuffer.get()); |
| 1899 case GL_RASTERIZER_DISCARD: | 1899 case GL_RASTERIZER_DISCARD: |
| 1900 return getBooleanParameter(scriptState, pname); | 1900 return getBooleanParameter(scriptState, pname); |
| 1901 case GL_READ_BUFFER: | 1901 case GL_READ_BUFFER: |
| 1902 { | 1902 { |
| 1903 GLenum value = 0; | 1903 GLenum value = 0; |
| 1904 if (!isContextLost()) { | 1904 if (!isContextLost()) { |
| 1905 WebGLFramebuffer* readFramebufferBinding = getFramebufferBinding
(GL_READ_FRAMEBUFFER); | 1905 WebGLFramebuffer* readFramebufferBinding = getFramebufferBinding
(GL_READ_FRAMEBUFFER); |
| 1906 if (!readFramebufferBinding) | 1906 if (!readFramebufferBinding) |
| 1907 value = m_readBufferOfDefaultFramebuffer; | 1907 value = m_readBufferOfDefaultFramebuffer; |
| 1908 else | 1908 else |
| 1909 value = readFramebufferBinding->getReadBuffer(); | 1909 value = readFramebufferBinding->getReadBuffer(); |
| 1910 } | 1910 } |
| 1911 return WebGLAny(scriptState, value); | 1911 return WebGLAny(scriptState, value); |
| 1912 } | 1912 } |
| 1913 case GL_READ_FRAMEBUFFER_BINDING: | 1913 case GL_READ_FRAMEBUFFER_BINDING: |
| 1914 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_readF
ramebufferBinding.get())); | 1914 return WebGLAny(scriptState, m_readFramebufferBinding.get()); |
| 1915 case GL_SAMPLE_ALPHA_TO_COVERAGE: | 1915 case GL_SAMPLE_ALPHA_TO_COVERAGE: |
| 1916 return getBooleanParameter(scriptState, pname); | 1916 return getBooleanParameter(scriptState, pname); |
| 1917 case GL_SAMPLE_COVERAGE: | 1917 case GL_SAMPLE_COVERAGE: |
| 1918 return getBooleanParameter(scriptState, pname); | 1918 return getBooleanParameter(scriptState, pname); |
| 1919 case GL_SAMPLER_BINDING: | 1919 case GL_SAMPLER_BINDING: |
| 1920 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_sampl
erUnits[m_activeTextureUnit].get())); | 1920 return WebGLAny(scriptState, m_samplerUnits[m_activeTextureUnit].get()); |
| 1921 case GL_TEXTURE_BINDING_2D_ARRAY: | 1921 case GL_TEXTURE_BINDING_2D_ARRAY: |
| 1922 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_textu
reUnits[m_activeTextureUnit].m_texture2DArrayBinding.get())); | 1922 return WebGLAny(scriptState, m_textureUnits[m_activeTextureUnit].m_textu
re2DArrayBinding.get()); |
| 1923 case GL_TEXTURE_BINDING_3D: | 1923 case GL_TEXTURE_BINDING_3D: |
| 1924 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_textu
reUnits[m_activeTextureUnit].m_texture3DBinding.get())); | 1924 return WebGLAny(scriptState, m_textureUnits[m_activeTextureUnit].m_textu
re3DBinding.get()); |
| 1925 case GL_TRANSFORM_FEEDBACK_ACTIVE: | 1925 case GL_TRANSFORM_FEEDBACK_ACTIVE: |
| 1926 return getBooleanParameter(scriptState, pname); | 1926 return getBooleanParameter(scriptState, pname); |
| 1927 case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: | 1927 case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: |
| 1928 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_bound
TransformFeedbackBuffer.get())); | 1928 return WebGLAny(scriptState, m_boundTransformFeedbackBuffer.get()); |
| 1929 case GL_TRANSFORM_FEEDBACK_BINDING: | 1929 case GL_TRANSFORM_FEEDBACK_BINDING: |
| 1930 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_trans
formFeedbackBinding.get())); | 1930 return WebGLAny(scriptState, m_transformFeedbackBinding.get()); |
| 1931 case GL_TRANSFORM_FEEDBACK_PAUSED: | 1931 case GL_TRANSFORM_FEEDBACK_PAUSED: |
| 1932 return getBooleanParameter(scriptState, pname); | 1932 return getBooleanParameter(scriptState, pname); |
| 1933 case GL_UNIFORM_BUFFER_BINDING: | 1933 case GL_UNIFORM_BUFFER_BINDING: |
| 1934 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_bound
UniformBuffer.get())); | 1934 return WebGLAny(scriptState, m_boundUniformBuffer.get()); |
| 1935 case GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT: | 1935 case GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT: |
| 1936 return getIntParameter(scriptState, pname); | 1936 return getIntParameter(scriptState, pname); |
| 1937 case GL_UNPACK_IMAGE_HEIGHT: | 1937 case GL_UNPACK_IMAGE_HEIGHT: |
| 1938 return getIntParameter(scriptState, pname); | 1938 return getIntParameter(scriptState, pname); |
| 1939 case GL_UNPACK_ROW_LENGTH: | 1939 case GL_UNPACK_ROW_LENGTH: |
| 1940 return getIntParameter(scriptState, pname); | 1940 return getIntParameter(scriptState, pname); |
| 1941 case GL_UNPACK_SKIP_IMAGES: | 1941 case GL_UNPACK_SKIP_IMAGES: |
| 1942 return getBooleanParameter(scriptState, pname); | 1942 return getBooleanParameter(scriptState, pname); |
| 1943 case GL_UNPACK_SKIP_PIXELS: | 1943 case GL_UNPACK_SKIP_PIXELS: |
| 1944 return getBooleanParameter(scriptState, pname); | 1944 return getBooleanParameter(scriptState, pname); |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2227 } | 2227 } |
| 2228 ASSERT(attachmentObject->isTexture() || attachmentObject->isRenderbuffer
()); | 2228 ASSERT(attachmentObject->isTexture() || attachmentObject->isRenderbuffer
()); |
| 2229 if (attachmentObject->isTexture()) | 2229 if (attachmentObject->isTexture()) |
| 2230 return WebGLAny(scriptState, GL_TEXTURE); | 2230 return WebGLAny(scriptState, GL_TEXTURE); |
| 2231 if (attachmentObject->isRenderbuffer()) | 2231 if (attachmentObject->isRenderbuffer()) |
| 2232 return WebGLAny(scriptState, GL_RENDERBUFFER); | 2232 return WebGLAny(scriptState, GL_RENDERBUFFER); |
| 2233 break; | 2233 break; |
| 2234 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: | 2234 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
| 2235 if (!attachmentObject) | 2235 if (!attachmentObject) |
| 2236 break; | 2236 break; |
| 2237 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(attachm
entObject)); | 2237 return WebGLAny(scriptState, attachmentObject); |
| 2238 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: | 2238 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: |
| 2239 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: | 2239 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: |
| 2240 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: | 2240 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: |
| 2241 if (!attachmentObject || !attachmentObject->isTexture()) | 2241 if (!attachmentObject || !attachmentObject->isTexture()) |
| 2242 break; | 2242 break; |
| 2243 case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE: | 2243 case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE: |
| 2244 case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: | 2244 case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: |
| 2245 case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: | 2245 case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: |
| 2246 case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: | 2246 case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: |
| 2247 case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: | 2247 case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2350 default: | 2350 default: |
| 2351 return WebGLRenderingContextBase::getTexParameter(scriptState, target, p
name); | 2351 return WebGLRenderingContextBase::getTexParameter(scriptState, target, p
name); |
| 2352 } | 2352 } |
| 2353 } | 2353 } |
| 2354 | 2354 |
| 2355 WebGLBuffer* WebGL2RenderingContextBase::validateBufferDataTarget(const char* fu
nctionName, GLenum target) | 2355 WebGLBuffer* WebGL2RenderingContextBase::validateBufferDataTarget(const char* fu
nctionName, GLenum target) |
| 2356 { | 2356 { |
| 2357 WebGLBuffer* buffer = nullptr; | 2357 WebGLBuffer* buffer = nullptr; |
| 2358 switch (target) { | 2358 switch (target) { |
| 2359 case GL_ELEMENT_ARRAY_BUFFER: | 2359 case GL_ELEMENT_ARRAY_BUFFER: |
| 2360 buffer = m_boundVertexArrayObject->boundElementArrayBuffer().get(); | 2360 buffer = m_boundVertexArrayObject->boundElementArrayBuffer(); |
| 2361 break; | 2361 break; |
| 2362 case GL_ARRAY_BUFFER: | 2362 case GL_ARRAY_BUFFER: |
| 2363 buffer = m_boundArrayBuffer.get(); | 2363 buffer = m_boundArrayBuffer.get(); |
| 2364 break; | 2364 break; |
| 2365 case GL_COPY_READ_BUFFER: | 2365 case GL_COPY_READ_BUFFER: |
| 2366 buffer = m_boundCopyReadBuffer.get(); | 2366 buffer = m_boundCopyReadBuffer.get(); |
| 2367 break; | 2367 break; |
| 2368 case GL_COPY_WRITE_BUFFER: | 2368 case GL_COPY_WRITE_BUFFER: |
| 2369 buffer = m_boundCopyWriteBuffer.get(); | 2369 buffer = m_boundCopyWriteBuffer.get(); |
| 2370 break; | 2370 break; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2418 GLenum WebGL2RenderingContextBase::boundFramebufferColorFormat() | 2418 GLenum WebGL2RenderingContextBase::boundFramebufferColorFormat() |
| 2419 { | 2419 { |
| 2420 if (m_readFramebufferBinding && m_readFramebufferBinding->object()) | 2420 if (m_readFramebufferBinding && m_readFramebufferBinding->object()) |
| 2421 return m_readFramebufferBinding->colorBufferFormat(); | 2421 return m_readFramebufferBinding->colorBufferFormat(); |
| 2422 if (m_requestedAttributes.alpha()) | 2422 if (m_requestedAttributes.alpha()) |
| 2423 return GL_RGBA; | 2423 return GL_RGBA; |
| 2424 return GL_RGB; | 2424 return GL_RGB; |
| 2425 } | 2425 } |
| 2426 | 2426 |
| 2427 } // namespace blink | 2427 } // namespace blink |
| OLD | NEW |