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 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 } | 1106 } |
1107 | 1107 |
1108 void WebGL2RenderingContextBase::clearBufferfi(GLenum buffer, GLint drawbuffer,
GLfloat depth, GLint stencil) | 1108 void WebGL2RenderingContextBase::clearBufferfi(GLenum buffer, GLint drawbuffer,
GLfloat depth, GLint stencil) |
1109 { | 1109 { |
1110 if (isContextLost()) | 1110 if (isContextLost()) |
1111 return; | 1111 return; |
1112 | 1112 |
1113 webContext()->clearBufferfi(buffer, drawbuffer, depth, stencil); | 1113 webContext()->clearBufferfi(buffer, drawbuffer, depth, stencil); |
1114 } | 1114 } |
1115 | 1115 |
1116 PassRefPtrWillBeRawPtr<WebGLQuery> WebGL2RenderingContextBase::createQuery() | 1116 WebGLQuery* WebGL2RenderingContextBase::createQuery() |
1117 { | 1117 { |
1118 if (isContextLost()) | 1118 if (isContextLost()) |
1119 return nullptr; | 1119 return nullptr; |
1120 RefPtrWillBeRawPtr<WebGLQuery> o = WebGLQuery::create(this); | 1120 WebGLQuery* o = WebGLQuery::create(this); |
1121 addSharedObject(o.get()); | 1121 addSharedObject(o); |
1122 return o; | 1122 return o; |
1123 } | 1123 } |
1124 | 1124 |
1125 void WebGL2RenderingContextBase::deleteQuery(WebGLQuery* query) | 1125 void WebGL2RenderingContextBase::deleteQuery(WebGLQuery* query) |
1126 { | 1126 { |
1127 if (m_currentBooleanOcclusionQuery == query) { | 1127 if (m_currentBooleanOcclusionQuery == query) { |
1128 webContext()->endQueryEXT(m_currentBooleanOcclusionQuery->getTarget()); | 1128 webContext()->endQueryEXT(m_currentBooleanOcclusionQuery->getTarget()); |
1129 m_currentBooleanOcclusionQuery = nullptr; | 1129 m_currentBooleanOcclusionQuery = nullptr; |
1130 } | 1130 } |
1131 | 1131 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1219 } | 1219 } |
1220 break; | 1220 break; |
1221 default: | 1221 default: |
1222 synthesizeGLError(GL_INVALID_ENUM, "endQuery", "invalid target"); | 1222 synthesizeGLError(GL_INVALID_ENUM, "endQuery", "invalid target"); |
1223 return; | 1223 return; |
1224 } | 1224 } |
1225 | 1225 |
1226 webContext()->endQueryEXT(target); | 1226 webContext()->endQueryEXT(target); |
1227 } | 1227 } |
1228 | 1228 |
1229 PassRefPtrWillBeRawPtr<WebGLQuery> WebGL2RenderingContextBase::getQuery(GLenum t
arget, GLenum pname) | 1229 WebGLQuery* WebGL2RenderingContextBase::getQuery(GLenum target, GLenum pname) |
1230 { | 1230 { |
1231 if (isContextLost()) | 1231 if (isContextLost()) |
1232 return nullptr; | 1232 return nullptr; |
1233 | 1233 |
1234 if (pname != GL_CURRENT_QUERY) { | 1234 if (pname != GL_CURRENT_QUERY) { |
1235 synthesizeGLError(GL_INVALID_ENUM, "getQuery", "invalid parameter name")
; | 1235 synthesizeGLError(GL_INVALID_ENUM, "getQuery", "invalid parameter name")
; |
1236 return nullptr; | 1236 return nullptr; |
1237 } | 1237 } |
1238 | 1238 |
1239 switch (target) { | 1239 switch (target) { |
1240 case GL_ANY_SAMPLES_PASSED: | 1240 case GL_ANY_SAMPLES_PASSED: |
1241 case GL_ANY_SAMPLES_PASSED_CONSERVATIVE: | 1241 case GL_ANY_SAMPLES_PASSED_CONSERVATIVE: |
1242 if (m_currentBooleanOcclusionQuery && m_currentBooleanOcclusionQuery->ge
tTarget() == target) | 1242 if (m_currentBooleanOcclusionQuery && m_currentBooleanOcclusionQuery->ge
tTarget() == target) |
1243 return PassRefPtrWillBeRawPtr<WebGLQuery>(m_currentBooleanOcclusionQ
uery.get()); | 1243 return m_currentBooleanOcclusionQuery; |
1244 break; | 1244 break; |
1245 case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: | 1245 case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: |
1246 return PassRefPtrWillBeRawPtr<WebGLQuery>(m_currentTransformFeedbackPrim
itivesWrittenQuery.get()); | 1246 return m_currentTransformFeedbackPrimitivesWrittenQuery; |
1247 default: | 1247 default: |
1248 synthesizeGLError(GL_INVALID_ENUM, "getQuery", "invalid target"); | 1248 synthesizeGLError(GL_INVALID_ENUM, "getQuery", "invalid target"); |
1249 return nullptr; | 1249 return nullptr; |
1250 } | 1250 } |
1251 return nullptr; | 1251 return nullptr; |
1252 } | 1252 } |
1253 | 1253 |
1254 ScriptValue WebGL2RenderingContextBase::getQueryParameter(ScriptState* scriptSta
te, WebGLQuery* query, GLenum pname) | 1254 ScriptValue WebGL2RenderingContextBase::getQueryParameter(ScriptState* scriptSta
te, WebGLQuery* query, GLenum pname) |
1255 { | 1255 { |
1256 if (isContextLost() || !validateWebGLObject("getQueryParameter", query)) | 1256 if (isContextLost() || !validateWebGLObject("getQueryParameter", query)) |
(...skipping 11 matching lines...) Expand all Loading... |
1268 GLuint value; | 1268 GLuint value; |
1269 webContext()->getQueryObjectuivEXT(objectOrZero(query), pname, &valu
e); | 1269 webContext()->getQueryObjectuivEXT(objectOrZero(query), pname, &valu
e); |
1270 return WebGLAny(scriptState, value == GL_TRUE); | 1270 return WebGLAny(scriptState, value == GL_TRUE); |
1271 } | 1271 } |
1272 default: | 1272 default: |
1273 synthesizeGLError(GL_INVALID_ENUM, "getQueryParameter", "invalid paramet
er name"); | 1273 synthesizeGLError(GL_INVALID_ENUM, "getQueryParameter", "invalid paramet
er name"); |
1274 return ScriptValue::createNull(scriptState); | 1274 return ScriptValue::createNull(scriptState); |
1275 } | 1275 } |
1276 } | 1276 } |
1277 | 1277 |
1278 PassRefPtrWillBeRawPtr<WebGLSampler> WebGL2RenderingContextBase::createSampler() | 1278 WebGLSampler* WebGL2RenderingContextBase::createSampler() |
1279 { | 1279 { |
1280 if (isContextLost()) | 1280 if (isContextLost()) |
1281 return nullptr; | 1281 return nullptr; |
1282 RefPtrWillBeRawPtr<WebGLSampler> o = WebGLSampler::create(this); | 1282 WebGLSampler* o = WebGLSampler::create(this); |
1283 addSharedObject(o.get()); | 1283 addSharedObject(o); |
1284 return o; | 1284 return o; |
1285 } | 1285 } |
1286 | 1286 |
1287 void WebGL2RenderingContextBase::deleteSampler(WebGLSampler* sampler) | 1287 void WebGL2RenderingContextBase::deleteSampler(WebGLSampler* sampler) |
1288 { | 1288 { |
1289 for (size_t i = 0; i < m_samplerUnits.size(); ++i) { | 1289 for (size_t i = 0; i < m_samplerUnits.size(); ++i) { |
1290 if (sampler == m_samplerUnits[i]) { | 1290 if (sampler == m_samplerUnits[i]) { |
1291 m_samplerUnits[i] = nullptr; | 1291 m_samplerUnits[i] = nullptr; |
1292 webContext()->bindSampler(i, 0); | 1292 webContext()->bindSampler(i, 0); |
1293 } | 1293 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1364 GLfloat value = 0.f; | 1364 GLfloat value = 0.f; |
1365 webContext()->getSamplerParameterfv(objectOrZero(sampler), pname, &v
alue); | 1365 webContext()->getSamplerParameterfv(objectOrZero(sampler), pname, &v
alue); |
1366 return WebGLAny(scriptState, value); | 1366 return WebGLAny(scriptState, value); |
1367 } | 1367 } |
1368 default: | 1368 default: |
1369 synthesizeGLError(GL_INVALID_ENUM, "getSamplerParameter", "invalid param
eter name"); | 1369 synthesizeGLError(GL_INVALID_ENUM, "getSamplerParameter", "invalid param
eter name"); |
1370 return ScriptValue::createNull(scriptState); | 1370 return ScriptValue::createNull(scriptState); |
1371 } | 1371 } |
1372 } | 1372 } |
1373 | 1373 |
1374 PassRefPtrWillBeRawPtr<WebGLSync> WebGL2RenderingContextBase::fenceSync(GLenum c
ondition, GLbitfield flags) | 1374 WebGLSync* WebGL2RenderingContextBase::fenceSync(GLenum condition, GLbitfield fl
ags) |
1375 { | 1375 { |
1376 if (isContextLost()) | 1376 if (isContextLost()) |
1377 return nullptr; | 1377 return nullptr; |
1378 | 1378 |
1379 RefPtrWillBeRawPtr<WebGLSync> o = WebGLFenceSync::create(this, condition, fl
ags); | 1379 WebGLSync* o = WebGLFenceSync::create(this, condition, flags); |
1380 addSharedObject(o.get()); | 1380 addSharedObject(o); |
1381 return o.release(); | 1381 return o; |
1382 } | 1382 } |
1383 | 1383 |
1384 GLboolean WebGL2RenderingContextBase::isSync(WebGLSync* sync) | 1384 GLboolean WebGL2RenderingContextBase::isSync(WebGLSync* sync) |
1385 { | 1385 { |
1386 if (isContextLost() || !sync) | 1386 if (isContextLost() || !sync) |
1387 return 0; | 1387 return 0; |
1388 | 1388 |
1389 return webContext()->isSync(sync->object()); | 1389 return webContext()->isSync(sync->object()); |
1390 } | 1390 } |
1391 | 1391 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1437 GLsizei length = -1; | 1437 GLsizei length = -1; |
1438 webContext()->getSynciv(syncObjectOrZero(sync), pname, 1, &length, &
value); | 1438 webContext()->getSynciv(syncObjectOrZero(sync), pname, 1, &length, &
value); |
1439 return WebGLAny(scriptState, static_cast<unsigned>(value)); | 1439 return WebGLAny(scriptState, static_cast<unsigned>(value)); |
1440 } | 1440 } |
1441 default: | 1441 default: |
1442 synthesizeGLError(GL_INVALID_ENUM, "getSyncParameter", "invalid paramete
r name"); | 1442 synthesizeGLError(GL_INVALID_ENUM, "getSyncParameter", "invalid paramete
r name"); |
1443 return ScriptValue::createNull(scriptState); | 1443 return ScriptValue::createNull(scriptState); |
1444 } | 1444 } |
1445 } | 1445 } |
1446 | 1446 |
1447 PassRefPtrWillBeRawPtr<WebGLTransformFeedback> WebGL2RenderingContextBase::creat
eTransformFeedback() | 1447 WebGLTransformFeedback* WebGL2RenderingContextBase::createTransformFeedback() |
1448 { | 1448 { |
1449 if (isContextLost()) | 1449 if (isContextLost()) |
1450 return nullptr; | 1450 return nullptr; |
1451 RefPtrWillBeRawPtr<WebGLTransformFeedback> o = WebGLTransformFeedback::creat
e(this); | 1451 WebGLTransformFeedback* o = WebGLTransformFeedback::create(this); |
1452 addSharedObject(o.get()); | 1452 addSharedObject(o); |
1453 return o; | 1453 return o; |
1454 } | 1454 } |
1455 | 1455 |
1456 void WebGL2RenderingContextBase::deleteTransformFeedback(WebGLTransformFeedback*
feedback) | 1456 void WebGL2RenderingContextBase::deleteTransformFeedback(WebGLTransformFeedback*
feedback) |
1457 { | 1457 { |
1458 if (feedback == m_transformFeedbackBinding) | 1458 if (feedback == m_transformFeedbackBinding) |
1459 m_transformFeedbackBinding = nullptr; | 1459 m_transformFeedbackBinding = nullptr; |
1460 | 1460 |
1461 deleteObject(feedback); | 1461 deleteObject(feedback); |
1462 } | 1462 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1518 Vector<CString> keepAlive; // Must keep these instances alive while looking
at their data | 1518 Vector<CString> keepAlive; // Must keep these instances alive while looking
at their data |
1519 Vector<const char*> varyingStrings; | 1519 Vector<const char*> varyingStrings; |
1520 for (size_t i = 0; i < varyings.size(); ++i) { | 1520 for (size_t i = 0; i < varyings.size(); ++i) { |
1521 keepAlive.append(varyings[i].ascii()); | 1521 keepAlive.append(varyings[i].ascii()); |
1522 varyingStrings.append(keepAlive.last().data()); | 1522 varyingStrings.append(keepAlive.last().data()); |
1523 } | 1523 } |
1524 | 1524 |
1525 webContext()->transformFeedbackVaryings(objectOrZero(program), varyings.size
(), varyingStrings.data(), bufferMode); | 1525 webContext()->transformFeedbackVaryings(objectOrZero(program), varyings.size
(), varyingStrings.data(), bufferMode); |
1526 } | 1526 } |
1527 | 1527 |
1528 PassRefPtrWillBeRawPtr<WebGLActiveInfo> WebGL2RenderingContextBase::getTransform
FeedbackVarying(WebGLProgram* program, GLuint index) | 1528 WebGLActiveInfo* WebGL2RenderingContextBase::getTransformFeedbackVarying(WebGLPr
ogram* program, GLuint index) |
1529 { | 1529 { |
1530 if (isContextLost() || !validateWebGLObject("getTransformFeedbackVarying", p
rogram)) | 1530 if (isContextLost() || !validateWebGLObject("getTransformFeedbackVarying", p
rogram)) |
1531 return nullptr; | 1531 return nullptr; |
1532 | 1532 |
1533 notImplemented(); | 1533 notImplemented(); |
1534 return nullptr; | 1534 return nullptr; |
1535 } | 1535 } |
1536 | 1536 |
1537 void WebGL2RenderingContextBase::pauseTransformFeedback() | 1537 void WebGL2RenderingContextBase::pauseTransformFeedback() |
1538 { | 1538 { |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1695 } | 1695 } |
1696 | 1696 |
1697 void WebGL2RenderingContextBase::uniformBlockBinding(WebGLProgram* program, GLui
nt uniformBlockIndex, GLuint uniformBlockBinding) | 1697 void WebGL2RenderingContextBase::uniformBlockBinding(WebGLProgram* program, GLui
nt uniformBlockIndex, GLuint uniformBlockBinding) |
1698 { | 1698 { |
1699 if (isContextLost() || !validateWebGLObject("uniformBlockBinding", program)) | 1699 if (isContextLost() || !validateWebGLObject("uniformBlockBinding", program)) |
1700 return; | 1700 return; |
1701 | 1701 |
1702 webContext()->uniformBlockBinding(objectOrZero(program), uniformBlockIndex,
uniformBlockBinding); | 1702 webContext()->uniformBlockBinding(objectOrZero(program), uniformBlockIndex,
uniformBlockBinding); |
1703 } | 1703 } |
1704 | 1704 |
1705 PassRefPtrWillBeRawPtr<WebGLVertexArrayObject> WebGL2RenderingContextBase::creat
eVertexArray() | 1705 WebGLVertexArrayObject* WebGL2RenderingContextBase::createVertexArray() |
1706 { | 1706 { |
1707 if (isContextLost()) | 1707 if (isContextLost()) |
1708 return nullptr; | 1708 return nullptr; |
1709 | 1709 |
1710 RefPtrWillBeRawPtr<WebGLVertexArrayObject> o = WebGLVertexArrayObject::creat
e(this, WebGLVertexArrayObjectBase::VaoTypeUser); | 1710 WebGLVertexArrayObject* o = WebGLVertexArrayObject::create(this, WebGLVertex
ArrayObjectBase::VaoTypeUser); |
1711 addContextObject(o.get()); | 1711 addContextObject(o); |
1712 return o.release(); | 1712 return o; |
1713 } | 1713 } |
1714 | 1714 |
1715 void WebGL2RenderingContextBase::deleteVertexArray(WebGLVertexArrayObject* verte
xArray) | 1715 void WebGL2RenderingContextBase::deleteVertexArray(WebGLVertexArrayObject* verte
xArray) |
1716 { | 1716 { |
1717 if (isContextLost() || !vertexArray) | 1717 if (isContextLost() || !vertexArray) |
1718 return; | 1718 return; |
1719 | 1719 |
1720 if (!vertexArray->isDefaultObject() && vertexArray == m_boundVertexArrayObje
ct) | 1720 if (!vertexArray->isDefaultObject() && vertexArray == m_boundVertexArrayObje
ct) |
1721 setBoundVertexArrayObject(nullptr); | 1721 setBoundVertexArrayObject(nullptr); |
1722 | 1722 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1808 { | 1808 { |
1809 if (isContextLost()) | 1809 if (isContextLost()) |
1810 return ScriptValue::createNull(scriptState); | 1810 return ScriptValue::createNull(scriptState); |
1811 switch (pname) { | 1811 switch (pname) { |
1812 case GL_SHADING_LANGUAGE_VERSION: | 1812 case GL_SHADING_LANGUAGE_VERSION: |
1813 return WebGLAny(scriptState, "WebGL GLSL ES 3.00 (" + String(webContext(
)->getString(GL_SHADING_LANGUAGE_VERSION)) + ")"); | 1813 return WebGLAny(scriptState, "WebGL GLSL ES 3.00 (" + String(webContext(
)->getString(GL_SHADING_LANGUAGE_VERSION)) + ")"); |
1814 case GL_VERSION: | 1814 case GL_VERSION: |
1815 return WebGLAny(scriptState, "WebGL 2.0 (" + String(webContext()->getStr
ing(GL_VERSION)) + ")"); | 1815 return WebGLAny(scriptState, "WebGL 2.0 (" + String(webContext()->getStr
ing(GL_VERSION)) + ")"); |
1816 | 1816 |
1817 case GL_COPY_READ_BUFFER_BINDING: | 1817 case GL_COPY_READ_BUFFER_BINDING: |
1818 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_bound
CopyReadBuffer.get())); | 1818 return WebGLAny(scriptState, m_boundCopyReadBuffer.get()); |
1819 case GL_COPY_WRITE_BUFFER_BINDING: | 1819 case GL_COPY_WRITE_BUFFER_BINDING: |
1820 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_bound
CopyWriteBuffer.get())); | 1820 return WebGLAny(scriptState, m_boundCopyWriteBuffer.get()); |
1821 case GL_DRAW_FRAMEBUFFER_BINDING: | 1821 case GL_DRAW_FRAMEBUFFER_BINDING: |
1822 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_frame
bufferBinding.get())); | 1822 return WebGLAny(scriptState, m_framebufferBinding.get()); |
1823 case GL_FRAGMENT_SHADER_DERIVATIVE_HINT: | 1823 case GL_FRAGMENT_SHADER_DERIVATIVE_HINT: |
1824 return getUnsignedIntParameter(scriptState, pname); | 1824 return getUnsignedIntParameter(scriptState, pname); |
1825 case GL_MAX_3D_TEXTURE_SIZE: | 1825 case GL_MAX_3D_TEXTURE_SIZE: |
1826 return getIntParameter(scriptState, pname); | 1826 return getIntParameter(scriptState, pname); |
1827 case GL_MAX_ARRAY_TEXTURE_LAYERS: | 1827 case GL_MAX_ARRAY_TEXTURE_LAYERS: |
1828 return getIntParameter(scriptState, pname); | 1828 return getIntParameter(scriptState, pname); |
1829 case GC3D_MAX_CLIENT_WAIT_TIMEOUT_WEBGL: | 1829 case GC3D_MAX_CLIENT_WAIT_TIMEOUT_WEBGL: |
1830 return WebGLAny(scriptState, 0u); | 1830 return WebGLAny(scriptState, 0u); |
1831 case GL_MAX_COLOR_ATTACHMENTS: | 1831 case GL_MAX_COLOR_ATTACHMENTS: |
1832 return getIntParameter(scriptState, pname); | 1832 return getIntParameter(scriptState, pname); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1878 return getIntParameter(scriptState, pname); | 1878 return getIntParameter(scriptState, pname); |
1879 case GL_MIN_PROGRAM_TEXEL_OFFSET: | 1879 case GL_MIN_PROGRAM_TEXEL_OFFSET: |
1880 return getIntParameter(scriptState, pname); | 1880 return getIntParameter(scriptState, pname); |
1881 case GL_PACK_ROW_LENGTH: | 1881 case GL_PACK_ROW_LENGTH: |
1882 return getIntParameter(scriptState, pname); | 1882 return getIntParameter(scriptState, pname); |
1883 case GL_PACK_SKIP_PIXELS: | 1883 case GL_PACK_SKIP_PIXELS: |
1884 return getIntParameter(scriptState, pname); | 1884 return getIntParameter(scriptState, pname); |
1885 case GL_PACK_SKIP_ROWS: | 1885 case GL_PACK_SKIP_ROWS: |
1886 return getIntParameter(scriptState, pname); | 1886 return getIntParameter(scriptState, pname); |
1887 case GL_PIXEL_PACK_BUFFER_BINDING: | 1887 case GL_PIXEL_PACK_BUFFER_BINDING: |
1888 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_bound
PixelPackBuffer.get())); | 1888 return WebGLAny(scriptState, m_boundPixelPackBuffer.get()); |
1889 case GL_PIXEL_UNPACK_BUFFER_BINDING: | 1889 case GL_PIXEL_UNPACK_BUFFER_BINDING: |
1890 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_bound
PixelUnpackBuffer.get())); | 1890 return WebGLAny(scriptState, m_boundPixelUnpackBuffer.get()); |
1891 case GL_RASTERIZER_DISCARD: | 1891 case GL_RASTERIZER_DISCARD: |
1892 return getBooleanParameter(scriptState, pname); | 1892 return getBooleanParameter(scriptState, pname); |
1893 case GL_READ_BUFFER: | 1893 case GL_READ_BUFFER: |
1894 { | 1894 { |
1895 GLenum value = 0; | 1895 GLenum value = 0; |
1896 if (!isContextLost()) { | 1896 if (!isContextLost()) { |
1897 WebGLFramebuffer* readFramebufferBinding = getFramebufferBinding
(GL_READ_FRAMEBUFFER); | 1897 WebGLFramebuffer* readFramebufferBinding = getFramebufferBinding
(GL_READ_FRAMEBUFFER); |
1898 if (!readFramebufferBinding) | 1898 if (!readFramebufferBinding) |
1899 value = m_readBufferOfDefaultFramebuffer; | 1899 value = m_readBufferOfDefaultFramebuffer; |
1900 else | 1900 else |
1901 value = readFramebufferBinding->getReadBuffer(); | 1901 value = readFramebufferBinding->getReadBuffer(); |
1902 } | 1902 } |
1903 return WebGLAny(scriptState, value); | 1903 return WebGLAny(scriptState, value); |
1904 } | 1904 } |
1905 case GL_READ_FRAMEBUFFER_BINDING: | 1905 case GL_READ_FRAMEBUFFER_BINDING: |
1906 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_readF
ramebufferBinding.get())); | 1906 return WebGLAny(scriptState, m_readFramebufferBinding.get()); |
1907 case GL_SAMPLE_ALPHA_TO_COVERAGE: | 1907 case GL_SAMPLE_ALPHA_TO_COVERAGE: |
1908 return getBooleanParameter(scriptState, pname); | 1908 return getBooleanParameter(scriptState, pname); |
1909 case GL_SAMPLE_COVERAGE: | 1909 case GL_SAMPLE_COVERAGE: |
1910 return getBooleanParameter(scriptState, pname); | 1910 return getBooleanParameter(scriptState, pname); |
1911 case GL_SAMPLER_BINDING: | 1911 case GL_SAMPLER_BINDING: |
1912 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_sampl
erUnits[m_activeTextureUnit].get())); | 1912 return WebGLAny(scriptState, m_samplerUnits[m_activeTextureUnit].get()); |
1913 case GL_TEXTURE_BINDING_2D_ARRAY: | 1913 case GL_TEXTURE_BINDING_2D_ARRAY: |
1914 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_textu
reUnits[m_activeTextureUnit].m_texture2DArrayBinding.get())); | 1914 return WebGLAny(scriptState, m_textureUnits[m_activeTextureUnit].m_textu
re2DArrayBinding.get()); |
1915 case GL_TEXTURE_BINDING_3D: | 1915 case GL_TEXTURE_BINDING_3D: |
1916 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_textu
reUnits[m_activeTextureUnit].m_texture3DBinding.get())); | 1916 return WebGLAny(scriptState, m_textureUnits[m_activeTextureUnit].m_textu
re3DBinding.get()); |
1917 case GL_TRANSFORM_FEEDBACK_ACTIVE: | 1917 case GL_TRANSFORM_FEEDBACK_ACTIVE: |
1918 return getBooleanParameter(scriptState, pname); | 1918 return getBooleanParameter(scriptState, pname); |
1919 case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: | 1919 case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: |
1920 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_bound
TransformFeedbackBuffer.get())); | 1920 return WebGLAny(scriptState, m_boundTransformFeedbackBuffer.get()); |
1921 case GL_TRANSFORM_FEEDBACK_BINDING: | 1921 case GL_TRANSFORM_FEEDBACK_BINDING: |
1922 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_trans
formFeedbackBinding.get())); | 1922 return WebGLAny(scriptState, m_transformFeedbackBinding.get()); |
1923 case GL_TRANSFORM_FEEDBACK_PAUSED: | 1923 case GL_TRANSFORM_FEEDBACK_PAUSED: |
1924 return getBooleanParameter(scriptState, pname); | 1924 return getBooleanParameter(scriptState, pname); |
1925 case GL_UNIFORM_BUFFER_BINDING: | 1925 case GL_UNIFORM_BUFFER_BINDING: |
1926 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_bound
UniformBuffer.get())); | 1926 return WebGLAny(scriptState, m_boundUniformBuffer.get()); |
1927 case GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT: | 1927 case GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT: |
1928 return getIntParameter(scriptState, pname); | 1928 return getIntParameter(scriptState, pname); |
1929 case GL_UNPACK_IMAGE_HEIGHT: | 1929 case GL_UNPACK_IMAGE_HEIGHT: |
1930 return getIntParameter(scriptState, pname); | 1930 return getIntParameter(scriptState, pname); |
1931 case GL_UNPACK_ROW_LENGTH: | 1931 case GL_UNPACK_ROW_LENGTH: |
1932 return getIntParameter(scriptState, pname); | 1932 return getIntParameter(scriptState, pname); |
1933 case GL_UNPACK_SKIP_IMAGES: | 1933 case GL_UNPACK_SKIP_IMAGES: |
1934 return getBooleanParameter(scriptState, pname); | 1934 return getBooleanParameter(scriptState, pname); |
1935 case GL_UNPACK_SKIP_PIXELS: | 1935 case GL_UNPACK_SKIP_PIXELS: |
1936 return getBooleanParameter(scriptState, pname); | 1936 return getBooleanParameter(scriptState, pname); |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2219 } | 2219 } |
2220 ASSERT(attachmentObject->isTexture() || attachmentObject->isRenderbuffer
()); | 2220 ASSERT(attachmentObject->isTexture() || attachmentObject->isRenderbuffer
()); |
2221 if (attachmentObject->isTexture()) | 2221 if (attachmentObject->isTexture()) |
2222 return WebGLAny(scriptState, GL_TEXTURE); | 2222 return WebGLAny(scriptState, GL_TEXTURE); |
2223 if (attachmentObject->isRenderbuffer()) | 2223 if (attachmentObject->isRenderbuffer()) |
2224 return WebGLAny(scriptState, GL_RENDERBUFFER); | 2224 return WebGLAny(scriptState, GL_RENDERBUFFER); |
2225 break; | 2225 break; |
2226 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: | 2226 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
2227 if (!attachmentObject) | 2227 if (!attachmentObject) |
2228 break; | 2228 break; |
2229 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(attachm
entObject)); | 2229 return WebGLAny(scriptState, attachmentObject); |
2230 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: | 2230 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: |
2231 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: | 2231 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: |
2232 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: | 2232 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: |
2233 if (!attachmentObject || !attachmentObject->isTexture()) | 2233 if (!attachmentObject || !attachmentObject->isTexture()) |
2234 break; | 2234 break; |
2235 case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE: | 2235 case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE: |
2236 case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: | 2236 case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: |
2237 case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: | 2237 case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: |
2238 case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: | 2238 case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: |
2239 case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: | 2239 case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2342 default: | 2342 default: |
2343 return WebGLRenderingContextBase::getTexParameter(scriptState, target, p
name); | 2343 return WebGLRenderingContextBase::getTexParameter(scriptState, target, p
name); |
2344 } | 2344 } |
2345 } | 2345 } |
2346 | 2346 |
2347 WebGLBuffer* WebGL2RenderingContextBase::validateBufferDataTarget(const char* fu
nctionName, GLenum target) | 2347 WebGLBuffer* WebGL2RenderingContextBase::validateBufferDataTarget(const char* fu
nctionName, GLenum target) |
2348 { | 2348 { |
2349 WebGLBuffer* buffer = nullptr; | 2349 WebGLBuffer* buffer = nullptr; |
2350 switch (target) { | 2350 switch (target) { |
2351 case GL_ELEMENT_ARRAY_BUFFER: | 2351 case GL_ELEMENT_ARRAY_BUFFER: |
2352 buffer = m_boundVertexArrayObject->boundElementArrayBuffer().get(); | 2352 buffer = m_boundVertexArrayObject->boundElementArrayBuffer(); |
2353 break; | 2353 break; |
2354 case GL_ARRAY_BUFFER: | 2354 case GL_ARRAY_BUFFER: |
2355 buffer = m_boundArrayBuffer.get(); | 2355 buffer = m_boundArrayBuffer.get(); |
2356 break; | 2356 break; |
2357 case GL_COPY_READ_BUFFER: | 2357 case GL_COPY_READ_BUFFER: |
2358 buffer = m_boundCopyReadBuffer.get(); | 2358 buffer = m_boundCopyReadBuffer.get(); |
2359 break; | 2359 break; |
2360 case GL_COPY_WRITE_BUFFER: | 2360 case GL_COPY_WRITE_BUFFER: |
2361 buffer = m_boundCopyWriteBuffer.get(); | 2361 buffer = m_boundCopyWriteBuffer.get(); |
2362 break; | 2362 break; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2410 GLenum WebGL2RenderingContextBase::boundFramebufferColorFormat() | 2410 GLenum WebGL2RenderingContextBase::boundFramebufferColorFormat() |
2411 { | 2411 { |
2412 if (m_readFramebufferBinding && m_readFramebufferBinding->object()) | 2412 if (m_readFramebufferBinding && m_readFramebufferBinding->object()) |
2413 return m_readFramebufferBinding->colorBufferFormat(); | 2413 return m_readFramebufferBinding->colorBufferFormat(); |
2414 if (m_requestedAttributes.alpha()) | 2414 if (m_requestedAttributes.alpha()) |
2415 return GL_RGBA; | 2415 return GL_RGBA; |
2416 return GL_RGB; | 2416 return GL_RGB; |
2417 } | 2417 } |
2418 | 2418 |
2419 } // namespace blink | 2419 } // namespace blink |
OLD | NEW |