| 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 "modules/webgl/WebGL2RenderingContextBase.h" | 5 #include "modules/webgl/WebGL2RenderingContextBase.h" |
| 6 | 6 |
| 7 #include "bindings/modules/v8/WebGLAny.h" | 7 #include "bindings/modules/v8/WebGLAny.h" |
| 8 #include "core/frame/ImageBitmap.h" | 8 #include "core/frame/ImageBitmap.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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 return false; | 385 return false; |
| 386 } | 386 } |
| 387 break; | 387 break; |
| 388 default: | 388 default: |
| 389 ASSERT_NOT_REACHED(); | 389 ASSERT_NOT_REACHED(); |
| 390 return false; | 390 return false; |
| 391 } | 391 } |
| 392 return true; | 392 return true; |
| 393 } | 393 } |
| 394 | 394 |
| 395 void WebGL2RenderingContextBase::framebufferTextureLayer(ScriptState* scriptStat
e, GLenum target, GLenum attachment, WebGLTexture* texture, GLint level, GLint l
ayer) | 395 void WebGL2RenderingContextBase::framebufferTextureLayer(GLenum target, GLenum a
ttachment, WebGLTexture* texture, GLint level, GLint layer) |
| 396 { | 396 { |
| 397 if (isContextLost() || !validateFramebufferFuncParameters("framebufferTextur
eLayer", target, attachment)) | 397 if (isContextLost() || !validateFramebufferFuncParameters("framebufferTextur
eLayer", target, attachment)) |
| 398 return; | 398 return; |
| 399 if (texture && !texture->validate(contextGroup(), this)) { | 399 if (texture && !texture->validate(contextGroup(), this)) { |
| 400 synthesizeGLError(GL_INVALID_VALUE, "framebufferTextureLayer", "no textu
re or texture not from this context"); | 400 synthesizeGLError(GL_INVALID_VALUE, "framebufferTextureLayer", "no textu
re or texture not from this context"); |
| 401 return; | 401 return; |
| 402 } | 402 } |
| 403 GLenum textarget = texture ? texture->getTarget() : 0; | 403 GLenum textarget = texture ? texture->getTarget() : 0; |
| 404 if (texture) { | 404 if (texture) { |
| 405 if (textarget != GL_TEXTURE_3D && textarget != GL_TEXTURE_2D_ARRAY) { | 405 if (textarget != GL_TEXTURE_3D && textarget != GL_TEXTURE_2D_ARRAY) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 421 contextGL()->FramebufferTextureLayer(target, GL_DEPTH_ATTACHMENT, object
OrZero(texture), level, layer); | 421 contextGL()->FramebufferTextureLayer(target, GL_DEPTH_ATTACHMENT, object
OrZero(texture), level, layer); |
| 422 contextGL()->FramebufferTextureLayer(target, GL_STENCIL_ATTACHMENT, obje
ctOrZero(texture), level, layer); | 422 contextGL()->FramebufferTextureLayer(target, GL_STENCIL_ATTACHMENT, obje
ctOrZero(texture), level, layer); |
| 423 } else { | 423 } else { |
| 424 contextGL()->FramebufferTextureLayer(target, attachment, objectOrZero(te
xture), level, layer); | 424 contextGL()->FramebufferTextureLayer(target, attachment, objectOrZero(te
xture), level, layer); |
| 425 } | 425 } |
| 426 if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { | 426 if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { |
| 427 // On ES3, DEPTH_STENCIL_ATTACHMENT is like an alias for DEPTH_ATTACHMEN
T + STENCIL_ATTACHMENT. | 427 // On ES3, DEPTH_STENCIL_ATTACHMENT is like an alias for DEPTH_ATTACHMEN
T + STENCIL_ATTACHMENT. |
| 428 // We divide it here so in WebGLFramebuffer, we don't have to handle DEP
TH_STENCIL_ATTACHMENT in WebGL 2. | 428 // We divide it here so in WebGLFramebuffer, we don't have to handle DEP
TH_STENCIL_ATTACHMENT in WebGL 2. |
| 429 framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_DEPTH_AT
TACHMENT, textarget, texture, level, layer); | 429 framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_DEPTH_AT
TACHMENT, textarget, texture, level, layer); |
| 430 framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_STENCIL_
ATTACHMENT, textarget, texture, level, layer); | 430 framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_STENCIL_
ATTACHMENT, textarget, texture, level, layer); |
| 431 preserveObjectWrapper(scriptState, framebufferBinding, V8HiddenValue::we
bglAttachments(scriptState->isolate()), framebufferBinding->getPersistentCache()
, GL_DEPTH_ATTACHMENT, texture); | |
| 432 preserveObjectWrapper(scriptState, framebufferBinding, V8HiddenValue::we
bglAttachments(scriptState->isolate()), framebufferBinding->getPersistentCache()
, GL_STENCIL_ATTACHMENT, texture); | |
| 433 } else { | 431 } else { |
| 434 framebufferBinding->setAttachmentForBoundFramebuffer(target, attachment,
textarget, texture, level, layer); | 432 framebufferBinding->setAttachmentForBoundFramebuffer(target, attachment,
textarget, texture, level, layer); |
| 435 preserveObjectWrapper(scriptState, framebufferBinding, V8HiddenValue::we
bglAttachments(scriptState->isolate()), framebufferBinding->getPersistentCache()
, attachment, texture); | |
| 436 } | 433 } |
| 437 applyStencilTest(); | 434 applyStencilTest(); |
| 438 } | 435 } |
| 439 | 436 |
| 440 ScriptValue WebGL2RenderingContextBase::getInternalformatParameter(ScriptState*
scriptState, GLenum target, GLenum internalformat, GLenum pname) | 437 ScriptValue WebGL2RenderingContextBase::getInternalformatParameter(ScriptState*
scriptState, GLenum target, GLenum internalformat, GLenum pname) |
| 441 { | 438 { |
| 442 if (isContextLost()) | 439 if (isContextLost()) |
| 443 return ScriptValue::createNull(scriptState); | 440 return ScriptValue::createNull(scriptState); |
| 444 | 441 |
| 445 if (target != GL_RENDERBUFFER) { | 442 if (target != GL_RENDERBUFFER) { |
| (...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1819 } | 1816 } |
| 1820 | 1817 |
| 1821 GLboolean WebGL2RenderingContextBase::isQuery(WebGLQuery* query) | 1818 GLboolean WebGL2RenderingContextBase::isQuery(WebGLQuery* query) |
| 1822 { | 1819 { |
| 1823 if (isContextLost() || !query) | 1820 if (isContextLost() || !query) |
| 1824 return 0; | 1821 return 0; |
| 1825 | 1822 |
| 1826 return contextGL()->IsQueryEXT(query->object()); | 1823 return contextGL()->IsQueryEXT(query->object()); |
| 1827 } | 1824 } |
| 1828 | 1825 |
| 1829 void WebGL2RenderingContextBase::beginQuery(ScriptState* scriptState, GLenum tar
get, WebGLQuery* query) | 1826 void WebGL2RenderingContextBase::beginQuery(GLenum target, WebGLQuery* query) |
| 1830 { | 1827 { |
| 1831 bool deleted; | 1828 bool deleted; |
| 1832 if (!query) { | 1829 if (!query) { |
| 1833 synthesizeGLError(GL_INVALID_OPERATION, "beginQuery", "query object is n
ull"); | 1830 synthesizeGLError(GL_INVALID_OPERATION, "beginQuery", "query object is n
ull"); |
| 1834 return; | 1831 return; |
| 1835 } | 1832 } |
| 1836 | 1833 |
| 1837 if (!checkObjectToBeBound("beginQuery", query, deleted)) | 1834 if (!checkObjectToBeBound("beginQuery", query, deleted)) |
| 1838 return; | 1835 return; |
| 1839 if (deleted) { | 1836 if (deleted) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1868 break; | 1865 break; |
| 1869 default: | 1866 default: |
| 1870 synthesizeGLError(GL_INVALID_ENUM, "beginQuery", "invalid target"); | 1867 synthesizeGLError(GL_INVALID_ENUM, "beginQuery", "invalid target"); |
| 1871 return; | 1868 return; |
| 1872 } | 1869 } |
| 1873 | 1870 |
| 1874 if (!query->getTarget()) | 1871 if (!query->getTarget()) |
| 1875 query->setTarget(target); | 1872 query->setTarget(target); |
| 1876 | 1873 |
| 1877 contextGL()->BeginQueryEXT(target, query->object()); | 1874 contextGL()->BeginQueryEXT(target, query->object()); |
| 1878 preserveObjectWrapper(scriptState, this, V8HiddenValue::webglQueries(scriptS
tate->isolate()), &m_queryWrappers, static_cast<uint32_t>(target), query); | |
| 1879 } | 1875 } |
| 1880 | 1876 |
| 1881 void WebGL2RenderingContextBase::endQuery(GLenum target) | 1877 void WebGL2RenderingContextBase::endQuery(GLenum target) |
| 1882 { | 1878 { |
| 1883 if (isContextLost()) | 1879 if (isContextLost()) |
| 1884 return; | 1880 return; |
| 1885 | 1881 |
| 1886 switch (target) { | 1882 switch (target) { |
| 1887 case GL_ANY_SAMPLES_PASSED: | 1883 case GL_ANY_SAMPLES_PASSED: |
| 1888 case GL_ANY_SAMPLES_PASSED_CONSERVATIVE: | 1884 case GL_ANY_SAMPLES_PASSED_CONSERVATIVE: |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2006 } | 2002 } |
| 2007 | 2003 |
| 2008 GLboolean WebGL2RenderingContextBase::isSampler(WebGLSampler* sampler) | 2004 GLboolean WebGL2RenderingContextBase::isSampler(WebGLSampler* sampler) |
| 2009 { | 2005 { |
| 2010 if (isContextLost() || !sampler) | 2006 if (isContextLost() || !sampler) |
| 2011 return 0; | 2007 return 0; |
| 2012 | 2008 |
| 2013 return contextGL()->IsSampler(sampler->object()); | 2009 return contextGL()->IsSampler(sampler->object()); |
| 2014 } | 2010 } |
| 2015 | 2011 |
| 2016 void WebGL2RenderingContextBase::bindSampler(ScriptState* scriptState, GLuint un
it, WebGLSampler* sampler) | 2012 void WebGL2RenderingContextBase::bindSampler(GLuint unit, WebGLSampler* sampler) |
| 2017 { | 2013 { |
| 2018 if (isContextLost()) | 2014 if (isContextLost()) |
| 2019 return; | 2015 return; |
| 2020 | 2016 |
| 2021 bool deleted; | 2017 bool deleted; |
| 2022 if (!checkObjectToBeBound("bindSampler", sampler, deleted)) | 2018 if (!checkObjectToBeBound("bindSampler", sampler, deleted)) |
| 2023 return; | 2019 return; |
| 2024 if (deleted) { | 2020 if (deleted) { |
| 2025 synthesizeGLError(GL_INVALID_OPERATION, "bindSampler", "attempted to bin
d a deleted sampler"); | 2021 synthesizeGLError(GL_INVALID_OPERATION, "bindSampler", "attempted to bin
d a deleted sampler"); |
| 2026 return; | 2022 return; |
| 2027 } | 2023 } |
| 2028 | 2024 |
| 2029 if (unit >= m_samplerUnits.size()) { | 2025 if (unit >= m_samplerUnits.size()) { |
| 2030 synthesizeGLError(GL_INVALID_VALUE, "bindSampler", "texture unit out of
range"); | 2026 synthesizeGLError(GL_INVALID_VALUE, "bindSampler", "texture unit out of
range"); |
| 2031 return; | 2027 return; |
| 2032 } | 2028 } |
| 2033 | 2029 |
| 2034 m_samplerUnits[unit] = sampler; | 2030 m_samplerUnits[unit] = sampler; |
| 2035 | 2031 |
| 2036 contextGL()->BindSampler(unit, objectOrZero(sampler)); | 2032 contextGL()->BindSampler(unit, objectOrZero(sampler)); |
| 2037 | |
| 2038 preserveObjectWrapper(scriptState, this, V8HiddenValue::webglSamplers(script
State->isolate()), &m_samplerWrappers, static_cast<uint32_t>(unit), sampler); | |
| 2039 } | 2033 } |
| 2040 | 2034 |
| 2041 void WebGL2RenderingContextBase::samplerParameter(WebGLSampler* sampler, GLenum
pname, GLfloat paramf, GLint parami, bool isFloat) | 2035 void WebGL2RenderingContextBase::samplerParameter(WebGLSampler* sampler, GLenum
pname, GLfloat paramf, GLint parami, bool isFloat) |
| 2042 { | 2036 { |
| 2043 if (isContextLost() || !validateWebGLObject("samplerParameter", sampler)) | 2037 if (isContextLost() || !validateWebGLObject("samplerParameter", sampler)) |
| 2044 return; | 2038 return; |
| 2045 | 2039 |
| 2046 GLint param = isFloat ? static_cast<GLint>(paramf) : parami; | 2040 GLint param = isFloat ? static_cast<GLint>(paramf) : parami; |
| 2047 switch (pname) { | 2041 switch (pname) { |
| 2048 case GL_TEXTURE_MAX_LOD: | 2042 case GL_TEXTURE_MAX_LOD: |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2258 { | 2252 { |
| 2259 if (isContextLost() || !feedback) | 2253 if (isContextLost() || !feedback) |
| 2260 return 0; | 2254 return 0; |
| 2261 | 2255 |
| 2262 if (!feedback->hasEverBeenBound()) | 2256 if (!feedback->hasEverBeenBound()) |
| 2263 return 0; | 2257 return 0; |
| 2264 | 2258 |
| 2265 return contextGL()->IsTransformFeedback(feedback->object()); | 2259 return contextGL()->IsTransformFeedback(feedback->object()); |
| 2266 } | 2260 } |
| 2267 | 2261 |
| 2268 void WebGL2RenderingContextBase::bindTransformFeedback(ScriptState* scriptState,
GLenum target, WebGLTransformFeedback* feedback) | 2262 void WebGL2RenderingContextBase::bindTransformFeedback(GLenum target, WebGLTrans
formFeedback* feedback) |
| 2269 { | 2263 { |
| 2270 bool deleted; | 2264 bool deleted; |
| 2271 if (!checkObjectToBeBound("bindTransformFeedback", feedback, deleted)) | 2265 if (!checkObjectToBeBound("bindTransformFeedback", feedback, deleted)) |
| 2272 return; | 2266 return; |
| 2273 if (deleted) { | 2267 if (deleted) { |
| 2274 synthesizeGLError(GL_INVALID_OPERATION, "bindTransformFeedback", "attemp
ted to bind a deleted transform feedback object"); | 2268 synthesizeGLError(GL_INVALID_OPERATION, "bindTransformFeedback", "attemp
ted to bind a deleted transform feedback object"); |
| 2275 return; | 2269 return; |
| 2276 } | 2270 } |
| 2277 | 2271 |
| 2278 if (target != GL_TRANSFORM_FEEDBACK) { | 2272 if (target != GL_TRANSFORM_FEEDBACK) { |
| 2279 synthesizeGLError(GL_INVALID_ENUM, "bindTransformFeedback", "target must
be TRANSFORM_FEEDBACK"); | 2273 synthesizeGLError(GL_INVALID_ENUM, "bindTransformFeedback", "target must
be TRANSFORM_FEEDBACK"); |
| 2280 return; | 2274 return; |
| 2281 } | 2275 } |
| 2282 | 2276 |
| 2283 m_transformFeedbackBinding = feedback; | 2277 m_transformFeedbackBinding = feedback; |
| 2284 | 2278 |
| 2285 contextGL()->BindTransformFeedback(target, objectOrZero(feedback)); | 2279 contextGL()->BindTransformFeedback(target, objectOrZero(feedback)); |
| 2286 if (feedback) { | 2280 if (feedback) { |
| 2287 feedback->setTarget(target); | 2281 feedback->setTarget(target); |
| 2288 preserveObjectWrapper(scriptState, this, V8HiddenValue::webglMisc(script
State->isolate()), &m_miscWrappers, static_cast<uint32_t>(PreservedTransformFeed
back), feedback); | |
| 2289 } | 2282 } |
| 2290 | 2283 |
| 2291 } | 2284 } |
| 2292 | 2285 |
| 2293 void WebGL2RenderingContextBase::beginTransformFeedback(GLenum primitiveMode) | 2286 void WebGL2RenderingContextBase::beginTransformFeedback(GLenum primitiveMode) |
| 2294 { | 2287 { |
| 2295 if (isContextLost()) | 2288 if (isContextLost()) |
| 2296 return; | 2289 return; |
| 2297 if (!validateTransformFeedbackPrimitiveMode("beginTransformFeedback", primit
iveMode)) | 2290 if (!validateTransformFeedbackPrimitiveMode("beginTransformFeedback", primit
iveMode)) |
| 2298 return; | 2291 return; |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2682 WebGLVertexArrayObject* WebGL2RenderingContextBase::createVertexArray() | 2675 WebGLVertexArrayObject* WebGL2RenderingContextBase::createVertexArray() |
| 2683 { | 2676 { |
| 2684 if (isContextLost()) | 2677 if (isContextLost()) |
| 2685 return nullptr; | 2678 return nullptr; |
| 2686 | 2679 |
| 2687 WebGLVertexArrayObject* o = WebGLVertexArrayObject::create(this, WebGLVertex
ArrayObjectBase::VaoTypeUser); | 2680 WebGLVertexArrayObject* o = WebGLVertexArrayObject::create(this, WebGLVertex
ArrayObjectBase::VaoTypeUser); |
| 2688 addContextObject(o); | 2681 addContextObject(o); |
| 2689 return o; | 2682 return o; |
| 2690 } | 2683 } |
| 2691 | 2684 |
| 2692 void WebGL2RenderingContextBase::deleteVertexArray(ScriptState* scriptState, Web
GLVertexArrayObject* vertexArray) | 2685 void WebGL2RenderingContextBase::deleteVertexArray(WebGLVertexArrayObject* verte
xArray) |
| 2693 { | 2686 { |
| 2694 if (isContextLost() || !vertexArray) | 2687 if (isContextLost() || !vertexArray) |
| 2695 return; | 2688 return; |
| 2696 | 2689 |
| 2697 if (!vertexArray->isDefaultObject() && vertexArray == m_boundVertexArrayObje
ct) | 2690 if (!vertexArray->isDefaultObject() && vertexArray == m_boundVertexArrayObje
ct) |
| 2698 setBoundVertexArrayObject(scriptState, nullptr); | 2691 setBoundVertexArrayObject(nullptr); |
| 2699 | 2692 |
| 2700 vertexArray->deleteObject(contextGL()); | 2693 vertexArray->deleteObject(contextGL()); |
| 2701 } | 2694 } |
| 2702 | 2695 |
| 2703 GLboolean WebGL2RenderingContextBase::isVertexArray(WebGLVertexArrayObject* vert
exArray) | 2696 GLboolean WebGL2RenderingContextBase::isVertexArray(WebGLVertexArrayObject* vert
exArray) |
| 2704 { | 2697 { |
| 2705 if (isContextLost() || !vertexArray) | 2698 if (isContextLost() || !vertexArray) |
| 2706 return 0; | 2699 return 0; |
| 2707 | 2700 |
| 2708 if (!vertexArray->hasEverBeenBound()) | 2701 if (!vertexArray->hasEverBeenBound()) |
| 2709 return 0; | 2702 return 0; |
| 2710 | 2703 |
| 2711 return contextGL()->IsVertexArrayOES(vertexArray->object()); | 2704 return contextGL()->IsVertexArrayOES(vertexArray->object()); |
| 2712 } | 2705 } |
| 2713 | 2706 |
| 2714 void WebGL2RenderingContextBase::bindVertexArray(ScriptState* scriptState, WebGL
VertexArrayObject* vertexArray) | 2707 void WebGL2RenderingContextBase::bindVertexArray(WebGLVertexArrayObject* vertexA
rray) |
| 2715 { | 2708 { |
| 2716 if (isContextLost()) | 2709 if (isContextLost()) |
| 2717 return; | 2710 return; |
| 2718 | 2711 |
| 2719 if (vertexArray && (vertexArray->isDeleted() || !vertexArray->validate(0, th
is))) { | 2712 if (vertexArray && (vertexArray->isDeleted() || !vertexArray->validate(0, th
is))) { |
| 2720 synthesizeGLError(GL_INVALID_OPERATION, "bindVertexArray", "invalid vert
exArray"); | 2713 synthesizeGLError(GL_INVALID_OPERATION, "bindVertexArray", "invalid vert
exArray"); |
| 2721 return; | 2714 return; |
| 2722 } | 2715 } |
| 2723 | 2716 |
| 2724 if (vertexArray && !vertexArray->isDefaultObject() && vertexArray->object())
{ | 2717 if (vertexArray && !vertexArray->isDefaultObject() && vertexArray->object())
{ |
| 2725 contextGL()->BindVertexArrayOES(objectOrZero(vertexArray)); | 2718 contextGL()->BindVertexArrayOES(objectOrZero(vertexArray)); |
| 2726 | 2719 |
| 2727 vertexArray->setHasEverBeenBound(); | 2720 vertexArray->setHasEverBeenBound(); |
| 2728 setBoundVertexArrayObject(scriptState, vertexArray); | 2721 setBoundVertexArrayObject(vertexArray); |
| 2729 } else { | 2722 } else { |
| 2730 contextGL()->BindVertexArrayOES(0); | 2723 contextGL()->BindVertexArrayOES(0); |
| 2731 setBoundVertexArrayObject(scriptState, nullptr); | 2724 setBoundVertexArrayObject(nullptr); |
| 2732 } | 2725 } |
| 2733 } | 2726 } |
| 2734 | 2727 |
| 2735 void WebGL2RenderingContextBase::bindFramebuffer(ScriptState* scriptState, GLenu
m target, WebGLFramebuffer* buffer) | 2728 void WebGL2RenderingContextBase::bindFramebuffer(GLenum target, WebGLFramebuffer
* buffer) |
| 2736 { | 2729 { |
| 2737 bool deleted; | 2730 bool deleted; |
| 2738 if (!checkObjectToBeBound("bindFramebuffer", buffer, deleted)) | 2731 if (!checkObjectToBeBound("bindFramebuffer", buffer, deleted)) |
| 2739 return; | 2732 return; |
| 2740 | 2733 |
| 2741 if (deleted) | 2734 if (deleted) |
| 2742 buffer = 0; | 2735 buffer = 0; |
| 2743 | 2736 |
| 2744 switch (target) { | 2737 switch (target) { |
| 2745 case GL_DRAW_FRAMEBUFFER: | 2738 case GL_DRAW_FRAMEBUFFER: |
| 2746 break; | 2739 break; |
| 2747 case GL_FRAMEBUFFER: | 2740 case GL_FRAMEBUFFER: |
| 2748 case GL_READ_FRAMEBUFFER: | 2741 case GL_READ_FRAMEBUFFER: |
| 2749 m_readFramebufferBinding = buffer; | 2742 m_readFramebufferBinding = buffer; |
| 2750 break; | 2743 break; |
| 2751 default: | 2744 default: |
| 2752 synthesizeGLError(GL_INVALID_ENUM, "bindFramebuffer", "invalid target"); | 2745 synthesizeGLError(GL_INVALID_ENUM, "bindFramebuffer", "invalid target"); |
| 2753 return; | 2746 return; |
| 2754 } | 2747 } |
| 2755 | 2748 |
| 2756 setFramebuffer(target, buffer); | 2749 setFramebuffer(target, buffer); |
| 2757 if (scriptState) { | |
| 2758 preserveObjectWrapper(scriptState, this, V8HiddenValue::webglMisc(script
State->isolate()), &m_miscWrappers, static_cast<uint32_t>(PreservedFramebuffer),
buffer); | |
| 2759 } | |
| 2760 } | 2750 } |
| 2761 | 2751 |
| 2762 void WebGL2RenderingContextBase::deleteFramebuffer(WebGLFramebuffer* framebuffer
) | 2752 void WebGL2RenderingContextBase::deleteFramebuffer(WebGLFramebuffer* framebuffer
) |
| 2763 { | 2753 { |
| 2764 if (!deleteObject(framebuffer)) | 2754 if (!deleteObject(framebuffer)) |
| 2765 return; | 2755 return; |
| 2766 GLenum target = 0; | 2756 GLenum target = 0; |
| 2767 if (framebuffer == m_framebufferBinding) { | 2757 if (framebuffer == m_framebufferBinding) { |
| 2768 if (framebuffer == m_readFramebufferBinding) { | 2758 if (framebuffer == m_readFramebufferBinding) { |
| 2769 target = GL_FRAMEBUFFER; | 2759 target = GL_FRAMEBUFFER; |
| (...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3591 if (m_boundTransformFeedbackBuffer == buffer) | 3581 if (m_boundTransformFeedbackBuffer == buffer) |
| 3592 m_boundTransformFeedbackBuffer = nullptr; | 3582 m_boundTransformFeedbackBuffer = nullptr; |
| 3593 if (m_boundUniformBuffer == buffer) | 3583 if (m_boundUniformBuffer == buffer) |
| 3594 m_boundUniformBuffer = nullptr; | 3584 m_boundUniformBuffer = nullptr; |
| 3595 | 3585 |
| 3596 WebGLRenderingContextBase::removeBoundBuffer(buffer); | 3586 WebGLRenderingContextBase::removeBoundBuffer(buffer); |
| 3597 } | 3587 } |
| 3598 | 3588 |
| 3599 void WebGL2RenderingContextBase::restoreCurrentFramebuffer() | 3589 void WebGL2RenderingContextBase::restoreCurrentFramebuffer() |
| 3600 { | 3590 { |
| 3601 bindFramebuffer(nullptr, GL_DRAW_FRAMEBUFFER, m_framebufferBinding.get()); | 3591 bindFramebuffer(GL_DRAW_FRAMEBUFFER, m_framebufferBinding.get()); |
| 3602 bindFramebuffer(nullptr, GL_READ_FRAMEBUFFER, m_readFramebufferBinding.get()
); | 3592 bindFramebuffer(GL_READ_FRAMEBUFFER, m_readFramebufferBinding.get()); |
| 3593 } |
| 3594 |
| 3595 void WebGL2RenderingContextBase::visitChildDOMWrappers(v8::Isolate* isolate, con
st v8::Persistent<v8::Object>& wrapper) |
| 3596 { |
| 3597 if (isContextLost()) { |
| 3598 return; |
| 3599 } |
| 3600 |
| 3601 WebGLRenderingContextBase::visitChildDOMWrappers(isolate, wrapper); |
| 3602 |
| 3603 DOMWrapperWorld::setWrapperReferencesInAllWorlds(wrapper, m_transformFeedbac
kBinding, isolate); |
| 3604 DOMWrapperWorld::setWrapperReferencesInAllWorlds(wrapper, m_readFramebufferB
inding, isolate); |
| 3605 |
| 3606 DOMWrapperWorld::setWrapperReferencesInAllWorlds(wrapper, m_boundCopyReadBuf
fer, isolate); |
| 3607 DOMWrapperWorld::setWrapperReferencesInAllWorlds(wrapper, m_boundCopyWriteBu
ffer, isolate); |
| 3608 DOMWrapperWorld::setWrapperReferencesInAllWorlds(wrapper, m_boundPixelPackBu
ffer, isolate); |
| 3609 DOMWrapperWorld::setWrapperReferencesInAllWorlds(wrapper, m_boundPixelUnpack
Buffer, isolate); |
| 3610 DOMWrapperWorld::setWrapperReferencesInAllWorlds(wrapper, m_boundTransformFe
edbackBuffer, isolate); |
| 3611 DOMWrapperWorld::setWrapperReferencesInAllWorlds(wrapper, m_boundUniformBuff
er, isolate); |
| 3612 |
| 3613 for (auto& buf : m_boundIndexedTransformFeedbackBuffers) { |
| 3614 DOMWrapperWorld::setWrapperReferencesInAllWorlds(wrapper, buf, isolate); |
| 3615 } |
| 3616 |
| 3617 for (auto& buf : m_boundIndexedUniformBuffers) { |
| 3618 DOMWrapperWorld::setWrapperReferencesInAllWorlds(wrapper, buf, isolate); |
| 3619 } |
| 3620 |
| 3621 DOMWrapperWorld::setWrapperReferencesInAllWorlds(wrapper, m_currentBooleanOc
clusionQuery, isolate); |
| 3622 DOMWrapperWorld::setWrapperReferencesInAllWorlds(wrapper, m_currentTransform
FeedbackPrimitivesWrittenQuery, isolate); |
| 3623 |
| 3624 for (auto& unit : m_samplerUnits) { |
| 3625 DOMWrapperWorld::setWrapperReferencesInAllWorlds(wrapper, unit, isolate)
; |
| 3626 } |
| 3603 } | 3627 } |
| 3604 | 3628 |
| 3605 WebGLImageConversion::PixelStoreParams WebGL2RenderingContextBase::getPackPixelS
toreParams() | 3629 WebGLImageConversion::PixelStoreParams WebGL2RenderingContextBase::getPackPixelS
toreParams() |
| 3606 { | 3630 { |
| 3607 WebGLImageConversion::PixelStoreParams params; | 3631 WebGLImageConversion::PixelStoreParams params; |
| 3608 params.alignment = m_packAlignment; | 3632 params.alignment = m_packAlignment; |
| 3609 params.rowLength = m_packRowLength; | 3633 params.rowLength = m_packRowLength; |
| 3610 params.skipPixels = m_packSkipPixels; | 3634 params.skipPixels = m_packSkipPixels; |
| 3611 params.skipRows = m_packSkipRows; | 3635 params.skipRows = m_packSkipRows; |
| 3612 return params; | 3636 return params; |
| 3613 } | 3637 } |
| 3614 | 3638 |
| 3615 WebGLImageConversion::PixelStoreParams WebGL2RenderingContextBase::getUnpackPixe
lStoreParams(TexImageDimension dimension) | 3639 WebGLImageConversion::PixelStoreParams WebGL2RenderingContextBase::getUnpackPixe
lStoreParams(TexImageDimension dimension) |
| 3616 { | 3640 { |
| 3617 WebGLImageConversion::PixelStoreParams params; | 3641 WebGLImageConversion::PixelStoreParams params; |
| 3618 params.alignment = m_unpackAlignment; | 3642 params.alignment = m_unpackAlignment; |
| 3619 params.rowLength = m_unpackRowLength; | 3643 params.rowLength = m_unpackRowLength; |
| 3620 params.skipPixels = m_unpackSkipPixels; | 3644 params.skipPixels = m_unpackSkipPixels; |
| 3621 params.skipRows = m_unpackSkipRows; | 3645 params.skipRows = m_unpackSkipRows; |
| 3622 if (dimension == Tex3D) { | 3646 if (dimension == Tex3D) { |
| 3623 params.imageHeight = m_unpackImageHeight; | 3647 params.imageHeight = m_unpackImageHeight; |
| 3624 params.skipImages = m_unpackSkipImages; | 3648 params.skipImages = m_unpackSkipImages; |
| 3625 } | 3649 } |
| 3626 return params; | 3650 return params; |
| 3627 } | 3651 } |
| 3628 | 3652 |
| 3629 } // namespace blink | 3653 } // namespace blink |
| OLD | NEW |