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
...@@ -8,11 +8,11 @@ Name Strings ...@@ -8,11 +8,11 @@ Name Strings
Version Version
Last Modifed Date: July 16, 2014 Last Modifed Date: March 24, 2017
Dependencies 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. EXT_texture_format_BGRA8888 affects the definition of this extension.
ARB_texture_rg affects the definition of this extension. ARB_texture_rg affects the definition of this extension.
...@@ -31,86 +31,120 @@ Overview ...@@ -31,86 +31,120 @@ Overview
New Procedures and Functions 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 The command
void glCopyTextureCHROMIUM (GLuint source_id, CopyTextureCHROMIUM
GLuint dest_id,
GLint internal_format, GLenum dest_type,
GLboolean unpack_flip_y,
GLboolean unpack_premultiply_alpha,
GLboolean unpack_unmultiply_alpha)
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 <destTarget> must be TEXTURE_2D,
destination texture. 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 The internal format of the destination texture is converted to that
specified by <internal_format>. Must be one of the following symbolic specified by <internalFormat>.
constants: GL_RGB, GL_RGBA
The internal format of <source_id> texture must be one of the following When source texture doens't contain a superset of the component
symbolic constants: GL_R8, GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA, required by <internalFormat>, fill the components by following rules.
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.
source format color components source format color components
===================================================== ----------------------------------------
GL_ALPHA (0, 0, 0, A) ALPHA (0, 0, 0, A)
GL_R8 (R, 0, 0, 1) RED (R, 0, 0, 1)
GL_LUMINANCE (L, L, L, 1) LUMINANCE (L, L, L, 1)
GL_LUMINANCE_ALPHA (L, L, L, A) LUMINANCE_ALPHA (L, L, L, A)
GL_RGB (R, G, B, 1) RGB (R, G, B, 1)
GL_RGBA (R, G, B, A) RGB8 (R, G, B, 1)
GL_BGRA_EXT (R, G, B, A) RGBA (R, G, B, A)
GL_RGB_YCBCR_422_CHROMIUM (R, G, B, 1) 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 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 no alpha processing occurs. This is the equivalent of having neither flag
set. 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. applied as part of the copy operation.
INVALID_OPERATION is generated if <internal_format> is not one of the valid formats INVALID_OPERATION is generated if <internalFormat> is not one of the
described above. formats in Table 1.0.
INVALID_OPERATION is generated if the internal format of <source_id> is not one of INVALID_OPERATION is generated if the internal format of <sourceId> is not
formats from the table above. 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. objects.
INVALID_VALUE is generated if textures corresponding to <dest_id> have not INVALID_ENUM is generated if <destTarget> is not one of the valid targets
been bound as GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE_ARB objects. described above.
INVALID_OPERATION is generated if the bound target of destination texture
does not match <target>.
INVALID_VALUE is generated if textures corresponding to <source_id> have not INVALID_VALUE is generated if textures corresponding to <destId> have not
been bound as GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE_ARB or been bound as TEXTURE_2D, TEXTURE_CUBE_MAP, or
GL_TEXTURE_EXTERNAL_OES objects. TEXTURE_RECTANGLE_ARB objects.
INVALID_VALUE is generated if level 0 of the source texture is not defined. 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 The command
void glCopySubTextureCHROMIUM (GLuint source_id, CopySubTextureCHROMIUM
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)
Copies the sub contents of texture referred to by <source_id> to <dest_id> Copies the sub contents of texture referred to by <sourceId> to <destId>
texture without redefining <dest_id> texture. texture without redefining <destId> texture.
See CopyTextureCHROMIUM for the interpretation of the <flip_y>, See CopyTextureCHROMIUM for the interpretation of the <destTarget>,
<premultiply_alpha>, and <unmultiply_alpha> arguments. <sourceLevel>, <destLevel>, <flipY>, <premultiplyAlpha>, and
<unmultiplyAlpha> arguments.
<xoffset> and <yoffset> specify a texel offset in the x and y direction <xoffset> and <yoffset> specify a texel offset in the x and y direction
respectively within the destination texture. respectively within the destination texture.
...@@ -122,25 +156,76 @@ New Procedures and Functions ...@@ -122,25 +156,76 @@ New Procedures and Functions
<height> specifies the width of the texture subimage. <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. texture is not defined.
INVALID_OPERATION is generated if source internal_format and destination INVALID_OPERATION is generated if the internal format of <sourceId> or
internal_format are not one of the valid formats described above. <destId> is not one of formats in Table 1.1.
INVALID_OPERATION is generated if the destination texture has not been INVALID_OPERATION is generated if the destination texture array has not
defined. been defined.
INVALID_VALUE is generated if <dest_id> texture is not bound as INVALID_VALUE is generated if <destId> texture is not bound as
GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE_ARB. TEXTURE_2D or TEXTURE_RECTANGLE_ARB.
INVALID_VALUE is generated if level 0 of the source texture or INVALID_VALUE is generated if level 0 of the source texture or
the destination texture is not defined. 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 Dependencies on ARB_texture_rg
...@@ -168,8 +253,12 @@ Revision History ...@@ -168,8 +253,12 @@ Revision History
8/1/2011 Documented the extension 8/1/2011 Documented the extension
7/4/2013 Add a new parameter dest_type to glCopyTextureCHROMIUM() 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 19/6/2015 Add arguments unpack_flip_y, unpack_premultiply_alpha, and
unpack_unmultiply_alpha to both commands. unpack_unmultiply_alpha to both commands.
4/1/2016 Removed the argument target. 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 ...@@ -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,11 +72,23 @@ class MockTextureImpl : public TextureImpl ...@@ -72,11 +72,23 @@ 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 *));
MOCK_METHOD7(copySubTexture,
gl::Error(ContextImpl *, 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 &, const gl::Offset &,
size_t,
const gl::Rectangle &, const gl::Rectangle &,
bool, bool,
bool, bool,
......
...@@ -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,
......
...@@ -94,8 +94,8 @@ TEST_P(CopyTextureTest, BasicCopyTexture) ...@@ -94,8 +94,8 @@ TEST_P(CopyTextureTest, BasicCopyTexture)
glBindTexture(GL_TEXTURE_2D, mTextures[0]); glBindTexture(GL_TEXTURE_2D, mTextures[0]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, &pixels); 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, glCopyTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, GL_RGBA,
false); GL_UNSIGNED_BYTE, false, false, false);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
...@@ -118,7 +118,8 @@ TEST_P(CopyTextureTest, BasicCopySubTexture) ...@@ -118,7 +118,8 @@ TEST_P(CopyTextureTest, BasicCopySubTexture)
glBindTexture(GL_TEXTURE_2D, mTextures[1]); glBindTexture(GL_TEXTURE_2D, mTextures[1]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); 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(); EXPECT_GL_NO_ERROR();
...@@ -160,12 +161,13 @@ TEST_P(CopyTextureTest, ImmutableTexture) ...@@ -160,12 +161,13 @@ TEST_P(CopyTextureTest, ImmutableTexture)
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
// Should generate an error when the texture is redefined // Should generate an error when the texture is redefined
glCopyTextureCHROMIUM(mTextures[0], mTextures[1], GL_RGBA, GL_UNSIGNED_BYTE, false, false, glCopyTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, GL_RGBA,
false); GL_UNSIGNED_BYTE, false, false, false);
EXPECT_GL_ERROR(GL_INVALID_OPERATION); EXPECT_GL_ERROR(GL_INVALID_OPERATION);
// Should succeed when using CopySubTexture // 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(); EXPECT_GL_NO_ERROR();
// Check that FB is complete. // Check that FB is complete.
...@@ -211,8 +213,8 @@ TEST_P(CopyTextureTest, InternalFormat) ...@@ -211,8 +213,8 @@ TEST_P(CopyTextureTest, InternalFormat)
nullptr); nullptr);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
glCopyTextureCHROMIUM(mTextures[0], mTextures[1], destFormat, GL_UNSIGNED_BYTE, false, glCopyTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, destFormat,
false, false); GL_UNSIGNED_BYTE, false, false, false);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
} }
...@@ -233,8 +235,8 @@ TEST_P(CopyTextureTest, InternalFormat) ...@@ -233,8 +235,8 @@ TEST_P(CopyTextureTest, InternalFormat)
nullptr); nullptr);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
glCopySubTextureCHROMIUM(mTextures[0], mTextures[1], 0, 0, 0, 0, 1, 1, false, false, glCopySubTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, 0, 0, 0, 0, 1,
false); 1, false, false, false);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
} }
...@@ -266,8 +268,8 @@ TEST_P(CopyTextureTest, InternalFormatNotSupported) ...@@ -266,8 +268,8 @@ TEST_P(CopyTextureTest, InternalFormatNotSupported)
// Check unsupported format reports an error. // Check unsupported format reports an error.
for (GLint unsupportedDestFormat : unsupportedDestFormats) for (GLint unsupportedDestFormat : unsupportedDestFormats)
{ {
glCopyTextureCHROMIUM(mTextures[0], mTextures[1], unsupportedDestFormat, GL_UNSIGNED_BYTE, glCopyTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0,
false, false, false); unsupportedDestFormat, GL_UNSIGNED_BYTE, false, false, false);
EXPECT_GL_ERROR(GL_INVALID_OPERATION); EXPECT_GL_ERROR(GL_INVALID_OPERATION);
} }
...@@ -276,7 +278,8 @@ TEST_P(CopyTextureTest, InternalFormatNotSupported) ...@@ -276,7 +278,8 @@ TEST_P(CopyTextureTest, InternalFormatNotSupported)
glBindTexture(GL_TEXTURE_2D, mTextures[1]); glBindTexture(GL_TEXTURE_2D, mTextures[1]);
glTexImage2D(GL_TEXTURE_2D, 0, unsupportedDestFormat, 1, 1, 0, unsupportedDestFormat, glTexImage2D(GL_TEXTURE_2D, 0, unsupportedDestFormat, 1, 1, 0, unsupportedDestFormat,
GL_UNSIGNED_BYTE, nullptr); 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); EXPECT_GL_ERROR(GL_INVALID_OPERATION);
} }
} }
...@@ -307,8 +310,8 @@ TEST_P(CopyTextureTest, RedefineDestinationTexture) ...@@ -307,8 +310,8 @@ TEST_P(CopyTextureTest, RedefineDestinationTexture)
// If the dest texture has different properties, glCopyTextureCHROMIUM() // If the dest texture has different properties, glCopyTextureCHROMIUM()
// redefines them. // redefines them.
glCopyTextureCHROMIUM(mTextures[0], mTextures[1], GL_RGBA, GL_UNSIGNED_BYTE, false, false, glCopyTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, GL_RGBA,
false); GL_UNSIGNED_BYTE, false, false, false);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
// glTexSubImage2D() succeeds because mTextures[1] is redefined into 2x2 // glTexSubImage2D() succeeds because mTextures[1] is redefined into 2x2
...@@ -338,23 +341,28 @@ TEST_P(CopyTextureTest, CopySubTextureDimension) ...@@ -338,23 +341,28 @@ TEST_P(CopyTextureTest, CopySubTextureDimension)
glBindTexture(GL_TEXTURE_2D, mTextures[1]); glBindTexture(GL_TEXTURE_2D, mTextures[1]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 3, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); 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(); EXPECT_GL_NO_ERROR();
// xoffset < 0 // 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); EXPECT_GL_ERROR(GL_INVALID_VALUE);
// x < 0 // 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); EXPECT_GL_ERROR(GL_INVALID_VALUE);
// xoffset + width > dest_width // 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); EXPECT_GL_ERROR(GL_INVALID_VALUE);
// x + width > source_width // 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); EXPECT_GL_ERROR(GL_INVALID_VALUE);
} }
...@@ -372,17 +380,20 @@ TEST_P(CopyTextureTest, CopyTextureInvalidTextureIds) ...@@ -372,17 +380,20 @@ TEST_P(CopyTextureTest, CopyTextureInvalidTextureIds)
glBindTexture(GL_TEXTURE_2D, mTextures[1]); glBindTexture(GL_TEXTURE_2D, mTextures[1]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 3, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); 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); 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); 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); EXPECT_GL_ERROR(GL_INVALID_VALUE);
glCopyTextureCHROMIUM(mTextures[0], mTextures[1], GL_RGBA, GL_UNSIGNED_BYTE, false, false, glCopyTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, GL_RGBA,
false); GL_UNSIGNED_BYTE, false, false, false);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
} }
...@@ -400,16 +411,20 @@ TEST_P(CopyTextureTest, CopySubTextureInvalidTextureIds) ...@@ -400,16 +411,20 @@ TEST_P(CopyTextureTest, CopySubTextureInvalidTextureIds)
glBindTexture(GL_TEXTURE_2D, mTextures[1]); glBindTexture(GL_TEXTURE_2D, mTextures[1]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 3, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); 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); 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); 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); 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(); EXPECT_GL_NO_ERROR();
} }
...@@ -430,11 +445,14 @@ TEST_P(CopyTextureTest, CopySubTextureOffset) ...@@ -430,11 +445,14 @@ TEST_P(CopyTextureTest, CopySubTextureOffset)
glBindTexture(GL_TEXTURE_2D, mTextures[1]); glBindTexture(GL_TEXTURE_2D, mTextures[1]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, transparentPixels); 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(); 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(); 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(); EXPECT_GL_NO_ERROR();
// Check that FB is complete. // Check that FB is complete.
...@@ -461,8 +479,8 @@ TEST_P(CopyTextureTest, FlipY) ...@@ -461,8 +479,8 @@ TEST_P(CopyTextureTest, FlipY)
glBindTexture(GL_TEXTURE_2D, mTextures[0]); glBindTexture(GL_TEXTURE_2D, mTextures[0]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, rgbaPixels); 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, glCopyTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, GL_RGBA,
GL_FALSE); GL_UNSIGNED_BYTE, GL_TRUE, GL_FALSE, GL_FALSE);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
// Check that FB is complete. // Check that FB is complete.
...@@ -489,8 +507,8 @@ TEST_P(CopyTextureTest, PremultiplyAlpha) ...@@ -489,8 +507,8 @@ TEST_P(CopyTextureTest, PremultiplyAlpha)
glBindTexture(GL_TEXTURE_2D, mTextures[0]); glBindTexture(GL_TEXTURE_2D, mTextures[0]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, rgbaPixels); 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, glCopyTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, GL_RGBA,
GL_FALSE); GL_UNSIGNED_BYTE, GL_FALSE, GL_TRUE, GL_FALSE);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
// Check that FB is complete. // Check that FB is complete.
...@@ -517,8 +535,8 @@ TEST_P(CopyTextureTest, UnmultiplyAlpha) ...@@ -517,8 +535,8 @@ TEST_P(CopyTextureTest, UnmultiplyAlpha)
glBindTexture(GL_TEXTURE_2D, mTextures[0]); glBindTexture(GL_TEXTURE_2D, mTextures[0]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, rgbaPixels); 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, glCopyTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, GL_RGBA,
GL_TRUE); GL_UNSIGNED_BYTE, GL_FALSE, GL_FALSE, GL_TRUE);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
// Check that FB is complete. // Check that FB is complete.
...@@ -545,8 +563,8 @@ TEST_P(CopyTextureTest, UnmultiplyAndPremultiplyAlpha) ...@@ -545,8 +563,8 @@ TEST_P(CopyTextureTest, UnmultiplyAndPremultiplyAlpha)
glBindTexture(GL_TEXTURE_2D, mTextures[0]); glBindTexture(GL_TEXTURE_2D, mTextures[0]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, rgbaPixels); 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, glCopyTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, GL_RGBA,
GL_TRUE); GL_UNSIGNED_BYTE, GL_FALSE, GL_TRUE, GL_TRUE);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
// Check that FB is complete. // Check that FB is complete.
...@@ -574,8 +592,8 @@ TEST_P(CopyTextureTest, LuminanceAlpha) ...@@ -574,8 +592,8 @@ TEST_P(CopyTextureTest, LuminanceAlpha)
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, 1, 1, 0, GL_LUMINANCE_ALPHA, glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, 1, 1, 0, GL_LUMINANCE_ALPHA,
GL_UNSIGNED_BYTE, &originalPixels); GL_UNSIGNED_BYTE, &originalPixels);
glCopyTextureCHROMIUM(mTextures[0], mTextures[1], GL_RGBA, GL_UNSIGNED_BYTE, false, false, glCopyTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, GL_RGBA,
false); GL_UNSIGNED_BYTE, false, false, false);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
...@@ -597,8 +615,8 @@ TEST_P(CopyTextureTest, Luminance) ...@@ -597,8 +615,8 @@ TEST_P(CopyTextureTest, Luminance)
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 1, 1, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 1, 1, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE,
&originalPixels); &originalPixels);
glCopyTextureCHROMIUM(mTextures[0], mTextures[1], GL_RGBA, GL_UNSIGNED_BYTE, false, false, glCopyTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, GL_RGBA,
false); GL_UNSIGNED_BYTE, false, false, false);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
...@@ -619,8 +637,8 @@ TEST_P(CopyTextureTest, Alpha) ...@@ -619,8 +637,8 @@ TEST_P(CopyTextureTest, Alpha)
glBindTexture(GL_TEXTURE_2D, mTextures[0]); glBindTexture(GL_TEXTURE_2D, mTextures[0]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 1, 1, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &originalPixels); 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, glCopyTextureCHROMIUM(mTextures[0], 0, GL_TEXTURE_2D, mTextures[1], 0, GL_RGBA,
false); GL_UNSIGNED_BYTE, false, false, false);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
......
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