summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorjun.a.jiang@intel.com <jun.a.jiang@intel.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-19 20:46:54 +0000
committerjun.a.jiang@intel.com <jun.a.jiang@intel.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-19 20:46:54 +0000
commita4a6bdd1b407ab712a04eacc2feddc1b1df61dfd (patch)
tree19fc073a2bd7279759403e9c2e88a43cca745db6 /gpu
parentdb7ee15d7b5f0c5065b54210d9a42cd8c0fd33a8 (diff)
downloadchromium_src-a4a6bdd1b407ab712a04eacc2feddc1b1df61dfd.zip
chromium_src-a4a6bdd1b407ab712a04eacc2feddc1b1df61dfd.tar.gz
chromium_src-a4a6bdd1b407ab712a04eacc2feddc1b1df61dfd.tar.bz2
Add a new parameter dest_type to the GL_CHROMIUM_copy_texture extension.
It is used to define the destination texture if needed, which is possible for texImage2D(..., canvas) and texImage2D(..., video) in WebGL. BUG= Review URL: https://chromiumcodereview.appspot.com/13613006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195269 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/GLES2/extensions/CHROMIUM/CHROMIUM_copy_texture.txt10
-rw-r--r--gpu/GLES2/gl2extchromium.h4
-rw-r--r--gpu/command_buffer/client/gles2_c_lib_autogen.h4
-rw-r--r--gpu/command_buffer/client/gles2_cmd_helper_autogen.h4
-rw-r--r--gpu/command_buffer/client/gles2_implementation_autogen.h2
-rw-r--r--gpu/command_buffer/client/gles2_implementation_impl_autogen.h6
-rw-r--r--gpu/command_buffer/client/gles2_implementation_unittest_autogen.h4
-rw-r--r--gpu/command_buffer/client/gles2_interface_autogen.h2
-rw-r--r--gpu/command_buffer/client/gles2_interface_stub_autogen.h2
-rw-r--r--gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h2
-rw-r--r--gpu/command_buffer/client/gles2_trace_implementation_autogen.h2
-rw-r--r--gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h5
-rw-r--r--gpu/command_buffer/cmd_buffer_functions.txt2
-rw-r--r--gpu/command_buffer/common/gles2_cmd_format_autogen.h16
-rw-r--r--gpu/command_buffer/common/gles2_cmd_format_test_autogen.h4
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc16
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_autogen.h9
-rw-r--r--gpu/command_buffer/tests/gl_copy_texture_CHROMIUM_unittest.cc27
18 files changed, 73 insertions, 48 deletions
diff --git a/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_copy_texture.txt b/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_copy_texture.txt
index 5d346bc..4cd179f 100644
--- a/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_copy_texture.txt
+++ b/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_copy_texture.txt
@@ -38,16 +38,19 @@ New Procedures and Functions
void glCopyTextureCHROMIUM (GLenum target, GLenum source_id,
GLenum dest_id, GLint level,
- GLint internal_format)
+ GLint internal_format, GLenum dest_type)
Copies the contents of texture referred to by <source_id> to texture
<dest_id>.
Texture level 0 is copied from the source image to level <level> of the
- destination texture.
+ destination texture. The level parameter must be 0 at present.
The internal format of the destination texture is converted to that
- specified by <internal_format>
+ specified by <internal_format>.
+
+ The format type of the destination texture is converted to that specified
+ by <dest_type>.
<target> uses the same parameters as TexImage2D.
@@ -80,3 +83,4 @@ New State
Revision History
8/1/2011 Documented the extension
+ 7/4/2013 Add a new parameter dest_type to glCopyTextureCHROMIUM()
diff --git a/gpu/GLES2/gl2extchromium.h b/gpu/GLES2/gl2extchromium.h
index 4218406..9193467 100644
--- a/gpu/GLES2/gl2extchromium.h
+++ b/gpu/GLES2/gl2extchromium.h
@@ -326,11 +326,11 @@ typedef void (GL_APIENTRYP PFNGLBINDUNIFORMLOCATIONCHROMIUMPROC) (
#ifdef GL_GLEXT_PROTOTYPES
GL_APICALL void GL_APIENTRY glCopyTextureCHROMIUM(
GLenum target, GLenum source_id, GLenum dest_id, GLint level,
- GLint internalformat);
+ GLint internalformat, GLenum dest_type);
#endif
typedef void (GL_APIENTRYP PFNGLCOPYTEXTURECHROMIUMPROC) (
GLenum target, GLenum source_id, GLenum dest_id, GLint level,
- GLint internalformat);
+ GLint internalformat, GLenum dest_type);
#endif /* GL_CHROMIUM_copy_texture */
/* GL_CHROMIUM_lose_context */
diff --git a/gpu/command_buffer/client/gles2_c_lib_autogen.h b/gpu/command_buffer/client/gles2_c_lib_autogen.h
index 70a7c55..f1a5b08 100644
--- a/gpu/command_buffer/client/gles2_c_lib_autogen.h
+++ b/gpu/command_buffer/client/gles2_c_lib_autogen.h
@@ -655,9 +655,9 @@ void GLES2TexImageIOSurface2DCHROMIUM(
}
void GLES2CopyTextureCHROMIUM(
GLenum target, GLenum source_id, GLenum dest_id, GLint level,
- GLint internalformat) {
+ GLint internalformat, GLenum dest_type) {
gles2::GetGLContext()->CopyTextureCHROMIUM(
- target, source_id, dest_id, level, internalformat);
+ target, source_id, dest_id, level, internalformat, dest_type);
}
void GLES2DrawArraysInstancedANGLE(
GLenum mode, GLint first, GLsizei count, GLsizei primcount) {
diff --git a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
index d55fe34..1a99879 100644
--- a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
+++ b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
@@ -1866,11 +1866,11 @@
void CopyTextureCHROMIUM(
GLenum target, GLenum source_id, GLenum dest_id, GLint level,
- GLint internalformat) {
+ GLint internalformat, GLenum dest_type) {
gles2::cmds::CopyTextureCHROMIUM* c =
GetCmdSpace<gles2::cmds::CopyTextureCHROMIUM>();
if (c) {
- c->Init(target, source_id, dest_id, level, internalformat);
+ c->Init(target, source_id, dest_id, level, internalformat, dest_type);
}
}
diff --git a/gpu/command_buffer/client/gles2_implementation_autogen.h b/gpu/command_buffer/client/gles2_implementation_autogen.h
index 8e49da5..3510bbf 100644
--- a/gpu/command_buffer/client/gles2_implementation_autogen.h
+++ b/gpu/command_buffer/client/gles2_implementation_autogen.h
@@ -480,7 +480,7 @@ virtual void TexImageIOSurface2DCHROMIUM(
virtual void CopyTextureCHROMIUM(
GLenum target, GLenum source_id, GLenum dest_id, GLint level,
- GLint internalformat) OVERRIDE;
+ GLint internalformat, GLenum dest_type) OVERRIDE;
virtual void DrawArraysInstancedANGLE(
GLenum mode, GLint first, GLsizei count, GLsizei primcount) OVERRIDE;
diff --git a/gpu/command_buffer/client/gles2_implementation_impl_autogen.h b/gpu/command_buffer/client/gles2_implementation_impl_autogen.h
index 9ddcd089..743f5e9 100644
--- a/gpu/command_buffer/client/gles2_implementation_impl_autogen.h
+++ b/gpu/command_buffer/client/gles2_implementation_impl_autogen.h
@@ -1630,11 +1630,11 @@ void GLES2Implementation::TexImageIOSurface2DCHROMIUM(
void GLES2Implementation::CopyTextureCHROMIUM(
GLenum target, GLenum source_id, GLenum dest_id, GLint level,
- GLint internalformat) {
+ GLint internalformat, GLenum dest_type) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
- GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTextureCHROMIUM(" << GLES2Util::GetStringEnum(target) << ", " << GLES2Util::GetStringEnum(source_id) << ", " << GLES2Util::GetStringEnum(dest_id) << ", " << level << ", " << internalformat << ")"); // NOLINT
+ GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTextureCHROMIUM(" << GLES2Util::GetStringEnum(target) << ", " << GLES2Util::GetStringEnum(source_id) << ", " << GLES2Util::GetStringEnum(dest_id) << ", " << level << ", " << internalformat << ", " << GLES2Util::GetStringPixelType(dest_type) << ")"); // NOLINT
helper_->CopyTextureCHROMIUM(
- target, source_id, dest_id, level, internalformat);
+ target, source_id, dest_id, level, internalformat, dest_type);
CheckGLError();
}
diff --git a/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h b/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h
index b28a051..d783468 100644
--- a/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h
+++ b/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h
@@ -1678,9 +1678,9 @@ TEST_F(GLES2ImplementationTest, CopyTextureCHROMIUM) {
cmds::CopyTextureCHROMIUM cmd;
};
Cmds expected;
- expected.cmd.Init(1, 2, 3, 4, GL_ALPHA);
+ expected.cmd.Init(1, 2, 3, 4, GL_ALPHA, GL_UNSIGNED_BYTE);
- gl_->CopyTextureCHROMIUM(1, 2, 3, 4, GL_ALPHA);
+ gl_->CopyTextureCHROMIUM(1, 2, 3, 4, GL_ALPHA, GL_UNSIGNED_BYTE);
EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
}
diff --git a/gpu/command_buffer/client/gles2_interface_autogen.h b/gpu/command_buffer/client/gles2_interface_autogen.h
index 5451db6..865f7ed 100644
--- a/gpu/command_buffer/client/gles2_interface_autogen.h
+++ b/gpu/command_buffer/client/gles2_interface_autogen.h
@@ -277,7 +277,7 @@ virtual void TexImageIOSurface2DCHROMIUM(
GLuint plane) = 0;
virtual void CopyTextureCHROMIUM(
GLenum target, GLenum source_id, GLenum dest_id, GLint level,
- GLint internalformat) = 0;
+ GLint internalformat, GLenum dest_type) = 0;
virtual void DrawArraysInstancedANGLE(
GLenum mode, GLint first, GLsizei count, GLsizei primcount) = 0;
virtual void DrawElementsInstancedANGLE(
diff --git a/gpu/command_buffer/client/gles2_interface_stub_autogen.h b/gpu/command_buffer/client/gles2_interface_stub_autogen.h
index 1ca2b4f..769b260 100644
--- a/gpu/command_buffer/client/gles2_interface_stub_autogen.h
+++ b/gpu/command_buffer/client/gles2_interface_stub_autogen.h
@@ -306,7 +306,7 @@ virtual void TexImageIOSurface2DCHROMIUM(
GLuint plane) OVERRIDE;
virtual void CopyTextureCHROMIUM(
GLenum target, GLenum source_id, GLenum dest_id, GLint level,
- GLint internalformat) OVERRIDE;
+ GLint internalformat, GLenum dest_type) OVERRIDE;
virtual void DrawArraysInstancedANGLE(
GLenum mode, GLint first, GLsizei count, GLsizei primcount) OVERRIDE;
virtual void DrawElementsInstancedANGLE(
diff --git a/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h b/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
index 4a430a1..b1c4ac5 100644
--- a/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
+++ b/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
@@ -579,7 +579,7 @@ void GLES2InterfaceStub::TexImageIOSurface2DCHROMIUM(
}
void GLES2InterfaceStub::CopyTextureCHROMIUM(
GLenum /* target */, GLenum /* source_id */, GLenum /* dest_id */,
- GLint /* level */, GLint /* internalformat */) {
+ GLint /* level */, GLint /* internalformat */, GLenum /* dest_type */) {
}
void GLES2InterfaceStub::DrawArraysInstancedANGLE(
GLenum /* mode */, GLint /* first */, GLsizei /* count */,
diff --git a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
index 3c7617e..7ec9eb6 100644
--- a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
+++ b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
@@ -306,7 +306,7 @@ virtual void TexImageIOSurface2DCHROMIUM(
GLuint plane) OVERRIDE;
virtual void CopyTextureCHROMIUM(
GLenum target, GLenum source_id, GLenum dest_id, GLint level,
- GLint internalformat) OVERRIDE;
+ GLint internalformat, GLenum dest_type) OVERRIDE;
virtual void DrawArraysInstancedANGLE(
GLenum mode, GLint first, GLsizei count, GLsizei primcount) OVERRIDE;
virtual void DrawElementsInstancedANGLE(
diff --git a/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h b/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
index 99fe9a4..0471880 100644
--- a/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
+++ b/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
@@ -1066,9 +1066,10 @@ void GLES2TraceImplementation::TexImageIOSurface2DCHROMIUM(
void GLES2TraceImplementation::CopyTextureCHROMIUM(
GLenum target, GLenum source_id, GLenum dest_id, GLint level,
- GLint internalformat) {
+ GLint internalformat, GLenum dest_type) {
TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::CopyTextureCHROMIUM");
- gl_->CopyTextureCHROMIUM(target, source_id, dest_id, level, internalformat);
+ gl_->CopyTextureCHROMIUM(
+ target, source_id, dest_id, level, internalformat, dest_type);
}
void GLES2TraceImplementation::DrawArraysInstancedANGLE(
diff --git a/gpu/command_buffer/cmd_buffer_functions.txt b/gpu/command_buffer/cmd_buffer_functions.txt
index 992a00f..1a9268b 100644
--- a/gpu/command_buffer/cmd_buffer_functions.txt
+++ b/gpu/command_buffer/cmd_buffer_functions.txt
@@ -191,7 +191,7 @@ GL_APICALL void GL_APIENTRY glDestroyStreamTextureCHROMIUM (GLuint textu
GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLidShader shader, GLsizeiNotNegative bufsize, GLsizeiOptional* length, char* source);
GL_APICALL void GL_APIENTRY glPostSubBufferCHROMIUM (GLint x, GLint y, GLint width, GLint height);
GL_APICALL void GL_APIENTRY glTexImageIOSurface2DCHROMIUM (GLenumTextureBindTarget target, GLsizei width, GLsizei height, GLuint ioSurfaceId, GLuint plane);
-GL_APICALL void GL_APIENTRY glCopyTextureCHROMIUM (GLenum target, GLenum source_id, GLenum dest_id, GLint level, GLintTextureInternalFormat internalformat);
+GL_APICALL void GL_APIENTRY glCopyTextureCHROMIUM (GLenum target, GLenum source_id, GLenum dest_id, GLint level, GLintTextureInternalFormat internalformat, GLenumPixelType dest_type);
GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE (GLenumDrawMode mode, GLint first, GLsizei count, GLsizei primcount);
GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE (GLenumDrawMode mode, GLsizei count, GLenumIndexType type, const void* indices, GLsizei primcount);
GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE (GLuint index, GLuint divisor);
diff --git a/gpu/command_buffer/common/gles2_cmd_format_autogen.h b/gpu/command_buffer/common/gles2_cmd_format_autogen.h
index 3557348..2e2b736 100644
--- a/gpu/command_buffer/common/gles2_cmd_format_autogen.h
+++ b/gpu/command_buffer/common/gles2_cmd_format_autogen.h
@@ -9890,20 +9890,23 @@ struct CopyTextureCHROMIUM {
void Init(
GLenum _target, GLenum _source_id, GLenum _dest_id, GLint _level,
- GLint _internalformat) {
+ GLint _internalformat, GLenum _dest_type) {
SetHeader();
target = _target;
source_id = _source_id;
dest_id = _dest_id;
level = _level;
internalformat = _internalformat;
+ dest_type = _dest_type;
}
void* Set(
void* cmd, GLenum _target, GLenum _source_id, GLenum _dest_id,
- GLint _level, GLint _internalformat) {
+ GLint _level, GLint _internalformat, GLenum _dest_type) {
static_cast<ValueType*>(
- cmd)->Init(_target, _source_id, _dest_id, _level, _internalformat);
+ cmd)->Init(
+ _target, _source_id, _dest_id, _level, _internalformat,
+ _dest_type);
return NextCmdAddress<ValueType>(cmd);
}
@@ -9913,10 +9916,11 @@ struct CopyTextureCHROMIUM {
uint32 dest_id;
int32 level;
int32 internalformat;
+ uint32 dest_type;
};
-COMPILE_ASSERT(sizeof(CopyTextureCHROMIUM) == 24,
- Sizeof_CopyTextureCHROMIUM_is_not_24);
+COMPILE_ASSERT(sizeof(CopyTextureCHROMIUM) == 28,
+ Sizeof_CopyTextureCHROMIUM_is_not_28);
COMPILE_ASSERT(offsetof(CopyTextureCHROMIUM, header) == 0,
OffsetOf_CopyTextureCHROMIUM_header_not_0);
COMPILE_ASSERT(offsetof(CopyTextureCHROMIUM, target) == 4,
@@ -9929,6 +9933,8 @@ COMPILE_ASSERT(offsetof(CopyTextureCHROMIUM, level) == 16,
OffsetOf_CopyTextureCHROMIUM_level_not_16);
COMPILE_ASSERT(offsetof(CopyTextureCHROMIUM, internalformat) == 20,
OffsetOf_CopyTextureCHROMIUM_internalformat_not_20);
+COMPILE_ASSERT(offsetof(CopyTextureCHROMIUM, dest_type) == 24,
+ OffsetOf_CopyTextureCHROMIUM_dest_type_not_24);
struct DrawArraysInstancedANGLE {
typedef DrawArraysInstancedANGLE ValueType;
diff --git a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h
index 59e9f49..e11bc47 100644
--- a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h
+++ b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h
@@ -3883,7 +3883,8 @@ TEST_F(GLES2FormatTest, CopyTextureCHROMIUM) {
static_cast<GLenum>(12),
static_cast<GLenum>(13),
static_cast<GLint>(14),
- static_cast<GLint>(15));
+ static_cast<GLint>(15),
+ static_cast<GLenum>(16));
EXPECT_EQ(static_cast<uint32>(cmds::CopyTextureCHROMIUM::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
@@ -3892,6 +3893,7 @@ TEST_F(GLES2FormatTest, CopyTextureCHROMIUM) {
EXPECT_EQ(static_cast<GLenum>(13), cmd.dest_id);
EXPECT_EQ(static_cast<GLint>(14), cmd.level);
EXPECT_EQ(static_cast<GLint>(15), cmd.internalformat);
+ EXPECT_EQ(static_cast<GLenum>(16), cmd.dest_type);
CheckBytesWrittenMatchesExpectedSize(
next_cmd, sizeof(cmd));
}
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 55ea6d5..38be722 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -911,7 +911,8 @@ class GLES2DecoderImpl : public GLES2Decoder {
GLuint source_id,
GLuint target_id,
GLint level,
- GLenum internal_format);
+ GLenum internal_format,
+ GLenum dest_type);
// Wrapper for TexStorage2DEXT.
void DoTexStorage2DEXT(
@@ -9618,7 +9619,7 @@ static GLenum ExtractFormatFromStorageFormat(GLenum internalformat) {
void GLES2DecoderImpl::DoCopyTextureCHROMIUM(
GLenum target, GLuint source_id, GLuint dest_id, GLint level,
- GLenum internal_format) {
+ GLenum internal_format, GLenum dest_type) {
Texture* dest_texture = GetTexture(dest_id);
Texture* source_texture = GetTexture(source_id);
@@ -9684,18 +9685,14 @@ void GLES2DecoderImpl::DoCopyTextureCHROMIUM(
return;
}
- GLenum dest_type;
+ GLenum dest_type_previous;
GLenum dest_internal_format;
bool dest_level_defined = dest_texture->GetLevelSize(
GL_TEXTURE_2D, level, &dest_width, &dest_height);
if (dest_level_defined) {
- dest_texture->GetLevelType(GL_TEXTURE_2D, level, &dest_type,
+ dest_texture->GetLevelType(GL_TEXTURE_2D, level, &dest_type_previous,
&dest_internal_format);
- } else {
- GLenum source_internal_format;
- source_texture->GetLevelType(GL_TEXTURE_2D, 0, &dest_type,
- &source_internal_format);
}
// Set source texture's width and height to be the same as
@@ -9708,7 +9705,8 @@ void GLES2DecoderImpl::DoCopyTextureCHROMIUM(
// Resize the destination texture to the dimensions of the source texture.
if (!dest_level_defined || dest_width != source_width ||
dest_height != source_height ||
- dest_internal_format != internal_format) {
+ dest_internal_format != internal_format ||
+ dest_type_previous != dest_type) {
// Ensure that the glTexImage2D succeeds.
LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCopyTextureCHROMIUM");
glBindTexture(GL_TEXTURE_2D, dest_texture->service_id());
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
index 8975fd8..0bc6350 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
@@ -3030,12 +3030,19 @@ error::Error GLES2DecoderImpl::HandleCopyTextureCHROMIUM(
GLenum dest_id = static_cast<GLenum>(c.dest_id);
GLint level = static_cast<GLint>(c.level);
GLint internalformat = static_cast<GLint>(c.internalformat);
+ GLenum dest_type = static_cast<GLenum>(c.dest_type);
if (!validators_->texture_internal_format.IsValid(internalformat)) {
LOCAL_SET_GL_ERROR(
GL_INVALID_VALUE, "glCopyTextureCHROMIUM", "internalformat GL_INVALID_VALUE"); // NOLINT
return error::kNoError;
}
- DoCopyTextureCHROMIUM(target, source_id, dest_id, level, internalformat);
+ if (!validators_->pixel_type.IsValid(dest_type)) {
+ LOCAL_SET_GL_ERROR_INVALID_ENUM("glCopyTextureCHROMIUM", dest_type,
+ "dest_type");
+ return error::kNoError;
+ }
+ DoCopyTextureCHROMIUM(
+ target, source_id, dest_id, level, internalformat, dest_type);
return error::kNoError;
}
diff --git a/gpu/command_buffer/tests/gl_copy_texture_CHROMIUM_unittest.cc b/gpu/command_buffer/tests/gl_copy_texture_CHROMIUM_unittest.cc
index 2006fe6..8286b93 100644
--- a/gpu/command_buffer/tests/gl_copy_texture_CHROMIUM_unittest.cc
+++ b/gpu/command_buffer/tests/gl_copy_texture_CHROMIUM_unittest.cc
@@ -58,7 +58,8 @@ TEST_F(GLCopyTextureCHROMIUMTest, Basic) {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
pixels);
- glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA);
+ glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA,
+ GL_UNSIGNED_BYTE);
EXPECT_TRUE(glGetError() == GL_NO_ERROR);
// Check the FB is still bound.
@@ -92,7 +93,8 @@ TEST_F(GLCopyTextureCHROMIUMTest, FlipY) {
pixels);
glPixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, GL_TRUE);
- glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA);
+ glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA,
+ GL_UNSIGNED_BYTE);
EXPECT_TRUE(GL_NO_ERROR == glGetError());
uint8 copied_pixels[2][2][4] = {{{0}}};
@@ -115,7 +117,8 @@ TEST_F(GLCopyTextureCHROMIUMTest, PremultiplyAlpha) {
pixels);
glPixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, GL_TRUE);
- glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA);
+ glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA,
+ GL_UNSIGNED_BYTE);
EXPECT_TRUE(GL_NO_ERROR == glGetError());
uint8 copied_pixels[1 * 4] = {0};
@@ -138,7 +141,8 @@ TEST_F(GLCopyTextureCHROMIUMTest, UnpremultiplyAlpha) {
pixels);
glPixelStorei(GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, GL_TRUE);
- glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA);
+ glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA,
+ GL_UNSIGNED_BYTE);
EXPECT_TRUE(GL_NO_ERROR == glGetError());
uint8 copied_pixels[1 * 4] = {0};
@@ -169,7 +173,8 @@ TEST_F(GLCopyTextureCHROMIUMTest, FlipYAndPremultiplyAlpha) {
glPixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, GL_TRUE);
glPixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, GL_TRUE);
- glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA);
+ glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA,
+ GL_UNSIGNED_BYTE);
EXPECT_TRUE(GL_NO_ERROR == glGetError());
uint8 copied_pixels[2][2][4] = {{{0}}};
@@ -204,7 +209,8 @@ TEST_F(GLCopyTextureCHROMIUMTest, FlipYAndUnpremultiplyAlpha) {
glPixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, GL_TRUE);
glPixelStorei(GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, GL_TRUE);
- glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA);
+ glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA,
+ GL_UNSIGNED_BYTE);
EXPECT_TRUE(GL_NO_ERROR == glGetError());
uint8 copied_pixels[2][2][4] = {{{0}}};
@@ -257,7 +263,7 @@ TEST_F(GLCopyTextureCHROMIUMTest, BasicStatePreservation) {
glActiveTexture(GL_TEXTURE1 + x);
glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0,
- GL_RGBA);
+ GL_RGBA, GL_UNSIGNED_BYTE);
EXPECT_TRUE(GL_NO_ERROR == glGetError());
EXPECT_EQ(setting, glIsEnabled(GL_DEPTH_TEST));
@@ -304,7 +310,7 @@ TEST_F(GLCopyTextureCHROMIUMTest, TextureStatePreserved) {
glBindTexture(GL_TEXTURE_2D, texture_ids[1]);
glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0,
- GL_RGBA);
+ GL_RGBA, GL_UNSIGNED_BYTE);
EXPECT_TRUE(GL_NO_ERROR == glGetError());
GLint active_texture = 0;
@@ -364,7 +370,7 @@ TEST_F(GLCopyTextureCHROMIUMTest, FBOStatePreserved) {
GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color);
glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0,
- GL_RGBA);
+ GL_RGBA, GL_UNSIGNED_BYTE);
EXPECT_TRUE(GL_NO_ERROR == glGetError());
EXPECT_TRUE(glIsFramebuffer(framebuffer_id));
@@ -466,7 +472,8 @@ TEST_F(GLCopyTextureCHROMIUMTest, ProgramStatePreservation) {
glBindTexture(GL_TEXTURE_2D, textures_[0]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
pixels);
- glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA);
+ glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA,
+ GL_UNSIGNED_BYTE);
// test using program after
glClear(GL_COLOR_BUFFER_BIT);