| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 || ((lhs.internalformat == rhs.internalformat) && (lhs.format == rhs
.format) && (lhs.type < rhs.type))); | 122 || ((lhs.internalformat == rhs.internalformat) && (lhs.format == rhs
.format) && (lhs.type < rhs.type))); |
| 123 } | 123 } |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 // ScopedDrawingBufferBinder is used for ReadPixels/CopyTexImage2D/CopySubImage2
D to read from | 126 // ScopedDrawingBufferBinder is used for ReadPixels/CopyTexImage2D/CopySubImage2
D to read from |
| 127 // a multisampled DrawingBuffer. In this situation, we need to blit to a single
sampled buffer | 127 // a multisampled DrawingBuffer. In this situation, we need to blit to a single
sampled buffer |
| 128 // for reading, during which the bindings could be changed and need to be recove
red. | 128 // for reading, during which the bindings could be changed and need to be recove
red. |
| 129 class ScopedDrawingBufferBinder { | 129 class ScopedDrawingBufferBinder { |
| 130 STACK_ALLOCATED(); | 130 STACK_ALLOCATED(); |
| 131 public: | 131 public: |
| 132 ScopedDrawingBufferBinder(DrawingBuffer* drawingBuffer, WebGLFramebuffer* fr
amebufferBinding) | 132 ScopedDrawingBufferBinder(DrawingBuffer*, WebGLFramebuffer*); |
| 133 : m_drawingBuffer(drawingBuffer) | 133 ~ScopedDrawingBufferBinder(); |
| 134 , m_readFramebufferBinding(framebufferBinding) | |
| 135 { | |
| 136 // Commit DrawingBuffer if needed (e.g., for multisampling) | |
| 137 if (!m_readFramebufferBinding && m_drawingBuffer) | |
| 138 m_drawingBuffer->commit(); | |
| 139 } | |
| 140 | |
| 141 ~ScopedDrawingBufferBinder() | |
| 142 { | |
| 143 // Restore DrawingBuffer if needed | |
| 144 if (!m_readFramebufferBinding && m_drawingBuffer) | |
| 145 m_drawingBuffer->restoreFramebufferBindings(); | |
| 146 } | |
| 147 | 134 |
| 148 private: | 135 private: |
| 149 DrawingBuffer* m_drawingBuffer; | 136 DrawingBuffer* m_drawingBuffer; |
| 150 Member<WebGLFramebuffer> m_readFramebufferBinding; | 137 Member<WebGLFramebuffer> m_readFramebufferBinding; |
| 151 }; | 138 }; |
| 152 | 139 |
| 153 class MODULES_EXPORT WebGLRenderingContextBase : public CanvasRenderingContext,
public Page::MultisamplingChangedObserver { | 140 class MODULES_EXPORT WebGLRenderingContextBase : public CanvasRenderingContext,
public Page::MultisamplingChangedObserver { |
| 154 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WebGLRenderingContextBase); | 141 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WebGLRenderingContextBase); |
| 155 public: | 142 public: |
| 156 ~WebGLRenderingContextBase() override; | 143 ~WebGLRenderingContextBase() override; |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 { | 738 { |
| 752 return m_extensionEnabled[name]; | 739 return m_extensionEnabled[name]; |
| 753 } | 740 } |
| 754 | 741 |
| 755 // ScopedDrawingBufferBinder is used for ReadPixels/CopyTexImage2D/CopySubIm
age2D to read from | 742 // ScopedDrawingBufferBinder is used for ReadPixels/CopyTexImage2D/CopySubIm
age2D to read from |
| 756 // a multisampled DrawingBuffer. In this situation, we need to blit to a sin
gle sampled buffer | 743 // a multisampled DrawingBuffer. In this situation, we need to blit to a sin
gle sampled buffer |
| 757 // for reading, during which the bindings could be changed and need to be re
covered. | 744 // for reading, during which the bindings could be changed and need to be re
covered. |
| 758 class ScopedDrawingBufferBinder { | 745 class ScopedDrawingBufferBinder { |
| 759 STACK_ALLOCATED(); | 746 STACK_ALLOCATED(); |
| 760 public: | 747 public: |
| 761 ScopedDrawingBufferBinder(DrawingBuffer* drawingBuffer, WebGLFramebuffer
* framebufferBinding) | 748 ScopedDrawingBufferBinder(DrawingBuffer*, WebGLFramebuffer*); |
| 762 : m_drawingBuffer(drawingBuffer) | 749 ~ScopedDrawingBufferBinder(); |
| 763 , m_readFramebufferBinding(framebufferBinding) | |
| 764 { | |
| 765 // Commit DrawingBuffer if needed (e.g., for multisampling) | |
| 766 if (!m_readFramebufferBinding && m_drawingBuffer) | |
| 767 m_drawingBuffer->commit(); | |
| 768 } | |
| 769 | |
| 770 ~ScopedDrawingBufferBinder() | |
| 771 { | |
| 772 // Restore DrawingBuffer if needed | |
| 773 if (!m_readFramebufferBinding && m_drawingBuffer) | |
| 774 m_drawingBuffer->restoreFramebufferBindings(); | |
| 775 } | |
| 776 | 750 |
| 777 private: | 751 private: |
| 778 DrawingBuffer* m_drawingBuffer; | 752 DrawingBuffer* m_drawingBuffer; |
| 779 Member<WebGLFramebuffer> m_readFramebufferBinding; | 753 Member<WebGLFramebuffer> m_readFramebufferBinding; |
| 780 }; | 754 }; |
| 781 | 755 |
| 782 // Errors raised by synthesizeGLError() while the context is lost. | 756 // Errors raised by synthesizeGLError() while the context is lost. |
| 783 Vector<GLenum> m_lostContextErrors; | 757 Vector<GLenum> m_lostContextErrors; |
| 784 | 758 |
| 785 bool m_isWebGL2FormatsTypesAdded; | 759 bool m_isWebGL2FormatsTypesAdded; |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 static WebGLRenderingContextBase* oldestEvictedContext(); | 1106 static WebGLRenderingContextBase* oldestEvictedContext(); |
| 1133 }; | 1107 }; |
| 1134 | 1108 |
| 1135 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co
ntext->is3d(), context.is3d()); | 1109 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co
ntext->is3d(), context.is3d()); |
| 1136 | 1110 |
| 1137 } // namespace blink | 1111 } // namespace blink |
| 1138 | 1112 |
| 1139 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB
ase::TextureUnitState); | 1113 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB
ase::TextureUnitState); |
| 1140 | 1114 |
| 1141 #endif // WebGLRenderingContextBase_h | 1115 #endif // WebGLRenderingContextBase_h |
| OLD | NEW |