Chromium Code Reviews| 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 { |
|
danakj
2016/04/04 22:30:28
The WebGLRCBase used to subclass Page::Multisampli
| |
| 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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 603 bool m_stencilEnabled; | 601 bool m_stencilEnabled; |
| 604 GLuint m_stencilMask, m_stencilMaskBack; | 602 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. | 603 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; | 604 GLuint m_stencilFuncMask, m_stencilFuncMaskBack; |
| 607 | 605 |
| 608 bool m_isDepthStencilSupported; | 606 bool m_isDepthStencilSupported; |
| 609 | 607 |
| 610 bool m_synthesizedErrorsToConsole; | 608 bool m_synthesizedErrorsToConsole; |
| 611 int m_numGLErrorsToConsoleAllowed; | 609 int m_numGLErrorsToConsoleAllowed; |
| 612 | 610 |
| 613 bool m_multisamplingAllowed; | |
| 614 bool m_multisamplingObserverRegistered; | |
| 615 | |
| 616 unsigned long m_onePlusMaxNonDefaultTextureUnit; | 611 unsigned long m_onePlusMaxNonDefaultTextureUnit; |
| 617 | 612 |
| 618 OwnPtr<Extensions3DUtil> m_extensionsUtil; | 613 OwnPtr<Extensions3DUtil> m_extensionsUtil; |
| 619 | 614 |
| 620 enum ExtensionFlags { | 615 enum ExtensionFlags { |
| 621 ApprovedExtension = 0x00, | 616 ApprovedExtension = 0x00, |
| 622 // Extension that is behind the draft extensions runtime flag: | 617 // Extension that is behind the draft extensions runtime flag: |
| 623 DraftExtension = 0x01, | 618 DraftExtension = 0x01, |
| 624 }; | 619 }; |
| 625 | 620 |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1054 // Later, return the cached value. | 1049 // Later, return the cached value. |
| 1055 GLint maxDrawBuffers(); | 1050 GLint maxDrawBuffers(); |
| 1056 GLint maxColorAttachments(); | 1051 GLint maxColorAttachments(); |
| 1057 | 1052 |
| 1058 void setBackDrawBuffer(GLenum); | 1053 void setBackDrawBuffer(GLenum); |
| 1059 void setFramebuffer(GLenum, WebGLFramebuffer*); | 1054 void setFramebuffer(GLenum, WebGLFramebuffer*); |
| 1060 | 1055 |
| 1061 virtual void restoreCurrentFramebuffer(); | 1056 virtual void restoreCurrentFramebuffer(); |
| 1062 void restoreCurrentTexture2D(); | 1057 void restoreCurrentTexture2D(); |
| 1063 | 1058 |
| 1064 void multisamplingChanged(bool) override; | |
| 1065 | |
| 1066 void findNewMaxNonDefaultTextureUnit(); | 1059 void findNewMaxNonDefaultTextureUnit(); |
| 1067 | 1060 |
| 1068 virtual void renderbufferStorageImpl(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, const char* functionName); | 1061 virtual void renderbufferStorageImpl(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, const char* functionName); |
| 1069 | 1062 |
| 1070 // Ensures that the JavaScript wrappers for objects that are | 1063 // Ensures that the JavaScript wrappers for objects that are |
| 1071 // latched into the context's state, or which are implicitly | 1064 // latched into the context's state, or which are implicitly |
| 1072 // linked together (like programs and their attached shaders), are | 1065 // linked together (like programs and their attached shaders), are |
| 1073 // not garbage collected before they should be. | 1066 // not garbage collected before they should be. |
| 1074 static void preserveObjectWrapper(ScriptState*, ScriptWrappable* sourceObjec t, const char* baseName, unsigned long index, ScriptWrappable* targetObject); | 1067 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 | 1068 // Called to lazily instantiate the wrapper for the default VAO |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 1103 #endif | 1096 #endif |
| 1104 }; | 1097 }; |
| 1105 | 1098 |
| 1106 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d()); | 1099 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co ntext->is3d(), context.is3d()); |
| 1107 | 1100 |
| 1108 } // namespace blink | 1101 } // namespace blink |
| 1109 | 1102 |
| 1110 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState); | 1103 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB ase::TextureUnitState); |
| 1111 | 1104 |
| 1112 #endif // WebGLRenderingContextBase_h | 1105 #endif // WebGLRenderingContextBase_h |
| OLD | NEW |