Commit fc72a073 by Geoff Lang

Update CHROMIUM_copy_texture entry points to the ES3 versions.

BUG=angleproject:1932 Change-Id: Ia45f8522320af1d747fbfb57468e8b881b033543 Reviewed-on: https://chromium-review.googlesource.com/459101Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent ee218f27
...@@ -1325,14 +1325,20 @@ GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei ...@@ -1325,14 +1325,20 @@ GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei
#ifndef GL_CHROMIUM_copy_texture #ifndef GL_CHROMIUM_copy_texture
#define GL_CHROMIUM_copy_texture 1 #define GL_CHROMIUM_copy_texture 1
typedef void(GL_APIENTRYP PFNGLCOPYTEXTURECHROMIUMPROC)(GLuint sourceId, typedef void(GL_APIENTRYP PFNGLCOPYTEXTURECHROMIUMPROC)(GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId, GLuint destId,
GLint destLevel,
GLint internalFormat, GLint internalFormat,
GLenum destType, GLenum destType,
GLboolean unpackFlipY, GLboolean unpackFlipY,
GLboolean unpackPremultiplyAlpha, GLboolean unpackPremultiplyAlpha,
GLboolean unpackUnmultiplyAlpha); GLboolean unpackUnmultiplyAlpha);
typedef void(GL_APIENTRYP PFNGLCOPYSUBTEXTURECHROMIUMPROC)(GLuint sourceId, typedef void(GL_APIENTRYP PFNGLCOPYSUBTEXTURECHROMIUMPROC)(GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId, GLuint destId,
GLint destLevel,
GLint xoffset, GLint xoffset,
GLint yoffset, GLint yoffset,
GLint x, GLint x,
...@@ -1344,14 +1350,20 @@ typedef void(GL_APIENTRYP PFNGLCOPYSUBTEXTURECHROMIUMPROC)(GLuint sourceId, ...@@ -1344,14 +1350,20 @@ typedef void(GL_APIENTRYP PFNGLCOPYSUBTEXTURECHROMIUMPROC)(GLuint sourceId,
GLboolean unpackUnmultiplyAlpha); GLboolean unpackUnmultiplyAlpha);
#ifdef GL_GLEXT_PROTOTYPES #ifdef GL_GLEXT_PROTOTYPES
GL_APICALL void GL_APIENTRY glCopyTextureCHROMIUM(GLuint sourceId, GL_APICALL void GL_APIENTRY glCopyTextureCHROMIUM(GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId, GLuint destId,
GLint destLevel,
GLint internalFormat, GLint internalFormat,
GLenum destType, GLenum destType,
GLboolean unpackFlipY, GLboolean unpackFlipY,
GLboolean unpackPremultiplyAlpha, GLboolean unpackPremultiplyAlpha,
GLboolean unpackUnmultiplyAlpha); GLboolean unpackUnmultiplyAlpha);
GL_APICALL void GL_APIENTRY glCopySubTextureCHROMIUM(GLuint sourceId, GL_APICALL void GL_APIENTRY glCopySubTextureCHROMIUM(GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId, GLuint destId,
GLint destLevel,
GLint xoffset, GLint xoffset,
GLint yoffset, GLint yoffset,
GLint x, GLint x,
......
...@@ -3150,7 +3150,10 @@ void Context::generateMipmap(GLenum target) ...@@ -3150,7 +3150,10 @@ void Context::generateMipmap(GLenum target)
} }
void Context::copyTextureCHROMIUM(GLuint sourceId, void Context::copyTextureCHROMIUM(GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId, GLuint destId,
GLint destLevel,
GLint internalFormat, GLint internalFormat,
GLenum destType, GLenum destType,
GLboolean unpackFlipY, GLboolean unpackFlipY,
...@@ -3161,13 +3164,16 @@ void Context::copyTextureCHROMIUM(GLuint sourceId, ...@@ -3161,13 +3164,16 @@ void Context::copyTextureCHROMIUM(GLuint sourceId,
gl::Texture *sourceTexture = getTexture(sourceId); gl::Texture *sourceTexture = getTexture(sourceId);
gl::Texture *destTexture = getTexture(destId); gl::Texture *destTexture = getTexture(destId);
handleError(destTexture->copyTexture(this, internalFormat, destType, unpackFlipY == GL_TRUE, handleError(destTexture->copyTexture(
unpackPremultiplyAlpha == GL_TRUE, this, destTarget, destLevel, internalFormat, destType, sourceLevel, unpackFlipY == GL_TRUE,
unpackUnmultiplyAlpha == GL_TRUE, sourceTexture)); unpackPremultiplyAlpha == GL_TRUE, unpackUnmultiplyAlpha == GL_TRUE, sourceTexture));
} }
void Context::copySubTextureCHROMIUM(GLuint sourceId, void Context::copySubTextureCHROMIUM(GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId, GLuint destId,
GLint destLevel,
GLint xoffset, GLint xoffset,
GLint yoffset, GLint yoffset,
GLint x, GLint x,
...@@ -3190,9 +3196,9 @@ void Context::copySubTextureCHROMIUM(GLuint sourceId, ...@@ -3190,9 +3196,9 @@ void Context::copySubTextureCHROMIUM(GLuint sourceId,
gl::Texture *destTexture = getTexture(destId); gl::Texture *destTexture = getTexture(destId);
Offset offset(xoffset, yoffset, 0); Offset offset(xoffset, yoffset, 0);
Rectangle area(x, y, width, height); Rectangle area(x, y, width, height);
handleError(destTexture->copySubTexture(this, offset, area, unpackFlipY == GL_TRUE, handleError(destTexture->copySubTexture(
unpackPremultiplyAlpha == GL_TRUE, this, destTarget, destLevel, offset, sourceLevel, area, unpackFlipY == GL_TRUE,
unpackUnmultiplyAlpha == GL_TRUE, sourceTexture)); unpackPremultiplyAlpha == GL_TRUE, unpackUnmultiplyAlpha == GL_TRUE, sourceTexture));
} }
void Context::compressedCopyTextureCHROMIUM(GLuint sourceId, GLuint destId) void Context::compressedCopyTextureCHROMIUM(GLuint sourceId, GLuint destId)
......
...@@ -496,14 +496,20 @@ class Context final : public ValidationContext ...@@ -496,14 +496,20 @@ class Context final : public ValidationContext
GLsizei imageSize, GLsizei imageSize,
const GLvoid *data); const GLvoid *data);
void copyTextureCHROMIUM(GLuint sourceId, void copyTextureCHROMIUM(GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId, GLuint destId,
GLint destLevel,
GLint internalFormat, GLint internalFormat,
GLenum destType, GLenum destType,
GLboolean unpackFlipY, GLboolean unpackFlipY,
GLboolean unpackPremultiplyAlpha, GLboolean unpackPremultiplyAlpha,
GLboolean unpackUnmultiplyAlpha); GLboolean unpackUnmultiplyAlpha);
void copySubTextureCHROMIUM(GLuint sourceId, void copySubTextureCHROMIUM(GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId, GLuint destId,
GLint destLevel,
GLint xoffset, GLint xoffset,
GLint yoffset, GLint yoffset,
GLint x, GLint x,
......
...@@ -967,38 +967,52 @@ Error Texture::copySubImage(const Context *context, ...@@ -967,38 +967,52 @@ Error Texture::copySubImage(const Context *context,
} }
Error Texture::copyTexture(const Context *context, Error Texture::copyTexture(const Context *context,
GLenum target,
size_t level,
GLenum internalFormat, GLenum internalFormat,
GLenum type, GLenum type,
size_t sourceLevel,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha, bool unpackUnmultiplyAlpha,
const Texture *source) const Texture *source)
{ {
ASSERT(target == mState.mTarget ||
(mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target)));
// Release from previous calls to eglBindTexImage, to avoid calling the Impl after // Release from previous calls to eglBindTexImage, to avoid calling the Impl after
releaseTexImageInternal(); releaseTexImageInternal();
orphanImages(); orphanImages();
ANGLE_TRY(mTexture->copyTexture(rx::SafeGetImpl(context), internalFormat, type, unpackFlipY, ANGLE_TRY(mTexture->copyTexture(rx::SafeGetImpl(context), target, level, internalFormat, type,
unpackPremultiplyAlpha, unpackUnmultiplyAlpha, source)); sourceLevel, unpackFlipY, unpackPremultiplyAlpha,
unpackUnmultiplyAlpha, source));
const auto &sourceDesc = source->mState.getImageDesc(source->getTarget(), 0); const auto &sourceDesc = source->mState.getImageDesc(source->getTarget(), 0);
const GLenum sizedFormat = GetSizedInternalFormat(internalFormat, type); const GLenum sizedFormat = GetSizedInternalFormat(internalFormat, type);
mState.setImageDesc(getTarget(), 0, ImageDesc(sourceDesc.size, Format(sizedFormat))); mState.setImageDesc(target, level, ImageDesc(sourceDesc.size, Format(sizedFormat)));
mDirtyChannel.signal(); mDirtyChannel.signal();
return NoError(); return NoError();
} }
Error Texture::copySubTexture(const Context *context, Error Texture::copySubTexture(const Context *context,
GLenum target,
size_t level,
const Offset &destOffset, const Offset &destOffset,
size_t sourceLevel,
const Rectangle &sourceArea, const Rectangle &sourceArea,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha, bool unpackUnmultiplyAlpha,
const Texture *source) const Texture *source)
{ {
return mTexture->copySubTexture(rx::SafeGetImpl(context), destOffset, sourceArea, unpackFlipY, ASSERT(target == mState.mTarget ||
unpackPremultiplyAlpha, unpackUnmultiplyAlpha, source); (mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target)));
return mTexture->copySubTexture(rx::SafeGetImpl(context), target, level, destOffset,
sourceLevel, sourceArea, unpackFlipY, unpackPremultiplyAlpha,
unpackUnmultiplyAlpha, source);
} }
Error Texture::copyCompressedTexture(const Context *context, const Texture *source) Error Texture::copyCompressedTexture(const Context *context, const Texture *source)
......
...@@ -313,14 +313,20 @@ class Texture final : public egl::ImageSibling, ...@@ -313,14 +313,20 @@ class Texture final : public egl::ImageSibling,
const Framebuffer *source); const Framebuffer *source);
Error copyTexture(const Context *context, Error copyTexture(const Context *context,
GLenum target,
size_t level,
GLenum internalFormat, GLenum internalFormat,
GLenum type, GLenum type,
size_t sourceLevel,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha, bool unpackUnmultiplyAlpha,
const Texture *source); const Texture *source);
Error copySubTexture(const Context *context, Error copySubTexture(const Context *context,
GLenum target,
size_t level,
const Offset &destOffset, const Offset &destOffset,
size_t sourceLevel,
const Rectangle &sourceArea, const Rectangle &sourceArea,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
......
...@@ -20,8 +20,11 @@ TextureImpl::~TextureImpl() ...@@ -20,8 +20,11 @@ TextureImpl::~TextureImpl()
} }
gl::Error TextureImpl::copyTexture(ContextImpl *contextImpl, gl::Error TextureImpl::copyTexture(ContextImpl *contextImpl,
GLenum target,
size_t level,
GLenum internalFormat, GLenum internalFormat,
GLenum type, GLenum type,
size_t sourceLevel,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha, bool unpackUnmultiplyAlpha,
...@@ -32,7 +35,10 @@ gl::Error TextureImpl::copyTexture(ContextImpl *contextImpl, ...@@ -32,7 +35,10 @@ gl::Error TextureImpl::copyTexture(ContextImpl *contextImpl,
} }
gl::Error TextureImpl::copySubTexture(ContextImpl *contextImpl, gl::Error TextureImpl::copySubTexture(ContextImpl *contextImpl,
GLenum target,
size_t level,
const gl::Offset &destOffset, const gl::Offset &destOffset,
size_t sourceLevel,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
......
...@@ -95,14 +95,20 @@ class TextureImpl : public FramebufferAttachmentObjectImpl ...@@ -95,14 +95,20 @@ class TextureImpl : public FramebufferAttachmentObjectImpl
const gl::Framebuffer *source) = 0; const gl::Framebuffer *source) = 0;
virtual gl::Error copyTexture(ContextImpl *contextImpl, virtual gl::Error copyTexture(ContextImpl *contextImpl,
GLenum target,
size_t level,
GLenum internalFormat, GLenum internalFormat,
GLenum type, GLenum type,
size_t sourceLevel,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha, bool unpackUnmultiplyAlpha,
const gl::Texture *source); const gl::Texture *source);
virtual gl::Error copySubTexture(ContextImpl *contextImpl, virtual gl::Error copySubTexture(ContextImpl *contextImpl,
GLenum target,
size_t level,
const gl::Offset &destOffset, const gl::Offset &destOffset,
size_t sourceLevel,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
......
...@@ -72,16 +72,28 @@ class MockTextureImpl : public TextureImpl ...@@ -72,16 +72,28 @@ class MockTextureImpl : public TextureImpl
const gl::Offset &, const gl::Offset &,
const gl::Rectangle &, const gl::Rectangle &,
const gl::Framebuffer *)); const gl::Framebuffer *));
MOCK_METHOD7(copyTexture, MOCK_METHOD10(copyTexture,
gl::Error(ContextImpl *, GLenum, GLenum, bool, bool, bool, const gl::Texture *)); gl::Error(ContextImpl *,
MOCK_METHOD7(copySubTexture, GLenum,
gl::Error(ContextImpl *, size_t,
const gl::Offset &, GLenum,
const gl::Rectangle &, GLenum,
bool, size_t,
bool, bool,
bool, bool,
const gl::Texture *)); bool,
const gl::Texture *));
MOCK_METHOD10(copySubTexture,
gl::Error(ContextImpl *,
GLenum,
size_t,
const gl::Offset &,
size_t,
const gl::Rectangle &,
bool,
bool,
bool,
const gl::Texture *));
MOCK_METHOD2(copyCompressedTexture, gl::Error(ContextImpl *, const gl::Texture *source)); MOCK_METHOD2(copyCompressedTexture, gl::Error(ContextImpl *, const gl::Texture *source));
MOCK_METHOD5(setStorage, gl::Error(ContextImpl *, GLenum, size_t, GLenum, const gl::Extents &)); MOCK_METHOD5(setStorage, gl::Error(ContextImpl *, GLenum, size_t, GLenum, const gl::Extents &));
MOCK_METHOD3(setImageExternal, MOCK_METHOD3(setImageExternal,
......
...@@ -178,6 +178,7 @@ class RendererD3D : public BufferFactoryD3D ...@@ -178,6 +178,7 @@ class RendererD3D : public BufferFactoryD3D
GLenum destFormat, GLenum destFormat,
const gl::Offset &destOffset, const gl::Offset &destOffset,
TextureStorage *storage, TextureStorage *storage,
GLenum destTarget,
GLint destLevel, GLint destLevel,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
......
...@@ -1030,17 +1030,21 @@ gl::Error TextureD3D_2D::copySubImage(ContextImpl *contextImpl, ...@@ -1030,17 +1030,21 @@ gl::Error TextureD3D_2D::copySubImage(ContextImpl *contextImpl,
} }
gl::Error TextureD3D_2D::copyTexture(ContextImpl *contextImpl, gl::Error TextureD3D_2D::copyTexture(ContextImpl *contextImpl,
GLenum target,
size_t level,
GLenum internalFormat, GLenum internalFormat,
GLenum type, GLenum type,
size_t sourceLevel,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha, bool unpackUnmultiplyAlpha,
const gl::Texture *source) const gl::Texture *source)
{ {
ASSERT(target == GL_TEXTURE_2D);
GLenum sourceTarget = source->getTarget(); GLenum sourceTarget = source->getTarget();
GLint sourceLevel = 0;
GLint destLevel = 0; GLint destLevel = static_cast<GLint>(level);
GLenum sizedInternalFormat = gl::GetSizedInternalFormat(internalFormat, type); GLenum sizedInternalFormat = gl::GetSizedInternalFormat(internalFormat, type);
gl::Extents size(static_cast<int>(source->getWidth(sourceTarget, sourceLevel)), gl::Extents size(static_cast<int>(source->getWidth(sourceTarget, sourceLevel)),
...@@ -1055,24 +1059,28 @@ gl::Error TextureD3D_2D::copyTexture(ContextImpl *contextImpl, ...@@ -1055,24 +1059,28 @@ gl::Error TextureD3D_2D::copyTexture(ContextImpl *contextImpl,
gl::Rectangle sourceRect(0, 0, size.width, size.height); gl::Rectangle sourceRect(0, 0, size.width, size.height);
gl::Offset destOffset(0, 0, 0); gl::Offset destOffset(0, 0, 0);
ANGLE_TRY(mRenderer->copyTexture(source, sourceLevel, sourceRect, ANGLE_TRY(mRenderer->copyTexture(source, static_cast<GLint>(sourceLevel), sourceRect,
gl::GetInternalFormatInfo(sizedInternalFormat).format, gl::GetInternalFormatInfo(sizedInternalFormat).format,
destOffset, mTexStorage, destLevel, unpackFlipY, destOffset, mTexStorage, target, destLevel, unpackFlipY,
unpackPremultiplyAlpha, unpackUnmultiplyAlpha)); unpackPremultiplyAlpha, unpackUnmultiplyAlpha));
return gl::NoError(); return gl::NoError();
} }
gl::Error TextureD3D_2D::copySubTexture(ContextImpl *contextImpl, gl::Error TextureD3D_2D::copySubTexture(ContextImpl *contextImpl,
GLenum target,
size_t level,
const gl::Offset &destOffset, const gl::Offset &destOffset,
size_t sourceLevel,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha, bool unpackUnmultiplyAlpha,
const gl::Texture *source) const gl::Texture *source)
{ {
GLint sourceLevel = 0; ASSERT(target == GL_TEXTURE_2D);
GLint destLevel = 0;
GLint destLevel = static_cast<GLint>(level);
ASSERT(canCreateRenderTargetForImage(gl::ImageIndex::Make2D(destLevel))); ASSERT(canCreateRenderTargetForImage(gl::ImageIndex::Make2D(destLevel)));
...@@ -1080,9 +1088,9 @@ gl::Error TextureD3D_2D::copySubTexture(ContextImpl *contextImpl, ...@@ -1080,9 +1088,9 @@ gl::Error TextureD3D_2D::copySubTexture(ContextImpl *contextImpl,
ASSERT(isValidLevel(destLevel)); ASSERT(isValidLevel(destLevel));
ANGLE_TRY(updateStorageLevel(destLevel)); ANGLE_TRY(updateStorageLevel(destLevel));
ANGLE_TRY(mRenderer->copyTexture(source, sourceLevel, sourceArea, ANGLE_TRY(mRenderer->copyTexture(source, static_cast<GLint>(sourceLevel), sourceArea,
gl::GetInternalFormatInfo(getBaseLevelInternalFormat()).format, gl::GetInternalFormatInfo(getBaseLevelInternalFormat()).format,
destOffset, mTexStorage, destLevel, unpackFlipY, destOffset, mTexStorage, target, destLevel, unpackFlipY,
unpackPremultiplyAlpha, unpackUnmultiplyAlpha)); unpackPremultiplyAlpha, unpackUnmultiplyAlpha));
return gl::NoError(); return gl::NoError();
......
...@@ -201,14 +201,20 @@ class TextureD3D_2D : public TextureD3D ...@@ -201,14 +201,20 @@ class TextureD3D_2D : public TextureD3D
const gl::Framebuffer *source) override; const gl::Framebuffer *source) override;
gl::Error copyTexture(ContextImpl *contextImpl, gl::Error copyTexture(ContextImpl *contextImpl,
GLenum target,
size_t level,
GLenum internalFormat, GLenum internalFormat,
GLenum type, GLenum type,
size_t sourceLevel,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha, bool unpackUnmultiplyAlpha,
const gl::Texture *source) override; const gl::Texture *source) override;
gl::Error copySubTexture(ContextImpl *contextImpl, gl::Error copySubTexture(ContextImpl *contextImpl,
GLenum target,
size_t level,
const gl::Offset &destOffset, const gl::Offset &destOffset,
size_t sourceLevel,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
......
...@@ -3206,6 +3206,7 @@ gl::Error Renderer11::copyTexture(const gl::Texture *source, ...@@ -3206,6 +3206,7 @@ gl::Error Renderer11::copyTexture(const gl::Texture *source,
GLenum destFormat, GLenum destFormat,
const gl::Offset &destOffset, const gl::Offset &destOffset,
TextureStorage *storage, TextureStorage *storage,
GLenum destTarget,
GLint destLevel, GLint destLevel,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
...@@ -3216,6 +3217,7 @@ gl::Error Renderer11::copyTexture(const gl::Texture *source, ...@@ -3216,6 +3217,7 @@ gl::Error Renderer11::copyTexture(const gl::Texture *source,
TextureStorage *sourceStorage = nullptr; TextureStorage *sourceStorage = nullptr;
ANGLE_TRY(const_cast<TextureD3D *>(sourceD3D)->getNativeTexture(&sourceStorage)); ANGLE_TRY(const_cast<TextureD3D *>(sourceD3D)->getNativeTexture(&sourceStorage));
ASSERT(destTarget == GL_TEXTURE_2D);
TextureStorage11_2D *sourceStorage11 = GetAs<TextureStorage11_2D>(sourceStorage); TextureStorage11_2D *sourceStorage11 = GetAs<TextureStorage11_2D>(sourceStorage);
ASSERT(sourceStorage11); ASSERT(sourceStorage11);
......
...@@ -219,6 +219,7 @@ class Renderer11 : public RendererD3D ...@@ -219,6 +219,7 @@ class Renderer11 : public RendererD3D
GLenum destFormat, GLenum destFormat,
const gl::Offset &destOffset, const gl::Offset &destOffset,
TextureStorage *storage, TextureStorage *storage,
GLenum destTarget,
GLint destLevel, GLint destLevel,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
......
...@@ -2463,11 +2463,14 @@ gl::Error Renderer9::copyTexture(const gl::Texture *source, ...@@ -2463,11 +2463,14 @@ gl::Error Renderer9::copyTexture(const gl::Texture *source,
GLenum destFormat, GLenum destFormat,
const gl::Offset &destOffset, const gl::Offset &destOffset,
TextureStorage *storage, TextureStorage *storage,
GLenum destTarget,
GLint destLevel, GLint destLevel,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha) bool unpackUnmultiplyAlpha)
{ {
ASSERT(destTarget == GL_TEXTURE_2D);
RECT rect; RECT rect;
rect.left = sourceRect.x; rect.left = sourceRect.x;
rect.top = sourceRect.y; rect.top = sourceRect.y;
......
...@@ -216,6 +216,7 @@ class Renderer9 : public RendererD3D ...@@ -216,6 +216,7 @@ class Renderer9 : public RendererD3D
GLenum destFormat, GLenum destFormat,
const gl::Offset &destOffset, const gl::Offset &destOffset,
TextureStorage *storage, TextureStorage *storage,
GLenum destTarget,
GLint destLevel, GLint destLevel,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
......
...@@ -428,7 +428,10 @@ gl::Error BlitGL::blitColorBufferWithShader(const gl::Framebuffer *source, ...@@ -428,7 +428,10 @@ gl::Error BlitGL::blitColorBufferWithShader(const gl::Framebuffer *source,
} }
gl::Error BlitGL::copySubTexture(TextureGL *source, gl::Error BlitGL::copySubTexture(TextureGL *source,
size_t sourceLevel,
TextureGL *dest, TextureGL *dest,
GLenum destTarget,
size_t destLevel,
const gl::Extents &sourceSize, const gl::Extents &sourceSize,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
const gl::Offset &destOffset, const gl::Offset &destOffset,
...@@ -464,6 +467,7 @@ gl::Error BlitGL::copySubTexture(TextureGL *source, ...@@ -464,6 +467,7 @@ gl::Error BlitGL::copySubTexture(TextureGL *source,
} }
source->setMinFilter(GL_NEAREST); source->setMinFilter(GL_NEAREST);
source->setMagFilter(GL_NEAREST); source->setMagFilter(GL_NEAREST);
source->setBaseLevel(static_cast<GLuint>(sourceLevel));
// Render to the destination texture, sampling from the source texture // Render to the destination texture, sampling from the source texture
ScopedGLState scopedState( ScopedGLState scopedState(
...@@ -500,8 +504,8 @@ gl::Error BlitGL::copySubTexture(TextureGL *source, ...@@ -500,8 +504,8 @@ gl::Error BlitGL::copySubTexture(TextureGL *source,
} }
mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mScratchFBO); mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mScratchFBO);
mFunctions->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, dest->getTarget(), mFunctions->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, destTarget,
dest->getTextureID(), 0); dest->getTextureID(), static_cast<GLint>(destLevel));
mStateManager->bindVertexArray(mVAO, 0); mStateManager->bindVertexArray(mVAO, 0);
mFunctions->drawArrays(GL_TRIANGLES, 0, 3); mFunctions->drawArrays(GL_TRIANGLES, 0, 3);
......
...@@ -61,7 +61,10 @@ class BlitGL : public angle::NonCopyable ...@@ -61,7 +61,10 @@ class BlitGL : public angle::NonCopyable
GLenum filter); GLenum filter);
gl::Error copySubTexture(TextureGL *source, gl::Error copySubTexture(TextureGL *source,
size_t sourceLevel,
TextureGL *dest, TextureGL *dest,
GLenum destTarget,
size_t destLevel,
const gl::Extents &sourceSize, const gl::Extents &sourceSize,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
const gl::Offset &destOffset, const gl::Offset &destOffset,
......
...@@ -632,8 +632,11 @@ gl::Error TextureGL::copySubImage(ContextImpl *contextImpl, ...@@ -632,8 +632,11 @@ gl::Error TextureGL::copySubImage(ContextImpl *contextImpl,
} }
gl::Error TextureGL::copyTexture(ContextImpl *contextImpl, gl::Error TextureGL::copyTexture(ContextImpl *contextImpl,
GLenum target,
size_t level,
GLenum internalFormat, GLenum internalFormat,
GLenum type, GLenum type,
size_t sourceLevel,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha, bool unpackUnmultiplyAlpha,
...@@ -647,12 +650,16 @@ gl::Error TextureGL::copyTexture(ContextImpl *contextImpl, ...@@ -647,12 +650,16 @@ gl::Error TextureGL::copyTexture(ContextImpl *contextImpl,
reserveTexImageToBeFilled(getTarget(), 0, sizedInternalFormat, sourceImageDesc.size, reserveTexImageToBeFilled(getTarget(), 0, sizedInternalFormat, sourceImageDesc.size,
internalFormat, type); internalFormat, type);
return copySubTextureHelper(gl::Offset(0, 0, 0), sourceArea, internalFormat, unpackFlipY, return copySubTextureHelper(target, level, gl::Offset(0, 0, 0), sourceLevel, sourceArea,
unpackPremultiplyAlpha, unpackUnmultiplyAlpha, source); internalFormat, unpackFlipY, unpackPremultiplyAlpha,
unpackUnmultiplyAlpha, source);
} }
gl::Error TextureGL::copySubTexture(ContextImpl *contextImpl, gl::Error TextureGL::copySubTexture(ContextImpl *contextImpl,
GLenum target,
size_t level,
const gl::Offset &destOffset, const gl::Offset &destOffset,
size_t sourceLevel,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
...@@ -660,11 +667,14 @@ gl::Error TextureGL::copySubTexture(ContextImpl *contextImpl, ...@@ -660,11 +667,14 @@ gl::Error TextureGL::copySubTexture(ContextImpl *contextImpl,
const gl::Texture *source) const gl::Texture *source)
{ {
GLenum destFormat = mState.getImageDesc(mState.mTarget, 0).format.format; GLenum destFormat = mState.getImageDesc(mState.mTarget, 0).format.format;
return copySubTextureHelper(destOffset, sourceArea, destFormat, unpackFlipY, return copySubTextureHelper(target, level, destOffset, sourceLevel, sourceArea, destFormat,
unpackPremultiplyAlpha, unpackUnmultiplyAlpha, source); unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha, source);
} }
gl::Error TextureGL::copySubTextureHelper(const gl::Offset &destOffset, gl::Error TextureGL::copySubTextureHelper(GLenum target,
size_t level,
const gl::Offset &destOffset,
size_t sourceLevel,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
GLenum destFormat, GLenum destFormat,
bool unpackFlipY, bool unpackFlipY,
...@@ -691,9 +701,10 @@ gl::Error TextureGL::copySubTextureHelper(const gl::Offset &destOffset, ...@@ -691,9 +701,10 @@ gl::Error TextureGL::copySubTextureHelper(const gl::Offset &destOffset,
} }
// We can't use copyTexSubImage, do a manual copy // We can't use copyTexSubImage, do a manual copy
return mBlitter->copySubTexture(sourceGL, this, sourceImageDesc.size, sourceArea, destOffset, return mBlitter->copySubTexture(
needsLumaWorkaround, sourceGL->mLevelInfo[0].sourceFormat, sourceGL, sourceLevel, this, target, level, sourceImageDesc.size, sourceArea, destOffset,
unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha); needsLumaWorkaround, sourceGL->mLevelInfo[sourceLevel].sourceFormat, unpackFlipY,
unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
} }
gl::Error TextureGL::setStorage(ContextImpl *contextImpl, gl::Error TextureGL::setStorage(ContextImpl *contextImpl,
...@@ -1031,6 +1042,18 @@ bool TextureGL::hasAnyDirtyBit() const ...@@ -1031,6 +1042,18 @@ bool TextureGL::hasAnyDirtyBit() const
return mLocalDirtyBits.any(); return mLocalDirtyBits.any();
} }
void TextureGL::setBaseLevel(GLuint baseLevel)
{
if (baseLevel != mAppliedBaseLevel)
{
mAppliedBaseLevel = baseLevel;
mLocalDirtyBits.set(gl::Texture::DIRTY_BIT_BASE_LEVEL);
mStateManager->bindTexture(getTarget(), mTextureID);
mFunctions->texParameteri(getTarget(), GL_TEXTURE_BASE_LEVEL, baseLevel);
}
}
void TextureGL::setMinFilter(GLenum filter) void TextureGL::setMinFilter(GLenum filter)
{ {
if (filter != mAppliedSampler.minFilter) if (filter != mAppliedSampler.minFilter)
......
...@@ -108,20 +108,29 @@ class TextureGL : public TextureImpl ...@@ -108,20 +108,29 @@ class TextureGL : public TextureImpl
const gl::Framebuffer *source) override; const gl::Framebuffer *source) override;
gl::Error copyTexture(ContextImpl *contextImpl, gl::Error copyTexture(ContextImpl *contextImpl,
GLenum target,
size_t level,
GLenum internalFormat, GLenum internalFormat,
GLenum type, GLenum type,
size_t sourceLevel,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha, bool unpackUnmultiplyAlpha,
const gl::Texture *source) override; const gl::Texture *source) override;
gl::Error copySubTexture(ContextImpl *contextImpl, gl::Error copySubTexture(ContextImpl *contextImpl,
GLenum target,
size_t level,
const gl::Offset &destOffset, const gl::Offset &destOffset,
size_t sourceLevel,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha, bool unpackUnmultiplyAlpha,
const gl::Texture *source) override; const gl::Texture *source) override;
gl::Error copySubTextureHelper(const gl::Offset &destOffset, gl::Error copySubTextureHelper(GLenum target,
size_t level,
const gl::Offset &destOffset,
size_t sourceLevel,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
GLenum destFormat, GLenum destFormat,
bool unpackFlipY, bool unpackFlipY,
...@@ -156,11 +165,11 @@ class TextureGL : public TextureImpl ...@@ -156,11 +165,11 @@ class TextureGL : public TextureImpl
GLuint getTextureID() const; GLuint getTextureID() const;
GLenum getTarget() const; GLenum getTarget() const;
void setBaseLevel(GLuint) override {}
void syncState(const gl::Texture::DirtyBits &dirtyBits) override; void syncState(const gl::Texture::DirtyBits &dirtyBits) override;
bool hasAnyDirtyBit() const; bool hasAnyDirtyBit() const;
void setBaseLevel(GLuint baseLevel) override;
void setMinFilter(GLenum filter); void setMinFilter(GLenum filter);
void setMagFilter(GLenum filter); void setMagFilter(GLenum filter);
......
...@@ -3171,7 +3171,10 @@ bool ValidateProgramPathFragmentInputGen(Context *context, ...@@ -3171,7 +3171,10 @@ bool ValidateProgramPathFragmentInputGen(Context *context,
bool ValidateCopyTextureCHROMIUM(Context *context, bool ValidateCopyTextureCHROMIUM(Context *context,
GLuint sourceId, GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId, GLuint destId,
GLint destLevel,
GLint internalFormat, GLint internalFormat,
GLenum destType, GLenum destType,
GLboolean unpackFlipY, GLboolean unpackFlipY,
...@@ -3249,7 +3252,10 @@ bool ValidateCopyTextureCHROMIUM(Context *context, ...@@ -3249,7 +3252,10 @@ bool ValidateCopyTextureCHROMIUM(Context *context,
bool ValidateCopySubTextureCHROMIUM(Context *context, bool ValidateCopySubTextureCHROMIUM(Context *context,
GLuint sourceId, GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId, GLuint destId,
GLint destLevel,
GLint xoffset, GLint xoffset,
GLint yoffset, GLint yoffset,
GLint x, GLint x,
...@@ -3332,7 +3338,6 @@ bool ValidateCopySubTextureCHROMIUM(Context *context, ...@@ -3332,7 +3338,6 @@ bool ValidateCopySubTextureCHROMIUM(Context *context,
return false; return false;
} }
GLenum destTarget = dest->getTarget();
ASSERT(destTarget != GL_TEXTURE_CUBE_MAP); ASSERT(destTarget != GL_TEXTURE_CUBE_MAP);
if (dest->getWidth(sourceTarget, 0) == 0 || dest->getHeight(sourceTarget, 0) == 0) if (dest->getWidth(sourceTarget, 0) == 0 || dest->getHeight(sourceTarget, 0) == 0)
{ {
......
...@@ -318,7 +318,10 @@ bool ValidateProgramPathFragmentInputGen(Context *context, ...@@ -318,7 +318,10 @@ bool ValidateProgramPathFragmentInputGen(Context *context,
bool ValidateCopyTextureCHROMIUM(Context *context, bool ValidateCopyTextureCHROMIUM(Context *context,
GLuint sourceId, GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId, GLuint destId,
GLint destLevel,
GLint internalFormat, GLint internalFormat,
GLenum destType, GLenum destType,
GLboolean unpackFlipY, GLboolean unpackFlipY,
...@@ -326,7 +329,10 @@ bool ValidateCopyTextureCHROMIUM(Context *context, ...@@ -326,7 +329,10 @@ bool ValidateCopyTextureCHROMIUM(Context *context,
GLboolean unpackUnmultiplyAlpha); GLboolean unpackUnmultiplyAlpha);
bool ValidateCopySubTextureCHROMIUM(Context *context, bool ValidateCopySubTextureCHROMIUM(Context *context,
GLuint sourceId, GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId, GLuint destId,
GLint destLevel,
GLint xoffset, GLint xoffset,
GLint yoffset, GLint yoffset,
GLint x, GLint x,
......
...@@ -1854,7 +1854,10 @@ ANGLE_EXPORT void GL_APIENTRY ProgramPathFragmentInputGenCHROMIUM(GLuint program ...@@ -1854,7 +1854,10 @@ ANGLE_EXPORT void GL_APIENTRY ProgramPathFragmentInputGenCHROMIUM(GLuint program
} }
ANGLE_EXPORT void GL_APIENTRY CopyTextureCHROMIUM(GLuint sourceId, ANGLE_EXPORT void GL_APIENTRY CopyTextureCHROMIUM(GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId, GLuint destId,
GLint destLevel,
GLint internalFormat, GLint internalFormat,
GLenum destType, GLenum destType,
GLboolean unpackFlipY, GLboolean unpackFlipY,
...@@ -1862,30 +1865,35 @@ ANGLE_EXPORT void GL_APIENTRY CopyTextureCHROMIUM(GLuint sourceId, ...@@ -1862,30 +1865,35 @@ ANGLE_EXPORT void GL_APIENTRY CopyTextureCHROMIUM(GLuint sourceId,
GLboolean unpackUnmultiplyAlpha) GLboolean unpackUnmultiplyAlpha)
{ {
EVENT( EVENT(
"(GLuint sourceId = %u, GLuint destId = %u, GLint internalFormat = 0x%X, GLenum destType = " "(GLuint sourceId = %u, GLint sourceLevel = %d, GLenum destTarget = 0x%X, GLuint destId = "
"%u, GLint destLevel = %d, GLint internalFormat = 0x%X, GLenum destType = "
"0x%X, GLboolean unpackFlipY = %u, GLboolean unpackPremultiplyAlpha = %u, GLboolean " "0x%X, GLboolean unpackFlipY = %u, GLboolean unpackPremultiplyAlpha = %u, GLboolean "
"unpackUnmultiplyAlpha = %u)", "unpackUnmultiplyAlpha = %u)",
sourceId, destId, internalFormat, destType, unpackFlipY, unpackPremultiplyAlpha, sourceId, sourceLevel, destTarget, destId, destLevel, internalFormat, destType, unpackFlipY,
unpackUnmultiplyAlpha); unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
Context *context = GetValidGlobalContext(); Context *context = GetValidGlobalContext();
if (context) if (context)
{ {
if (!context->skipValidation() && if (!context->skipValidation() &&
!ValidateCopyTextureCHROMIUM(context, sourceId, destId, internalFormat, destType, !ValidateCopyTextureCHROMIUM(context, sourceId, sourceLevel, destTarget, destId,
unpackFlipY, unpackPremultiplyAlpha, destLevel, internalFormat, destType, unpackFlipY,
unpackUnmultiplyAlpha)) unpackPremultiplyAlpha, unpackUnmultiplyAlpha))
{ {
return; return;
} }
context->copyTextureCHROMIUM(sourceId, destId, internalFormat, destType, unpackFlipY, context->copyTextureCHROMIUM(sourceId, sourceLevel, destTarget, destId, destLevel,
unpackPremultiplyAlpha, unpackUnmultiplyAlpha); internalFormat, destType, unpackFlipY, unpackPremultiplyAlpha,
unpackUnmultiplyAlpha);
} }
} }
ANGLE_EXPORT void GL_APIENTRY CopySubTextureCHROMIUM(GLuint sourceId, ANGLE_EXPORT void GL_APIENTRY CopySubTextureCHROMIUM(GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId, GLuint destId,
GLint destLevel,
GLint xoffset, GLint xoffset,
GLint yoffset, GLint yoffset,
GLint x, GLint x,
...@@ -1897,25 +1905,27 @@ ANGLE_EXPORT void GL_APIENTRY CopySubTextureCHROMIUM(GLuint sourceId, ...@@ -1897,25 +1905,27 @@ ANGLE_EXPORT void GL_APIENTRY CopySubTextureCHROMIUM(GLuint sourceId,
GLboolean unpackUnmultiplyAlpha) GLboolean unpackUnmultiplyAlpha)
{ {
EVENT( EVENT(
"(GLuint sourceId = %u, GLuint destId = %u, , GLboolean unpackFlipY = %u, GLint xoffset = " "(GLuint sourceId = %u, GLint sourceLevel = %d, GLenum destTarget = 0x%X, GLuint destId = "
"%u, GLint destLevel = %d, GLint xoffset = "
"%d, GLint yoffset = %d, GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = " "%d, GLint yoffset = %d, GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = "
"%d, GLboolean unpackPremultiplyAlpha = %u, GLboolean unpackUnmultiplyAlpha = %u)", "%d, GLboolean unpackPremultiplyAlpha = %u, GLboolean unpackUnmultiplyAlpha = %u)",
sourceId, destId, xoffset, yoffset, x, y, width, height, unpackFlipY, sourceId, sourceLevel, destTarget, destId, destLevel, xoffset, yoffset, x, y, width, height,
unpackPremultiplyAlpha, unpackUnmultiplyAlpha); unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
Context *context = GetValidGlobalContext(); Context *context = GetValidGlobalContext();
if (context) if (context)
{ {
if (!context->skipValidation() && if (!context->skipValidation() &&
!ValidateCopySubTextureCHROMIUM(context, sourceId, destId, xoffset, yoffset, x, y, !ValidateCopySubTextureCHROMIUM(
width, height, unpackFlipY, unpackPremultiplyAlpha, context, sourceId, sourceLevel, destTarget, destId, destLevel, xoffset, yoffset, x,
unpackUnmultiplyAlpha)) y, width, height, unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha))
{ {
return; return;
} }
context->copySubTextureCHROMIUM(sourceId, destId, xoffset, yoffset, x, y, width, height, context->copySubTextureCHROMIUM(sourceId, sourceLevel, destTarget, destId, destLevel,
unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha); xoffset, yoffset, x, y, width, height, unpackFlipY,
unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
} }
} }
......
...@@ -240,7 +240,10 @@ ANGLE_EXPORT void GL_APIENTRY ProgramPathFragmentInputGenCHROMIUM(GLuint program ...@@ -240,7 +240,10 @@ ANGLE_EXPORT void GL_APIENTRY ProgramPathFragmentInputGenCHROMIUM(GLuint program
// GL_CHROMIUM_copy_texture // GL_CHROMIUM_copy_texture
ANGLE_EXPORT void GL_APIENTRY CopyTextureCHROMIUM(GLuint sourceId, ANGLE_EXPORT void GL_APIENTRY CopyTextureCHROMIUM(GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId, GLuint destId,
GLint destLevel,
GLint internalFormat, GLint internalFormat,
GLenum destType, GLenum destType,
GLboolean unpackFlipY, GLboolean unpackFlipY,
...@@ -248,7 +251,10 @@ ANGLE_EXPORT void GL_APIENTRY CopyTextureCHROMIUM(GLuint sourceId, ...@@ -248,7 +251,10 @@ ANGLE_EXPORT void GL_APIENTRY CopyTextureCHROMIUM(GLuint sourceId,
GLboolean unpackUnmultiplyAlpha); GLboolean unpackUnmultiplyAlpha);
ANGLE_EXPORT void GL_APIENTRY CopySubTextureCHROMIUM(GLuint sourceId, ANGLE_EXPORT void GL_APIENTRY CopySubTextureCHROMIUM(GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId, GLuint destId,
GLint destLevel,
GLint xoffset, GLint xoffset,
GLint yoffset, GLint yoffset,
GLint x, GLint x,
......
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