| 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*, WebGLFramebuffer*); | 132 ScopedDrawingBufferBinder(DrawingBuffer* drawingBuffer, WebGLFramebuffer* fr
amebufferBinding) |
| 133 ~ScopedDrawingBufferBinder(); | 133 : m_drawingBuffer(drawingBuffer) |
| 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 } |
| 134 | 147 |
| 135 private: | 148 private: |
| 136 DrawingBuffer* m_drawingBuffer; | 149 DrawingBuffer* m_drawingBuffer; |
| 137 Member<WebGLFramebuffer> m_readFramebufferBinding; | 150 Member<WebGLFramebuffer> m_readFramebufferBinding; |
| 138 }; | 151 }; |
| 139 | 152 |
| 140 class MODULES_EXPORT WebGLRenderingContextBase : public CanvasRenderingContext,
public Page::MultisamplingChangedObserver { | 153 class MODULES_EXPORT WebGLRenderingContextBase : public CanvasRenderingContext,
public Page::MultisamplingChangedObserver { |
| 141 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WebGLRenderingContextBase); | 154 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WebGLRenderingContextBase); |
| 142 public: | 155 public: |
| 143 ~WebGLRenderingContextBase() override; | 156 ~WebGLRenderingContextBase() override; |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 { | 751 { |
| 739 return m_extensionEnabled[name]; | 752 return m_extensionEnabled[name]; |
| 740 } | 753 } |
| 741 | 754 |
| 742 // ScopedDrawingBufferBinder is used for ReadPixels/CopyTexImage2D/CopySubIm
age2D to read from | 755 // ScopedDrawingBufferBinder is used for ReadPixels/CopyTexImage2D/CopySubIm
age2D to read from |
| 743 // a multisampled DrawingBuffer. In this situation, we need to blit to a sin
gle sampled buffer | 756 // a multisampled DrawingBuffer. In this situation, we need to blit to a sin
gle sampled buffer |
| 744 // for reading, during which the bindings could be changed and need to be re
covered. | 757 // for reading, during which the bindings could be changed and need to be re
covered. |
| 745 class ScopedDrawingBufferBinder { | 758 class ScopedDrawingBufferBinder { |
| 746 STACK_ALLOCATED(); | 759 STACK_ALLOCATED(); |
| 747 public: | 760 public: |
| 748 ScopedDrawingBufferBinder(DrawingBuffer*, WebGLFramebuffer*); | 761 ScopedDrawingBufferBinder(DrawingBuffer* drawingBuffer, WebGLFramebuffer
* framebufferBinding) |
| 749 ~ScopedDrawingBufferBinder(); | 762 : m_drawingBuffer(drawingBuffer) |
| 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 } |
| 750 | 776 |
| 751 private: | 777 private: |
| 752 DrawingBuffer* m_drawingBuffer; | 778 DrawingBuffer* m_drawingBuffer; |
| 753 Member<WebGLFramebuffer> m_readFramebufferBinding; | 779 Member<WebGLFramebuffer> m_readFramebufferBinding; |
| 754 }; | 780 }; |
| 755 | 781 |
| 756 // Errors raised by synthesizeGLError() while the context is lost. | 782 // Errors raised by synthesizeGLError() while the context is lost. |
| 757 Vector<GLenum> m_lostContextErrors; | 783 Vector<GLenum> m_lostContextErrors; |
| 758 | 784 |
| 759 bool m_isWebGL2FormatsTypesAdded; | 785 bool m_isWebGL2FormatsTypesAdded; |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 static WebGLRenderingContextBase* oldestEvictedContext(); | 1132 static WebGLRenderingContextBase* oldestEvictedContext(); |
| 1107 }; | 1133 }; |
| 1108 | 1134 |
| 1109 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co
ntext->is3d(), context.is3d()); | 1135 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co
ntext->is3d(), context.is3d()); |
| 1110 | 1136 |
| 1111 } // namespace blink | 1137 } // namespace blink |
| 1112 | 1138 |
| 1113 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB
ase::TextureUnitState); | 1139 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB
ase::TextureUnitState); |
| 1114 | 1140 |
| 1115 #endif // WebGLRenderingContextBase_h | 1141 #endif // WebGLRenderingContextBase_h |
| OLD | NEW |