| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 ContextProviderCreationInfo creationInfo; | 567 ContextProviderCreationInfo creationInfo; |
| 568 creationInfo.contextAttributes = contextAttributes; | 568 creationInfo.contextAttributes = contextAttributes; |
| 569 creationInfo.glInfo = glInfo; | 569 creationInfo.glInfo = glInfo; |
| 570 creationInfo.scriptState = scriptState; | 570 creationInfo.scriptState = scriptState; |
| 571 WebTaskRunner* taskRunner = Platform::current()->mainThread()->getWebTaskRun
ner(); | 571 WebTaskRunner* taskRunner = Platform::current()->mainThread()->getWebTaskRun
ner(); |
| 572 taskRunner->postTask(BLINK_FROM_HERE, crossThreadBind(&createContextProvider
OnMainThread, crossThreadUnretained(&creationInfo), crossThreadUnretained(&waita
bleEvent))); | 572 taskRunner->postTask(BLINK_FROM_HERE, crossThreadBind(&createContextProvider
OnMainThread, crossThreadUnretained(&creationInfo), crossThreadUnretained(&waita
bleEvent))); |
| 573 waitableEvent.wait(); | 573 waitableEvent.wait(); |
| 574 return std::move(creationInfo.createdContextProvider); | 574 return std::move(creationInfo.createdContextProvider); |
| 575 } | 575 } |
| 576 | 576 |
| 577 std::unique_ptr<WebGraphicsContext3DProvider> WebGLRenderingContextBase::createC
ontextProviderInternal(HTMLCanvasElement* canvas, ScriptState* scriptState, WebG
LContextAttributes attributes, unsigned webGLVersion) | 577 std::unique_ptr<WebGraphicsContext3DProvider> WebGLRenderingContextBase::createC
ontextProviderInternal(HTMLCanvasElement* canvas, ScriptState* scriptState, cons
t CanvasContextCreationAttributes& attributes, unsigned webGLVersion) |
| 578 { | 578 { |
| 579 // Exactly one of these must be provided. | 579 // Exactly one of these must be provided. |
| 580 DCHECK_EQ(!canvas, !!scriptState); | 580 DCHECK_EQ(!canvas, !!scriptState); |
| 581 // The canvas is only given on the main thread. | 581 // The canvas is only given on the main thread. |
| 582 DCHECK(!canvas || isMainThread()); | 582 DCHECK(!canvas || isMainThread()); |
| 583 | 583 |
| 584 Platform::ContextAttributes contextAttributes = toPlatformContextAttributes(
attributes, webGLVersion); | 584 Platform::ContextAttributes contextAttributes = toPlatformContextAttributes(
attributes, webGLVersion); |
| 585 Platform::GraphicsInfo glInfo; | 585 Platform::GraphicsInfo glInfo; |
| 586 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider; | 586 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider; |
| 587 if (isMainThread()) { | 587 if (isMainThread()) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 605 } | 605 } |
| 606 gpu::gles2::GLES2Interface* gl = contextProvider->contextGL(); | 606 gpu::gles2::GLES2Interface* gl = contextProvider->contextGL(); |
| 607 if (!String(gl->GetString(GL_EXTENSIONS)).contains("GL_OES_packed_depth_sten
cil")) { | 607 if (!String(gl->GetString(GL_EXTENSIONS)).contains("GL_OES_packed_depth_sten
cil")) { |
| 608 if (canvas) | 608 if (canvas) |
| 609 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webg
lcontextcreationerror, false, true, "OES_packed_depth_stencil support is require
d.")); | 609 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webg
lcontextcreationerror, false, true, "OES_packed_depth_stencil support is require
d.")); |
| 610 return nullptr; | 610 return nullptr; |
| 611 } | 611 } |
| 612 return contextProvider; | 612 return contextProvider; |
| 613 } | 613 } |
| 614 | 614 |
| 615 std::unique_ptr<WebGraphicsContext3DProvider> WebGLRenderingContextBase::createW
ebGraphicsContext3DProvider(HTMLCanvasElement* canvas, WebGLContextAttributes at
tributes, unsigned webGLVersion) | 615 std::unique_ptr<WebGraphicsContext3DProvider> WebGLRenderingContextBase::createW
ebGraphicsContext3DProvider(HTMLCanvasElement* canvas, const CanvasContextCreati
onAttributes& attributes, unsigned webGLVersion) |
| 616 { | 616 { |
| 617 Document& document = canvas->document(); | 617 Document& document = canvas->document(); |
| 618 LocalFrame* frame = document.frame(); | 618 LocalFrame* frame = document.frame(); |
| 619 if (!frame) { | 619 if (!frame) { |
| 620 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Web page was not allowed to create a WebGL cont
ext.")); | 620 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Web page was not allowed to create a WebGL cont
ext.")); |
| 621 return nullptr; | 621 return nullptr; |
| 622 } | 622 } |
| 623 Settings* settings = frame->settings(); | 623 Settings* settings = frame->settings(); |
| 624 | 624 |
| 625 // The FrameLoaderClient might block creation of a new WebGL context despite
the page settings; in | 625 // The FrameLoaderClient might block creation of a new WebGL context despite
the page settings; in |
| 626 // particular, if WebGL contexts were lost one or more times via the GL_ARB_
robustness extension. | 626 // particular, if WebGL contexts were lost one or more times via the GL_ARB_
robustness extension. |
| 627 if (!frame->loader().client()->allowWebGL(settings && settings->webGLEnabled
())) { | 627 if (!frame->loader().client()->allowWebGL(settings && settings->webGLEnabled
())) { |
| 628 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Web page was not allowed to create a WebGL cont
ext.")); | 628 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Web page was not allowed to create a WebGL cont
ext.")); |
| 629 return nullptr; | 629 return nullptr; |
| 630 } | 630 } |
| 631 | 631 |
| 632 return createContextProviderInternal(canvas, nullptr, attributes, webGLVersi
on); | 632 return createContextProviderInternal(canvas, nullptr, attributes, webGLVersi
on); |
| 633 } | 633 } |
| 634 | 634 |
| 635 std::unique_ptr<WebGraphicsContext3DProvider> WebGLRenderingContextBase::createW
ebGraphicsContext3DProvider(ScriptState* scriptState, WebGLContextAttributes att
ributes, unsigned webGLVersion) | 635 std::unique_ptr<WebGraphicsContext3DProvider> WebGLRenderingContextBase::createW
ebGraphicsContext3DProvider(ScriptState* scriptState, const CanvasContextCreatio
nAttributes& attributes, unsigned webGLVersion) |
| 636 { | 636 { |
| 637 return createContextProviderInternal(nullptr, scriptState, attributes, webGL
Version); | 637 return createContextProviderInternal(nullptr, scriptState, attributes, webGL
Version); |
| 638 } | 638 } |
| 639 | 639 |
| 640 void WebGLRenderingContextBase::forceNextWebGLContextCreationToFail() | 640 void WebGLRenderingContextBase::forceNextWebGLContextCreationToFail() |
| 641 { | 641 { |
| 642 shouldFailContextCreationForTesting = true; | 642 shouldFailContextCreationForTesting = true; |
| 643 } | 643 } |
| 644 | 644 |
| 645 ImageBitmap* WebGLRenderingContextBase::transferToImageBitmapBase() | 645 ImageBitmap* WebGLRenderingContextBase::transferToImageBitmapBase() |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 return true; | 881 return true; |
| 882 default: | 882 default: |
| 883 return false; | 883 return false; |
| 884 } | 884 } |
| 885 } | 885 } |
| 886 | 886 |
| 887 } // namespace | 887 } // namespace |
| 888 | 888 |
| 889 WebGLRenderingContextBase::WebGLRenderingContextBase(OffscreenCanvas* passedOffs
creenCanvas, | 889 WebGLRenderingContextBase::WebGLRenderingContextBase(OffscreenCanvas* passedOffs
creenCanvas, |
| 890 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, | 890 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, |
| 891 const WebGLContextAttributes& requestedAttributes, unsigned version) | 891 const CanvasContextCreationAttributes& requestedAttributes, unsigned version
) |
| 892 : WebGLRenderingContextBase(nullptr, passedOffscreenCanvas, std::move(contex
tProvider), requestedAttributes, version) | 892 : WebGLRenderingContextBase(nullptr, passedOffscreenCanvas, std::move(contex
tProvider), requestedAttributes, version) |
| 893 { } | 893 { } |
| 894 | 894 |
| 895 WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCa
nvas, | 895 WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCa
nvas, |
| 896 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, | 896 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, |
| 897 const WebGLContextAttributes& requestedAttributes, unsigned version) | 897 const CanvasContextCreationAttributes& requestedAttributes, unsigned version
) |
| 898 : WebGLRenderingContextBase(passedCanvas, nullptr, std::move(contextProvider
), requestedAttributes, version) | 898 : WebGLRenderingContextBase(passedCanvas, nullptr, std::move(contextProvider
), requestedAttributes, version) |
| 899 { } | 899 { } |
| 900 | 900 |
| 901 WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCa
nvas, | 901 WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCa
nvas, |
| 902 OffscreenCanvas* passedOffscreenCanvas, std::unique_ptr<WebGraphicsContext3D
Provider> contextProvider, | 902 OffscreenCanvas* passedOffscreenCanvas, std::unique_ptr<WebGraphicsContext3D
Provider> contextProvider, |
| 903 const WebGLContextAttributes& requestedAttributes, unsigned version) | 903 const CanvasContextCreationAttributes& requestedAttributes, unsigned version
) |
| 904 : CanvasRenderingContext(passedCanvas, passedOffscreenCanvas) | 904 : CanvasRenderingContext(passedCanvas, passedOffscreenCanvas, requestedAttri
butes) |
| 905 , m_isHidden(false) | 905 , m_isHidden(false) |
| 906 , m_contextLostMode(NotLostContext) | 906 , m_contextLostMode(NotLostContext) |
| 907 , m_autoRecoveryMethod(Manual) | 907 , m_autoRecoveryMethod(Manual) |
| 908 , m_dispatchContextLostEventTimer(this, &WebGLRenderingContextBase::dispatch
ContextLostEvent) | 908 , m_dispatchContextLostEventTimer(this, &WebGLRenderingContextBase::dispatch
ContextLostEvent) |
| 909 , m_restoreAllowed(false) | 909 , m_restoreAllowed(false) |
| 910 , m_restoreTimer(this, &WebGLRenderingContextBase::maybeRestoreContext) | 910 , m_restoreTimer(this, &WebGLRenderingContextBase::maybeRestoreContext) |
| 911 , m_preservedDefaultVAOObjectWrapper(false) | 911 , m_preservedDefaultVAOObjectWrapper(false) |
| 912 , m_generatedImageCache(4) | 912 , m_generatedImageCache(4) |
| 913 , m_requestedAttributes(requestedAttributes) | |
| 914 , m_synthesizedErrorsToConsole(true) | 913 , m_synthesizedErrorsToConsole(true) |
| 915 , m_numGLErrorsToConsoleAllowed(maxGLErrorsAllowedToConsole) | 914 , m_numGLErrorsToConsoleAllowed(maxGLErrorsAllowedToConsole) |
| 916 , m_onePlusMaxNonDefaultTextureUnit(0) | 915 , m_onePlusMaxNonDefaultTextureUnit(0) |
| 917 , m_isWebGL2FormatsTypesAdded(false) | 916 , m_isWebGL2FormatsTypesAdded(false) |
| 918 , m_isWebGL2InternalFormatsCopyTexImageAdded(false) | 917 , m_isWebGL2InternalFormatsCopyTexImageAdded(false) |
| 919 , m_isOESTextureFloatFormatsTypesAdded(false) | 918 , m_isOESTextureFloatFormatsTypesAdded(false) |
| 920 , m_isOESTextureHalfFloatFormatsTypesAdded(false) | 919 , m_isOESTextureHalfFloatFormatsTypesAdded(false) |
| 921 , m_isWebGLDepthTextureFormatsTypesAdded(false) | 920 , m_isWebGLDepthTextureFormatsTypesAdded(false) |
| 922 , m_isEXTsRGBFormatsTypesAdded(false) | 921 , m_isEXTsRGBFormatsTypesAdded(false) |
| 923 , m_version(version) | 922 , m_version(version) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 947 } | 946 } |
| 948 | 947 |
| 949 ADD_VALUES_TO_SET(m_supportedInternalFormats, kSupportedInternalFormatsES2); | 948 ADD_VALUES_TO_SET(m_supportedInternalFormats, kSupportedInternalFormatsES2); |
| 950 ADD_VALUES_TO_SET(m_supportedInternalFormatsCopyTexImage, kSupportedInternal
FormatsES2); | 949 ADD_VALUES_TO_SET(m_supportedInternalFormatsCopyTexImage, kSupportedInternal
FormatsES2); |
| 951 ADD_VALUES_TO_SET(m_supportedFormats, kSupportedFormatsES2); | 950 ADD_VALUES_TO_SET(m_supportedFormats, kSupportedFormatsES2); |
| 952 ADD_VALUES_TO_SET(m_supportedTypes, kSupportedTypesES2); | 951 ADD_VALUES_TO_SET(m_supportedTypes, kSupportedTypesES2); |
| 953 } | 952 } |
| 954 | 953 |
| 955 PassRefPtr<DrawingBuffer> WebGLRenderingContextBase::createDrawingBuffer(std::un
ique_ptr<WebGraphicsContext3DProvider> contextProvider) | 954 PassRefPtr<DrawingBuffer> WebGLRenderingContextBase::createDrawingBuffer(std::un
ique_ptr<WebGraphicsContext3DProvider> contextProvider) |
| 956 { | 955 { |
| 957 bool premultipliedAlpha = m_requestedAttributes.premultipliedAlpha(); | 956 bool premultipliedAlpha = creationAttributes().premultipliedAlpha(); |
| 958 bool wantAlphaChannel = m_requestedAttributes.alpha(); | 957 bool wantAlphaChannel = creationAttributes().alpha(); |
| 959 bool wantDepthBuffer = m_requestedAttributes.depth(); | 958 bool wantDepthBuffer = creationAttributes().depth(); |
| 960 bool wantStencilBuffer = m_requestedAttributes.stencil(); | 959 bool wantStencilBuffer = creationAttributes().stencil(); |
| 961 bool wantAntialiasing = m_requestedAttributes.antialias(); | 960 bool wantAntialiasing = creationAttributes().antialias(); |
| 962 DrawingBuffer::PreserveDrawingBuffer preserve = m_requestedAttributes.preser
veDrawingBuffer() ? DrawingBuffer::Preserve : DrawingBuffer::Discard; | 961 DrawingBuffer::PreserveDrawingBuffer preserve = creationAttributes().preserv
eDrawingBuffer() ? DrawingBuffer::Preserve : DrawingBuffer::Discard; |
| 963 DrawingBuffer::WebGLVersion webGLVersion = DrawingBuffer::WebGL1; | 962 DrawingBuffer::WebGLVersion webGLVersion = DrawingBuffer::WebGL1; |
| 964 if (version() == 1) { | 963 if (version() == 1) { |
| 965 webGLVersion = DrawingBuffer::WebGL1; | 964 webGLVersion = DrawingBuffer::WebGL1; |
| 966 } else if (version() == 2) { | 965 } else if (version() == 2) { |
| 967 webGLVersion = DrawingBuffer::WebGL2; | 966 webGLVersion = DrawingBuffer::WebGL2; |
| 968 } else { | 967 } else { |
| 969 NOTREACHED(); | 968 NOTREACHED(); |
| 970 } | 969 } |
| 971 return DrawingBuffer::create( | 970 return DrawingBuffer::create( |
| 972 std::move(contextProvider), | 971 std::move(contextProvider), |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1345 return false; | 1344 return false; |
| 1346 } | 1345 } |
| 1347 | 1346 |
| 1348 return true; | 1347 return true; |
| 1349 } | 1348 } |
| 1350 | 1349 |
| 1351 ImageData* WebGLRenderingContextBase::paintRenderingResultsToImageData(SourceDra
wingBuffer sourceBuffer) | 1350 ImageData* WebGLRenderingContextBase::paintRenderingResultsToImageData(SourceDra
wingBuffer sourceBuffer) |
| 1352 { | 1351 { |
| 1353 if (isContextLost()) | 1352 if (isContextLost()) |
| 1354 return nullptr; | 1353 return nullptr; |
| 1355 if (m_requestedAttributes.premultipliedAlpha()) | 1354 if (creationAttributes().premultipliedAlpha()) |
| 1356 return nullptr; | 1355 return nullptr; |
| 1357 | 1356 |
| 1358 clearIfComposited(); | 1357 clearIfComposited(); |
| 1359 drawingBuffer()->commit(); | 1358 drawingBuffer()->commit(); |
| 1360 ScopedFramebufferRestorer restorer(this); | 1359 ScopedFramebufferRestorer restorer(this); |
| 1361 int width, height; | 1360 int width, height; |
| 1362 WTF::ArrayBufferContents contents; | 1361 WTF::ArrayBufferContents contents; |
| 1363 if (!drawingBuffer()->paintRenderingResultsToImageData(width, height, source
Buffer, contents)) | 1362 if (!drawingBuffer()->paintRenderingResultsToImageData(width, height, source
Buffer, contents)) |
| 1364 return nullptr; | 1363 return nullptr; |
| 1365 DOMArrayBuffer* imageDataPixels = DOMArrayBuffer::create(contents); | 1364 DOMArrayBuffer* imageDataPixels = DOMArrayBuffer::create(contents); |
| (...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2551 default: | 2550 default: |
| 2552 synthesizeGLError(GL_INVALID_ENUM, "getBufferParameter", "invalid parame
ter name"); | 2551 synthesizeGLError(GL_INVALID_ENUM, "getBufferParameter", "invalid parame
ter name"); |
| 2553 return ScriptValue::createNull(scriptState); | 2552 return ScriptValue::createNull(scriptState); |
| 2554 } | 2553 } |
| 2555 } | 2554 } |
| 2556 | 2555 |
| 2557 void WebGLRenderingContextBase::getContextAttributes(Nullable<WebGLContextAttrib
utes>& result) | 2556 void WebGLRenderingContextBase::getContextAttributes(Nullable<WebGLContextAttrib
utes>& result) |
| 2558 { | 2557 { |
| 2559 if (isContextLost()) | 2558 if (isContextLost()) |
| 2560 return; | 2559 return; |
| 2561 result.set(m_requestedAttributes); | 2560 result.set(toWebGLContextAttributes(creationAttributes())); |
| 2562 // Some requested attributes may not be honored, so we need to query the und
erlying | 2561 // Some requested attributes may not be honored, so we need to query the und
erlying |
| 2563 // context/drawing buffer and adjust accordingly. | 2562 // context/drawing buffer and adjust accordingly. |
| 2564 if (m_requestedAttributes.depth() && !drawingBuffer()->hasDepthBuffer()) | 2563 if (creationAttributes().depth() && !drawingBuffer()->hasDepthBuffer()) |
| 2565 result.get().setDepth(false); | 2564 result.get().setDepth(false); |
| 2566 if (m_requestedAttributes.stencil() && !drawingBuffer()->hasStencilBuffer()) | 2565 if (creationAttributes().stencil() && !drawingBuffer()->hasStencilBuffer()) |
| 2567 result.get().setStencil(false); | 2566 result.get().setStencil(false); |
| 2568 result.get().setAntialias(drawingBuffer()->multisample()); | 2567 result.get().setAntialias(drawingBuffer()->multisample()); |
| 2569 } | 2568 } |
| 2570 | 2569 |
| 2571 GLenum WebGLRenderingContextBase::getError() | 2570 GLenum WebGLRenderingContextBase::getError() |
| 2572 { | 2571 { |
| 2573 if (!m_lostContextErrors.isEmpty()) { | 2572 if (!m_lostContextErrors.isEmpty()) { |
| 2574 GLenum error = m_lostContextErrors.first(); | 2573 GLenum error = m_lostContextErrors.first(); |
| 2575 m_lostContextErrors.remove(0); | 2574 m_lostContextErrors.remove(0); |
| 2576 return error; | 2575 return error; |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2758 return getBooleanArrayParameter(scriptState, pname); | 2757 return getBooleanArrayParameter(scriptState, pname); |
| 2759 case GL_COMPRESSED_TEXTURE_FORMATS: | 2758 case GL_COMPRESSED_TEXTURE_FORMATS: |
| 2760 return WebGLAny(scriptState, DOMUint32Array::create(m_compressedTextureF
ormats.data(), m_compressedTextureFormats.size())); | 2759 return WebGLAny(scriptState, DOMUint32Array::create(m_compressedTextureF
ormats.data(), m_compressedTextureFormats.size())); |
| 2761 case GL_CULL_FACE: | 2760 case GL_CULL_FACE: |
| 2762 return getBooleanParameter(scriptState, pname); | 2761 return getBooleanParameter(scriptState, pname); |
| 2763 case GL_CULL_FACE_MODE: | 2762 case GL_CULL_FACE_MODE: |
| 2764 return getUnsignedIntParameter(scriptState, pname); | 2763 return getUnsignedIntParameter(scriptState, pname); |
| 2765 case GL_CURRENT_PROGRAM: | 2764 case GL_CURRENT_PROGRAM: |
| 2766 return WebGLAny(scriptState, m_currentProgram.get()); | 2765 return WebGLAny(scriptState, m_currentProgram.get()); |
| 2767 case GL_DEPTH_BITS: | 2766 case GL_DEPTH_BITS: |
| 2768 if (!m_framebufferBinding && !m_requestedAttributes.depth()) | 2767 if (!m_framebufferBinding && !creationAttributes().depth()) |
| 2769 return WebGLAny(scriptState, intZero); | 2768 return WebGLAny(scriptState, intZero); |
| 2770 return getIntParameter(scriptState, pname); | 2769 return getIntParameter(scriptState, pname); |
| 2771 case GL_DEPTH_CLEAR_VALUE: | 2770 case GL_DEPTH_CLEAR_VALUE: |
| 2772 return getFloatParameter(scriptState, pname); | 2771 return getFloatParameter(scriptState, pname); |
| 2773 case GL_DEPTH_FUNC: | 2772 case GL_DEPTH_FUNC: |
| 2774 return getUnsignedIntParameter(scriptState, pname); | 2773 return getUnsignedIntParameter(scriptState, pname); |
| 2775 case GL_DEPTH_RANGE: | 2774 case GL_DEPTH_RANGE: |
| 2776 return getWebGLFloatArrayParameter(scriptState, pname); | 2775 return getWebGLFloatArrayParameter(scriptState, pname); |
| 2777 case GL_DEPTH_TEST: | 2776 case GL_DEPTH_TEST: |
| 2778 return getBooleanParameter(scriptState, pname); | 2777 return getBooleanParameter(scriptState, pname); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2857 return getUnsignedIntParameter(scriptState, pname); | 2856 return getUnsignedIntParameter(scriptState, pname); |
| 2858 case GL_STENCIL_BACK_PASS_DEPTH_PASS: | 2857 case GL_STENCIL_BACK_PASS_DEPTH_PASS: |
| 2859 return getUnsignedIntParameter(scriptState, pname); | 2858 return getUnsignedIntParameter(scriptState, pname); |
| 2860 case GL_STENCIL_BACK_REF: | 2859 case GL_STENCIL_BACK_REF: |
| 2861 return getIntParameter(scriptState, pname); | 2860 return getIntParameter(scriptState, pname); |
| 2862 case GL_STENCIL_BACK_VALUE_MASK: | 2861 case GL_STENCIL_BACK_VALUE_MASK: |
| 2863 return getUnsignedIntParameter(scriptState, pname); | 2862 return getUnsignedIntParameter(scriptState, pname); |
| 2864 case GL_STENCIL_BACK_WRITEMASK: | 2863 case GL_STENCIL_BACK_WRITEMASK: |
| 2865 return getUnsignedIntParameter(scriptState, pname); | 2864 return getUnsignedIntParameter(scriptState, pname); |
| 2866 case GL_STENCIL_BITS: | 2865 case GL_STENCIL_BITS: |
| 2867 if (!m_framebufferBinding && !m_requestedAttributes.stencil()) | 2866 if (!m_framebufferBinding && !creationAttributes().stencil()) |
| 2868 return WebGLAny(scriptState, intZero); | 2867 return WebGLAny(scriptState, intZero); |
| 2869 return getIntParameter(scriptState, pname); | 2868 return getIntParameter(scriptState, pname); |
| 2870 case GL_STENCIL_CLEAR_VALUE: | 2869 case GL_STENCIL_CLEAR_VALUE: |
| 2871 return getIntParameter(scriptState, pname); | 2870 return getIntParameter(scriptState, pname); |
| 2872 case GL_STENCIL_FAIL: | 2871 case GL_STENCIL_FAIL: |
| 2873 return getUnsignedIntParameter(scriptState, pname); | 2872 return getUnsignedIntParameter(scriptState, pname); |
| 2874 case GL_STENCIL_FUNC: | 2873 case GL_STENCIL_FUNC: |
| 2875 return getUnsignedIntParameter(scriptState, pname); | 2874 return getUnsignedIntParameter(scriptState, pname); |
| 2876 case GL_STENCIL_PASS_DEPTH_FAIL: | 2875 case GL_STENCIL_PASS_DEPTH_FAIL: |
| 2877 return getUnsignedIntParameter(scriptState, pname); | 2876 return getUnsignedIntParameter(scriptState, pname); |
| (...skipping 3262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6140 | 6139 |
| 6141 if (!frame->loader().client()->allowWebGL(settings && settings->webGLEnabled
())) | 6140 if (!frame->loader().client()->allowWebGL(settings && settings->webGLEnabled
())) |
| 6142 return; | 6141 return; |
| 6143 | 6142 |
| 6144 // If the context was lost due to RealLostContext, we need to destroy the ol
d DrawingBuffer before creating new DrawingBuffer to ensure resource budget enou
gh. | 6143 // If the context was lost due to RealLostContext, we need to destroy the ol
d DrawingBuffer before creating new DrawingBuffer to ensure resource budget enou
gh. |
| 6145 if (drawingBuffer()) { | 6144 if (drawingBuffer()) { |
| 6146 m_drawingBuffer->beginDestruction(); | 6145 m_drawingBuffer->beginDestruction(); |
| 6147 m_drawingBuffer.clear(); | 6146 m_drawingBuffer.clear(); |
| 6148 } | 6147 } |
| 6149 | 6148 |
| 6150 Platform::ContextAttributes attributes = toPlatformContextAttributes(m_reque
stedAttributes, version()); | 6149 Platform::ContextAttributes attributes = toPlatformContextAttributes(creatio
nAttributes(), version()); |
| 6151 Platform::GraphicsInfo glInfo; | 6150 Platform::GraphicsInfo glInfo; |
| 6152 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider = wrapUnique(P
latform::current()->createOffscreenGraphicsContext3DProvider( | 6151 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider = wrapUnique(P
latform::current()->createOffscreenGraphicsContext3DProvider( |
| 6153 attributes, canvas()->document().topDocument().url(), 0, &glInfo)); | 6152 attributes, canvas()->document().topDocument().url(), 0, &glInfo)); |
| 6154 RefPtr<DrawingBuffer> buffer; | 6153 RefPtr<DrawingBuffer> buffer; |
| 6155 if (contextProvider && contextProvider->bindToCurrentThread()) { | 6154 if (contextProvider && contextProvider->bindToCurrentThread()) { |
| 6156 // Construct a new drawing buffer with the new GL context. | 6155 // Construct a new drawing buffer with the new GL context. |
| 6157 buffer = createDrawingBuffer(std::move(contextProvider)); | 6156 buffer = createDrawingBuffer(std::move(contextProvider)); |
| 6158 // If DrawingBuffer::create() fails to allocate a fbo, |drawingBuffer| i
s set to null. | 6157 // If DrawingBuffer::create() fails to allocate a fbo, |drawingBuffer| i
s set to null. |
| 6159 } | 6158 } |
| 6160 if (!buffer) { | 6159 if (!buffer) { |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6491 | 6490 |
| 6492 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(HTMLCanvasElementOrOffs
creenCanvas& result) const | 6491 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(HTMLCanvasElementOrOffs
creenCanvas& result) const |
| 6493 { | 6492 { |
| 6494 if (canvas()) | 6493 if (canvas()) |
| 6495 result.setHTMLCanvasElement(canvas()); | 6494 result.setHTMLCanvasElement(canvas()); |
| 6496 else | 6495 else |
| 6497 result.setOffscreenCanvas(getOffscreenCanvas()); | 6496 result.setOffscreenCanvas(getOffscreenCanvas()); |
| 6498 } | 6497 } |
| 6499 | 6498 |
| 6500 } // namespace blink | 6499 } // namespace blink |
| OLD | NEW |