| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #include "modules/webgl/OESTextureFloat.h" | 44 #include "modules/webgl/OESTextureFloat.h" |
| 45 #include "modules/webgl/OESTextureFloatLinear.h" | 45 #include "modules/webgl/OESTextureFloatLinear.h" |
| 46 #include "modules/webgl/OESTextureHalfFloat.h" | 46 #include "modules/webgl/OESTextureHalfFloat.h" |
| 47 #include "modules/webgl/OESTextureHalfFloatLinear.h" | 47 #include "modules/webgl/OESTextureHalfFloatLinear.h" |
| 48 #include "modules/webgl/OESVertexArrayObject.h" | 48 #include "modules/webgl/OESVertexArrayObject.h" |
| 49 #include "modules/webgl/WebGLCompressedTextureASTC.h" | 49 #include "modules/webgl/WebGLCompressedTextureASTC.h" |
| 50 #include "modules/webgl/WebGLCompressedTextureATC.h" | 50 #include "modules/webgl/WebGLCompressedTextureATC.h" |
| 51 #include "modules/webgl/WebGLCompressedTextureETC1.h" | 51 #include "modules/webgl/WebGLCompressedTextureETC1.h" |
| 52 #include "modules/webgl/WebGLCompressedTexturePVRTC.h" | 52 #include "modules/webgl/WebGLCompressedTexturePVRTC.h" |
| 53 #include "modules/webgl/WebGLCompressedTextureS3TC.h" | 53 #include "modules/webgl/WebGLCompressedTextureS3TC.h" |
| 54 #include "modules/webgl/WebGLContextAttributeHelpers.h" | |
| 55 #include "modules/webgl/WebGLContextEvent.h" | 54 #include "modules/webgl/WebGLContextEvent.h" |
| 56 #include "modules/webgl/WebGLDebugRendererInfo.h" | 55 #include "modules/webgl/WebGLDebugRendererInfo.h" |
| 57 #include "modules/webgl/WebGLDebugShaders.h" | 56 #include "modules/webgl/WebGLDebugShaders.h" |
| 58 #include "modules/webgl/WebGLDepthTexture.h" | 57 #include "modules/webgl/WebGLDepthTexture.h" |
| 59 #include "modules/webgl/WebGLDrawBuffers.h" | 58 #include "modules/webgl/WebGLDrawBuffers.h" |
| 60 #include "modules/webgl/WebGLLoseContext.h" | 59 #include "modules/webgl/WebGLLoseContext.h" |
| 61 #include "platform/CheckedInt.h" | 60 #include "platform/CheckedInt.h" |
| 62 #include "platform/graphics/gpu/DrawingBuffer.h" | 61 #include "platform/graphics/gpu/DrawingBuffer.h" |
| 63 #include "public/platform/Platform.h" | 62 #include "public/platform/Platform.h" |
| 64 #include "public/platform/WebGraphicsContext3DProvider.h" | 63 #include "public/platform/WebGraphicsContext3DProvider.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 78 return false; | 77 return false; |
| 79 if (extensionsUtil->supportsExtension("GL_EXT_debug_marker")) { | 78 if (extensionsUtil->supportsExtension("GL_EXT_debug_marker")) { |
| 80 String contextLabel(String::format("WebGLRenderingContext-%p", contextPr
ovider)); | 79 String contextLabel(String::format("WebGLRenderingContext-%p", contextPr
ovider)); |
| 81 gl->PushGroupMarkerEXT(0, contextLabel.ascii().data()); | 80 gl->PushGroupMarkerEXT(0, contextLabel.ascii().data()); |
| 82 } | 81 } |
| 83 return true; | 82 return true; |
| 84 } | 83 } |
| 85 | 84 |
| 86 CanvasRenderingContext* WebGLRenderingContext::Factory::create(ScriptState* scri
ptState, OffscreenCanvas* offscreenCanvas, const CanvasContextCreationAttributes
& attrs) | 85 CanvasRenderingContext* WebGLRenderingContext::Factory::create(ScriptState* scri
ptState, OffscreenCanvas* offscreenCanvas, const CanvasContextCreationAttributes
& attrs) |
| 87 { | 86 { |
| 88 WebGLContextAttributes attributes = toWebGLContextAttributes(attrs); | 87 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider(createWebGraph
icsContext3DProvider(scriptState, attrs, 1)); |
| 89 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider(createWebGraph
icsContext3DProvider(scriptState, attributes, 1)); | |
| 90 if (!shouldCreateContext(contextProvider.get())) | 88 if (!shouldCreateContext(contextProvider.get())) |
| 91 return nullptr; | 89 return nullptr; |
| 92 | 90 |
| 93 WebGLRenderingContext* renderingContext = new WebGLRenderingContext(offscree
nCanvas, std::move(contextProvider), attributes); | 91 WebGLRenderingContext* renderingContext = new WebGLRenderingContext(offscree
nCanvas, std::move(contextProvider), attrs); |
| 94 if (!renderingContext->drawingBuffer()) | 92 if (!renderingContext->drawingBuffer()) |
| 95 return nullptr; | 93 return nullptr; |
| 96 renderingContext->initializeNewContext(); | 94 renderingContext->initializeNewContext(); |
| 97 renderingContext->registerContextExtensions(); | 95 renderingContext->registerContextExtensions(); |
| 98 | 96 |
| 99 return renderingContext; | 97 return renderingContext; |
| 100 } | 98 } |
| 101 | 99 |
| 102 CanvasRenderingContext* WebGLRenderingContext::Factory::create(HTMLCanvasElement
* canvas, const CanvasContextCreationAttributes& attrs, Document&) | 100 CanvasRenderingContext* WebGLRenderingContext::Factory::create(HTMLCanvasElement
* canvas, const CanvasContextCreationAttributes& attrs, Document&) |
| 103 { | 101 { |
| 104 WebGLContextAttributes attributes = toWebGLContextAttributes(attrs); | 102 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider(createWebGraph
icsContext3DProvider(canvas, attrs, 1)); |
| 105 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider(createWebGraph
icsContext3DProvider(canvas, attributes, 1)); | |
| 106 if (!shouldCreateContext(contextProvider.get())) | 103 if (!shouldCreateContext(contextProvider.get())) |
| 107 return nullptr; | 104 return nullptr; |
| 108 | 105 |
| 109 WebGLRenderingContext* renderingContext = new WebGLRenderingContext(canvas,
std::move(contextProvider), attributes); | 106 WebGLRenderingContext* renderingContext = new WebGLRenderingContext(canvas,
std::move(contextProvider), attrs); |
| 110 if (!renderingContext->drawingBuffer()) { | 107 if (!renderingContext->drawingBuffer()) { |
| 111 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Could not create a WebGL context.")); | 108 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Could not create a WebGL context.")); |
| 112 return nullptr; | 109 return nullptr; |
| 113 } | 110 } |
| 114 renderingContext->initializeNewContext(); | 111 renderingContext->initializeNewContext(); |
| 115 renderingContext->registerContextExtensions(); | 112 renderingContext->registerContextExtensions(); |
| 116 | 113 |
| 117 return renderingContext; | 114 return renderingContext; |
| 118 } | 115 } |
| 119 | 116 |
| 120 void WebGLRenderingContext::Factory::onError(HTMLCanvasElement* canvas, const St
ring& error) | 117 void WebGLRenderingContext::Factory::onError(HTMLCanvasElement* canvas, const St
ring& error) |
| 121 { | 118 { |
| 122 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontext
creationerror, false, true, error)); | 119 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontext
creationerror, false, true, error)); |
| 123 } | 120 } |
| 124 | 121 |
| 125 WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, st
d::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextA
ttributes& requestedAttributes) | 122 WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, st
d::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const CanvasContext
CreationAttributes& requestedAttributes) |
| 126 : WebGLRenderingContextBase(passedCanvas, std::move(contextProvider), reques
tedAttributes, 1) | 123 : WebGLRenderingContextBase(passedCanvas, std::move(contextProvider), reques
tedAttributes, 1) |
| 127 { | 124 { |
| 128 } | 125 } |
| 129 | 126 |
| 130 WebGLRenderingContext::WebGLRenderingContext(OffscreenCanvas* passedOffscreenCan
vas, std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const WebGLC
ontextAttributes& requestedAttributes) | 127 WebGLRenderingContext::WebGLRenderingContext(OffscreenCanvas* passedOffscreenCan
vas, std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const Canvas
ContextCreationAttributes& requestedAttributes) |
| 131 : WebGLRenderingContextBase(passedOffscreenCanvas, std::move(contextProvider
), requestedAttributes, 1) | 128 : WebGLRenderingContextBase(passedOffscreenCanvas, std::move(contextProvider
), requestedAttributes, 1) |
| 132 { | 129 { |
| 133 } | 130 } |
| 134 | 131 |
| 135 WebGLRenderingContext::~WebGLRenderingContext() | 132 WebGLRenderingContext::~WebGLRenderingContext() |
| 136 { | 133 { |
| 137 } | 134 } |
| 138 | 135 |
| 139 void WebGLRenderingContext::setCanvasGetContextResult(RenderingContext& result) | 136 void WebGLRenderingContext::setCanvasGetContextResult(RenderingContext& result) |
| 140 { | 137 { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 visitor->traceWrappers(m_webglDebugShaders); | 229 visitor->traceWrappers(m_webglDebugShaders); |
| 233 visitor->traceWrappers(m_webglDrawBuffers); | 230 visitor->traceWrappers(m_webglDrawBuffers); |
| 234 visitor->traceWrappers(m_webglCompressedTextureASTC); | 231 visitor->traceWrappers(m_webglCompressedTextureASTC); |
| 235 visitor->traceWrappers(m_webglCompressedTextureATC); | 232 visitor->traceWrappers(m_webglCompressedTextureATC); |
| 236 visitor->traceWrappers(m_webglCompressedTextureETC1); | 233 visitor->traceWrappers(m_webglCompressedTextureETC1); |
| 237 visitor->traceWrappers(m_webglCompressedTexturePVRTC); | 234 visitor->traceWrappers(m_webglCompressedTexturePVRTC); |
| 238 visitor->traceWrappers(m_webglCompressedTextureS3TC); | 235 visitor->traceWrappers(m_webglCompressedTextureS3TC); |
| 239 visitor->traceWrappers(m_webglDepthTexture); | 236 visitor->traceWrappers(m_webglDepthTexture); |
| 240 } | 237 } |
| 241 } // namespace blink | 238 } // namespace blink |
| OLD | NEW |