| Index: Source/modules/webgl/WebGLRenderingContextBase.h
|
| diff --git a/Source/modules/webgl/WebGLRenderingContextBase.h b/Source/modules/webgl/WebGLRenderingContextBase.h
|
| index c6cb76eacb089a3c6ce423667f5ee65a41410ce6..c83e9797b5d5001382374c7a60f70452a5c51122 100644
|
| --- a/Source/modules/webgl/WebGLRenderingContextBase.h
|
| +++ b/Source/modules/webgl/WebGLRenderingContextBase.h
|
| @@ -122,6 +122,33 @@ struct FormatTypeCompare {
|
| }
|
| };
|
|
|
| +// ScopedDrawingBufferBinder is used for ReadPixels/CopyTexImage2D/CopySubImage2D to read from
|
| +// a multisampled DrawingBuffer. In this situation, we need to blit to a single sampled buffer
|
| +// for reading, during which the bindings could be changed and need to be recovered.
|
| +class ScopedDrawingBufferBinder {
|
| + STACK_ALLOCATED();
|
| +public:
|
| + ScopedDrawingBufferBinder(DrawingBuffer* drawingBuffer, WebGLFramebuffer* framebufferBinding)
|
| + : m_drawingBuffer(drawingBuffer)
|
| + , m_readFramebufferBinding(framebufferBinding)
|
| + {
|
| + // Commit DrawingBuffer if needed (e.g., for multisampling)
|
| + if (!m_readFramebufferBinding && m_drawingBuffer)
|
| + m_drawingBuffer->commit();
|
| + }
|
| +
|
| + ~ScopedDrawingBufferBinder()
|
| + {
|
| + // Restore DrawingBuffer if needed
|
| + if (!m_readFramebufferBinding && m_drawingBuffer)
|
| + m_drawingBuffer->restoreFramebufferBindings();
|
| + }
|
| +
|
| +private:
|
| + DrawingBuffer* m_drawingBuffer;
|
| + Member<WebGLFramebuffer> m_readFramebufferBinding;
|
| +};
|
| +
|
| class MODULES_EXPORT WebGLRenderingContextBase : public CanvasRenderingContext, public Page::MultisamplingChangedObserver {
|
| WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WebGLRenderingContextBase);
|
| public:
|
| @@ -250,7 +277,7 @@ public:
|
| void linkProgram(WebGLProgram*);
|
| void pixelStorei(GLenum pname, GLint param);
|
| void polygonOffset(GLfloat factor, GLfloat units);
|
| - void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, DOMArrayBufferView* pixels);
|
| + virtual void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, DOMArrayBufferView* pixels);
|
| void renderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
| void sampleCoverage(GLfloat value, GLboolean invert);
|
| void scissor(GLint x, GLint y, GLsizei width, GLsizei height);
|
| @@ -850,6 +877,10 @@ protected:
|
| // Generates INVALID_OPERATION and returns false if the combination is unsupported.
|
| bool validateReadPixelsFormatTypeCombination(GLenum format, GLenum type, GLenum readBufferInternalFormat, GLenum readBufferType);
|
|
|
| + // Helper function to check parameters of readPixels. Returns true if all parameters
|
| + // are valid. Otherwise, generates appropriate error and returns false.
|
| + bool validateReadPixelsFuncParameters(GLsizei width, GLsizei height, GLenum format, GLenum type, long long bufferSize);
|
| +
|
| virtual GLint getMaxTextureLevelForTarget(GLenum target);
|
|
|
| // Helper function to check input level for functions {copy}Tex{Sub}Image.
|
|
|