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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 class WebGLSharedObject; | 99 class WebGLSharedObject; |
100 class WebGLUniformLocation; | 100 class WebGLUniformLocation; |
101 class WebGLVertexArrayObjectBase; | 101 class WebGLVertexArrayObjectBase; |
102 | 102 |
103 class WebGLRenderingContextLostCallback; | 103 class WebGLRenderingContextLostCallback; |
104 class WebGLRenderingContextErrorMessageCallback; | 104 class WebGLRenderingContextErrorMessageCallback; |
105 | 105 |
106 class MODULES_EXPORT WebGLRenderingContextBase : public CanvasRenderingContext,
public Page::MultisamplingChangedObserver { | 106 class MODULES_EXPORT WebGLRenderingContextBase : public CanvasRenderingContext,
public Page::MultisamplingChangedObserver { |
107 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WebGLRenderingContextBase); | 107 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WebGLRenderingContextBase); |
108 public: | 108 public: |
109 virtual ~WebGLRenderingContextBase(); | 109 ~WebGLRenderingContextBase() override; |
110 | 110 |
111 virtual unsigned version() const = 0; | 111 virtual unsigned version() const = 0; |
112 virtual String contextName() const = 0; | 112 virtual String contextName() const = 0; |
113 virtual void registerContextExtensions() = 0; | 113 virtual void registerContextExtensions() = 0; |
114 | 114 |
115 virtual void initializeNewContext(); | 115 virtual void initializeNewContext(); |
116 | 116 |
117 static unsigned getWebGLVersion(const CanvasRenderingContext*); | 117 static unsigned getWebGLVersion(const CanvasRenderingContext*); |
118 | 118 |
119 static PassOwnPtr<WebGraphicsContext3D> createWebGraphicsContext3D(HTMLCanva
sElement*, WebGLContextAttributes, unsigned webGLVersion); | 119 static PassOwnPtr<WebGraphicsContext3D> createWebGraphicsContext3D(HTMLCanva
sElement*, WebGLContextAttributes, unsigned webGLVersion); |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 friend class WebGLRenderingContextErrorMessageCallback; | 399 friend class WebGLRenderingContextErrorMessageCallback; |
400 friend class WebGLVertexArrayObjectBase; | 400 friend class WebGLVertexArrayObjectBase; |
401 friend class ScopedTexture2DRestorer; | 401 friend class ScopedTexture2DRestorer; |
402 friend class ScopedFramebufferRestorer; | 402 friend class ScopedFramebufferRestorer; |
403 | 403 |
404 WebGLRenderingContextBase(HTMLCanvasElement*, PassOwnPtr<WebGraphicsContext3
D>, const WebGLContextAttributes&); | 404 WebGLRenderingContextBase(HTMLCanvasElement*, PassOwnPtr<WebGraphicsContext3
D>, const WebGLContextAttributes&); |
405 PassRefPtr<DrawingBuffer> createDrawingBuffer(PassOwnPtr<WebGraphicsContext3
D>); | 405 PassRefPtr<DrawingBuffer> createDrawingBuffer(PassOwnPtr<WebGraphicsContext3
D>); |
406 void setupFlags(); | 406 void setupFlags(); |
407 | 407 |
408 // CanvasRenderingContext implementation. | 408 // CanvasRenderingContext implementation. |
409 virtual bool is3d() const override { return true; } | 409 bool is3d() const override { return true; } |
410 virtual bool isAccelerated() const override { return true; } | 410 bool isAccelerated() const override { return true; } |
411 virtual void setIsHidden(bool) override; | 411 void setIsHidden(bool) override; |
412 bool paintRenderingResultsToCanvas(SourceDrawingBuffer) override; | 412 bool paintRenderingResultsToCanvas(SourceDrawingBuffer) override; |
413 virtual WebLayer* platformLayer() const override; | 413 WebLayer* platformLayer() const override; |
414 void stop() override; | 414 void stop() override; |
415 | 415 |
416 void addSharedObject(WebGLSharedObject*); | 416 void addSharedObject(WebGLSharedObject*); |
417 void addContextObject(WebGLContextObject*); | 417 void addContextObject(WebGLContextObject*); |
418 void detachAndRemoveAllObjects(); | 418 void detachAndRemoveAllObjects(); |
419 | 419 |
420 void destroyContext(); | 420 void destroyContext(); |
421 void markContextChanged(ContentChangeType); | 421 void markContextChanged(ContentChangeType); |
422 | 422 |
423 // Query if the context is NPOT strict. | 423 // Query if the context is NPOT strict. |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 | 633 |
634 template <typename T> | 634 template <typename T> |
635 class TypedExtensionTracker final : public ExtensionTracker { | 635 class TypedExtensionTracker final : public ExtensionTracker { |
636 public: | 636 public: |
637 static PassOwnPtrWillBeRawPtr<TypedExtensionTracker<T>> create(RefPtrWil
lBeMember<T>& extensionField, ExtensionFlags flags, const char* const* prefixes) | 637 static PassOwnPtrWillBeRawPtr<TypedExtensionTracker<T>> create(RefPtrWil
lBeMember<T>& extensionField, ExtensionFlags flags, const char* const* prefixes) |
638 { | 638 { |
639 return adoptPtrWillBeNoop(new TypedExtensionTracker<T>(extensionFiel
d, flags, prefixes)); | 639 return adoptPtrWillBeNoop(new TypedExtensionTracker<T>(extensionFiel
d, flags, prefixes)); |
640 } | 640 } |
641 | 641 |
642 #if !ENABLE(OILPAN) | 642 #if !ENABLE(OILPAN) |
643 virtual ~TypedExtensionTracker() | 643 ~TypedExtensionTracker() override |
644 { | 644 { |
645 if (m_extension) { | 645 if (m_extension) { |
646 m_extension->lose(true); | 646 m_extension->lose(true); |
647 m_extension = nullptr; | 647 m_extension = nullptr; |
648 } | 648 } |
649 } | 649 } |
650 #endif | 650 #endif |
651 | 651 |
652 virtual PassRefPtrWillBeRawPtr<WebGLExtension> getExtension(WebGLRenderi
ngContextBase* context) override | 652 PassRefPtrWillBeRawPtr<WebGLExtension> getExtension(WebGLRenderingContex
tBase* context) override |
653 { | 653 { |
654 if (!m_extension) { | 654 if (!m_extension) { |
655 m_extension = T::create(context); | 655 m_extension = T::create(context); |
656 m_extensionField = m_extension; | 656 m_extensionField = m_extension; |
657 } | 657 } |
658 | 658 |
659 return m_extension; | 659 return m_extension; |
660 } | 660 } |
661 | 661 |
662 virtual bool supported(WebGLRenderingContextBase* context) const overrid
e | 662 bool supported(WebGLRenderingContextBase* context) const override |
663 { | 663 { |
664 return T::supported(context); | 664 return T::supported(context); |
665 } | 665 } |
666 | 666 |
667 virtual const char* extensionName() const override | 667 const char* extensionName() const override |
668 { | 668 { |
669 return T::extensionName(); | 669 return T::extensionName(); |
670 } | 670 } |
671 | 671 |
672 virtual void loseExtension() override | 672 void loseExtension() override |
673 { | 673 { |
674 if (m_extension) { | 674 if (m_extension) { |
675 m_extension->lose(false); | 675 m_extension->lose(false); |
676 if (m_extension->isLost()) | 676 if (m_extension->isLost()) |
677 m_extension = nullptr; | 677 m_extension = nullptr; |
678 } | 678 } |
679 } | 679 } |
680 | 680 |
681 DEFINE_INLINE_VIRTUAL_TRACE() | 681 DEFINE_INLINE_VIRTUAL_TRACE() |
682 { | 682 { |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 // Later, return the cached value. | 979 // Later, return the cached value. |
980 GLint maxDrawBuffers(); | 980 GLint maxDrawBuffers(); |
981 GLint maxColorAttachments(); | 981 GLint maxColorAttachments(); |
982 | 982 |
983 void setBackDrawBuffer(GLenum); | 983 void setBackDrawBuffer(GLenum); |
984 void setFramebuffer(GLenum, WebGLFramebuffer*); | 984 void setFramebuffer(GLenum, WebGLFramebuffer*); |
985 | 985 |
986 virtual void restoreCurrentFramebuffer(); | 986 virtual void restoreCurrentFramebuffer(); |
987 void restoreCurrentTexture2D(); | 987 void restoreCurrentTexture2D(); |
988 | 988 |
989 virtual void multisamplingChanged(bool) override; | 989 void multisamplingChanged(bool) override; |
990 | 990 |
991 void findNewMaxNonDefaultTextureUnit(); | 991 void findNewMaxNonDefaultTextureUnit(); |
992 | 992 |
993 virtual void renderbufferStorageImpl(GLenum target, GLsizei samples, GLenum
internalformat, GLsizei width, GLsizei height, const char* functionName); | 993 virtual void renderbufferStorageImpl(GLenum target, GLsizei samples, GLenum
internalformat, GLsizei width, GLsizei height, const char* functionName); |
994 | 994 |
995 friend class WebGLStateRestorer; | 995 friend class WebGLStateRestorer; |
996 friend class WebGLRenderingContextEvictionManager; | 996 friend class WebGLRenderingContextEvictionManager; |
997 | 997 |
998 static Vector<WebGLRenderingContextBase*>& activeContexts(); | 998 static Vector<WebGLRenderingContextBase*>& activeContexts(); |
999 static Vector<WebGLRenderingContextBase*>& forciblyEvictedContexts(); | 999 static Vector<WebGLRenderingContextBase*>& forciblyEvictedContexts(); |
(...skipping 10 matching lines...) Expand all Loading... |
1010 static IntSize oldestContextSize(); | 1010 static IntSize oldestContextSize(); |
1011 }; | 1011 }; |
1012 | 1012 |
1013 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co
ntext->is3d(), context.is3d()); | 1013 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co
ntext->is3d(), context.is3d()); |
1014 | 1014 |
1015 } // namespace blink | 1015 } // namespace blink |
1016 | 1016 |
1017 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB
ase::TextureUnitState); | 1017 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB
ase::TextureUnitState); |
1018 | 1018 |
1019 #endif // WebGLRenderingContextBase_h | 1019 #endif // WebGLRenderingContextBase_h |
OLD | NEW |