Update CHROMIUM_copy_texture entry points to the ES3 versions.

BUG=angleproject:1932

Change-Id: Ia45f8522320af1d747fbfb57468e8b881b033543
Reviewed-on: https://chromium-review.googlesource.com/459101
Reviewed-by: Geoff Lang <geofflang@chromium.org>
This commit is contained in:
Geoff Lang 2017-03-24 14:52:39 -04:00
Родитель ee218f273f
Коммит fc72a07301
25 изменённых файлов: 436 добавлений и 173 удалений

Просмотреть файл

@ -8,11 +8,11 @@ Name Strings
Version
Last Modifed Date: July 16, 2014
Last Modifed Date: March 24, 2017
Dependencies
OpenGL ES 2.0 is required.
OpenGL ES 2.0 or OpenGL ES 3.0 is required.
EXT_texture_format_BGRA8888 affects the definition of this extension.
ARB_texture_rg affects the definition of this extension.
@ -31,86 +31,120 @@ Overview
New Procedures and Functions
void CopyTextureCHROMIUM(uint sourceId,
int sourceLevel,
enum destTarget,
uint destId,
int destLevel,
int internalFormat,
enum destType,
boolean unpackFlipY,
boolean unpackPremultiplyAlpha,
boolean unpackUnmultiplyAlpha)
void CopySubTextureCHROMIUM(uint sourceId,
int sourceLevel,
enum destTarget,
uint destId,
int destLevel,
int xoffset,
int yoffset,
int x,
int y,
sizei width,
sizei height,
boolean unpackFlipY,
boolean unpackPremultiplyAlpha,
boolean unpackUnmultiplyAlpha)
Additions to the OpenGL ES 2.0 Specification
The command
void glCopyTextureCHROMIUM (GLuint source_id,
GLuint dest_id,
GLint internal_format, GLenum dest_type,
GLboolean unpack_flip_y,
GLboolean unpack_premultiply_alpha,
GLboolean unpack_unmultiply_alpha)
CopyTextureCHROMIUM
Copies the contents of <source_id> texture to <dest_id> texture.
Copies the contents of <sourceLevel> level of <sourceId> texture to
<destLevel> level and <destTarget> target of <destId> texture.
Texture level 0 is copied from the source image to level 0 of the
destination texture.
<destTarget> must be TEXTURE_2D,
TEXTURE_CUBE_MAP_POSITIVE_X, TEXTURE_CUBE_MAP_NEGATIVE_X,
TEXTURE_CUBE_MAP_POSITIVE_Y, TEXTURE_CUBE_MAP_NEGATIVE_Y,
TEXTURE_CUBE_MAP_POSITIVE_Z, TEXTURE_CUBE_MAP_NEGATIVE_Z,
TEXTURE_RECTANGLE_ARB.
The internal format of the destination texture is converted to that
specified by <internal_format>. Must be one of the following symbolic
constants: GL_RGB, GL_RGBA
The internal format of <source_id> texture must be one of the following
symbolic constants: GL_R8, GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA,
GL_RGB, GL_RGBA, GL_BGRA_EXT, GL_RGB_YCBCR_422_CHROMIUM
When <source_id> texture doens't contain a superset of the component
required by <internal_format>, fill the components by following rules.
specified by <internalFormat>.
source format color components
=====================================================
GL_ALPHA (0, 0, 0, A)
GL_R8 (R, 0, 0, 1)
GL_LUMINANCE (L, L, L, 1)
GL_LUMINANCE_ALPHA (L, L, L, A)
GL_RGB (R, G, B, 1)
GL_RGBA (R, G, B, A)
GL_BGRA_EXT (R, G, B, A)
GL_RGB_YCBCR_422_CHROMIUM (R, G, B, 1)
When source texture doens't contain a superset of the component
required by <internalFormat>, fill the components by following rules.
source format color components
----------------------------------------
ALPHA (0, 0, 0, A)
RED (R, 0, 0, 1)
LUMINANCE (L, L, L, 1)
LUMINANCE_ALPHA (L, L, L, A)
RGB (R, G, B, 1)
RGB8 (R, G, B, 1)
RGBA (R, G, B, A)
RGBA8 (R, G, B, A)
BGRA_EXT (R, G, B, A)
BGRA8_EXT (R, G, B, A)
RGB_YCBCR_420V_CHROMIUM (R, G, B, 1)
RGB_YCBCR_422_CHROMIUM (R, G, B, 1)
The format type of the destination texture is converted to that specified
by <dest_type>.
by <destType>.
If <flip_y> is true, vertically flip texture image data.
If <flipY> is true, vertically flip texture image data.
If <unpack_premultiply_alpha> and <unpack_unmultiply_alpha> are true,
If <unpackPremultiplyAlpha> and <unpackUnmultiplyAlpha> are true,
no alpha processing occurs. This is the equivalent of having neither flag
set.
When <source_id> refers to a stream texture, the texture matrix will be
When <sourceId> refers to a stream texture, the texture matrix will be
applied as part of the copy operation.
INVALID_OPERATION is generated if <internal_format> is not one of the valid formats
described above.
INVALID_OPERATION is generated if <internalFormat> is not one of the
formats in Table 1.0.
INVALID_OPERATION is generated if the internal format of <source_id> is not one of
formats from the table above.
INVALID_OPERATION is generated if the internal format of <sourceId> is not
one of formats in Table 1.1.
INVALID_VALUE is generated if <source_id> or <dest_id> are not valid texture
INVALID_VALUE is generated if <sourceId> or <destId> are not valid texture
objects.
INVALID_VALUE is generated if textures corresponding to <dest_id> have not
been bound as GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE_ARB objects.
INVALID_ENUM is generated if <destTarget> is not one of the valid targets
described above.
INVALID_VALUE is generated if textures corresponding to <source_id> have not
been bound as GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE_ARB or
GL_TEXTURE_EXTERNAL_OES objects.
INVALID_OPERATION is generated if the bound target of destination texture
does not match <target>.
INVALID_VALUE is generated if level 0 of the source texture is not defined.
INVALID_VALUE is generated if textures corresponding to <destId> have not
been bound as TEXTURE_2D, TEXTURE_CUBE_MAP, or
TEXTURE_RECTANGLE_ARB objects.
INVALID_VALUE is generated if textures corresponding to <sourceId> have not
been bound as TEXTURE_2D, TEXTURE_RECTANGLE_ARB or
TEXTURE_EXTERNAL_OES objects.
INVALID_VALUE is generated if <sourceLevel> is not 0 for ES 2.0, or if
<sourceLevel> or <destLevel> is less than 0 for ES 3.0.
INVALID_VALUE is generated if <sourceLevel> of the source texture is not
defined.
The command
void glCopySubTextureCHROMIUM (GLuint source_id,
GLuint dest_id,
GLint xoffset, GLint yoffset,
GLint x, GLint y,
GLsizei width, GLsizei height,
GLboolean unpack_flip_y,
GLboolean unpack_premultiply_alpha,
GLboolean unpack_unmultiply_alpha)
CopySubTextureCHROMIUM
Copies the sub contents of texture referred to by <source_id> to <dest_id>
texture without redefining <dest_id> texture.
Copies the sub contents of texture referred to by <sourceId> to <destId>
texture without redefining <destId> texture.
See CopyTextureCHROMIUM for the interpretation of the <flip_y>,
<premultiply_alpha>, and <unmultiply_alpha> arguments.
See CopyTextureCHROMIUM for the interpretation of the <destTarget>,
<sourceLevel>, <destLevel>, <flipY>, <premultiplyAlpha>, and
<unmultiplyAlpha> arguments.
<xoffset> and <yoffset> specify a texel offset in the x and y direction
respectively within the destination texture.
@ -122,25 +156,76 @@ New Procedures and Functions
<height> specifies the width of the texture subimage.
INVALID_VALUE is generated if either <source_id> texture or <dest_id>
INVALID_VALUE is generated if either <sourceId> texture or <destId>
texture is not defined.
INVALID_OPERATION is generated if source internal_format and destination
internal_format are not one of the valid formats described above.
INVALID_OPERATION is generated if the internal format of <sourceId> or
<destId> is not one of formats in Table 1.1.
INVALID_OPERATION is generated if the destination texture has not been
defined.
INVALID_OPERATION is generated if the destination texture array has not
been defined.
INVALID_VALUE is generated if <dest_id> texture is not bound as
GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE_ARB.
INVALID_VALUE is generated if <destId> texture is not bound as
TEXTURE_2D or TEXTURE_RECTANGLE_ARB.
INVALID_VALUE is generated if level 0 of the source texture or
the destination texture is not defined.
INVALID_VALUE is generated if <xoffset> < 0 , or <yoffset> < 0.
INVALID_VALUE is generated if (<xoffset> + <width>) > destWidth,
or (<yoffset> + <height>) > destHeight.
INVALID_VALUE is generated if (<xoffset> + <width>) > dest_width,
or (<yoffset> + <height>) > dest_height.
Table 1.0 Valid internal formats for CopyTextureCHROMIUM:
<internalFormat>
---------------
RGB
RGBA
RGB8
RGBA8
BGRA_EXT
BGRA8_EXT,
SRGB_EXT
SRGB_ALPHA_EXT
R8
R8UI
RG8
RG8UI
SRGB8
RGB565
RGB8UI
SRGB8_ALPHA8
RGB5_A1
RGBA4
RGBA4
RGBA8UI
RGB9_E5
R16F
R32F
RG16F
RG32F
RGB16F
RGB32F
RGBA16F
RGBA32F
R11F_G11F_B10F
Table 1.1 Valid source texture internal formats for CopyTextureCHROMIUM and
source and destination formats for CopySubTextureCHROMIUM:
internal format
---------------
RED
ALPHA
LUMINANCE
LUMINANCE_ALPHA
RGB
RGBA
RGB8
RGBA8
BGRA_EXT
BGRA8_EXT
RGB_YCBCR_420V_CHROMIUM
RGB_YCBCR_422_CHROMIUM.
Dependencies on ARB_texture_rg
@ -168,8 +253,12 @@ Revision History
8/1/2011 Documented the extension
7/4/2013 Add a new parameter dest_type to glCopyTextureCHROMIUM()
16/7/2014 Add GL_TEXTURE_RECTANGLE_ARB as valid source_id target
16/7/2014 Add TEXTURE_RECTANGLE_ARB as valid source_id target
19/6/2015 Add arguments unpack_flip_y, unpack_premultiply_alpha, and
unpack_unmultiply_alpha to both commands.
4/1/2016 Removed the argument target.
4/1/2016 Added GL_TEXTURE_RECTANGLE_ARB as valid dest_id target
4/1/2016 Added TEXTURE_RECTANGLE_ARB as valid dest_id target.
19/12/2016 Supported more ES 3.0 formats.
18/1/2017 Supported source_level and dest_level.
19/1/2017 Added TEXTURE_CUBE_MAP as valid dest_id target.
24/3/2017 Clean up naming and move formats into tables.

Просмотреть файл

@ -1325,14 +1325,20 @@ GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei
#ifndef GL_CHROMIUM_copy_texture
#define GL_CHROMIUM_copy_texture 1
typedef void(GL_APIENTRYP PFNGLCOPYTEXTURECHROMIUMPROC)(GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId,
GLint destLevel,
GLint internalFormat,
GLenum destType,
GLboolean unpackFlipY,
GLboolean unpackPremultiplyAlpha,
GLboolean unpackUnmultiplyAlpha);
typedef void(GL_APIENTRYP PFNGLCOPYSUBTEXTURECHROMIUMPROC)(GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId,
GLint destLevel,
GLint xoffset,
GLint yoffset,
GLint x,
@ -1344,14 +1350,20 @@ typedef void(GL_APIENTRYP PFNGLCOPYSUBTEXTURECHROMIUMPROC)(GLuint sourceId,
GLboolean unpackUnmultiplyAlpha);
#ifdef GL_GLEXT_PROTOTYPES
GL_APICALL void GL_APIENTRY glCopyTextureCHROMIUM(GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId,
GLint destLevel,
GLint internalFormat,
GLenum destType,
GLboolean unpackFlipY,
GLboolean unpackPremultiplyAlpha,
GLboolean unpackUnmultiplyAlpha);
GL_APICALL void GL_APIENTRY glCopySubTextureCHROMIUM(GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId,
GLint destLevel,
GLint xoffset,
GLint yoffset,
GLint x,

Просмотреть файл

@ -3150,7 +3150,10 @@ void Context::generateMipmap(GLenum target)
}
void Context::copyTextureCHROMIUM(GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId,
GLint destLevel,
GLint internalFormat,
GLenum destType,
GLboolean unpackFlipY,
@ -3161,13 +3164,16 @@ void Context::copyTextureCHROMIUM(GLuint sourceId,
gl::Texture *sourceTexture = getTexture(sourceId);
gl::Texture *destTexture = getTexture(destId);
handleError(destTexture->copyTexture(this, internalFormat, destType, unpackFlipY == GL_TRUE,
unpackPremultiplyAlpha == GL_TRUE,
unpackUnmultiplyAlpha == GL_TRUE, sourceTexture));
handleError(destTexture->copyTexture(
this, destTarget, destLevel, internalFormat, destType, sourceLevel, unpackFlipY == GL_TRUE,
unpackPremultiplyAlpha == GL_TRUE, unpackUnmultiplyAlpha == GL_TRUE, sourceTexture));
}
void Context::copySubTextureCHROMIUM(GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId,
GLint destLevel,
GLint xoffset,
GLint yoffset,
GLint x,
@ -3190,9 +3196,9 @@ void Context::copySubTextureCHROMIUM(GLuint sourceId,
gl::Texture *destTexture = getTexture(destId);
Offset offset(xoffset, yoffset, 0);
Rectangle area(x, y, width, height);
handleError(destTexture->copySubTexture(this, offset, area, unpackFlipY == GL_TRUE,
unpackPremultiplyAlpha == GL_TRUE,
unpackUnmultiplyAlpha == GL_TRUE, sourceTexture));
handleError(destTexture->copySubTexture(
this, destTarget, destLevel, offset, sourceLevel, area, unpackFlipY == GL_TRUE,
unpackPremultiplyAlpha == GL_TRUE, unpackUnmultiplyAlpha == GL_TRUE, sourceTexture));
}
void Context::compressedCopyTextureCHROMIUM(GLuint sourceId, GLuint destId)

Просмотреть файл

@ -496,14 +496,20 @@ class Context final : public ValidationContext
GLsizei imageSize,
const GLvoid *data);
void copyTextureCHROMIUM(GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId,
GLint destLevel,
GLint internalFormat,
GLenum destType,
GLboolean unpackFlipY,
GLboolean unpackPremultiplyAlpha,
GLboolean unpackUnmultiplyAlpha);
void copySubTextureCHROMIUM(GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId,
GLint destLevel,
GLint xoffset,
GLint yoffset,
GLint x,

Просмотреть файл

@ -967,38 +967,52 @@ Error Texture::copySubImage(const Context *context,
}
Error Texture::copyTexture(const Context *context,
GLenum target,
size_t level,
GLenum internalFormat,
GLenum type,
size_t sourceLevel,
bool unpackFlipY,
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha,
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
releaseTexImageInternal();
orphanImages();
ANGLE_TRY(mTexture->copyTexture(rx::SafeGetImpl(context), internalFormat, type, unpackFlipY,
unpackPremultiplyAlpha, unpackUnmultiplyAlpha, source));
ANGLE_TRY(mTexture->copyTexture(rx::SafeGetImpl(context), target, level, internalFormat, type,
sourceLevel, unpackFlipY, unpackPremultiplyAlpha,
unpackUnmultiplyAlpha, source));
const auto &sourceDesc = source->mState.getImageDesc(source->getTarget(), 0);
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();
return NoError();
}
Error Texture::copySubTexture(const Context *context,
GLenum target,
size_t level,
const Offset &destOffset,
size_t sourceLevel,
const Rectangle &sourceArea,
bool unpackFlipY,
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha,
const Texture *source)
{
return mTexture->copySubTexture(rx::SafeGetImpl(context), destOffset, sourceArea, unpackFlipY,
unpackPremultiplyAlpha, unpackUnmultiplyAlpha, source);
ASSERT(target == mState.mTarget ||
(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)

Просмотреть файл

@ -313,14 +313,20 @@ class Texture final : public egl::ImageSibling,
const Framebuffer *source);
Error copyTexture(const Context *context,
GLenum target,
size_t level,
GLenum internalFormat,
GLenum type,
size_t sourceLevel,
bool unpackFlipY,
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha,
const Texture *source);
Error copySubTexture(const Context *context,
GLenum target,
size_t level,
const Offset &destOffset,
size_t sourceLevel,
const Rectangle &sourceArea,
bool unpackFlipY,
bool unpackPremultiplyAlpha,

Просмотреть файл

@ -20,8 +20,11 @@ TextureImpl::~TextureImpl()
}
gl::Error TextureImpl::copyTexture(ContextImpl *contextImpl,
GLenum target,
size_t level,
GLenum internalFormat,
GLenum type,
size_t sourceLevel,
bool unpackFlipY,
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha,
@ -32,7 +35,10 @@ gl::Error TextureImpl::copyTexture(ContextImpl *contextImpl,
}
gl::Error TextureImpl::copySubTexture(ContextImpl *contextImpl,
GLenum target,
size_t level,
const gl::Offset &destOffset,
size_t sourceLevel,
const gl::Rectangle &sourceArea,
bool unpackFlipY,
bool unpackPremultiplyAlpha,

Просмотреть файл

@ -95,14 +95,20 @@ class TextureImpl : public FramebufferAttachmentObjectImpl
const gl::Framebuffer *source) = 0;
virtual gl::Error copyTexture(ContextImpl *contextImpl,
GLenum target,
size_t level,
GLenum internalFormat,
GLenum type,
size_t sourceLevel,
bool unpackFlipY,
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha,
const gl::Texture *source);
virtual gl::Error copySubTexture(ContextImpl *contextImpl,
GLenum target,
size_t level,
const gl::Offset &destOffset,
size_t sourceLevel,
const gl::Rectangle &sourceArea,
bool unpackFlipY,
bool unpackPremultiplyAlpha,

Просмотреть файл

@ -72,16 +72,28 @@ class MockTextureImpl : public TextureImpl
const gl::Offset &,
const gl::Rectangle &,
const gl::Framebuffer *));
MOCK_METHOD7(copyTexture,
gl::Error(ContextImpl *, GLenum, GLenum, bool, bool, bool, const gl::Texture *));
MOCK_METHOD7(copySubTexture,
gl::Error(ContextImpl *,
const gl::Offset &,
const gl::Rectangle &,
bool,
bool,
bool,
const gl::Texture *));
MOCK_METHOD10(copyTexture,
gl::Error(ContextImpl *,
GLenum,
size_t,
GLenum,
GLenum,
size_t,
bool,
bool,
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_METHOD5(setStorage, gl::Error(ContextImpl *, GLenum, size_t, GLenum, const gl::Extents &));
MOCK_METHOD3(setImageExternal,

Просмотреть файл

@ -178,6 +178,7 @@ class RendererD3D : public BufferFactoryD3D
GLenum destFormat,
const gl::Offset &destOffset,
TextureStorage *storage,
GLenum destTarget,
GLint destLevel,
bool unpackFlipY,
bool unpackPremultiplyAlpha,

Просмотреть файл

@ -1030,17 +1030,21 @@ gl::Error TextureD3D_2D::copySubImage(ContextImpl *contextImpl,
}
gl::Error TextureD3D_2D::copyTexture(ContextImpl *contextImpl,
GLenum target,
size_t level,
GLenum internalFormat,
GLenum type,
size_t sourceLevel,
bool unpackFlipY,
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha,
const gl::Texture *source)
{
GLenum sourceTarget = source->getTarget();
GLint sourceLevel = 0;
ASSERT(target == GL_TEXTURE_2D);
GLint destLevel = 0;
GLenum sourceTarget = source->getTarget();
GLint destLevel = static_cast<GLint>(level);
GLenum sizedInternalFormat = gl::GetSizedInternalFormat(internalFormat, type);
gl::Extents size(static_cast<int>(source->getWidth(sourceTarget, sourceLevel)),
@ -1055,24 +1059,28 @@ gl::Error TextureD3D_2D::copyTexture(ContextImpl *contextImpl,
gl::Rectangle sourceRect(0, 0, size.width, size.height);
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,
destOffset, mTexStorage, destLevel, unpackFlipY,
destOffset, mTexStorage, target, destLevel, unpackFlipY,
unpackPremultiplyAlpha, unpackUnmultiplyAlpha));
return gl::NoError();
}
gl::Error TextureD3D_2D::copySubTexture(ContextImpl *contextImpl,
GLenum target,
size_t level,
const gl::Offset &destOffset,
size_t sourceLevel,
const gl::Rectangle &sourceArea,
bool unpackFlipY,
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha,
const gl::Texture *source)
{
GLint sourceLevel = 0;
GLint destLevel = 0;
ASSERT(target == GL_TEXTURE_2D);
GLint destLevel = static_cast<GLint>(level);
ASSERT(canCreateRenderTargetForImage(gl::ImageIndex::Make2D(destLevel)));
@ -1080,9 +1088,9 @@ gl::Error TextureD3D_2D::copySubTexture(ContextImpl *contextImpl,
ASSERT(isValidLevel(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,
destOffset, mTexStorage, destLevel, unpackFlipY,
destOffset, mTexStorage, target, destLevel, unpackFlipY,
unpackPremultiplyAlpha, unpackUnmultiplyAlpha));
return gl::NoError();

Просмотреть файл

@ -201,14 +201,20 @@ class TextureD3D_2D : public TextureD3D
const gl::Framebuffer *source) override;
gl::Error copyTexture(ContextImpl *contextImpl,
GLenum target,
size_t level,
GLenum internalFormat,
GLenum type,
size_t sourceLevel,
bool unpackFlipY,
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha,
const gl::Texture *source) override;
gl::Error copySubTexture(ContextImpl *contextImpl,
GLenum target,
size_t level,
const gl::Offset &destOffset,
size_t sourceLevel,
const gl::Rectangle &sourceArea,
bool unpackFlipY,
bool unpackPremultiplyAlpha,

Просмотреть файл

@ -3206,6 +3206,7 @@ gl::Error Renderer11::copyTexture(const gl::Texture *source,
GLenum destFormat,
const gl::Offset &destOffset,
TextureStorage *storage,
GLenum destTarget,
GLint destLevel,
bool unpackFlipY,
bool unpackPremultiplyAlpha,
@ -3216,6 +3217,7 @@ gl::Error Renderer11::copyTexture(const gl::Texture *source,
TextureStorage *sourceStorage = nullptr;
ANGLE_TRY(const_cast<TextureD3D *>(sourceD3D)->getNativeTexture(&sourceStorage));
ASSERT(destTarget == GL_TEXTURE_2D);
TextureStorage11_2D *sourceStorage11 = GetAs<TextureStorage11_2D>(sourceStorage);
ASSERT(sourceStorage11);

Просмотреть файл

@ -219,6 +219,7 @@ class Renderer11 : public RendererD3D
GLenum destFormat,
const gl::Offset &destOffset,
TextureStorage *storage,
GLenum destTarget,
GLint destLevel,
bool unpackFlipY,
bool unpackPremultiplyAlpha,

Просмотреть файл

@ -2463,11 +2463,14 @@ gl::Error Renderer9::copyTexture(const gl::Texture *source,
GLenum destFormat,
const gl::Offset &destOffset,
TextureStorage *storage,
GLenum destTarget,
GLint destLevel,
bool unpackFlipY,
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha)
{
ASSERT(destTarget == GL_TEXTURE_2D);
RECT rect;
rect.left = sourceRect.x;
rect.top = sourceRect.y;

Просмотреть файл

@ -216,6 +216,7 @@ class Renderer9 : public RendererD3D
GLenum destFormat,
const gl::Offset &destOffset,
TextureStorage *storage,
GLenum destTarget,
GLint destLevel,
bool unpackFlipY,
bool unpackPremultiplyAlpha,

Просмотреть файл

@ -428,7 +428,10 @@ gl::Error BlitGL::blitColorBufferWithShader(const gl::Framebuffer *source,
}
gl::Error BlitGL::copySubTexture(TextureGL *source,
size_t sourceLevel,
TextureGL *dest,
GLenum destTarget,
size_t destLevel,
const gl::Extents &sourceSize,
const gl::Rectangle &sourceArea,
const gl::Offset &destOffset,
@ -464,6 +467,7 @@ gl::Error BlitGL::copySubTexture(TextureGL *source,
}
source->setMinFilter(GL_NEAREST);
source->setMagFilter(GL_NEAREST);
source->setBaseLevel(static_cast<GLuint>(sourceLevel));
// Render to the destination texture, sampling from the source texture
ScopedGLState scopedState(
@ -500,8 +504,8 @@ gl::Error BlitGL::copySubTexture(TextureGL *source,
}
mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mScratchFBO);
mFunctions->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, dest->getTarget(),
dest->getTextureID(), 0);
mFunctions->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, destTarget,
dest->getTextureID(), static_cast<GLint>(destLevel));
mStateManager->bindVertexArray(mVAO, 0);
mFunctions->drawArrays(GL_TRIANGLES, 0, 3);

Просмотреть файл

@ -61,7 +61,10 @@ class BlitGL : public angle::NonCopyable
GLenum filter);
gl::Error copySubTexture(TextureGL *source,
size_t sourceLevel,
TextureGL *dest,
GLenum destTarget,
size_t destLevel,
const gl::Extents &sourceSize,
const gl::Rectangle &sourceArea,
const gl::Offset &destOffset,

Просмотреть файл

@ -632,8 +632,11 @@ gl::Error TextureGL::copySubImage(ContextImpl *contextImpl,
}
gl::Error TextureGL::copyTexture(ContextImpl *contextImpl,
GLenum target,
size_t level,
GLenum internalFormat,
GLenum type,
size_t sourceLevel,
bool unpackFlipY,
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha,
@ -647,12 +650,16 @@ gl::Error TextureGL::copyTexture(ContextImpl *contextImpl,
reserveTexImageToBeFilled(getTarget(), 0, sizedInternalFormat, sourceImageDesc.size,
internalFormat, type);
return copySubTextureHelper(gl::Offset(0, 0, 0), sourceArea, internalFormat, unpackFlipY,
unpackPremultiplyAlpha, unpackUnmultiplyAlpha, source);
return copySubTextureHelper(target, level, gl::Offset(0, 0, 0), sourceLevel, sourceArea,
internalFormat, unpackFlipY, unpackPremultiplyAlpha,
unpackUnmultiplyAlpha, source);
}
gl::Error TextureGL::copySubTexture(ContextImpl *contextImpl,
GLenum target,
size_t level,
const gl::Offset &destOffset,
size_t sourceLevel,
const gl::Rectangle &sourceArea,
bool unpackFlipY,
bool unpackPremultiplyAlpha,
@ -660,11 +667,14 @@ gl::Error TextureGL::copySubTexture(ContextImpl *contextImpl,
const gl::Texture *source)
{
GLenum destFormat = mState.getImageDesc(mState.mTarget, 0).format.format;
return copySubTextureHelper(destOffset, sourceArea, destFormat, unpackFlipY,
unpackPremultiplyAlpha, unpackUnmultiplyAlpha, source);
return copySubTextureHelper(target, level, destOffset, sourceLevel, sourceArea, destFormat,
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,
GLenum destFormat,
bool unpackFlipY,
@ -691,9 +701,10 @@ gl::Error TextureGL::copySubTextureHelper(const gl::Offset &destOffset,
}
// We can't use copyTexSubImage, do a manual copy
return mBlitter->copySubTexture(sourceGL, this, sourceImageDesc.size, sourceArea, destOffset,
needsLumaWorkaround, sourceGL->mLevelInfo[0].sourceFormat,
unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
return mBlitter->copySubTexture(
sourceGL, sourceLevel, this, target, level, sourceImageDesc.size, sourceArea, destOffset,
needsLumaWorkaround, sourceGL->mLevelInfo[sourceLevel].sourceFormat, unpackFlipY,
unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
}
gl::Error TextureGL::setStorage(ContextImpl *contextImpl,
@ -1031,6 +1042,18 @@ bool TextureGL::hasAnyDirtyBit() const
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)
{
if (filter != mAppliedSampler.minFilter)

Просмотреть файл

@ -108,20 +108,29 @@ class TextureGL : public TextureImpl
const gl::Framebuffer *source) override;
gl::Error copyTexture(ContextImpl *contextImpl,
GLenum target,
size_t level,
GLenum internalFormat,
GLenum type,
size_t sourceLevel,
bool unpackFlipY,
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha,
const gl::Texture *source) override;
gl::Error copySubTexture(ContextImpl *contextImpl,
GLenum target,
size_t level,
const gl::Offset &destOffset,
size_t sourceLevel,
const gl::Rectangle &sourceArea,
bool unpackFlipY,
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha,
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,
GLenum destFormat,
bool unpackFlipY,
@ -156,11 +165,11 @@ class TextureGL : public TextureImpl
GLuint getTextureID() const;
GLenum getTarget() const;
void setBaseLevel(GLuint) override {}
void syncState(const gl::Texture::DirtyBits &dirtyBits) override;
bool hasAnyDirtyBit() const;
void setBaseLevel(GLuint baseLevel) override;
void setMinFilter(GLenum filter);
void setMagFilter(GLenum filter);

Просмотреть файл

@ -3171,7 +3171,10 @@ bool ValidateProgramPathFragmentInputGen(Context *context,
bool ValidateCopyTextureCHROMIUM(Context *context,
GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId,
GLint destLevel,
GLint internalFormat,
GLenum destType,
GLboolean unpackFlipY,
@ -3249,7 +3252,10 @@ bool ValidateCopyTextureCHROMIUM(Context *context,
bool ValidateCopySubTextureCHROMIUM(Context *context,
GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId,
GLint destLevel,
GLint xoffset,
GLint yoffset,
GLint x,
@ -3332,7 +3338,6 @@ bool ValidateCopySubTextureCHROMIUM(Context *context,
return false;
}
GLenum destTarget = dest->getTarget();
ASSERT(destTarget != GL_TEXTURE_CUBE_MAP);
if (dest->getWidth(sourceTarget, 0) == 0 || dest->getHeight(sourceTarget, 0) == 0)
{

Просмотреть файл

@ -318,7 +318,10 @@ bool ValidateProgramPathFragmentInputGen(Context *context,
bool ValidateCopyTextureCHROMIUM(Context *context,
GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId,
GLint destLevel,
GLint internalFormat,
GLenum destType,
GLboolean unpackFlipY,
@ -326,7 +329,10 @@ bool ValidateCopyTextureCHROMIUM(Context *context,
GLboolean unpackUnmultiplyAlpha);
bool ValidateCopySubTextureCHROMIUM(Context *context,
GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId,
GLint destLevel,
GLint xoffset,
GLint yoffset,
GLint x,

Просмотреть файл

@ -1854,7 +1854,10 @@ ANGLE_EXPORT void GL_APIENTRY ProgramPathFragmentInputGenCHROMIUM(GLuint program
}
ANGLE_EXPORT void GL_APIENTRY CopyTextureCHROMIUM(GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId,
GLint destLevel,
GLint internalFormat,
GLenum destType,
GLboolean unpackFlipY,
@ -1862,30 +1865,35 @@ ANGLE_EXPORT void GL_APIENTRY CopyTextureCHROMIUM(GLuint sourceId,
GLboolean unpackUnmultiplyAlpha)
{
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 "
"unpackUnmultiplyAlpha = %u)",
sourceId, destId, internalFormat, destType, unpackFlipY, unpackPremultiplyAlpha,
unpackUnmultiplyAlpha);
sourceId, sourceLevel, destTarget, destId, destLevel, internalFormat, destType, unpackFlipY,
unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
Context *context = GetValidGlobalContext();
if (context)
{
if (!context->skipValidation() &&
!ValidateCopyTextureCHROMIUM(context, sourceId, destId, internalFormat, destType,
unpackFlipY, unpackPremultiplyAlpha,
unpackUnmultiplyAlpha))
!ValidateCopyTextureCHROMIUM(context, sourceId, sourceLevel, destTarget, destId,
destLevel, internalFormat, destType, unpackFlipY,
unpackPremultiplyAlpha, unpackUnmultiplyAlpha))
{
return;
}
context->copyTextureCHROMIUM(sourceId, destId, internalFormat, destType, unpackFlipY,
unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
context->copyTextureCHROMIUM(sourceId, sourceLevel, destTarget, destId, destLevel,
internalFormat, destType, unpackFlipY, unpackPremultiplyAlpha,
unpackUnmultiplyAlpha);
}
}
ANGLE_EXPORT void GL_APIENTRY CopySubTextureCHROMIUM(GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId,
GLint destLevel,
GLint xoffset,
GLint yoffset,
GLint x,
@ -1897,25 +1905,27 @@ ANGLE_EXPORT void GL_APIENTRY CopySubTextureCHROMIUM(GLuint sourceId,
GLboolean unpackUnmultiplyAlpha)
{
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, GLboolean unpackPremultiplyAlpha = %u, GLboolean unpackUnmultiplyAlpha = %u)",
sourceId, destId, xoffset, yoffset, x, y, width, height, unpackFlipY,
unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
sourceId, sourceLevel, destTarget, destId, destLevel, xoffset, yoffset, x, y, width, height,
unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
Context *context = GetValidGlobalContext();
if (context)
{
if (!context->skipValidation() &&
!ValidateCopySubTextureCHROMIUM(context, sourceId, destId, xoffset, yoffset, x, y,
width, height, unpackFlipY, unpackPremultiplyAlpha,
unpackUnmultiplyAlpha))
!ValidateCopySubTextureCHROMIUM(
context, sourceId, sourceLevel, destTarget, destId, destLevel, xoffset, yoffset, x,
y, width, height, unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha))
{
return;
}
context->copySubTextureCHROMIUM(sourceId, destId, xoffset, yoffset, x, y, width, height,
unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
context->copySubTextureCHROMIUM(sourceId, sourceLevel, destTarget, destId, destLevel,
xoffset, yoffset, x, y, width, height, unpackFlipY,
unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
}
}

Просмотреть файл

@ -240,7 +240,10 @@ ANGLE_EXPORT void GL_APIENTRY ProgramPathFragmentInputGenCHROMIUM(GLuint program
// GL_CHROMIUM_copy_texture
ANGLE_EXPORT void GL_APIENTRY CopyTextureCHROMIUM(GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId,
GLint destLevel,
GLint internalFormat,
GLenum destType,
GLboolean unpackFlipY,
@ -248,7 +251,10 @@ ANGLE_EXPORT void GL_APIENTRY CopyTextureCHROMIUM(GLuint sourceId,
GLboolean unpackUnmultiplyAlpha);
ANGLE_EXPORT void GL_APIENTRY CopySubTextureCHROMIUM(GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId,
GLint destLevel,
GLint xoffset,
GLint yoffset,
GLint x,

Просмотреть файл

@ -94,8 +94,8 @@ TEST_P(CopyTextureTest, BasicCopyTexture)
glBindTexture(GL_TEXTURE_2D, mTextures[0]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, &pixels);
glCopyTextureCHROMIUM(mTextures[0], mTextures[1], GL_RGBA, GL_UNSIGNED_BYTE, false, false,
false);
glCopyTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, GL_RGBA,
GL_UNSIGNED_BYTE, false, false, false);
EXPECT_GL_NO_ERROR();
@ -118,7 +118,8 @@ TEST_P(CopyTextureTest, BasicCopySubTexture)
glBindTexture(GL_TEXTURE_2D, mTextures[1]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
glCopySubTextureCHROMIUM(mTextures[0], mTextures[1], 0, 0, 0, 0, 1, 1, false, false, false);
glCopySubTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, 0, 0, 0, 0, 1, 1,
false, false, false);
EXPECT_GL_NO_ERROR();
@ -160,12 +161,13 @@ TEST_P(CopyTextureTest, ImmutableTexture)
EXPECT_GL_NO_ERROR();
// Should generate an error when the texture is redefined
glCopyTextureCHROMIUM(mTextures[0], mTextures[1], GL_RGBA, GL_UNSIGNED_BYTE, false, false,
false);
glCopyTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, GL_RGBA,
GL_UNSIGNED_BYTE, false, false, false);
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
// Should succeed when using CopySubTexture
glCopySubTextureCHROMIUM(mTextures[0], mTextures[1], 0, 0, 0, 0, 1, 1, false, false, false);
glCopySubTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, 0, 0, 0, 0, 1, 1,
false, false, false);
EXPECT_GL_NO_ERROR();
// Check that FB is complete.
@ -211,8 +213,8 @@ TEST_P(CopyTextureTest, InternalFormat)
nullptr);
EXPECT_GL_NO_ERROR();
glCopyTextureCHROMIUM(mTextures[0], mTextures[1], destFormat, GL_UNSIGNED_BYTE, false,
false, false);
glCopyTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, destFormat,
GL_UNSIGNED_BYTE, false, false, false);
EXPECT_GL_NO_ERROR();
}
@ -233,8 +235,8 @@ TEST_P(CopyTextureTest, InternalFormat)
nullptr);
EXPECT_GL_NO_ERROR();
glCopySubTextureCHROMIUM(mTextures[0], mTextures[1], 0, 0, 0, 0, 1, 1, false, false,
false);
glCopySubTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, 0, 0, 0, 0, 1,
1, false, false, false);
EXPECT_GL_NO_ERROR();
}
@ -266,8 +268,8 @@ TEST_P(CopyTextureTest, InternalFormatNotSupported)
// Check unsupported format reports an error.
for (GLint unsupportedDestFormat : unsupportedDestFormats)
{
glCopyTextureCHROMIUM(mTextures[0], mTextures[1], unsupportedDestFormat, GL_UNSIGNED_BYTE,
false, false, false);
glCopyTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0,
unsupportedDestFormat, GL_UNSIGNED_BYTE, false, false, false);
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
}
@ -276,7 +278,8 @@ TEST_P(CopyTextureTest, InternalFormatNotSupported)
glBindTexture(GL_TEXTURE_2D, mTextures[1]);
glTexImage2D(GL_TEXTURE_2D, 0, unsupportedDestFormat, 1, 1, 0, unsupportedDestFormat,
GL_UNSIGNED_BYTE, nullptr);
glCopySubTextureCHROMIUM(mTextures[0], mTextures[1], 0, 0, 0, 0, 1, 1, false, false, false);
glCopySubTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, 0, 0, 0, 0, 1, 1,
false, false, false);
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
}
}
@ -307,8 +310,8 @@ TEST_P(CopyTextureTest, RedefineDestinationTexture)
// If the dest texture has different properties, glCopyTextureCHROMIUM()
// redefines them.
glCopyTextureCHROMIUM(mTextures[0], mTextures[1], GL_RGBA, GL_UNSIGNED_BYTE, false, false,
false);
glCopyTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, GL_RGBA,
GL_UNSIGNED_BYTE, false, false, false);
EXPECT_GL_NO_ERROR();
// glTexSubImage2D() succeeds because mTextures[1] is redefined into 2x2
@ -338,23 +341,28 @@ TEST_P(CopyTextureTest, CopySubTextureDimension)
glBindTexture(GL_TEXTURE_2D, mTextures[1]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 3, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
glCopySubTextureCHROMIUM(mTextures[0], mTextures[1], 1, 1, 0, 0, 1, 1, false, false, false);
glCopySubTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, 1, 1, 0, 0, 1, 1,
false, false, false);
EXPECT_GL_NO_ERROR();
// xoffset < 0
glCopySubTextureCHROMIUM(mTextures[0], mTextures[1], -1, 1, 0, 0, 1, 1, false, false, false);
glCopySubTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, -1, 1, 0, 0, 1, 1,
false, false, false);
EXPECT_GL_ERROR(GL_INVALID_VALUE);
// x < 0
glCopySubTextureCHROMIUM(mTextures[0], mTextures[1], 1, 1, -1, 0, 1, 1, false, false, false);
glCopySubTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, 1, 1, -1, 0, 1, 1,
false, false, false);
EXPECT_GL_ERROR(GL_INVALID_VALUE);
// xoffset + width > dest_width
glCopySubTextureCHROMIUM(mTextures[0], mTextures[1], 2, 2, 0, 0, 2, 2, false, false, false);
glCopySubTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, 2, 2, 0, 0, 2, 2,
false, false, false);
EXPECT_GL_ERROR(GL_INVALID_VALUE);
// x + width > source_width
glCopySubTextureCHROMIUM(mTextures[0], mTextures[1], 0, 0, 1, 1, 2, 2, false, false, false);
glCopySubTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, 0, 0, 1, 1, 2, 2,
false, false, false);
EXPECT_GL_ERROR(GL_INVALID_VALUE);
}
@ -372,17 +380,20 @@ TEST_P(CopyTextureTest, CopyTextureInvalidTextureIds)
glBindTexture(GL_TEXTURE_2D, mTextures[1]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 3, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
glCopyTextureCHROMIUM(mTextures[0], 99993, GL_RGBA, GL_UNSIGNED_BYTE, false, false, false);
glCopyTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, 99993, 0, GL_RGBA, GL_UNSIGNED_BYTE,
false, false, false);
EXPECT_GL_ERROR(GL_INVALID_VALUE);
glCopyTextureCHROMIUM(99994, mTextures[1], GL_RGBA, GL_UNSIGNED_BYTE, false, false, false);
glCopyTextureCHROMIUM(99994, 0, GL_TEXTURE_2D, mTextures[1], 0, GL_RGBA, GL_UNSIGNED_BYTE,
false, false, false);
EXPECT_GL_ERROR(GL_INVALID_VALUE);
glCopyTextureCHROMIUM(99995, 99996, GL_RGBA, GL_UNSIGNED_BYTE, false, false, false);
glCopyTextureCHROMIUM(99995, 0, GL_TEXTURE_2D, 99996, 0, GL_RGBA, GL_UNSIGNED_BYTE, false,
false, false);
EXPECT_GL_ERROR(GL_INVALID_VALUE);
glCopyTextureCHROMIUM(mTextures[0], mTextures[1], GL_RGBA, GL_UNSIGNED_BYTE, false, false,
false);
glCopyTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, GL_RGBA,
GL_UNSIGNED_BYTE, false, false, false);
EXPECT_GL_NO_ERROR();
}
@ -400,16 +411,20 @@ TEST_P(CopyTextureTest, CopySubTextureInvalidTextureIds)
glBindTexture(GL_TEXTURE_2D, mTextures[1]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 3, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
glCopySubTextureCHROMIUM(mTextures[0], 99993, 1, 1, 0, 0, 1, 1, false, false, false);
glCopySubTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, 99993, 0, 1, 1, 0, 0, 1, 1, false,
false, false);
EXPECT_GL_ERROR(GL_INVALID_VALUE);
glCopySubTextureCHROMIUM(99994, mTextures[1], 1, 1, 0, 0, 1, 1, false, false, false);
glCopySubTextureCHROMIUM(99994, 0, GL_TEXTURE_2D, mTextures[1], 0, 1, 1, 0, 0, 1, 1, false,
false, false);
EXPECT_GL_ERROR(GL_INVALID_VALUE);
glCopySubTextureCHROMIUM(99995, 99996, 1, 1, 0, 0, 1, 1, false, false, false);
glCopySubTextureCHROMIUM(99995, 0, GL_TEXTURE_2D, 99996, 0, 1, 1, 0, 0, 1, 1, false, false,
false);
EXPECT_GL_ERROR(GL_INVALID_VALUE);
glCopySubTextureCHROMIUM(mTextures[0], mTextures[1], 1, 1, 0, 0, 1, 1, false, false, false);
glCopySubTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, 1, 1, 0, 0, 1, 1,
false, false, false);
EXPECT_GL_NO_ERROR();
}
@ -430,11 +445,14 @@ TEST_P(CopyTextureTest, CopySubTextureOffset)
glBindTexture(GL_TEXTURE_2D, mTextures[1]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, transparentPixels);
glCopySubTextureCHROMIUM(mTextures[0], mTextures[1], 1, 1, 0, 0, 1, 1, false, false, false);
glCopySubTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, 1, 1, 0, 0, 1, 1,
false, false, false);
EXPECT_GL_NO_ERROR();
glCopySubTextureCHROMIUM(mTextures[0], mTextures[1], 1, 0, 1, 0, 1, 1, false, false, false);
glCopySubTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, 1, 0, 1, 0, 1, 1,
false, false, false);
EXPECT_GL_NO_ERROR();
glCopySubTextureCHROMIUM(mTextures[0], mTextures[1], 0, 1, 0, 1, 1, 1, false, false, false);
glCopySubTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, 0, 1, 0, 1, 1, 1,
false, false, false);
EXPECT_GL_NO_ERROR();
// Check that FB is complete.
@ -461,8 +479,8 @@ TEST_P(CopyTextureTest, FlipY)
glBindTexture(GL_TEXTURE_2D, mTextures[0]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, rgbaPixels);
glCopyTextureCHROMIUM(mTextures[0], mTextures[1], GL_RGBA, GL_UNSIGNED_BYTE, GL_TRUE, GL_FALSE,
GL_FALSE);
glCopyTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, GL_RGBA,
GL_UNSIGNED_BYTE, GL_TRUE, GL_FALSE, GL_FALSE);
EXPECT_GL_NO_ERROR();
// Check that FB is complete.
@ -489,8 +507,8 @@ TEST_P(CopyTextureTest, PremultiplyAlpha)
glBindTexture(GL_TEXTURE_2D, mTextures[0]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, rgbaPixels);
glCopyTextureCHROMIUM(mTextures[0], mTextures[1], GL_RGBA, GL_UNSIGNED_BYTE, GL_FALSE, GL_TRUE,
GL_FALSE);
glCopyTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, GL_RGBA,
GL_UNSIGNED_BYTE, GL_FALSE, GL_TRUE, GL_FALSE);
EXPECT_GL_NO_ERROR();
// Check that FB is complete.
@ -517,8 +535,8 @@ TEST_P(CopyTextureTest, UnmultiplyAlpha)
glBindTexture(GL_TEXTURE_2D, mTextures[0]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, rgbaPixels);
glCopyTextureCHROMIUM(mTextures[0], mTextures[1], GL_RGBA, GL_UNSIGNED_BYTE, GL_FALSE, GL_FALSE,
GL_TRUE);
glCopyTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, GL_RGBA,
GL_UNSIGNED_BYTE, GL_FALSE, GL_FALSE, GL_TRUE);
EXPECT_GL_NO_ERROR();
// Check that FB is complete.
@ -545,8 +563,8 @@ TEST_P(CopyTextureTest, UnmultiplyAndPremultiplyAlpha)
glBindTexture(GL_TEXTURE_2D, mTextures[0]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, rgbaPixels);
glCopyTextureCHROMIUM(mTextures[0], mTextures[1], GL_RGBA, GL_UNSIGNED_BYTE, GL_FALSE, GL_TRUE,
GL_TRUE);
glCopyTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, GL_RGBA,
GL_UNSIGNED_BYTE, GL_FALSE, GL_TRUE, GL_TRUE);
EXPECT_GL_NO_ERROR();
// Check that FB is complete.
@ -574,8 +592,8 @@ TEST_P(CopyTextureTest, LuminanceAlpha)
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, 1, 1, 0, GL_LUMINANCE_ALPHA,
GL_UNSIGNED_BYTE, &originalPixels);
glCopyTextureCHROMIUM(mTextures[0], mTextures[1], GL_RGBA, GL_UNSIGNED_BYTE, false, false,
false);
glCopyTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, GL_RGBA,
GL_UNSIGNED_BYTE, false, false, false);
EXPECT_GL_NO_ERROR();
@ -597,8 +615,8 @@ TEST_P(CopyTextureTest, Luminance)
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 1, 1, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE,
&originalPixels);
glCopyTextureCHROMIUM(mTextures[0], mTextures[1], GL_RGBA, GL_UNSIGNED_BYTE, false, false,
false);
glCopyTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, GL_RGBA,
GL_UNSIGNED_BYTE, false, false, false);
EXPECT_GL_NO_ERROR();
@ -619,8 +637,8 @@ TEST_P(CopyTextureTest, Alpha)
glBindTexture(GL_TEXTURE_2D, mTextures[0]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 1, 1, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &originalPixels);
glCopyTextureCHROMIUM(mTextures[0], mTextures[1], GL_RGBA, GL_UNSIGNED_BYTE, false, false,
false);
glCopyTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, GL_RGBA,
GL_UNSIGNED_BYTE, false, false, false);
EXPECT_GL_NO_ERROR();