Commit 690c8eb7 by Jamie Madill Committed by Commit Bot

Framebuffer: syncState before internal format query.

Since querying the internal format of an attachment might need ot look at the RenderTarget for some back-ends, or otherwise flush attachment changes, we should call syncState internally. This means that we can't mark these queries as const. Bug: angleproject:2372 Change-Id: I9bfb43a472bcd7dfdd6ea7fab4751d494e1126bb Reviewed-on: https://chromium-review.googlesource.com/948784Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 4d9d4839
...@@ -1362,14 +1362,18 @@ Error Framebuffer::clearBufferfi(const Context *context, ...@@ -1362,14 +1362,18 @@ Error Framebuffer::clearBufferfi(const Context *context,
return NoError(); return NoError();
} }
GLenum Framebuffer::getImplementationColorReadFormat(const Context *context) const Error Framebuffer::getImplementationColorReadFormat(const Context *context, GLenum *formatOut)
{ {
return mImpl->getImplementationColorReadFormat(context); ANGLE_TRY(syncState(context));
*formatOut = mImpl->getImplementationColorReadFormat(context);
return NoError();
} }
GLenum Framebuffer::getImplementationColorReadType(const Context *context) const Error Framebuffer::getImplementationColorReadType(const Context *context, GLenum *typeOut)
{ {
return mImpl->getImplementationColorReadType(context); ANGLE_TRY(syncState(context));
*typeOut = mImpl->getImplementationColorReadType(context);
return NoError();
} }
Error Framebuffer::readPixels(const Context *context, Error Framebuffer::readPixels(const Context *context,
......
...@@ -265,8 +265,10 @@ class Framebuffer final : public angle::ObserverInterface, public LabeledObject ...@@ -265,8 +265,10 @@ class Framebuffer final : public angle::ObserverInterface, public LabeledObject
GLfloat depth, GLfloat depth,
GLint stencil); GLint stencil);
GLenum getImplementationColorReadFormat(const Context *context) const; // These two methods call syncState() internally.
GLenum getImplementationColorReadType(const Context *context) const; Error getImplementationColorReadFormat(const Context *context, GLenum *formatOut);
Error getImplementationColorReadType(const Context *context, GLenum *typeOut);
Error readPixels(const Context *context, Error readPixels(const Context *context,
const Rectangle &area, const Rectangle &area,
GLenum format, GLenum format,
......
...@@ -1947,12 +1947,14 @@ Error State::getIntegerv(const Context *context, GLenum pname, GLint *params) ...@@ -1947,12 +1947,14 @@ Error State::getIntegerv(const Context *context, GLenum pname, GLint *params)
case GL_ELEMENT_ARRAY_BUFFER_BINDING: case GL_ELEMENT_ARRAY_BUFFER_BINDING:
*params = getVertexArray()->getElementArrayBuffer().id(); *params = getVertexArray()->getElementArrayBuffer().id();
break; break;
// case GL_FRAMEBUFFER_BINDING: case GL_DRAW_FRAMEBUFFER_BINDING:
// now equivalent to GL_DRAW_FRAMEBUFFER_BINDING_ANGLE static_assert(GL_DRAW_FRAMEBUFFER_BINDING == GL_DRAW_FRAMEBUFFER_BINDING_ANGLE,
case GL_DRAW_FRAMEBUFFER_BINDING_ANGLE: "Enum mismatch");
*params = mDrawFramebuffer->id(); *params = mDrawFramebuffer->id();
break; break;
case GL_READ_FRAMEBUFFER_BINDING_ANGLE: case GL_READ_FRAMEBUFFER_BINDING:
static_assert(GL_READ_FRAMEBUFFER_BINDING == GL_READ_FRAMEBUFFER_BINDING_ANGLE,
"Enum mismatch");
*params = mReadFramebuffer->id(); *params = mReadFramebuffer->id();
break; break;
case GL_RENDERBUFFER_BINDING: case GL_RENDERBUFFER_BINDING:
...@@ -2073,10 +2075,12 @@ Error State::getIntegerv(const Context *context, GLenum pname, GLint *params) ...@@ -2073,10 +2075,12 @@ Error State::getIntegerv(const Context *context, GLenum pname, GLint *params)
*params = mStencilClearValue; *params = mStencilClearValue;
break; break;
case GL_IMPLEMENTATION_COLOR_READ_TYPE: case GL_IMPLEMENTATION_COLOR_READ_TYPE:
*params = mReadFramebuffer->getImplementationColorReadType(context); ANGLE_TRY(mReadFramebuffer->getImplementationColorReadType(
context, reinterpret_cast<GLenum *>(params)));
break; break;
case GL_IMPLEMENTATION_COLOR_READ_FORMAT: case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
*params = mReadFramebuffer->getImplementationColorReadFormat(context); ANGLE_TRY(mReadFramebuffer->getImplementationColorReadFormat(
context, reinterpret_cast<GLenum *>(params)));
break; break;
case GL_SAMPLE_BUFFERS: case GL_SAMPLE_BUFFERS:
case GL_SAMPLES: case GL_SAMPLES:
......
...@@ -88,13 +88,13 @@ class TextureImpl : public FramebufferAttachmentObjectImpl ...@@ -88,13 +88,13 @@ class TextureImpl : public FramebufferAttachmentObjectImpl
size_t level, size_t level,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
GLenum internalFormat, GLenum internalFormat,
const gl::Framebuffer *source) = 0; gl::Framebuffer *source) = 0;
virtual gl::Error copySubImage(const gl::Context *context, virtual gl::Error copySubImage(const gl::Context *context,
gl::TextureTarget target, gl::TextureTarget target,
size_t level, size_t level,
const gl::Offset &destOffset, const gl::Offset &destOffset,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
const gl::Framebuffer *source) = 0; gl::Framebuffer *source) = 0;
virtual gl::Error copyTexture(const gl::Context *context, virtual gl::Error copyTexture(const gl::Context *context,
gl::TextureTarget target, gl::TextureTarget target,
......
...@@ -64,14 +64,14 @@ class MockTextureImpl : public TextureImpl ...@@ -64,14 +64,14 @@ class MockTextureImpl : public TextureImpl
size_t, size_t,
const gl::Rectangle &, const gl::Rectangle &,
GLenum, GLenum,
const gl::Framebuffer *)); gl::Framebuffer *));
MOCK_METHOD6(copySubImage, MOCK_METHOD6(copySubImage,
gl::Error(const gl::Context *, gl::Error(const gl::Context *,
gl::TextureTarget, gl::TextureTarget,
size_t, size_t,
const gl::Offset &, const gl::Offset &,
const gl::Rectangle &, const gl::Rectangle &,
const gl::Framebuffer *)); gl::Framebuffer *));
MOCK_METHOD10(copyTexture, MOCK_METHOD10(copyTexture,
gl::Error(const gl::Context *, gl::Error(const gl::Context *,
gl::TextureTarget, gl::TextureTarget,
......
...@@ -941,7 +941,7 @@ gl::Error TextureD3D_2D::copyImage(const gl::Context *context, ...@@ -941,7 +941,7 @@ gl::Error TextureD3D_2D::copyImage(const gl::Context *context,
size_t imageLevel, size_t imageLevel,
const gl::Rectangle &origSourceArea, const gl::Rectangle &origSourceArea,
GLenum internalFormat, GLenum internalFormat,
const gl::Framebuffer *source) gl::Framebuffer *source)
{ {
ASSERT(target == gl::TextureTarget::_2D); ASSERT(target == gl::TextureTarget::_2D);
...@@ -1015,7 +1015,7 @@ gl::Error TextureD3D_2D::copySubImage(const gl::Context *context, ...@@ -1015,7 +1015,7 @@ gl::Error TextureD3D_2D::copySubImage(const gl::Context *context,
size_t imageLevel, size_t imageLevel,
const gl::Offset &origDestOffset, const gl::Offset &origDestOffset,
const gl::Rectangle &origSourceArea, const gl::Rectangle &origSourceArea,
const gl::Framebuffer *source) gl::Framebuffer *source)
{ {
ASSERT(target == gl::TextureTarget::_2D && origDestOffset.z == 0); ASSERT(target == gl::TextureTarget::_2D && origDestOffset.z == 0);
...@@ -1727,7 +1727,7 @@ gl::Error TextureD3D_Cube::copyImage(const gl::Context *context, ...@@ -1727,7 +1727,7 @@ gl::Error TextureD3D_Cube::copyImage(const gl::Context *context,
size_t imageLevel, size_t imageLevel,
const gl::Rectangle &origSourceArea, const gl::Rectangle &origSourceArea,
GLenum internalFormat, GLenum internalFormat,
const gl::Framebuffer *source) gl::Framebuffer *source)
{ {
int faceIndex = static_cast<int>(gl::CubeMapTextureTargetToFaceIndex(target)); int faceIndex = static_cast<int>(gl::CubeMapTextureTargetToFaceIndex(target));
const gl::InternalFormat &internalFormatInfo = const gl::InternalFormat &internalFormatInfo =
...@@ -1805,7 +1805,7 @@ gl::Error TextureD3D_Cube::copySubImage(const gl::Context *context, ...@@ -1805,7 +1805,7 @@ gl::Error TextureD3D_Cube::copySubImage(const gl::Context *context,
size_t imageLevel, size_t imageLevel,
const gl::Offset &origDestOffset, const gl::Offset &origDestOffset,
const gl::Rectangle &origSourceArea, const gl::Rectangle &origSourceArea,
const gl::Framebuffer *source) gl::Framebuffer *source)
{ {
gl::Extents fbSize = source->getReadColorbuffer()->getSize(); gl::Extents fbSize = source->getReadColorbuffer()->getSize();
gl::Rectangle sourceArea; gl::Rectangle sourceArea;
...@@ -2535,7 +2535,7 @@ gl::Error TextureD3D_3D::copyImage(const gl::Context *context, ...@@ -2535,7 +2535,7 @@ gl::Error TextureD3D_3D::copyImage(const gl::Context *context,
size_t level, size_t level,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
GLenum internalFormat, GLenum internalFormat,
const gl::Framebuffer *source) gl::Framebuffer *source)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED();
return gl::InternalError() << "Copying 3D textures is unimplemented."; return gl::InternalError() << "Copying 3D textures is unimplemented.";
...@@ -2546,7 +2546,7 @@ gl::Error TextureD3D_3D::copySubImage(const gl::Context *context, ...@@ -2546,7 +2546,7 @@ gl::Error TextureD3D_3D::copySubImage(const gl::Context *context,
size_t imageLevel, size_t imageLevel,
const gl::Offset &destOffset, const gl::Offset &destOffset,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
const gl::Framebuffer *source) gl::Framebuffer *source)
{ {
ASSERT(target == gl::TextureTarget::_3D); ASSERT(target == gl::TextureTarget::_3D);
...@@ -3105,7 +3105,7 @@ gl::Error TextureD3D_2DArray::copyImage(const gl::Context *context, ...@@ -3105,7 +3105,7 @@ gl::Error TextureD3D_2DArray::copyImage(const gl::Context *context,
size_t level, size_t level,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
GLenum internalFormat, GLenum internalFormat,
const gl::Framebuffer *source) gl::Framebuffer *source)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED();
return gl::InternalError() << "Copying 2D array textures is unimplemented."; return gl::InternalError() << "Copying 2D array textures is unimplemented.";
...@@ -3116,7 +3116,7 @@ gl::Error TextureD3D_2DArray::copySubImage(const gl::Context *context, ...@@ -3116,7 +3116,7 @@ gl::Error TextureD3D_2DArray::copySubImage(const gl::Context *context,
size_t imageLevel, size_t imageLevel,
const gl::Offset &destOffset, const gl::Offset &destOffset,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
const gl::Framebuffer *source) gl::Framebuffer *source)
{ {
ASSERT(target == gl::TextureTarget::_2DArray); ASSERT(target == gl::TextureTarget::_2DArray);
...@@ -3616,7 +3616,7 @@ gl::Error TextureD3D_External::copyImage(const gl::Context *context, ...@@ -3616,7 +3616,7 @@ gl::Error TextureD3D_External::copyImage(const gl::Context *context,
size_t imageLevel, size_t imageLevel,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
GLenum internalFormat, GLenum internalFormat,
const gl::Framebuffer *source) gl::Framebuffer *source)
{ {
UNREACHABLE(); UNREACHABLE();
return gl::InternalError(); return gl::InternalError();
...@@ -3627,7 +3627,7 @@ gl::Error TextureD3D_External::copySubImage(const gl::Context *context, ...@@ -3627,7 +3627,7 @@ gl::Error TextureD3D_External::copySubImage(const gl::Context *context,
size_t imageLevel, size_t imageLevel,
const gl::Offset &destOffset, const gl::Offset &destOffset,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
const gl::Framebuffer *source) gl::Framebuffer *source)
{ {
UNREACHABLE(); UNREACHABLE();
return gl::InternalError(); return gl::InternalError();
...@@ -3831,7 +3831,7 @@ gl::Error TextureD3D_2DMultisample::copyImage(const gl::Context *context, ...@@ -3831,7 +3831,7 @@ gl::Error TextureD3D_2DMultisample::copyImage(const gl::Context *context,
size_t level, size_t level,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
GLenum internalFormat, GLenum internalFormat,
const gl::Framebuffer *source) gl::Framebuffer *source)
{ {
UNREACHABLE(); UNREACHABLE();
return gl::InternalError(); return gl::InternalError();
...@@ -3842,7 +3842,7 @@ gl::Error TextureD3D_2DMultisample::copySubImage(const gl::Context *context, ...@@ -3842,7 +3842,7 @@ gl::Error TextureD3D_2DMultisample::copySubImage(const gl::Context *context,
size_t level, size_t level,
const gl::Offset &destOffset, const gl::Offset &destOffset,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
const gl::Framebuffer *source) gl::Framebuffer *source)
{ {
UNREACHABLE(); UNREACHABLE();
return gl::InternalError(); return gl::InternalError();
......
...@@ -244,13 +244,13 @@ class TextureD3D_2D : public TextureD3D ...@@ -244,13 +244,13 @@ class TextureD3D_2D : public TextureD3D
size_t level, size_t level,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
GLenum internalFormat, GLenum internalFormat,
const gl::Framebuffer *source) override; gl::Framebuffer *source) override;
gl::Error copySubImage(const gl::Context *context, gl::Error copySubImage(const gl::Context *context,
gl::TextureTarget target, gl::TextureTarget target,
size_t level, size_t level,
const gl::Offset &destOffset, const gl::Offset &destOffset,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
const gl::Framebuffer *source) override; gl::Framebuffer *source) override;
gl::Error copyTexture(const gl::Context *context, gl::Error copyTexture(const gl::Context *context,
gl::TextureTarget target, gl::TextureTarget target,
...@@ -380,13 +380,13 @@ class TextureD3D_Cube : public TextureD3D ...@@ -380,13 +380,13 @@ class TextureD3D_Cube : public TextureD3D
size_t level, size_t level,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
GLenum internalFormat, GLenum internalFormat,
const gl::Framebuffer *source) override; gl::Framebuffer *source) override;
gl::Error copySubImage(const gl::Context *context, gl::Error copySubImage(const gl::Context *context,
gl::TextureTarget target, gl::TextureTarget target,
size_t level, size_t level,
const gl::Offset &destOffset, const gl::Offset &destOffset,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
const gl::Framebuffer *source) override; gl::Framebuffer *source) override;
gl::Error copyTexture(const gl::Context *context, gl::Error copyTexture(const gl::Context *context,
gl::TextureTarget target, gl::TextureTarget target,
...@@ -517,13 +517,13 @@ class TextureD3D_3D : public TextureD3D ...@@ -517,13 +517,13 @@ class TextureD3D_3D : public TextureD3D
size_t level, size_t level,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
GLenum internalFormat, GLenum internalFormat,
const gl::Framebuffer *source) override; gl::Framebuffer *source) override;
gl::Error copySubImage(const gl::Context *context, gl::Error copySubImage(const gl::Context *context,
gl::TextureTarget target, gl::TextureTarget target,
size_t level, size_t level,
const gl::Offset &destOffset, const gl::Offset &destOffset,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
const gl::Framebuffer *source) override; gl::Framebuffer *source) override;
gl::Error setStorage(const gl::Context *context, gl::Error setStorage(const gl::Context *context,
gl::TextureType type, gl::TextureType type,
...@@ -631,13 +631,13 @@ class TextureD3D_2DArray : public TextureD3D ...@@ -631,13 +631,13 @@ class TextureD3D_2DArray : public TextureD3D
size_t level, size_t level,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
GLenum internalFormat, GLenum internalFormat,
const gl::Framebuffer *source) override; gl::Framebuffer *source) override;
gl::Error copySubImage(const gl::Context *context, gl::Error copySubImage(const gl::Context *context,
gl::TextureTarget target, gl::TextureTarget target,
size_t level, size_t level,
const gl::Offset &destOffset, const gl::Offset &destOffset,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
const gl::Framebuffer *source) override; gl::Framebuffer *source) override;
gl::Error setStorage(const gl::Context *context, gl::Error setStorage(const gl::Context *context,
gl::TextureType type, gl::TextureType type,
...@@ -742,13 +742,13 @@ class TextureD3D_External : public TextureD3D ...@@ -742,13 +742,13 @@ class TextureD3D_External : public TextureD3D
size_t level, size_t level,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
GLenum internalFormat, GLenum internalFormat,
const gl::Framebuffer *source) override; gl::Framebuffer *source) override;
gl::Error copySubImage(const gl::Context *context, gl::Error copySubImage(const gl::Context *context,
gl::TextureTarget target, gl::TextureTarget target,
size_t level, size_t level,
const gl::Offset &destOffset, const gl::Offset &destOffset,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
const gl::Framebuffer *source) override; gl::Framebuffer *source) override;
gl::Error setStorage(const gl::Context *context, gl::Error setStorage(const gl::Context *context,
gl::TextureType type, gl::TextureType type,
...@@ -839,13 +839,13 @@ class TextureD3D_2DMultisample : public TextureD3D ...@@ -839,13 +839,13 @@ class TextureD3D_2DMultisample : public TextureD3D
size_t level, size_t level,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
GLenum internalFormat, GLenum internalFormat,
const gl::Framebuffer *source) override; gl::Framebuffer *source) override;
gl::Error copySubImage(const gl::Context *context, gl::Error copySubImage(const gl::Context *context,
gl::TextureTarget target, gl::TextureTarget target,
size_t level, size_t level,
const gl::Offset &destOffset, const gl::Offset &destOffset,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
const gl::Framebuffer *source) override; gl::Framebuffer *source) override;
gl::Error setStorageMultisample(const gl::Context *context, gl::Error setStorageMultisample(const gl::Context *context,
gl::TextureType type, gl::TextureType type,
......
...@@ -169,20 +169,22 @@ gl::Error BlitGL::copyImageToLUMAWorkaroundTexture(const gl::Context *context, ...@@ -169,20 +169,22 @@ gl::Error BlitGL::copyImageToLUMAWorkaroundTexture(const gl::Context *context,
size_t level, size_t level,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
GLenum internalFormat, GLenum internalFormat,
const gl::Framebuffer *source) gl::Framebuffer *source)
{ {
mStateManager->bindTexture(textureType, texture); mStateManager->bindTexture(textureType, texture);
// Allocate the texture memory // Allocate the texture memory
GLenum format = gl::GetUnsizedFormat(internalFormat); GLenum format = gl::GetUnsizedFormat(internalFormat);
GLenum readType = GL_NONE;
ANGLE_TRY(source->getImplementationColorReadType(context, &readType));
gl::PixelUnpackState unpack; gl::PixelUnpackState unpack;
mStateManager->setPixelUnpackState(unpack); mStateManager->setPixelUnpackState(unpack);
mStateManager->setPixelUnpackBuffer( mStateManager->setPixelUnpackBuffer(
context->getGLState().getTargetBuffer(gl::BufferBinding::PixelUnpack)); context->getGLState().getTargetBuffer(gl::BufferBinding::PixelUnpack));
mFunctions->texImage2D(ToGLenum(target), static_cast<GLint>(level), internalFormat, mFunctions->texImage2D(ToGLenum(target), static_cast<GLint>(level), internalFormat,
sourceArea.width, sourceArea.height, 0, format, sourceArea.width, sourceArea.height, 0, format, readType, nullptr);
source->getImplementationColorReadType(context), nullptr);
return copySubImageToLUMAWorkaroundTexture(context, texture, textureType, target, lumaFormat, return copySubImageToLUMAWorkaroundTexture(context, texture, textureType, target, lumaFormat,
level, gl::Offset(0, 0, 0), sourceArea, source); level, gl::Offset(0, 0, 0), sourceArea, source);
...@@ -196,7 +198,7 @@ gl::Error BlitGL::copySubImageToLUMAWorkaroundTexture(const gl::Context *context ...@@ -196,7 +198,7 @@ gl::Error BlitGL::copySubImageToLUMAWorkaroundTexture(const gl::Context *context
size_t level, size_t level,
const gl::Offset &destOffset, const gl::Offset &destOffset,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
const gl::Framebuffer *source) gl::Framebuffer *source)
{ {
ANGLE_TRY(initializeResources()); ANGLE_TRY(initializeResources());
...@@ -207,9 +209,14 @@ gl::Error BlitGL::copySubImageToLUMAWorkaroundTexture(const gl::Context *context ...@@ -207,9 +209,14 @@ gl::Error BlitGL::copySubImageToLUMAWorkaroundTexture(const gl::Context *context
const FramebufferGL *sourceFramebufferGL = GetImplAs<FramebufferGL>(source); const FramebufferGL *sourceFramebufferGL = GetImplAs<FramebufferGL>(source);
mStateManager->bindFramebuffer(GL_FRAMEBUFFER, sourceFramebufferGL->getFramebufferID()); mStateManager->bindFramebuffer(GL_FRAMEBUFFER, sourceFramebufferGL->getFramebufferID());
nativegl::CopyTexImageImageFormat copyTexImageFormat = nativegl::GetCopyTexImageImageFormat( GLenum readFormat = GL_NONE;
mFunctions, mWorkarounds, source->getImplementationColorReadFormat(context), ANGLE_TRY(source->getImplementationColorReadFormat(context, &readFormat));
source->getImplementationColorReadType(context));
GLenum readType = GL_NONE;
ANGLE_TRY(source->getImplementationColorReadType(context, &readType));
nativegl::CopyTexImageImageFormat copyTexImageFormat =
nativegl::GetCopyTexImageImageFormat(mFunctions, mWorkarounds, readFormat, readType);
mStateManager->bindTexture(gl::TextureType::_2D, mScratchTextures[0]); mStateManager->bindTexture(gl::TextureType::_2D, mScratchTextures[0]);
mFunctions->copyTexImage2D(GL_TEXTURE_2D, 0, copyTexImageFormat.internalFormat, sourceArea.x, mFunctions->copyTexImage2D(GL_TEXTURE_2D, 0, copyTexImageFormat.internalFormat, sourceArea.x,
...@@ -226,10 +233,9 @@ gl::Error BlitGL::copySubImageToLUMAWorkaroundTexture(const gl::Context *context ...@@ -226,10 +233,9 @@ gl::Error BlitGL::copySubImageToLUMAWorkaroundTexture(const gl::Context *context
// Make a temporary framebuffer using the second scratch texture to render the swizzled result // Make a temporary framebuffer using the second scratch texture to render the swizzled result
// to. // to.
mStateManager->bindTexture(gl::TextureType::_2D, mScratchTextures[1]); mStateManager->bindTexture(gl::TextureType::_2D, mScratchTextures[1]);
mFunctions->texImage2D(GL_TEXTURE_2D, 0, copyTexImageFormat.internalFormat, sourceArea.width, mFunctions->texImage2D(
sourceArea.height, 0, GL_TEXTURE_2D, 0, copyTexImageFormat.internalFormat, sourceArea.width, sourceArea.height, 0,
gl::GetUnsizedFormat(copyTexImageFormat.internalFormat), gl::GetUnsizedFormat(copyTexImageFormat.internalFormat), readType, nullptr);
source->getImplementationColorReadType(context), nullptr);
mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mScratchFBO); mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mScratchFBO);
mFunctions->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mFunctions->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
......
...@@ -46,7 +46,7 @@ class BlitGL : angle::NonCopyable ...@@ -46,7 +46,7 @@ class BlitGL : angle::NonCopyable
size_t level, size_t level,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
GLenum internalFormat, GLenum internalFormat,
const gl::Framebuffer *source); gl::Framebuffer *source);
gl::Error copySubImageToLUMAWorkaroundTexture(const gl::Context *context, gl::Error copySubImageToLUMAWorkaroundTexture(const gl::Context *context,
GLuint texture, GLuint texture,
...@@ -56,7 +56,7 @@ class BlitGL : angle::NonCopyable ...@@ -56,7 +56,7 @@ class BlitGL : angle::NonCopyable
size_t level, size_t level,
const gl::Offset &destOffset, const gl::Offset &destOffset,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
const gl::Framebuffer *source); gl::Framebuffer *source);
gl::Error blitColorBufferWithShader(const gl::Framebuffer *source, gl::Error blitColorBufferWithShader(const gl::Framebuffer *source,
const gl::Framebuffer *dest, const gl::Framebuffer *dest,
......
...@@ -549,9 +549,10 @@ gl::Error TextureGL::copyImage(const gl::Context *context, ...@@ -549,9 +549,10 @@ gl::Error TextureGL::copyImage(const gl::Context *context,
size_t level, size_t level,
const gl::Rectangle &origSourceArea, const gl::Rectangle &origSourceArea,
GLenum internalFormat, GLenum internalFormat,
const gl::Framebuffer *source) gl::Framebuffer *source)
{ {
GLenum type = source->getImplementationColorReadType(context); GLenum type = GL_NONE;
ANGLE_TRY(source->getImplementationColorReadType(context, &type));
nativegl::CopyTexImageImageFormat copyTexImageFormat = nativegl::CopyTexImageImageFormat copyTexImageFormat =
nativegl::GetCopyTexImageImageFormat(mFunctions, mWorkarounds, internalFormat, type); nativegl::GetCopyTexImageImageFormat(mFunctions, mWorkarounds, internalFormat, type);
...@@ -644,7 +645,7 @@ gl::Error TextureGL::copySubImage(const gl::Context *context, ...@@ -644,7 +645,7 @@ gl::Error TextureGL::copySubImage(const gl::Context *context,
size_t level, size_t level,
const gl::Offset &origDestOffset, const gl::Offset &origDestOffset,
const gl::Rectangle &origSourceArea, const gl::Rectangle &origSourceArea,
const gl::Framebuffer *source) gl::Framebuffer *source)
{ {
const FramebufferGL *sourceFramebufferGL = GetImplAs<FramebufferGL>(source); const FramebufferGL *sourceFramebufferGL = GetImplAs<FramebufferGL>(source);
......
...@@ -103,13 +103,13 @@ class TextureGL : public TextureImpl ...@@ -103,13 +103,13 @@ class TextureGL : public TextureImpl
size_t level, size_t level,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
GLenum internalFormat, GLenum internalFormat,
const gl::Framebuffer *source) override; gl::Framebuffer *source) override;
gl::Error copySubImage(const gl::Context *context, gl::Error copySubImage(const gl::Context *context,
gl::TextureTarget target, gl::TextureTarget target,
size_t level, size_t level,
const gl::Offset &destOffset, const gl::Offset &destOffset,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
const gl::Framebuffer *source) override; gl::Framebuffer *source) override;
gl::Error copyTexture(const gl::Context *context, gl::Error copyTexture(const gl::Context *context,
gl::TextureTarget target, gl::TextureTarget target,
......
...@@ -78,7 +78,7 @@ gl::Error TextureNULL::copyImage(const gl::Context *context, ...@@ -78,7 +78,7 @@ gl::Error TextureNULL::copyImage(const gl::Context *context,
size_t level, size_t level,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
GLenum internalFormat, GLenum internalFormat,
const gl::Framebuffer *source) gl::Framebuffer *source)
{ {
return gl::NoError(); return gl::NoError();
} }
...@@ -88,7 +88,7 @@ gl::Error TextureNULL::copySubImage(const gl::Context *context, ...@@ -88,7 +88,7 @@ gl::Error TextureNULL::copySubImage(const gl::Context *context,
size_t level, size_t level,
const gl::Offset &destOffset, const gl::Offset &destOffset,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
const gl::Framebuffer *source) gl::Framebuffer *source)
{ {
return gl::NoError(); return gl::NoError();
} }
......
...@@ -61,13 +61,13 @@ class TextureNULL : public TextureImpl ...@@ -61,13 +61,13 @@ class TextureNULL : public TextureImpl
size_t level, size_t level,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
GLenum internalFormat, GLenum internalFormat,
const gl::Framebuffer *source) override; gl::Framebuffer *source) override;
gl::Error copySubImage(const gl::Context *context, gl::Error copySubImage(const gl::Context *context,
gl::TextureTarget target, gl::TextureTarget target,
size_t level, size_t level,
const gl::Offset &destOffset, const gl::Offset &destOffset,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
const gl::Framebuffer *source) override; gl::Framebuffer *source) override;
gl::Error setStorage(const gl::Context *context, gl::Error setStorage(const gl::Context *context,
gl::TextureType type, gl::TextureType type,
......
...@@ -366,7 +366,7 @@ gl::Error TextureVk::copyImage(const gl::Context *context, ...@@ -366,7 +366,7 @@ gl::Error TextureVk::copyImage(const gl::Context *context,
size_t level, size_t level,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
GLenum internalFormat, GLenum internalFormat,
const gl::Framebuffer *source) gl::Framebuffer *source)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED();
return gl::InternalError(); return gl::InternalError();
...@@ -377,7 +377,7 @@ gl::Error TextureVk::copySubImage(const gl::Context *context, ...@@ -377,7 +377,7 @@ gl::Error TextureVk::copySubImage(const gl::Context *context,
size_t level, size_t level,
const gl::Offset &destOffset, const gl::Offset &destOffset,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
const gl::Framebuffer *source) gl::Framebuffer *source)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED();
return gl::InternalError(); return gl::InternalError();
......
...@@ -64,13 +64,13 @@ class TextureVk : public TextureImpl, public ResourceVk ...@@ -64,13 +64,13 @@ class TextureVk : public TextureImpl, public ResourceVk
size_t level, size_t level,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
GLenum internalFormat, GLenum internalFormat,
const gl::Framebuffer *source) override; gl::Framebuffer *source) override;
gl::Error copySubImage(const gl::Context *context, gl::Error copySubImage(const gl::Context *context,
gl::TextureTarget target, gl::TextureTarget target,
size_t level, size_t level,
const gl::Offset &destOffset, const gl::Offset &destOffset,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
const gl::Framebuffer *source) override; gl::Framebuffer *source) override;
gl::Error setStorage(const gl::Context *context, gl::Error setStorage(const gl::Context *context,
gl::TextureType type, gl::TextureType type,
......
...@@ -5171,7 +5171,7 @@ bool ValidateReadPixelsBase(Context *context, ...@@ -5171,7 +5171,7 @@ bool ValidateReadPixelsBase(Context *context,
return false; return false;
} }
const Framebuffer *framebuffer = context->getGLState().getReadFramebuffer(); Framebuffer *framebuffer = context->getGLState().getReadFramebuffer();
ASSERT(framebuffer); ASSERT(framebuffer);
if (framebuffer->getReadBufferState() == GL_NONE) if (framebuffer->getReadBufferState() == GL_NONE)
...@@ -5223,8 +5223,12 @@ bool ValidateReadPixelsBase(Context *context, ...@@ -5223,8 +5223,12 @@ bool ValidateReadPixelsBase(Context *context,
} }
} }
GLenum currentFormat = framebuffer->getImplementationColorReadFormat(context); GLenum currentFormat = GL_NONE;
GLenum currentType = framebuffer->getImplementationColorReadType(context); ANGLE_VALIDATION_TRY(framebuffer->getImplementationColorReadFormat(context, &currentFormat));
GLenum currentType = GL_NONE;
ANGLE_VALIDATION_TRY(framebuffer->getImplementationColorReadType(context, &currentType));
GLenum currentComponentType = readBuffer->getFormat().info->componentType; GLenum currentComponentType = readBuffer->getFormat().info->componentType;
bool validFormatTypeCombination = bool validFormatTypeCombination =
......
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