| 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 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 #include "bindings/core/v8/Nullable.h" | 29 #include "bindings/core/v8/Nullable.h" |
| 30 #include "bindings/core/v8/ScriptState.h" | 30 #include "bindings/core/v8/ScriptState.h" |
| 31 #include "bindings/core/v8/ScriptValue.h" | 31 #include "bindings/core/v8/ScriptValue.h" |
| 32 #include "bindings/core/v8/ScriptWrappable.h" | 32 #include "bindings/core/v8/ScriptWrappable.h" |
| 33 #include "core/CoreExport.h" | 33 #include "core/CoreExport.h" |
| 34 #include "core/dom/DOMTypedArray.h" | 34 #include "core/dom/DOMTypedArray.h" |
| 35 #include "core/dom/TypedFlexibleArrayBufferView.h" | 35 #include "core/dom/TypedFlexibleArrayBufferView.h" |
| 36 #include "core/html/canvas/CanvasRenderingContext.h" | 36 #include "core/html/canvas/CanvasRenderingContext.h" |
| 37 #include "core/layout/LayoutBoxModelObject.h" | 37 #include "core/layout/LayoutBoxModelObject.h" |
| 38 #include "core/page/Page.h" | |
| 39 #include "modules/webgl/WebGLContextAttributes.h" | 38 #include "modules/webgl/WebGLContextAttributes.h" |
| 40 #include "modules/webgl/WebGLExtensionName.h" | 39 #include "modules/webgl/WebGLExtensionName.h" |
| 41 #include "modules/webgl/WebGLTexture.h" | 40 #include "modules/webgl/WebGLTexture.h" |
| 42 #include "modules/webgl/WebGLVertexArrayObjectBase.h" | 41 #include "modules/webgl/WebGLVertexArrayObjectBase.h" |
| 43 #include "platform/Timer.h" | 42 #include "platform/Timer.h" |
| 44 #include "platform/graphics/GraphicsTypes3D.h" | 43 #include "platform/graphics/GraphicsTypes3D.h" |
| 45 #include "platform/graphics/ImageBuffer.h" | 44 #include "platform/graphics/ImageBuffer.h" |
| 46 #include "platform/graphics/gpu/DrawingBuffer.h" | 45 #include "platform/graphics/gpu/DrawingBuffer.h" |
| 47 #include "platform/graphics/gpu/Extensions3DUtil.h" | 46 #include "platform/graphics/gpu/Extensions3DUtil.h" |
| 48 #include "platform/graphics/gpu/WebGLImageConversion.h" | 47 #include "platform/graphics/gpu/WebGLImageConversion.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 // Restore DrawingBuffer if needed | 134 // Restore DrawingBuffer if needed |
| 136 if (!m_readFramebufferBinding && m_drawingBuffer) | 135 if (!m_readFramebufferBinding && m_drawingBuffer) |
| 137 m_drawingBuffer->restoreFramebufferBindings(); | 136 m_drawingBuffer->restoreFramebufferBindings(); |
| 138 } | 137 } |
| 139 | 138 |
| 140 private: | 139 private: |
| 141 DrawingBuffer* m_drawingBuffer; | 140 DrawingBuffer* m_drawingBuffer; |
| 142 Member<WebGLFramebuffer> m_readFramebufferBinding; | 141 Member<WebGLFramebuffer> m_readFramebufferBinding; |
| 143 }; | 142 }; |
| 144 | 143 |
| 145 class MODULES_EXPORT WebGLRenderingContextBase : public CanvasRenderingContext,
public Page::MultisamplingChangedObserver { | 144 class MODULES_EXPORT WebGLRenderingContextBase : public CanvasRenderingContext { |
| 146 USING_GARBAGE_COLLECTED_MIXIN(WebGLRenderingContextBase); | |
| 147 public: | 145 public: |
| 148 ~WebGLRenderingContextBase() override; | 146 ~WebGLRenderingContextBase() override; |
| 149 | 147 |
| 150 virtual unsigned version() const = 0; | 148 virtual unsigned version() const = 0; |
| 151 virtual String contextName() const = 0; | 149 virtual String contextName() const = 0; |
| 152 virtual void registerContextExtensions() = 0; | 150 virtual void registerContextExtensions() = 0; |
| 153 | 151 |
| 154 virtual void initializeNewContext(); | 152 virtual void initializeNewContext(); |
| 155 | 153 |
| 156 static unsigned getWebGLVersion(const CanvasRenderingContext*); | 154 static unsigned getWebGLVersion(const CanvasRenderingContext*); |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 GLboolean isValuebufferCHROMIUM(CHROMIUMValuebuffer*); | 402 GLboolean isValuebufferCHROMIUM(CHROMIUMValuebuffer*); |
| 405 void bindValuebufferCHROMIUM(GLenum target, CHROMIUMValuebuffer*); | 403 void bindValuebufferCHROMIUM(GLenum target, CHROMIUMValuebuffer*); |
| 406 void subscribeValueCHROMIUM(GLenum target, GLenum subscription); | 404 void subscribeValueCHROMIUM(GLenum target, GLenum subscription); |
| 407 void populateSubscribedValuesCHROMIUM(GLenum target); | 405 void populateSubscribedValuesCHROMIUM(GLenum target); |
| 408 void uniformValuebufferCHROMIUM(const WebGLUniformLocation*, GLenum target,
GLenum subscription); | 406 void uniformValuebufferCHROMIUM(const WebGLUniformLocation*, GLenum target,
GLenum subscription); |
| 409 | 407 |
| 410 // Eagerly finalize WebGLRenderingContextBase in order for it | 408 // Eagerly finalize WebGLRenderingContextBase in order for it |
| 411 // to (first) be able to detach its WebGLContextObjects, before | 409 // to (first) be able to detach its WebGLContextObjects, before |
| 412 // they're later swept and finalized. | 410 // they're later swept and finalized. |
| 413 EAGERLY_FINALIZE(); | 411 EAGERLY_FINALIZE(); |
| 412 DECLARE_EAGER_FINALIZATION_OPERATOR_NEW(); |
| 414 DECLARE_VIRTUAL_TRACE(); | 413 DECLARE_VIRTUAL_TRACE(); |
| 415 | 414 |
| 416 // Returns approximate gpu memory allocated per pixel. | 415 // Returns approximate gpu memory allocated per pixel. |
| 417 int externallyAllocatedBytesPerPixel() override; | 416 int externallyAllocatedBytesPerPixel() override; |
| 418 | 417 |
| 419 class TextureUnitState { | 418 class TextureUnitState { |
| 420 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 419 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| 421 public: | 420 public: |
| 422 Member<WebGLTexture> m_texture2DBinding; | 421 Member<WebGLTexture> m_texture2DBinding; |
| 423 Member<WebGLTexture> m_textureCubeMapBinding; | 422 Member<WebGLTexture> m_textureCubeMapBinding; |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 bool m_stencilEnabled; | 602 bool m_stencilEnabled; |
| 604 GLuint m_stencilMask, m_stencilMaskBack; | 603 GLuint m_stencilMask, m_stencilMaskBack; |
| 605 GLint m_stencilFuncRef, m_stencilFuncRefBack; // Note that these are the use
r specified values, not the internal clamped value. | 604 GLint m_stencilFuncRef, m_stencilFuncRefBack; // Note that these are the use
r specified values, not the internal clamped value. |
| 606 GLuint m_stencilFuncMask, m_stencilFuncMaskBack; | 605 GLuint m_stencilFuncMask, m_stencilFuncMaskBack; |
| 607 | 606 |
| 608 bool m_isDepthStencilSupported; | 607 bool m_isDepthStencilSupported; |
| 609 | 608 |
| 610 bool m_synthesizedErrorsToConsole; | 609 bool m_synthesizedErrorsToConsole; |
| 611 int m_numGLErrorsToConsoleAllowed; | 610 int m_numGLErrorsToConsoleAllowed; |
| 612 | 611 |
| 613 bool m_multisamplingAllowed; | |
| 614 bool m_multisamplingObserverRegistered; | |
| 615 | |
| 616 unsigned long m_onePlusMaxNonDefaultTextureUnit; | 612 unsigned long m_onePlusMaxNonDefaultTextureUnit; |
| 617 | 613 |
| 618 OwnPtr<Extensions3DUtil> m_extensionsUtil; | 614 OwnPtr<Extensions3DUtil> m_extensionsUtil; |
| 619 | 615 |
| 620 enum ExtensionFlags { | 616 enum ExtensionFlags { |
| 621 ApprovedExtension = 0x00, | 617 ApprovedExtension = 0x00, |
| 622 // Extension that is behind the draft extensions runtime flag: | 618 // Extension that is behind the draft extensions runtime flag: |
| 623 DraftExtension = 0x01, | 619 DraftExtension = 0x01, |
| 624 }; | 620 }; |
| 625 | 621 |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1054 // Later, return the cached value. | 1050 // Later, return the cached value. |
| 1055 GLint maxDrawBuffers(); | 1051 GLint maxDrawBuffers(); |
| 1056 GLint maxColorAttachments(); | 1052 GLint maxColorAttachments(); |
| 1057 | 1053 |
| 1058 void setBackDrawBuffer(GLenum); | 1054 void setBackDrawBuffer(GLenum); |
| 1059 void setFramebuffer(GLenum, WebGLFramebuffer*); | 1055 void setFramebuffer(GLenum, WebGLFramebuffer*); |
| 1060 | 1056 |
| 1061 virtual void restoreCurrentFramebuffer(); | 1057 virtual void restoreCurrentFramebuffer(); |
| 1062 void restoreCurrentTexture2D(); | 1058 void restoreCurrentTexture2D(); |
| 1063 | 1059 |
| 1064 void multisamplingChanged(bool) override; | |
| 1065 | |
| 1066 void findNewMaxNonDefaultTextureUnit(); | 1060 void findNewMaxNonDefaultTextureUnit(); |
| 1067 | 1061 |
| 1068 virtual void renderbufferStorageImpl(GLenum target, GLsizei samples, GLenum
internalformat, GLsizei width, GLsizei height, const char* functionName); | 1062 virtual void renderbufferStorageImpl(GLenum target, GLsizei samples, GLenum
internalformat, GLsizei width, GLsizei height, const char* functionName); |
| 1069 | 1063 |
| 1070 // Ensures that the JavaScript wrappers for objects that are | 1064 // Ensures that the JavaScript wrappers for objects that are |
| 1071 // latched into the context's state, or which are implicitly | 1065 // latched into the context's state, or which are implicitly |
| 1072 // linked together (like programs and their attached shaders), are | 1066 // linked together (like programs and their attached shaders), are |
| 1073 // not garbage collected before they should be. | 1067 // not garbage collected before they should be. |
| 1074 static void preserveObjectWrapper(ScriptState*, ScriptWrappable* sourceObjec
t, const char* baseName, unsigned long index, ScriptWrappable* targetObject); | 1068 static void preserveObjectWrapper(ScriptState*, ScriptWrappable* sourceObjec
t, const char* baseName, unsigned long index, ScriptWrappable* targetObject); |
| 1075 // Called to lazily instantiate the wrapper for the default VAO | 1069 // Called to lazily instantiate the wrapper for the default VAO |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1103 #endif | 1097 #endif |
| 1104 }; | 1098 }; |
| 1105 | 1099 |
| 1106 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co
ntext->is3d(), context.is3d()); | 1100 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co
ntext->is3d(), context.is3d()); |
| 1107 | 1101 |
| 1108 } // namespace blink | 1102 } // namespace blink |
| 1109 | 1103 |
| 1110 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB
ase::TextureUnitState); | 1104 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB
ase::TextureUnitState); |
| 1111 | 1105 |
| 1112 #endif // WebGLRenderingContextBase_h | 1106 #endif // WebGLRenderingContextBase_h |
| OLD | NEW |