Commit fa36c330 by Frank Henigman Committed by Commit Bot

Clip FramebufferGL::readPixels to framebuffer.

In GL, ReadPixels() is allowed to modify memory that corresponds to pixels outside the framebuffer. In WebGL it must not do that, so clip the read area to the framebuffer. Enable corresponding test. BUG=angleproject:1815 Change-Id: I8113ae417dee7834e63498aec8291ce711bd7513 Reviewed-on: https://chromium-review.googlesource.com/536434 Commit-Queue: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 088031e6
...@@ -69,6 +69,7 @@ class FramebufferGL : public FramebufferImpl ...@@ -69,6 +69,7 @@ class FramebufferGL : public FramebufferImpl
GLenum getImplementationColorReadFormat(const gl::Context *context) const override; GLenum getImplementationColorReadFormat(const gl::Context *context) const override;
GLenum getImplementationColorReadType(const gl::Context *context) const override; GLenum getImplementationColorReadType(const gl::Context *context) const override;
gl::Error readPixels(const gl::Context *context, gl::Error readPixels(const gl::Context *context,
const gl::Rectangle &area, const gl::Rectangle &area,
GLenum format, GLenum format,
...@@ -102,19 +103,20 @@ class FramebufferGL : public FramebufferImpl ...@@ -102,19 +103,20 @@ class FramebufferGL : public FramebufferImpl
const GLenum *attachments, const GLenum *attachments,
std::vector<GLenum> *modifiedAttachments) const; std::vector<GLenum> *modifiedAttachments) const;
gl::Error readPixelsRowByRowWorkaround(const gl::Context *context, gl::Error readPixelsRowByRow(const gl::Context *context,
const gl::Rectangle &area, const gl::Rectangle &area,
GLenum format, GLenum format,
GLenum type, GLenum type,
const gl::PixelPackState &pack, const gl::PixelPackState &pack,
void *pixels) const; GLubyte *pixels) const;
gl::Error readPixelsPaddingWorkaround(const gl::Context *context, gl::Error readPixelsAllAtOnce(const gl::Context *context,
const gl::Rectangle &area, const gl::Rectangle &area,
GLenum format, GLenum format,
GLenum type, GLenum type,
const gl::PixelPackState &pack, const gl::PixelPackState &pack,
void *pixels) const; GLubyte *pixels,
bool readLastRowSeparately) const;
const FunctionsGL *mFunctions; const FunctionsGL *mFunctions;
StateManagerGL *mStateManager; StateManagerGL *mStateManager;
......
...@@ -256,10 +256,7 @@ class WebGLReadOutsideFramebufferTest : public ANGLETest ...@@ -256,10 +256,7 @@ class WebGLReadOutsideFramebufferTest : public ANGLETest
// the corresponding source pixel is outside the framebuffer. // the corresponding source pixel is outside the framebuffer.
TEST_P(WebGLReadOutsideFramebufferTest, ReadPixels) TEST_P(WebGLReadOutsideFramebufferTest, ReadPixels)
{ {
if (IsD3DSM3() || IsD3D11()) Main(&WebGLReadOutsideFramebufferTest::TestReadPixels, false);
{
Main(&WebGLReadOutsideFramebufferTest::TestReadPixels, false);
}
} }
// Check that copyTexSubImage2D does not set a destination pixel when // Check that copyTexSubImage2D does not set a destination pixel when
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment