| 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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 ContextProviderCreationInfo creationInfo; | 566 ContextProviderCreationInfo creationInfo; |
| 567 creationInfo.contextAttributes = contextAttributes; | 567 creationInfo.contextAttributes = contextAttributes; |
| 568 creationInfo.glInfo = glInfo; | 568 creationInfo.glInfo = glInfo; |
| 569 creationInfo.scriptState = scriptState; | 569 creationInfo.scriptState = scriptState; |
| 570 WebTaskRunner* taskRunner = Platform::current()->mainThread()->getWebTaskRun
ner(); | 570 WebTaskRunner* taskRunner = Platform::current()->mainThread()->getWebTaskRun
ner(); |
| 571 taskRunner->postTask(BLINK_FROM_HERE, crossThreadBind(&createContextProvider
OnMainThread, crossThreadUnretained(&creationInfo), crossThreadUnretained(&waita
bleEvent))); | 571 taskRunner->postTask(BLINK_FROM_HERE, crossThreadBind(&createContextProvider
OnMainThread, crossThreadUnretained(&creationInfo), crossThreadUnretained(&waita
bleEvent))); |
| 572 waitableEvent.wait(); | 572 waitableEvent.wait(); |
| 573 return std::move(creationInfo.createdContextProvider); | 573 return std::move(creationInfo.createdContextProvider); |
| 574 } | 574 } |
| 575 | 575 |
| 576 std::unique_ptr<WebGraphicsContext3DProvider> WebGLRenderingContextBase::createC
ontextProviderInternal(HTMLCanvasElement* canvas, ScriptState* scriptState, WebG
LContextAttributes attributes, unsigned webGLVersion) | 576 std::unique_ptr<WebGraphicsContext3DProvider> WebGLRenderingContextBase::createC
ontextProviderInternal(HTMLCanvasElement* canvas, ScriptState* scriptState, cons
t CanvasContextCreationAttributes& attributes, unsigned webGLVersion) |
| 577 { | 577 { |
| 578 // Exactly one of these must be provided. | 578 // Exactly one of these must be provided. |
| 579 DCHECK_EQ(!canvas, !!scriptState); | 579 DCHECK_EQ(!canvas, !!scriptState); |
| 580 // The canvas is only given on the main thread. | 580 // The canvas is only given on the main thread. |
| 581 DCHECK(!canvas || isMainThread()); | 581 DCHECK(!canvas || isMainThread()); |
| 582 | 582 |
| 583 Platform::ContextAttributes contextAttributes = toPlatformContextAttributes(
attributes, webGLVersion); | 583 Platform::ContextAttributes contextAttributes = toPlatformContextAttributes(
attributes, webGLVersion); |
| 584 Platform::GraphicsInfo glInfo; | 584 Platform::GraphicsInfo glInfo; |
| 585 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider; | 585 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider; |
| 586 if (isMainThread()) { | 586 if (isMainThread()) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 604 } | 604 } |
| 605 gpu::gles2::GLES2Interface* gl = contextProvider->contextGL(); | 605 gpu::gles2::GLES2Interface* gl = contextProvider->contextGL(); |
| 606 if (!String(gl->GetString(GL_EXTENSIONS)).contains("GL_OES_packed_depth_sten
cil")) { | 606 if (!String(gl->GetString(GL_EXTENSIONS)).contains("GL_OES_packed_depth_sten
cil")) { |
| 607 if (canvas) | 607 if (canvas) |
| 608 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webg
lcontextcreationerror, false, true, "OES_packed_depth_stencil support is require
d.")); | 608 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webg
lcontextcreationerror, false, true, "OES_packed_depth_stencil support is require
d.")); |
| 609 return nullptr; | 609 return nullptr; |
| 610 } | 610 } |
| 611 return contextProvider; | 611 return contextProvider; |
| 612 } | 612 } |
| 613 | 613 |
| 614 std::unique_ptr<WebGraphicsContext3DProvider> WebGLRenderingContextBase::createW
ebGraphicsContext3DProvider(HTMLCanvasElement* canvas, WebGLContextAttributes at
tributes, unsigned webGLVersion) | 614 std::unique_ptr<WebGraphicsContext3DProvider> WebGLRenderingContextBase::createW
ebGraphicsContext3DProvider(HTMLCanvasElement* canvas, const CanvasContextCreati
onAttributes& attributes, unsigned webGLVersion) |
| 615 { | 615 { |
| 616 Document& document = canvas->document(); | 616 Document& document = canvas->document(); |
| 617 LocalFrame* frame = document.frame(); | 617 LocalFrame* frame = document.frame(); |
| 618 if (!frame) { | 618 if (!frame) { |
| 619 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Web page was not allowed to create a WebGL cont
ext.")); | 619 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Web page was not allowed to create a WebGL cont
ext.")); |
| 620 return nullptr; | 620 return nullptr; |
| 621 } | 621 } |
| 622 Settings* settings = frame->settings(); | 622 Settings* settings = frame->settings(); |
| 623 | 623 |
| 624 // The FrameLoaderClient might block creation of a new WebGL context despite
the page settings; in | 624 // The FrameLoaderClient might block creation of a new WebGL context despite
the page settings; in |
| 625 // particular, if WebGL contexts were lost one or more times via the GL_ARB_
robustness extension. | 625 // particular, if WebGL contexts were lost one or more times via the GL_ARB_
robustness extension. |
| 626 if (!frame->loader().client()->allowWebGL(settings && settings->webGLEnabled
())) { | 626 if (!frame->loader().client()->allowWebGL(settings && settings->webGLEnabled
())) { |
| 627 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Web page was not allowed to create a WebGL cont
ext.")); | 627 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Web page was not allowed to create a WebGL cont
ext.")); |
| 628 return nullptr; | 628 return nullptr; |
| 629 } | 629 } |
| 630 | 630 |
| 631 return createContextProviderInternal(canvas, nullptr, attributes, webGLVersi
on); | 631 return createContextProviderInternal(canvas, nullptr, attributes, webGLVersi
on); |
| 632 } | 632 } |
| 633 | 633 |
| 634 std::unique_ptr<WebGraphicsContext3DProvider> WebGLRenderingContextBase::createW
ebGraphicsContext3DProvider(ScriptState* scriptState, WebGLContextAttributes att
ributes, unsigned webGLVersion) | 634 std::unique_ptr<WebGraphicsContext3DProvider> WebGLRenderingContextBase::createW
ebGraphicsContext3DProvider(ScriptState* scriptState, const CanvasContextCreatio
nAttributes& attributes, unsigned webGLVersion) |
| 635 { | 635 { |
| 636 return createContextProviderInternal(nullptr, scriptState, attributes, webGL
Version); | 636 return createContextProviderInternal(nullptr, scriptState, attributes, webGL
Version); |
| 637 } | 637 } |
| 638 | 638 |
| 639 void WebGLRenderingContextBase::forceNextWebGLContextCreationToFail() | 639 void WebGLRenderingContextBase::forceNextWebGLContextCreationToFail() |
| 640 { | 640 { |
| 641 shouldFailContextCreationForTesting = true; | 641 shouldFailContextCreationForTesting = true; |
| 642 } | 642 } |
| 643 | 643 |
| 644 ImageBitmap* WebGLRenderingContextBase::transferToImageBitmapBase() | 644 ImageBitmap* WebGLRenderingContextBase::transferToImageBitmapBase() |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 893 return true; | 893 return true; |
| 894 default: | 894 default: |
| 895 return false; | 895 return false; |
| 896 } | 896 } |
| 897 } | 897 } |
| 898 | 898 |
| 899 } // namespace | 899 } // namespace |
| 900 | 900 |
| 901 WebGLRenderingContextBase::WebGLRenderingContextBase(OffscreenCanvas* passedOffs
creenCanvas, | 901 WebGLRenderingContextBase::WebGLRenderingContextBase(OffscreenCanvas* passedOffs
creenCanvas, |
| 902 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, | 902 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, |
| 903 const WebGLContextAttributes& requestedAttributes, unsigned version) | 903 const CanvasContextCreationAttributes& requestedAttributes, unsigned version
) |
| 904 : WebGLRenderingContextBase(nullptr, passedOffscreenCanvas, std::move(contex
tProvider), requestedAttributes, version) | 904 : WebGLRenderingContextBase(nullptr, passedOffscreenCanvas, std::move(contex
tProvider), requestedAttributes, version) |
| 905 { } | 905 { } |
| 906 | 906 |
| 907 WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCa
nvas, | 907 WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCa
nvas, |
| 908 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, | 908 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, |
| 909 const WebGLContextAttributes& requestedAttributes, unsigned version) | 909 const CanvasContextCreationAttributes& requestedAttributes, unsigned version
) |
| 910 : WebGLRenderingContextBase(passedCanvas, nullptr, std::move(contextProvider
), requestedAttributes, version) | 910 : WebGLRenderingContextBase(passedCanvas, nullptr, std::move(contextProvider
), requestedAttributes, version) |
| 911 { } | 911 { } |
| 912 | 912 |
| 913 WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCa
nvas, | 913 WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCa
nvas, |
| 914 OffscreenCanvas* passedOffscreenCanvas, std::unique_ptr<WebGraphicsContext3D
Provider> contextProvider, | 914 OffscreenCanvas* passedOffscreenCanvas, std::unique_ptr<WebGraphicsContext3D
Provider> contextProvider, |
| 915 const WebGLContextAttributes& requestedAttributes, unsigned version) | 915 const CanvasContextCreationAttributes& requestedAttributes, unsigned version
) |
| 916 : CanvasRenderingContext(passedCanvas, passedOffscreenCanvas) | 916 : CanvasRenderingContext(passedCanvas, passedOffscreenCanvas, requestedAttri
butes) |
| 917 , m_isHidden(false) | 917 , m_isHidden(false) |
| 918 , m_contextLostMode(NotLostContext) | 918 , m_contextLostMode(NotLostContext) |
| 919 , m_autoRecoveryMethod(Manual) | 919 , m_autoRecoveryMethod(Manual) |
| 920 , m_dispatchContextLostEventTimer(this, &WebGLRenderingContextBase::dispatch
ContextLostEvent) | 920 , m_dispatchContextLostEventTimer(this, &WebGLRenderingContextBase::dispatch
ContextLostEvent) |
| 921 , m_restoreAllowed(false) | 921 , m_restoreAllowed(false) |
| 922 , m_restoreTimer(this, &WebGLRenderingContextBase::maybeRestoreContext) | 922 , m_restoreTimer(this, &WebGLRenderingContextBase::maybeRestoreContext) |
| 923 , m_preservedDefaultVAOObjectWrapper(false) | 923 , m_preservedDefaultVAOObjectWrapper(false) |
| 924 , m_generatedImageCache(4) | 924 , m_generatedImageCache(4) |
| 925 , m_requestedAttributes(requestedAttributes) | |
| 926 , m_synthesizedErrorsToConsole(true) | 925 , m_synthesizedErrorsToConsole(true) |
| 927 , m_numGLErrorsToConsoleAllowed(maxGLErrorsAllowedToConsole) | 926 , m_numGLErrorsToConsoleAllowed(maxGLErrorsAllowedToConsole) |
| 928 , m_onePlusMaxNonDefaultTextureUnit(0) | 927 , m_onePlusMaxNonDefaultTextureUnit(0) |
| 929 , m_isWebGL2FormatsTypesAdded(false) | 928 , m_isWebGL2FormatsTypesAdded(false) |
| 930 , m_isWebGL2InternalFormatsCopyTexImageAdded(false) | 929 , m_isWebGL2InternalFormatsCopyTexImageAdded(false) |
| 931 , m_isOESTextureFloatFormatsTypesAdded(false) | 930 , m_isOESTextureFloatFormatsTypesAdded(false) |
| 932 , m_isOESTextureHalfFloatFormatsTypesAdded(false) | 931 , m_isOESTextureHalfFloatFormatsTypesAdded(false) |
| 933 , m_isWebGLDepthTextureFormatsTypesAdded(false) | 932 , m_isWebGLDepthTextureFormatsTypesAdded(false) |
| 934 , m_isEXTsRGBFormatsTypesAdded(false) | 933 , m_isEXTsRGBFormatsTypesAdded(false) |
| 935 , m_version(version) | 934 , m_version(version) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 959 } | 958 } |
| 960 | 959 |
| 961 ADD_VALUES_TO_SET(m_supportedInternalFormats, kSupportedInternalFormatsES2); | 960 ADD_VALUES_TO_SET(m_supportedInternalFormats, kSupportedInternalFormatsES2); |
| 962 ADD_VALUES_TO_SET(m_supportedInternalFormatsCopyTexImage, kSupportedInternal
FormatsES2); | 961 ADD_VALUES_TO_SET(m_supportedInternalFormatsCopyTexImage, kSupportedInternal
FormatsES2); |
| 963 ADD_VALUES_TO_SET(m_supportedFormats, kSupportedFormatsES2); | 962 ADD_VALUES_TO_SET(m_supportedFormats, kSupportedFormatsES2); |
| 964 ADD_VALUES_TO_SET(m_supportedTypes, kSupportedTypesES2); | 963 ADD_VALUES_TO_SET(m_supportedTypes, kSupportedTypesES2); |
| 965 } | 964 } |
| 966 | 965 |
| 967 PassRefPtr<DrawingBuffer> WebGLRenderingContextBase::createDrawingBuffer(std::un
ique_ptr<WebGraphicsContext3DProvider> contextProvider) | 966 PassRefPtr<DrawingBuffer> WebGLRenderingContextBase::createDrawingBuffer(std::un
ique_ptr<WebGraphicsContext3DProvider> contextProvider) |
| 968 { | 967 { |
| 969 bool premultipliedAlpha = m_requestedAttributes.premultipliedAlpha(); | 968 bool premultipliedAlpha = creationAttributes().premultipliedAlpha(); |
| 970 bool wantAlphaChannel = m_requestedAttributes.alpha(); | 969 bool wantAlphaChannel = creationAttributes().alpha(); |
| 971 bool wantDepthBuffer = m_requestedAttributes.depth(); | 970 bool wantDepthBuffer = creationAttributes().depth(); |
| 972 bool wantStencilBuffer = m_requestedAttributes.stencil(); | 971 bool wantStencilBuffer = creationAttributes().stencil(); |
| 973 bool wantAntialiasing = m_requestedAttributes.antialias(); | 972 bool wantAntialiasing = creationAttributes().antialias(); |
| 974 DrawingBuffer::PreserveDrawingBuffer preserve = m_requestedAttributes.preser
veDrawingBuffer() ? DrawingBuffer::Preserve : DrawingBuffer::Discard; | 973 DrawingBuffer::PreserveDrawingBuffer preserve = creationAttributes().preserv
eDrawingBuffer() ? DrawingBuffer::Preserve : DrawingBuffer::Discard; |
| 975 DrawingBuffer::WebGLVersion webGLVersion = DrawingBuffer::WebGL1; | 974 DrawingBuffer::WebGLVersion webGLVersion = DrawingBuffer::WebGL1; |
| 976 if (version() == 1) { | 975 if (version() == 1) { |
| 977 webGLVersion = DrawingBuffer::WebGL1; | 976 webGLVersion = DrawingBuffer::WebGL1; |
| 978 } else if (version() == 2) { | 977 } else if (version() == 2) { |
| 979 webGLVersion = DrawingBuffer::WebGL2; | 978 webGLVersion = DrawingBuffer::WebGL2; |
| 980 } else { | 979 } else { |
| 981 NOTREACHED(); | 980 NOTREACHED(); |
| 982 } | 981 } |
| 983 return DrawingBuffer::create( | 982 return DrawingBuffer::create( |
| 984 std::move(contextProvider), | 983 std::move(contextProvider), |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1357 return false; | 1356 return false; |
| 1358 } | 1357 } |
| 1359 | 1358 |
| 1360 return true; | 1359 return true; |
| 1361 } | 1360 } |
| 1362 | 1361 |
| 1363 ImageData* WebGLRenderingContextBase::paintRenderingResultsToImageData(SourceDra
wingBuffer sourceBuffer) | 1362 ImageData* WebGLRenderingContextBase::paintRenderingResultsToImageData(SourceDra
wingBuffer sourceBuffer) |
| 1364 { | 1363 { |
| 1365 if (isContextLost()) | 1364 if (isContextLost()) |
| 1366 return nullptr; | 1365 return nullptr; |
| 1367 if (m_requestedAttributes.premultipliedAlpha()) | 1366 if (creationAttributes().premultipliedAlpha()) |
| 1368 return nullptr; | 1367 return nullptr; |
| 1369 | 1368 |
| 1370 clearIfComposited(); | 1369 clearIfComposited(); |
| 1371 drawingBuffer()->commit(); | 1370 drawingBuffer()->commit(); |
| 1372 ScopedFramebufferRestorer restorer(this); | 1371 ScopedFramebufferRestorer restorer(this); |
| 1373 int width, height; | 1372 int width, height; |
| 1374 WTF::ArrayBufferContents contents; | 1373 WTF::ArrayBufferContents contents; |
| 1375 if (!drawingBuffer()->paintRenderingResultsToImageData(width, height, source
Buffer, contents)) | 1374 if (!drawingBuffer()->paintRenderingResultsToImageData(width, height, source
Buffer, contents)) |
| 1376 return nullptr; | 1375 return nullptr; |
| 1377 DOMArrayBuffer* imageDataPixels = DOMArrayBuffer::create(contents); | 1376 DOMArrayBuffer* imageDataPixels = DOMArrayBuffer::create(contents); |
| (...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2563 default: | 2562 default: |
| 2564 synthesizeGLError(GL_INVALID_ENUM, "getBufferParameter", "invalid parame
ter name"); | 2563 synthesizeGLError(GL_INVALID_ENUM, "getBufferParameter", "invalid parame
ter name"); |
| 2565 return ScriptValue::createNull(scriptState); | 2564 return ScriptValue::createNull(scriptState); |
| 2566 } | 2565 } |
| 2567 } | 2566 } |
| 2568 | 2567 |
| 2569 void WebGLRenderingContextBase::getContextAttributes(Nullable<WebGLContextAttrib
utes>& result) | 2568 void WebGLRenderingContextBase::getContextAttributes(Nullable<WebGLContextAttrib
utes>& result) |
| 2570 { | 2569 { |
| 2571 if (isContextLost()) | 2570 if (isContextLost()) |
| 2572 return; | 2571 return; |
| 2573 result.set(m_requestedAttributes); | 2572 result.set(toWebGLContextAttributes(creationAttributes())); |
| 2574 // Some requested attributes may not be honored, so we need to query the und
erlying | 2573 // Some requested attributes may not be honored, so we need to query the und
erlying |
| 2575 // context/drawing buffer and adjust accordingly. | 2574 // context/drawing buffer and adjust accordingly. |
| 2576 if (m_requestedAttributes.depth() && !drawingBuffer()->hasDepthBuffer()) | 2575 if (creationAttributes().depth() && !drawingBuffer()->hasDepthBuffer()) |
| 2577 result.get().setDepth(false); | 2576 result.get().setDepth(false); |
| 2578 if (m_requestedAttributes.stencil() && !drawingBuffer()->hasStencilBuffer()) | 2577 if (creationAttributes().stencil() && !drawingBuffer()->hasStencilBuffer()) |
| 2579 result.get().setStencil(false); | 2578 result.get().setStencil(false); |
| 2580 result.get().setAntialias(drawingBuffer()->multisample()); | 2579 result.get().setAntialias(drawingBuffer()->multisample()); |
| 2581 } | 2580 } |
| 2582 | 2581 |
| 2583 GLenum WebGLRenderingContextBase::getError() | 2582 GLenum WebGLRenderingContextBase::getError() |
| 2584 { | 2583 { |
| 2585 if (!m_lostContextErrors.isEmpty()) { | 2584 if (!m_lostContextErrors.isEmpty()) { |
| 2586 GLenum error = m_lostContextErrors.first(); | 2585 GLenum error = m_lostContextErrors.first(); |
| 2587 m_lostContextErrors.remove(0); | 2586 m_lostContextErrors.remove(0); |
| 2588 return error; | 2587 return error; |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2770 return getBooleanArrayParameter(scriptState, pname); | 2769 return getBooleanArrayParameter(scriptState, pname); |
| 2771 case GL_COMPRESSED_TEXTURE_FORMATS: | 2770 case GL_COMPRESSED_TEXTURE_FORMATS: |
| 2772 return WebGLAny(scriptState, DOMUint32Array::create(m_compressedTextureF
ormats.data(), m_compressedTextureFormats.size())); | 2771 return WebGLAny(scriptState, DOMUint32Array::create(m_compressedTextureF
ormats.data(), m_compressedTextureFormats.size())); |
| 2773 case GL_CULL_FACE: | 2772 case GL_CULL_FACE: |
| 2774 return getBooleanParameter(scriptState, pname); | 2773 return getBooleanParameter(scriptState, pname); |
| 2775 case GL_CULL_FACE_MODE: | 2774 case GL_CULL_FACE_MODE: |
| 2776 return getUnsignedIntParameter(scriptState, pname); | 2775 return getUnsignedIntParameter(scriptState, pname); |
| 2777 case GL_CURRENT_PROGRAM: | 2776 case GL_CURRENT_PROGRAM: |
| 2778 return WebGLAny(scriptState, m_currentProgram.get()); | 2777 return WebGLAny(scriptState, m_currentProgram.get()); |
| 2779 case GL_DEPTH_BITS: | 2778 case GL_DEPTH_BITS: |
| 2780 if (!m_framebufferBinding && !m_requestedAttributes.depth()) | 2779 if (!m_framebufferBinding && !creationAttributes().depth()) |
| 2781 return WebGLAny(scriptState, intZero); | 2780 return WebGLAny(scriptState, intZero); |
| 2782 return getIntParameter(scriptState, pname); | 2781 return getIntParameter(scriptState, pname); |
| 2783 case GL_DEPTH_CLEAR_VALUE: | 2782 case GL_DEPTH_CLEAR_VALUE: |
| 2784 return getFloatParameter(scriptState, pname); | 2783 return getFloatParameter(scriptState, pname); |
| 2785 case GL_DEPTH_FUNC: | 2784 case GL_DEPTH_FUNC: |
| 2786 return getUnsignedIntParameter(scriptState, pname); | 2785 return getUnsignedIntParameter(scriptState, pname); |
| 2787 case GL_DEPTH_RANGE: | 2786 case GL_DEPTH_RANGE: |
| 2788 return getWebGLFloatArrayParameter(scriptState, pname); | 2787 return getWebGLFloatArrayParameter(scriptState, pname); |
| 2789 case GL_DEPTH_TEST: | 2788 case GL_DEPTH_TEST: |
| 2790 return getBooleanParameter(scriptState, pname); | 2789 return getBooleanParameter(scriptState, pname); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2869 return getUnsignedIntParameter(scriptState, pname); | 2868 return getUnsignedIntParameter(scriptState, pname); |
| 2870 case GL_STENCIL_BACK_PASS_DEPTH_PASS: | 2869 case GL_STENCIL_BACK_PASS_DEPTH_PASS: |
| 2871 return getUnsignedIntParameter(scriptState, pname); | 2870 return getUnsignedIntParameter(scriptState, pname); |
| 2872 case GL_STENCIL_BACK_REF: | 2871 case GL_STENCIL_BACK_REF: |
| 2873 return getIntParameter(scriptState, pname); | 2872 return getIntParameter(scriptState, pname); |
| 2874 case GL_STENCIL_BACK_VALUE_MASK: | 2873 case GL_STENCIL_BACK_VALUE_MASK: |
| 2875 return getUnsignedIntParameter(scriptState, pname); | 2874 return getUnsignedIntParameter(scriptState, pname); |
| 2876 case GL_STENCIL_BACK_WRITEMASK: | 2875 case GL_STENCIL_BACK_WRITEMASK: |
| 2877 return getUnsignedIntParameter(scriptState, pname); | 2876 return getUnsignedIntParameter(scriptState, pname); |
| 2878 case GL_STENCIL_BITS: | 2877 case GL_STENCIL_BITS: |
| 2879 if (!m_framebufferBinding && !m_requestedAttributes.stencil()) | 2878 if (!m_framebufferBinding && !creationAttributes().stencil()) |
| 2880 return WebGLAny(scriptState, intZero); | 2879 return WebGLAny(scriptState, intZero); |
| 2881 return getIntParameter(scriptState, pname); | 2880 return getIntParameter(scriptState, pname); |
| 2882 case GL_STENCIL_CLEAR_VALUE: | 2881 case GL_STENCIL_CLEAR_VALUE: |
| 2883 return getIntParameter(scriptState, pname); | 2882 return getIntParameter(scriptState, pname); |
| 2884 case GL_STENCIL_FAIL: | 2883 case GL_STENCIL_FAIL: |
| 2885 return getUnsignedIntParameter(scriptState, pname); | 2884 return getUnsignedIntParameter(scriptState, pname); |
| 2886 case GL_STENCIL_FUNC: | 2885 case GL_STENCIL_FUNC: |
| 2887 return getUnsignedIntParameter(scriptState, pname); | 2886 return getUnsignedIntParameter(scriptState, pname); |
| 2888 case GL_STENCIL_PASS_DEPTH_FAIL: | 2887 case GL_STENCIL_PASS_DEPTH_FAIL: |
| 2889 return getUnsignedIntParameter(scriptState, pname); | 2888 return getUnsignedIntParameter(scriptState, pname); |
| (...skipping 3262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6152 | 6151 |
| 6153 if (!frame->loader().client()->allowWebGL(settings && settings->webGLEnabled
())) | 6152 if (!frame->loader().client()->allowWebGL(settings && settings->webGLEnabled
())) |
| 6154 return; | 6153 return; |
| 6155 | 6154 |
| 6156 // 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. | 6155 // 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. |
| 6157 if (drawingBuffer()) { | 6156 if (drawingBuffer()) { |
| 6158 m_drawingBuffer->beginDestruction(); | 6157 m_drawingBuffer->beginDestruction(); |
| 6159 m_drawingBuffer.clear(); | 6158 m_drawingBuffer.clear(); |
| 6160 } | 6159 } |
| 6161 | 6160 |
| 6162 Platform::ContextAttributes attributes = toPlatformContextAttributes(m_reque
stedAttributes, version()); | 6161 Platform::ContextAttributes attributes = toPlatformContextAttributes(creatio
nAttributes(), version()); |
| 6163 Platform::GraphicsInfo glInfo; | 6162 Platform::GraphicsInfo glInfo; |
| 6164 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider = wrapUnique(P
latform::current()->createOffscreenGraphicsContext3DProvider( | 6163 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider = wrapUnique(P
latform::current()->createOffscreenGraphicsContext3DProvider( |
| 6165 attributes, canvas()->document().topDocument().url(), 0, &glInfo)); | 6164 attributes, canvas()->document().topDocument().url(), 0, &glInfo)); |
| 6166 RefPtr<DrawingBuffer> buffer; | 6165 RefPtr<DrawingBuffer> buffer; |
| 6167 if (contextProvider && contextProvider->bindToCurrentThread()) { | 6166 if (contextProvider && contextProvider->bindToCurrentThread()) { |
| 6168 // Construct a new drawing buffer with the new GL context. | 6167 // Construct a new drawing buffer with the new GL context. |
| 6169 buffer = createDrawingBuffer(std::move(contextProvider)); | 6168 buffer = createDrawingBuffer(std::move(contextProvider)); |
| 6170 // If DrawingBuffer::create() fails to allocate a fbo, |drawingBuffer| i
s set to null. | 6169 // If DrawingBuffer::create() fails to allocate a fbo, |drawingBuffer| i
s set to null. |
| 6171 } | 6170 } |
| 6172 if (!buffer) { | 6171 if (!buffer) { |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6495 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); | 6494 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); |
| 6496 } | 6495 } |
| 6497 | 6496 |
| 6498 void WebGLRenderingContextBase::restoreUnpackParameters() | 6497 void WebGLRenderingContextBase::restoreUnpackParameters() |
| 6499 { | 6498 { |
| 6500 if (m_unpackAlignment != 1) | 6499 if (m_unpackAlignment != 1) |
| 6501 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); | 6500 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
| 6502 } | 6501 } |
| 6503 | 6502 |
| 6504 } // namespace blink | 6503 } // namespace blink |
| OLD | NEW |