diff options
26 files changed, 97 insertions, 1086 deletions
diff --git a/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_compressed_copy_texture.txt b/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_compressed_copy_texture.txt index d4f823e..9c080d8 100644 --- a/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_compressed_copy_texture.txt +++ b/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_compressed_copy_texture.txt @@ -71,48 +71,6 @@ New Procedures and Functions INVALID_VALUE is generated if level 0 of the source texture is not defined. - The command - - void glCompressedCopySubTextureCHROMIUM (GLenum target, - GLenum source_id, - GLenum dest_id, - GLint xoffset, GLint yoffset, - GLint x, GLint y, - GLsizei width, GLsizei height) - - Copies the sub contents of texture referred to by <source_id> to <dest_id> - texture without redefining <dest_id> texture. - - <target> uses the same parameters as TexImage2D. - - <xoffset> and <yoffset> specify a texel offset in the x and y direction - respectively within the destination texture. - - <x> and <y> specify a texel offset in the x and y direction respectively - within the source texture. - - <width> specifies the width of the texture subimage. - - <height> specifies the width of the texture subimage. - - INVALID_OPERATION is generated if internal format of source texture is not - one of the following: GL_ATC_RGB_AMD, GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD, - GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, - GL_ETC1_RGB8_OES - - INVALID_VALUE is generated if <target> is not GL_TEXTURE_2D. - - INVALID_OPERATION is generated if the destination texture has not been - defined. - - 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>) > dest_width, - or (<yoffset> + <height>) > dest_height. - Errors None. @@ -129,3 +87,4 @@ Revision History 15/6/2015 Documented the extension. 5/8/2015 Added glCompressedCopySubTextureCHROMIUM. + 1/6/2016 Remove glCompressedCopySubTextureCHROMIUM. diff --git a/gpu/GLES2/gl2chromium_autogen.h b/gpu/GLES2/gl2chromium_autogen.h index 7429cab..2e757eb 100644 --- a/gpu/GLES2/gl2chromium_autogen.h +++ b/gpu/GLES2/gl2chromium_autogen.h @@ -297,8 +297,6 @@ #define glCopySubTextureCHROMIUM GLES2_GET_FUN(CopySubTextureCHROMIUM) #define glCompressedCopyTextureCHROMIUM \ GLES2_GET_FUN(CompressedCopyTextureCHROMIUM) -#define glCompressedCopySubTextureCHROMIUM \ - GLES2_GET_FUN(CompressedCopySubTextureCHROMIUM) #define glDrawArraysInstancedANGLE GLES2_GET_FUN(DrawArraysInstancedANGLE) #define glDrawElementsInstancedANGLE GLES2_GET_FUN(DrawElementsInstancedANGLE) #define glVertexAttribDivisorANGLE GLES2_GET_FUN(VertexAttribDivisorANGLE) diff --git a/gpu/GLES2/gl2extchromium.h b/gpu/GLES2/gl2extchromium.h index a7b5e05..bed8164 100644 --- a/gpu/GLES2/gl2extchromium.h +++ b/gpu/GLES2/gl2extchromium.h @@ -417,31 +417,9 @@ typedef void(GL_APIENTRYP PFNGLCOPYSUBTEXTURECHROMIUMPROC)( #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glCompressedCopyTextureCHROMIUM( GLenum target, GLenum source_id, GLenum dest_id); - -GL_APICALL void GL_APIENTRY glCompressedCopySubTextureCHROMIUM( - GLenum target, - GLenum source_id, - GLenum dest_id, - GLint xoffset, - GLint yoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height); #endif typedef void(GL_APIENTRYP PFNGLCOMPRESSEDCOPYTEXTURECHROMIUMPROC)( GLenum target, GLenum source_id, GLenum dest_id); - -typedef void(GL_APIENTRYP PFNGLCOMPRESSEDCOPYSUBTEXTURECHROMIUMPROC)( - GLenum target, - GLenum source_id, - GLenum dest_id, - GLint xoffset, - GLint yoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height); #endif /* GL_CHROMIUM_compressed_copy_texture */ /* GL_CHROMIUM_lose_context */ diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py index d75d473..6809b65 100755 --- a/gpu/command_buffer/build_gles2_cmd_buffer.py +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py @@ -3975,12 +3975,6 @@ _FUNCTION_INFO = { 'extension': 'CHROMIUM_copy_compressed_texture', 'chromium': True, }, - 'CompressedCopySubTextureCHROMIUM': { - 'decoder_func': 'DoCompressedCopySubTextureCHROMIUM', - 'unit_test': False, - 'extension': 'CHROMIUM_copy_compressed_texture', - 'chromium': True, - }, 'TexStorage2DEXT': { 'unit_test': False, 'extension': 'EXT_texture_storage', diff --git a/gpu/command_buffer/client/gles2_c_lib_autogen.h b/gpu/command_buffer/client/gles2_c_lib_autogen.h index 0feb120..3c348b1 100644 --- a/gpu/command_buffer/client/gles2_c_lib_autogen.h +++ b/gpu/command_buffer/client/gles2_c_lib_autogen.h @@ -1367,18 +1367,6 @@ void GL_APIENTRY GLES2CompressedCopyTextureCHROMIUM(GLenum target, gles2::GetGLContext()->CompressedCopyTextureCHROMIUM(target, source_id, dest_id); } -void GL_APIENTRY GLES2CompressedCopySubTextureCHROMIUM(GLenum target, - GLenum source_id, - GLenum dest_id, - GLint xoffset, - GLint yoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height) { - gles2::GetGLContext()->CompressedCopySubTextureCHROMIUM( - target, source_id, dest_id, xoffset, yoffset, x, y, width, height); -} void GL_APIENTRY GLES2DrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, @@ -2756,11 +2744,6 @@ extern const NameToFunc g_gles2_function_table[] = { reinterpret_cast<GLES2FunctionPointer>(glCompressedCopyTextureCHROMIUM), }, { - "glCompressedCopySubTextureCHROMIUM", - reinterpret_cast<GLES2FunctionPointer>( - glCompressedCopySubTextureCHROMIUM), - }, - { "glDrawArraysInstancedANGLE", reinterpret_cast<GLES2FunctionPointer>(glDrawArraysInstancedANGLE), }, diff --git a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h index ba82b35..b8a4032 100644 --- a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h +++ b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h @@ -2535,22 +2535,6 @@ void CompressedCopyTextureCHROMIUM(GLenum target, } } -void CompressedCopySubTextureCHROMIUM(GLenum target, - GLenum source_id, - GLenum dest_id, - GLint xoffset, - GLint yoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height) { - gles2::cmds::CompressedCopySubTextureCHROMIUM* c = - GetCmdSpace<gles2::cmds::CompressedCopySubTextureCHROMIUM>(); - if (c) { - c->Init(target, source_id, dest_id, xoffset, yoffset, x, y, width, height); - } -} - void DrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, diff --git a/gpu/command_buffer/client/gles2_implementation_autogen.h b/gpu/command_buffer/client/gles2_implementation_autogen.h index d7be9a0..0ac39f9 100644 --- a/gpu/command_buffer/client/gles2_implementation_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_autogen.h @@ -951,16 +951,6 @@ void CompressedCopyTextureCHROMIUM(GLenum target, GLenum source_id, GLenum dest_id) override; -void CompressedCopySubTextureCHROMIUM(GLenum target, - GLenum source_id, - GLenum dest_id, - GLint xoffset, - GLint yoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height) override; - void DrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, diff --git a/gpu/command_buffer/client/gles2_implementation_impl_autogen.h b/gpu/command_buffer/client/gles2_implementation_impl_autogen.h index 559e480..2727a87 100644 --- a/gpu/command_buffer/client/gles2_implementation_impl_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_impl_autogen.h @@ -3240,38 +3240,6 @@ void GLES2Implementation::CompressedCopyTextureCHROMIUM(GLenum target, CheckGLError(); } -void GLES2Implementation::CompressedCopySubTextureCHROMIUM(GLenum target, - GLenum source_id, - GLenum dest_id, - GLint xoffset, - GLint yoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height) { - GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() - << "] glCompressedCopySubTextureCHROMIUM(" - << GLES2Util::GetStringEnum(target) << ", " - << GLES2Util::GetStringEnum(source_id) << ", " - << GLES2Util::GetStringEnum(dest_id) << ", " << xoffset - << ", " << yoffset << ", " << x << ", " << y << ", " - << width << ", " << height << ")"); - if (width < 0) { - SetGLError(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", - "width < 0"); - return; - } - if (height < 0) { - SetGLError(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", - "height < 0"); - return; - } - helper_->CompressedCopySubTextureCHROMIUM(target, source_id, dest_id, xoffset, - yoffset, x, y, width, height); - CheckGLError(); -} - void GLES2Implementation::GenValuebuffersCHROMIUM(GLsizei n, GLuint* buffers) { GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenValuebuffersCHROMIUM(" << n << ", " << static_cast<const void*>(buffers) << ")"); diff --git a/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h b/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h index 0015c46..6f3a011 100644 --- a/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h @@ -2842,17 +2842,6 @@ TEST_F(GLES2ImplementationTest, CompressedCopyTextureCHROMIUM) { EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } -TEST_F(GLES2ImplementationTest, CompressedCopySubTextureCHROMIUM) { - struct Cmds { - cmds::CompressedCopySubTextureCHROMIUM cmd; - }; - Cmds expected; - expected.cmd.Init(1, 2, 3, 4, 5, 6, 7, 8, 9); - - gl_->CompressedCopySubTextureCHROMIUM(1, 2, 3, 4, 5, 6, 7, 8, 9); - EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); -} - TEST_F(GLES2ImplementationTest, DrawArraysInstancedANGLE) { struct Cmds { cmds::DrawArraysInstancedANGLE cmd; diff --git a/gpu/command_buffer/client/gles2_interface_autogen.h b/gpu/command_buffer/client/gles2_interface_autogen.h index 56b1c0b..1940d30 100644 --- a/gpu/command_buffer/client/gles2_interface_autogen.h +++ b/gpu/command_buffer/client/gles2_interface_autogen.h @@ -709,15 +709,6 @@ virtual void CopySubTextureCHROMIUM(GLenum source_id, virtual void CompressedCopyTextureCHROMIUM(GLenum target, GLenum source_id, GLenum dest_id) = 0; -virtual void CompressedCopySubTextureCHROMIUM(GLenum target, - GLenum source_id, - GLenum dest_id, - GLint xoffset, - GLint yoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height) = 0; virtual void DrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, diff --git a/gpu/command_buffer/client/gles2_interface_stub_autogen.h b/gpu/command_buffer/client/gles2_interface_stub_autogen.h index aed6e72..be25847 100644 --- a/gpu/command_buffer/client/gles2_interface_stub_autogen.h +++ b/gpu/command_buffer/client/gles2_interface_stub_autogen.h @@ -688,15 +688,6 @@ void CopySubTextureCHROMIUM(GLenum source_id, void CompressedCopyTextureCHROMIUM(GLenum target, GLenum source_id, GLenum dest_id) override; -void CompressedCopySubTextureCHROMIUM(GLenum target, - GLenum source_id, - GLenum dest_id, - GLint xoffset, - GLint yoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height) override; void DrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, 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 6babece..d645e63 100644 --- a/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h +++ b/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h @@ -934,16 +934,6 @@ void GLES2InterfaceStub::CopySubTextureCHROMIUM( void GLES2InterfaceStub::CompressedCopyTextureCHROMIUM(GLenum /* target */, GLenum /* source_id */, GLenum /* dest_id */) {} -void GLES2InterfaceStub::CompressedCopySubTextureCHROMIUM( - GLenum /* target */, - GLenum /* source_id */, - GLenum /* dest_id */, - GLint /* xoffset */, - GLint /* yoffset */, - GLint /* x */, - GLint /* y */, - GLsizei /* width */, - GLsizei /* height */) {} 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 9c9f936..2b86e41 100644 --- a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h +++ b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h @@ -688,15 +688,6 @@ void CopySubTextureCHROMIUM(GLenum source_id, void CompressedCopyTextureCHROMIUM(GLenum target, GLenum source_id, GLenum dest_id) override; -void CompressedCopySubTextureCHROMIUM(GLenum target, - GLenum source_id, - GLenum dest_id, - GLint xoffset, - GLint yoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height) override; void DrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, 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 3f84d11..cf40552 100644 --- a/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h +++ b/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h @@ -1979,22 +1979,6 @@ void GLES2TraceImplementation::CompressedCopyTextureCHROMIUM(GLenum target, gl_->CompressedCopyTextureCHROMIUM(target, source_id, dest_id); } -void GLES2TraceImplementation::CompressedCopySubTextureCHROMIUM( - GLenum target, - GLenum source_id, - GLenum dest_id, - GLint xoffset, - GLint yoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", - "GLES2Trace::CompressedCopySubTextureCHROMIUM"); - gl_->CompressedCopySubTextureCHROMIUM(target, source_id, dest_id, xoffset, - yoffset, x, y, width, height); -} - void GLES2TraceImplementation::DrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, diff --git a/gpu/command_buffer/cmd_buffer_functions.txt b/gpu/command_buffer/cmd_buffer_functions.txt index 2d78a73..2ca188c 100644 --- a/gpu/command_buffer/cmd_buffer_functions.txt +++ b/gpu/command_buffer/cmd_buffer_functions.txt @@ -281,7 +281,6 @@ GL_APICALL void GL_APIENTRY glTexImageIOSurface2DCHROMIUM (GLenumTexture GL_APICALL void GL_APIENTRY glCopyTextureCHROMIUM (GLenum source_id, GLenum dest_id, GLintTextureInternalFormat internalformat, GLenumPixelType dest_type, GLboolean unpack_flip_y, GLboolean unpack_premultiply_alpha, GLboolean unpack_unmultiply_alpha); GL_APICALL void GL_APIENTRY glCopySubTextureCHROMIUM (GLenum source_id, GLenum 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); GL_APICALL void GL_APIENTRY glCompressedCopyTextureCHROMIUM (GLenum target, GLenum source_id, GLenum dest_id); -GL_APICALL void GL_APIENTRY glCompressedCopySubTextureCHROMIUM (GLenum target, GLenum source_id, GLenum dest_id, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); 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 3419f6c..23a5011 100644 --- a/gpu/command_buffer/common/gles2_cmd_format_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_format_autogen.h @@ -12533,93 +12533,6 @@ static_assert(offsetof(CompressedCopyTextureCHROMIUM, source_id) == 8, static_assert(offsetof(CompressedCopyTextureCHROMIUM, dest_id) == 12, "offset of CompressedCopyTextureCHROMIUM dest_id should be 12"); -struct CompressedCopySubTextureCHROMIUM { - typedef CompressedCopySubTextureCHROMIUM ValueType; - static const CommandId kCmdId = kCompressedCopySubTextureCHROMIUM; - static const cmd::ArgFlags kArgFlags = cmd::kFixed; - static const uint8_t cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3); - - static uint32_t ComputeSize() { - return static_cast<uint32_t>(sizeof(ValueType)); // NOLINT - } - - void SetHeader() { header.SetCmd<ValueType>(); } - - void Init(GLenum _target, - GLenum _source_id, - GLenum _dest_id, - GLint _xoffset, - GLint _yoffset, - GLint _x, - GLint _y, - GLsizei _width, - GLsizei _height) { - SetHeader(); - target = _target; - source_id = _source_id; - dest_id = _dest_id; - xoffset = _xoffset; - yoffset = _yoffset; - x = _x; - y = _y; - width = _width; - height = _height; - } - - void* Set(void* cmd, - GLenum _target, - GLenum _source_id, - GLenum _dest_id, - GLint _xoffset, - GLint _yoffset, - GLint _x, - GLint _y, - GLsizei _width, - GLsizei _height) { - static_cast<ValueType*>(cmd)->Init(_target, _source_id, _dest_id, _xoffset, - _yoffset, _x, _y, _width, _height); - return NextCmdAddress<ValueType>(cmd); - } - - gpu::CommandHeader header; - uint32_t target; - uint32_t source_id; - uint32_t dest_id; - int32_t xoffset; - int32_t yoffset; - int32_t x; - int32_t y; - int32_t width; - int32_t height; -}; - -static_assert(sizeof(CompressedCopySubTextureCHROMIUM) == 40, - "size of CompressedCopySubTextureCHROMIUM should be 40"); -static_assert(offsetof(CompressedCopySubTextureCHROMIUM, header) == 0, - "offset of CompressedCopySubTextureCHROMIUM header should be 0"); -static_assert(offsetof(CompressedCopySubTextureCHROMIUM, target) == 4, - "offset of CompressedCopySubTextureCHROMIUM target should be 4"); -static_assert( - offsetof(CompressedCopySubTextureCHROMIUM, source_id) == 8, - "offset of CompressedCopySubTextureCHROMIUM source_id should be 8"); -static_assert( - offsetof(CompressedCopySubTextureCHROMIUM, dest_id) == 12, - "offset of CompressedCopySubTextureCHROMIUM dest_id should be 12"); -static_assert( - offsetof(CompressedCopySubTextureCHROMIUM, xoffset) == 16, - "offset of CompressedCopySubTextureCHROMIUM xoffset should be 16"); -static_assert( - offsetof(CompressedCopySubTextureCHROMIUM, yoffset) == 20, - "offset of CompressedCopySubTextureCHROMIUM yoffset should be 20"); -static_assert(offsetof(CompressedCopySubTextureCHROMIUM, x) == 24, - "offset of CompressedCopySubTextureCHROMIUM x should be 24"); -static_assert(offsetof(CompressedCopySubTextureCHROMIUM, y) == 28, - "offset of CompressedCopySubTextureCHROMIUM y should be 28"); -static_assert(offsetof(CompressedCopySubTextureCHROMIUM, width) == 32, - "offset of CompressedCopySubTextureCHROMIUM width should be 32"); -static_assert(offsetof(CompressedCopySubTextureCHROMIUM, height) == 36, - "offset of CompressedCopySubTextureCHROMIUM height should be 36"); - struct DrawArraysInstancedANGLE { typedef DrawArraysInstancedANGLE ValueType; static const CommandId kCmdId = kDrawArraysInstancedANGLE; 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 f8ebe0f..727fc7d 100644 --- a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h @@ -4199,30 +4199,6 @@ TEST_F(GLES2FormatTest, CompressedCopyTextureCHROMIUM) { CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd)); } -TEST_F(GLES2FormatTest, CompressedCopySubTextureCHROMIUM) { - cmds::CompressedCopySubTextureCHROMIUM& cmd = - *GetBufferAs<cmds::CompressedCopySubTextureCHROMIUM>(); - void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11), - static_cast<GLenum>(12), static_cast<GLenum>(13), - static_cast<GLint>(14), static_cast<GLint>(15), - static_cast<GLint>(16), static_cast<GLint>(17), - static_cast<GLsizei>(18), static_cast<GLsizei>(19)); - EXPECT_EQ( - static_cast<uint32_t>(cmds::CompressedCopySubTextureCHROMIUM::kCmdId), - cmd.header.command); - EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); - EXPECT_EQ(static_cast<GLenum>(11), cmd.target); - EXPECT_EQ(static_cast<GLenum>(12), cmd.source_id); - EXPECT_EQ(static_cast<GLenum>(13), cmd.dest_id); - EXPECT_EQ(static_cast<GLint>(14), cmd.xoffset); - EXPECT_EQ(static_cast<GLint>(15), cmd.yoffset); - EXPECT_EQ(static_cast<GLint>(16), cmd.x); - EXPECT_EQ(static_cast<GLint>(17), cmd.y); - EXPECT_EQ(static_cast<GLsizei>(18), cmd.width); - EXPECT_EQ(static_cast<GLsizei>(19), cmd.height); - CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd)); -} - TEST_F(GLES2FormatTest, DrawArraysInstancedANGLE) { cmds::DrawArraysInstancedANGLE& cmd = *GetBufferAs<cmds::DrawArraysInstancedANGLE>(); diff --git a/gpu/command_buffer/common/gles2_cmd_ids_autogen.h b/gpu/command_buffer/common/gles2_cmd_ids_autogen.h index 1d8cfd6..9091f41 100644 --- a/gpu/command_buffer/common/gles2_cmd_ids_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_ids_autogen.h @@ -271,72 +271,71 @@ OP(CopyTextureCHROMIUM) /* 512 */ \ OP(CopySubTextureCHROMIUM) /* 513 */ \ OP(CompressedCopyTextureCHROMIUM) /* 514 */ \ - OP(CompressedCopySubTextureCHROMIUM) /* 515 */ \ - OP(DrawArraysInstancedANGLE) /* 516 */ \ - OP(DrawElementsInstancedANGLE) /* 517 */ \ - OP(VertexAttribDivisorANGLE) /* 518 */ \ - OP(GenMailboxCHROMIUM) /* 519 */ \ - OP(ProduceTextureCHROMIUMImmediate) /* 520 */ \ - OP(ProduceTextureDirectCHROMIUMImmediate) /* 521 */ \ - OP(ConsumeTextureCHROMIUMImmediate) /* 522 */ \ - OP(CreateAndConsumeTextureCHROMIUMImmediate) /* 523 */ \ - OP(BindUniformLocationCHROMIUMBucket) /* 524 */ \ - OP(GenValuebuffersCHROMIUMImmediate) /* 525 */ \ - OP(DeleteValuebuffersCHROMIUMImmediate) /* 526 */ \ - OP(IsValuebufferCHROMIUM) /* 527 */ \ - OP(BindValuebufferCHROMIUM) /* 528 */ \ - OP(SubscribeValueCHROMIUM) /* 529 */ \ - OP(PopulateSubscribedValuesCHROMIUM) /* 530 */ \ - OP(UniformValuebufferCHROMIUM) /* 531 */ \ - OP(BindTexImage2DCHROMIUM) /* 532 */ \ - OP(ReleaseTexImage2DCHROMIUM) /* 533 */ \ - OP(TraceBeginCHROMIUM) /* 534 */ \ - OP(TraceEndCHROMIUM) /* 535 */ \ - OP(DiscardFramebufferEXTImmediate) /* 536 */ \ - OP(LoseContextCHROMIUM) /* 537 */ \ - OP(InsertSyncPointCHROMIUM) /* 538 */ \ - OP(WaitSyncPointCHROMIUM) /* 539 */ \ - OP(InsertFenceSyncCHROMIUM) /* 540 */ \ - OP(GenSyncTokenCHROMIUMImmediate) /* 541 */ \ - OP(GenUnverifiedSyncTokenCHROMIUMImmediate) /* 542 */ \ - OP(VerifySyncTokensCHROMIUMImmediate) /* 543 */ \ - OP(WaitSyncTokenCHROMIUM) /* 544 */ \ - OP(DrawBuffersEXTImmediate) /* 545 */ \ - OP(DiscardBackbufferCHROMIUM) /* 546 */ \ - OP(ScheduleOverlayPlaneCHROMIUM) /* 547 */ \ - OP(ScheduleCALayerCHROMIUM) /* 548 */ \ - OP(CommitOverlayPlanesCHROMIUM) /* 549 */ \ - OP(SwapInterval) /* 550 */ \ - OP(FlushDriverCachesCHROMIUM) /* 551 */ \ - OP(MatrixLoadfCHROMIUMImmediate) /* 552 */ \ - OP(MatrixLoadIdentityCHROMIUM) /* 553 */ \ - OP(GenPathsCHROMIUM) /* 554 */ \ - OP(DeletePathsCHROMIUM) /* 555 */ \ - OP(IsPathCHROMIUM) /* 556 */ \ - OP(PathCommandsCHROMIUM) /* 557 */ \ - OP(PathParameterfCHROMIUM) /* 558 */ \ - OP(PathParameteriCHROMIUM) /* 559 */ \ - OP(PathStencilFuncCHROMIUM) /* 560 */ \ - OP(StencilFillPathCHROMIUM) /* 561 */ \ - OP(StencilStrokePathCHROMIUM) /* 562 */ \ - OP(CoverFillPathCHROMIUM) /* 563 */ \ - OP(CoverStrokePathCHROMIUM) /* 564 */ \ - OP(StencilThenCoverFillPathCHROMIUM) /* 565 */ \ - OP(StencilThenCoverStrokePathCHROMIUM) /* 566 */ \ - OP(StencilFillPathInstancedCHROMIUM) /* 567 */ \ - OP(StencilStrokePathInstancedCHROMIUM) /* 568 */ \ - OP(CoverFillPathInstancedCHROMIUM) /* 569 */ \ - OP(CoverStrokePathInstancedCHROMIUM) /* 570 */ \ - OP(StencilThenCoverFillPathInstancedCHROMIUM) /* 571 */ \ - OP(StencilThenCoverStrokePathInstancedCHROMIUM) /* 572 */ \ - OP(BindFragmentInputLocationCHROMIUMBucket) /* 573 */ \ - OP(ProgramPathFragmentInputGenCHROMIUM) /* 574 */ \ - OP(CoverageModulationCHROMIUM) /* 575 */ \ - OP(BlendBarrierKHR) /* 576 */ \ - OP(ApplyScreenSpaceAntialiasingCHROMIUM) /* 577 */ \ - OP(BindFragDataLocationIndexedEXTBucket) /* 578 */ \ - OP(BindFragDataLocationEXTBucket) /* 579 */ \ - OP(GetFragDataIndexEXT) /* 580 */ + OP(DrawArraysInstancedANGLE) /* 515 */ \ + OP(DrawElementsInstancedANGLE) /* 516 */ \ + OP(VertexAttribDivisorANGLE) /* 517 */ \ + OP(GenMailboxCHROMIUM) /* 518 */ \ + OP(ProduceTextureCHROMIUMImmediate) /* 519 */ \ + OP(ProduceTextureDirectCHROMIUMImmediate) /* 520 */ \ + OP(ConsumeTextureCHROMIUMImmediate) /* 521 */ \ + OP(CreateAndConsumeTextureCHROMIUMImmediate) /* 522 */ \ + OP(BindUniformLocationCHROMIUMBucket) /* 523 */ \ + OP(GenValuebuffersCHROMIUMImmediate) /* 524 */ \ + OP(DeleteValuebuffersCHROMIUMImmediate) /* 525 */ \ + OP(IsValuebufferCHROMIUM) /* 526 */ \ + OP(BindValuebufferCHROMIUM) /* 527 */ \ + OP(SubscribeValueCHROMIUM) /* 528 */ \ + OP(PopulateSubscribedValuesCHROMIUM) /* 529 */ \ + OP(UniformValuebufferCHROMIUM) /* 530 */ \ + OP(BindTexImage2DCHROMIUM) /* 531 */ \ + OP(ReleaseTexImage2DCHROMIUM) /* 532 */ \ + OP(TraceBeginCHROMIUM) /* 533 */ \ + OP(TraceEndCHROMIUM) /* 534 */ \ + OP(DiscardFramebufferEXTImmediate) /* 535 */ \ + OP(LoseContextCHROMIUM) /* 536 */ \ + OP(InsertSyncPointCHROMIUM) /* 537 */ \ + OP(WaitSyncPointCHROMIUM) /* 538 */ \ + OP(InsertFenceSyncCHROMIUM) /* 539 */ \ + OP(GenSyncTokenCHROMIUMImmediate) /* 540 */ \ + OP(GenUnverifiedSyncTokenCHROMIUMImmediate) /* 541 */ \ + OP(VerifySyncTokensCHROMIUMImmediate) /* 542 */ \ + OP(WaitSyncTokenCHROMIUM) /* 543 */ \ + OP(DrawBuffersEXTImmediate) /* 544 */ \ + OP(DiscardBackbufferCHROMIUM) /* 545 */ \ + OP(ScheduleOverlayPlaneCHROMIUM) /* 546 */ \ + OP(ScheduleCALayerCHROMIUM) /* 547 */ \ + OP(CommitOverlayPlanesCHROMIUM) /* 548 */ \ + OP(SwapInterval) /* 549 */ \ + OP(FlushDriverCachesCHROMIUM) /* 550 */ \ + OP(MatrixLoadfCHROMIUMImmediate) /* 551 */ \ + OP(MatrixLoadIdentityCHROMIUM) /* 552 */ \ + OP(GenPathsCHROMIUM) /* 553 */ \ + OP(DeletePathsCHROMIUM) /* 554 */ \ + OP(IsPathCHROMIUM) /* 555 */ \ + OP(PathCommandsCHROMIUM) /* 556 */ \ + OP(PathParameterfCHROMIUM) /* 557 */ \ + OP(PathParameteriCHROMIUM) /* 558 */ \ + OP(PathStencilFuncCHROMIUM) /* 559 */ \ + OP(StencilFillPathCHROMIUM) /* 560 */ \ + OP(StencilStrokePathCHROMIUM) /* 561 */ \ + OP(CoverFillPathCHROMIUM) /* 562 */ \ + OP(CoverStrokePathCHROMIUM) /* 563 */ \ + OP(StencilThenCoverFillPathCHROMIUM) /* 564 */ \ + OP(StencilThenCoverStrokePathCHROMIUM) /* 565 */ \ + OP(StencilFillPathInstancedCHROMIUM) /* 566 */ \ + OP(StencilStrokePathInstancedCHROMIUM) /* 567 */ \ + OP(CoverFillPathInstancedCHROMIUM) /* 568 */ \ + OP(CoverStrokePathInstancedCHROMIUM) /* 569 */ \ + OP(StencilThenCoverFillPathInstancedCHROMIUM) /* 570 */ \ + OP(StencilThenCoverStrokePathInstancedCHROMIUM) /* 571 */ \ + OP(BindFragmentInputLocationCHROMIUMBucket) /* 572 */ \ + OP(ProgramPathFragmentInputGenCHROMIUM) /* 573 */ \ + OP(CoverageModulationCHROMIUM) /* 574 */ \ + OP(BlendBarrierKHR) /* 575 */ \ + OP(ApplyScreenSpaceAntialiasingCHROMIUM) /* 576 */ \ + OP(BindFragDataLocationIndexedEXTBucket) /* 577 */ \ + OP(BindFragDataLocationEXTBucket) /* 578 */ \ + OP(GetFragDataIndexEXT) /* 579 */ enum CommandId { kStartPoint = cmd::kLastCommonId, // All GLES2 commands start after this. diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 02697ea..a5f42aff 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -964,16 +964,6 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient { GLuint source_id, GLuint dest_id); - void DoCompressedCopySubTextureCHROMIUM(GLenum target, - GLuint source_id, - GLuint dest_id, - GLint xoffset, - GLint yoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height); - // Wrapper for TexStorage2DEXT. void DoTexStorage2DEXT( GLenum target, @@ -13696,230 +13686,6 @@ void GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM(GLenum target, } } -void GLES2DecoderImpl::DoCompressedCopySubTextureCHROMIUM(GLenum target, - GLuint source_id, - GLuint dest_id, - GLint xoffset, - GLint yoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height) { - TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCompressedCopySubTextureCHROMIUM"); - - TextureRef* source_texture_ref = GetTexture(source_id); - TextureRef* dest_texture_ref = GetTexture(dest_id); - - if (!source_texture_ref || !dest_texture_ref) { - LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", - "unknown texture ids"); - return; - } - - Texture* source_texture = source_texture_ref->texture(); - Texture* dest_texture = dest_texture_ref->texture(); - int source_width = 0; - int source_height = 0; - gl::GLImage* image = - source_texture->GetLevelImage(source_texture->target(), 0); - if (image) { - gfx::Size size = image->GetSize(); - source_width = size.width(); - source_height = size.height(); - if (source_width <= 0 || source_height <= 0) { - LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", - "invalid image size"); - return; - } - } else { - if (!source_texture->GetLevelSize(source_texture->target(), 0, - &source_width, &source_height, nullptr)) { - LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", - "source texture has no level 0"); - return; - } - - // Check that this type of texture is allowed. - if (!texture_manager()->ValidForTarget(source_texture->target(), 0, - source_width, source_height, 1)) { - LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", - "source texture bad dimensions"); - return; - } - } - - GLenum source_type = 0; - GLenum source_internal_format = 0; - source_texture->GetLevelType(source_texture->target(), 0, &source_type, - &source_internal_format); - if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0, - width, height, 1)) { - LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", - "source texture bad dimensions."); - return; - } - - GLenum dest_type = 0; - GLenum dest_internal_format = 0; - bool dest_level_defined = dest_texture->GetLevelType( - dest_texture->target(), 0, &dest_type, &dest_internal_format); - if (!dest_level_defined) { - LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, - "glCompressedCopySubTextureCHROMIUM", - "destination texture is not defined"); - return; - } - if (!dest_texture->ValidForTexture(dest_texture->target(), 0, xoffset, - yoffset, 0, width, height, 1)) { - LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", - "destination texture bad dimensions."); - return; - } - - if (!ValidateCompressedCopyTextureCHROMIUM( - "glCompressedCopySubTextureCHROMIUM", target, source_texture_ref, - dest_texture_ref)) { - return; - } - - if (!ValidateCompressedTexSubDimensions("glCompressedCopySubTextureCHROMIUM", - source_texture->target(), 0, x, y, 0, - width, height, 1, - source_internal_format, - source_texture) || - !ValidateCompressedTexSubDimensions("glCompressedCopySubTextureCHROMIUM", - dest_texture->target(), 0, - xoffset, yoffset, 0, width, height, 1, - dest_internal_format, - dest_texture)) { - return; - } - - // Defer initializing the CopyTextureCHROMIUMResourceManager until it is - // needed because it takes 10s of milliseconds to initialize. - if (!copy_texture_CHROMIUM_.get()) { - LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCompressedCopySubTextureCHROMIUM"); - copy_texture_CHROMIUM_.reset(new CopyTextureCHROMIUMResourceManager()); - copy_texture_CHROMIUM_->Initialize(this); - RestoreCurrentFramebufferBindings(); - if (LOCAL_PEEK_GL_ERROR("glCompressedCopySubTextureCHROMIUM") != - GL_NO_ERROR) { - return; - } - } - - // Clear the source texture if necessary. - if (!texture_manager()->ClearTextureLevel(this, source_texture_ref, - source_texture->target(), 0)) { - LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, "glCompressedCopySubTextureCHROMIUM", - "source texture dimensions too big"); - return; - } - - int dest_width = 0; - int dest_height = 0; - bool ok = dest_texture->GetLevelSize( - GL_TEXTURE_2D, 0, &dest_width, &dest_height, nullptr); - DCHECK(ok); - if (xoffset != 0 || yoffset != 0 || width != dest_width || - height != dest_height) { - gfx::Rect cleared_rect; - if (TextureManager::CombineAdjacentRects( - dest_texture->GetLevelClearedRect(target, 0), - gfx::Rect(xoffset, yoffset, width, height), &cleared_rect)) { - DCHECK_GE(cleared_rect.size().GetArea(), - dest_texture->GetLevelClearedRect(target, 0).size().GetArea()); - texture_manager()->SetLevelClearedRect(dest_texture_ref, target, 0, - cleared_rect); - } else { - // Otherwise clear part of texture level that is not already cleared. - if (!texture_manager()->ClearTextureLevel(this, dest_texture_ref, target, - 0)) { - LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, - "glCompressedCopySubTextureCHROMIUM", - "destination texture dimensions too big"); - return; - } - } - } else { - texture_manager()->SetLevelCleared(dest_texture_ref, GL_TEXTURE_2D, 0, - true); - } - - ScopedTextureBinder binder( - &state_, dest_texture->service_id(), GL_TEXTURE_2D); - - // Try using GLImage::CopyTexSubImage when possible. - if (image && - image->CopyTexSubImage(GL_TEXTURE_2D, gfx::Point(xoffset, yoffset), - gfx::Rect(x, y, width, height))) { - return; - } - - TRACE_EVENT0( - "gpu", - "GLES2DecoderImpl::DoCompressedCopySubTextureCHROMIUM, fallback"); - - DoCopyTexImageIfNeeded(source_texture, source_texture->target()); - - // As a fallback, copy into a non-compressed GL_RGBA texture. - if (dest_internal_format != GL_RGBA) { - DCHECK_EQ(static_cast<GLenum>(GL_TEXTURE_2D), dest_texture->target()); - - // To preserve the contents of the original destination texture we must - // first copy the original destination texture to a temporary storage, then - // copy it back to the original destination texture. - GLenum tmp_target = GL_TEXTURE_2D; - GLuint tmp_service_id; - glGenTextures(1, &tmp_service_id); - DCHECK_NE(0u, tmp_service_id); - - glBindTexture(tmp_target, tmp_service_id); - - LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCompressedCopyTextureCHROMIUM"); - glTexImage2D(tmp_target, 0, GL_RGBA, dest_width, dest_height, 0, GL_RGBA, - GL_UNSIGNED_BYTE, NULL); - GLenum error = LOCAL_PEEK_GL_ERROR("glCompressedCopySubTextureCHROMIUM"); - if (error != GL_NO_ERROR) - return; - - copy_texture_CHROMIUM_->DoCopyTexture( - this, dest_texture->target(), dest_texture->service_id(), - dest_internal_format, tmp_target, tmp_service_id, GL_RGBA, - dest_width, dest_height, false, false, false); - - // Redefine destination texture to use RGBA. - glBindTexture(dest_texture->target(), dest_texture->service_id()); - LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCompressedCopyTextureCHROMIUM"); - glTexImage2D(dest_texture->target(), 0, GL_RGBA, dest_width, dest_height, 0, - GL_RGBA, GL_UNSIGNED_BYTE, NULL); - error = LOCAL_PEEK_GL_ERROR("glCompressedCopySubTextureCHROMIUM"); - if (error != GL_NO_ERROR) - return; - - texture_manager()->SetLevelInfo(dest_texture_ref, dest_texture->target(), 0, - GL_RGBA, dest_width, dest_height, 1, 0, - GL_RGBA, GL_UNSIGNED_BYTE, - gfx::Rect(dest_width, dest_height)); - - copy_texture_CHROMIUM_->DoCopyTexture( - this, tmp_target, tmp_service_id, GL_RGBA, - dest_texture->target(), dest_texture->service_id(), GL_RGBA, - dest_width, dest_height, false, false, false); - - glDeleteTextures(1, &tmp_service_id); - } - - // TODO(hkuang): get the StreamTexture transform matrix in GPU process. - // crbug.com/226218. - copy_texture_CHROMIUM_->DoCopySubTexture( - this, source_texture->target(), source_texture->service_id(), - source_internal_format, dest_texture->target(), - dest_texture->service_id(), GL_RGBA, xoffset, yoffset, x, y, width, - height, dest_width, dest_height, source_width, source_height, false, - false, false); -} - void GLES2DecoderImpl::DoTexStorage2DEXT( GLenum target, GLint levels, diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h index c6da4ef..b751b2a 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h @@ -4478,37 +4478,6 @@ error::Error GLES2DecoderImpl::HandleCompressedCopyTextureCHROMIUM( return error::kNoError; } -error::Error GLES2DecoderImpl::HandleCompressedCopySubTextureCHROMIUM( - uint32_t immediate_data_size, - const void* cmd_data) { - const gles2::cmds::CompressedCopySubTextureCHROMIUM& c = - *static_cast<const gles2::cmds::CompressedCopySubTextureCHROMIUM*>( - cmd_data); - (void)c; - GLenum target = static_cast<GLenum>(c.target); - GLenum source_id = static_cast<GLenum>(c.source_id); - GLenum dest_id = static_cast<GLenum>(c.dest_id); - GLint xoffset = static_cast<GLint>(c.xoffset); - GLint yoffset = static_cast<GLint>(c.yoffset); - GLint x = static_cast<GLint>(c.x); - GLint y = static_cast<GLint>(c.y); - GLsizei width = static_cast<GLsizei>(c.width); - GLsizei height = static_cast<GLsizei>(c.height); - if (width < 0) { - LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", - "width < 0"); - return error::kNoError; - } - if (height < 0) { - LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", - "height < 0"); - return error::kNoError; - } - DoCompressedCopySubTextureCHROMIUM(target, source_id, dest_id, xoffset, - yoffset, x, y, width, height); - return error::kNoError; -} - error::Error GLES2DecoderImpl::HandleProduceTextureCHROMIUMImmediate( uint32_t immediate_data_size, const void* cmd_data) { diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h index 5cda2e1..e8b9eb6 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h @@ -394,4 +394,12 @@ TEST_P(GLES2DecoderTest3, IsValuebufferCHROMIUMInvalidArgsBadSharedMemoryId) { kInvalidSharedMemoryOffset); EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd)); } + +TEST_P(GLES2DecoderTest3, SwapIntervalValidArgs) { + SpecializedSetup<cmds::SwapInterval, 0>(true); + cmds::SwapInterval cmd; + cmd.Init(1); + EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); + EXPECT_EQ(GL_NO_ERROR, GetGLError()); +} #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_3_AUTOGEN_H_ diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_4_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_4_autogen.h index 166ced9..9abba52 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_4_autogen.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_4_autogen.h @@ -12,11 +12,4 @@ #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_4_AUTOGEN_H_ #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_4_AUTOGEN_H_ -TEST_P(GLES2DecoderTest4, SwapIntervalValidArgs) { - SpecializedSetup<cmds::SwapInterval, 0>(true); - cmds::SwapInterval cmd; - cmd.Init(1); - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(GL_NO_ERROR, GetGLError()); -} #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_4_AUTOGEN_H_ diff --git a/gpu/command_buffer/tests/gl_compressed_copy_texture_CHROMIUM_unittest.cc b/gpu/command_buffer/tests/gl_compressed_copy_texture_CHROMIUM_unittest.cc index b444bb9..333da3c 100644 --- a/gpu/command_buffer/tests/gl_compressed_copy_texture_CHROMIUM_unittest.cc +++ b/gpu/command_buffer/tests/gl_compressed_copy_texture_CHROMIUM_unittest.cc @@ -22,12 +22,6 @@ namespace gpu { namespace { -enum CopyType { TexImage, TexSubImage }; -const CopyType kCopyTypes[] = { - TexImage, - TexSubImage, -}; - const uint8_t kCompressedImageColor[4] = {255u, 0u, 0u, 255u}; // Single compressed ATC block of source pixels all set to: @@ -46,14 +40,6 @@ const uint8_t kCompressedImageATCIA[16] = {0xff, 0xff, 0x0, 0x0, 0x0, 0x0, const uint8_t kCompressedImageDXT1[8] = {0x00, 0xf8, 0x00, 0xf8, 0xaa, 0xaa, 0xaa, 0xaa}; -// Four compressed DXT1 blocks solidly colored in red, green, blue and black: -// [R][G] -// [B][b] -const uint8_t kCompressedImageDXT1RGB[32] = { - 0x0, 0xf8, 0x0, 0xf8, 0xaa, 0xaa, 0xaa, 0xaa, 0xe0, 0x7, 0xe0, - 0x7, 0xaa, 0xaa, 0xaa, 0xaa, 0x1f, 0x0, 0x1f, 0x0, 0xaa, 0xaa, - 0xaa, 0xaa, 0x0, 0x0, 0x0, 0x0, 0xaa, 0xaa, 0xaa, 0xaa}; - // Single compressed DXT5 block of source pixels all set to: // kCompressedImageColor. const uint8_t kCompressedImageDXT5[16] = {0xff, 0xff, 0x0, 0x0, 0x0, 0x0, @@ -65,16 +51,6 @@ const uint8_t kCompressedImageDXT5[16] = {0xff, 0xff, 0x0, 0x0, 0x0, 0x0, const uint8_t kCompressedImageETC1[8] = {0x0, 0x0, 0xf8, 0x2, 0xff, 0xff, 0x0, 0x0}; -// Single block of zeroes, used for texture pre-allocation. -const uint8_t kInvalidCompressedImage[8] = {0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0}; - -// Four blocks of zeroes, used for texture pre-allocation. -const uint8_t kInvalidCompressedImageLarge[32] = { - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; - void glEnableDisable(GLint param, GLboolean value) { if (value) glEnable(param); @@ -86,8 +62,7 @@ void glEnableDisable(GLint param, GLboolean value) { // A collection of tests that exercise the GL_CHROMIUM_copy_texture extension. class GLCompressedCopyTextureCHROMIUMTest - : public testing::Test, - public ::testing::WithParamInterface<CopyType> { + : public testing::Test { protected: void SetUp() override { gl_.Initialize(GLManager::Options()); @@ -125,20 +100,14 @@ class GLCompressedCopyTextureCHROMIUMTest GLuint framebuffer_id_; }; -INSTANTIATE_TEST_CASE_P(CopyType, - GLCompressedCopyTextureCHROMIUMTest, - ::testing::ValuesIn(kCopyTypes)); - // Test to ensure that the basic functionality of the extension works. -TEST_P(GLCompressedCopyTextureCHROMIUMTest, Basic) { +TEST_F(GLCompressedCopyTextureCHROMIUMTest, Basic) { if (!GLTestHelper::HasExtension("GL_EXT_texture_compression_dxt1")) { LOG(INFO) << "GL_EXT_texture_compression_dxt1 not supported. Skipping test..."; return; } - CopyType copy_type = GetParam(); - glBindTexture(GL_TEXTURE_2D, textures_[0]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); @@ -154,17 +123,7 @@ TEST_P(GLCompressedCopyTextureCHROMIUMTest, Basic) { glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - if (copy_type == TexImage) { - glCompressedCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1]); - } else { - glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, - 4, 4, 0, - sizeof(kInvalidCompressedImage), - kInvalidCompressedImage); - - glCompressedCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], - textures_[1], 0, 0, 0, 0, 4, 4); - } + glCompressedCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1]); EXPECT_TRUE(glGetError() == GL_NO_ERROR); // Load shader program. @@ -193,9 +152,7 @@ TEST_P(GLCompressedCopyTextureCHROMIUMTest, Basic) { EXPECT_TRUE(GL_NO_ERROR == glGetError()); } -TEST_P(GLCompressedCopyTextureCHROMIUMTest, InternalFormat) { - CopyType copy_type = GetParam(); - +TEST_F(GLCompressedCopyTextureCHROMIUMTest, InternalFormat) { struct Image { const GLint format; const uint8_t* data; @@ -206,9 +163,8 @@ TEST_P(GLCompressedCopyTextureCHROMIUMTest, InternalFormat) { }; std::vector<scoped_ptr<Image>> supported_formats; - if ((GLTestHelper::HasExtension("GL_AMD_compressed_ATC_texture") || - GLTestHelper::HasExtension("GL_ATI_texture_compression_atitc")) && - copy_type != TexSubImage) { + if (GLTestHelper::HasExtension("GL_AMD_compressed_ATC_texture") || + GLTestHelper::HasExtension("GL_ATI_texture_compression_atitc")) { supported_formats.push_back(make_scoped_ptr(new Image( GL_ATC_RGB_AMD, kCompressedImageATC, @@ -231,8 +187,7 @@ TEST_P(GLCompressedCopyTextureCHROMIUMTest, InternalFormat) { kCompressedImageDXT5, sizeof(kCompressedImageDXT5)))); } - if (GLTestHelper::HasExtension("GL_OES_compressed_ETC1_RGB8_texture") && - copy_type != TexSubImage) { + if (GLTestHelper::HasExtension("GL_OES_compressed_ETC1_RGB8_texture")) { supported_formats.push_back(make_scoped_ptr(new Image( GL_ETC1_RGB8_OES, kCompressedImageETC1, @@ -254,30 +209,18 @@ TEST_P(GLCompressedCopyTextureCHROMIUMTest, InternalFormat) { glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - if (copy_type == TexImage) { - glCompressedCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], - textures_[1]); - } else { - glCompressedTexImage2D(GL_TEXTURE_2D, 0, image->format, 4, 4, 0, - sizeof(kInvalidCompressedImage), - kInvalidCompressedImage); - - glCompressedCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], - textures_[1], 0, 0, 0, 0, 4, 4); - } + glCompressedCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1]); EXPECT_TRUE(GL_NO_ERROR == glGetError()); } } -TEST_P(GLCompressedCopyTextureCHROMIUMTest, InternalFormatNotSupported) { +TEST_F(GLCompressedCopyTextureCHROMIUMTest, InternalFormatNotSupported) { if (!GLTestHelper::HasExtension("GL_EXT_texture_compression_dxt1")) { LOG(INFO) << "GL_EXT_texture_compression_dxt1 not supported. Skipping test..."; return; } - CopyType copy_type = GetParam(); - const uint8_t kUncompressedPixels[1 * 4] = {255u, 0u, 0u, 255u}; glBindTexture(GL_TEXTURE_2D, textures_[0]); @@ -296,27 +239,17 @@ TEST_P(GLCompressedCopyTextureCHROMIUMTest, InternalFormatNotSupported) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); // Check that the GL_RGBA format reports an error. - if (copy_type == TexImage) { - glCompressedCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1]); - } else { - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, - kUncompressedPixels); - - glCompressedCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], - textures_[1], 0, 0, 0, 0, 1, 1); - } + glCompressedCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1]); EXPECT_TRUE(GL_INVALID_OPERATION == glGetError()); } -TEST_P(GLCompressedCopyTextureCHROMIUMTest, InvalidTextureIds) { +TEST_F(GLCompressedCopyTextureCHROMIUMTest, InvalidTextureIds) { if (!GLTestHelper::HasExtension("GL_EXT_texture_compression_dxt1")) { LOG(INFO) << "GL_EXT_texture_compression_dxt1 not supported. Skipping test..."; return; } - CopyType copy_type = GetParam(); - glBindTexture(GL_TEXTURE_2D, textures_[0]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); @@ -332,52 +265,29 @@ TEST_P(GLCompressedCopyTextureCHROMIUMTest, InvalidTextureIds) { glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - if (copy_type == TexImage) { - glCompressedCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], 99993); - EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); - - glCompressedCopyTextureCHROMIUM(GL_TEXTURE_2D, 99994, textures_[1]); - EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); - - glCompressedCopyTextureCHROMIUM(GL_TEXTURE_2D, 99995, 99996); - EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); - - glCompressedCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1]); - EXPECT_TRUE(glGetError() == GL_NO_ERROR); - } else { - glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, 4, - 4, 0, sizeof(kInvalidCompressedImage), - kInvalidCompressedImage); - glCompressedCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], 99993, 0, 0, - 0, 0, 4, 4); - EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); + glCompressedCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], 99993); + EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); - glCompressedCopySubTextureCHROMIUM(GL_TEXTURE_2D, 99994, textures_[1], 0, 0, - 0, 0, 4, 4); - EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); + glCompressedCopyTextureCHROMIUM(GL_TEXTURE_2D, 99994, textures_[1]); + EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); - glCompressedCopySubTextureCHROMIUM(GL_TEXTURE_2D, 99995, 99996, 0, 0, 0, 0, - 4, 4); - EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); + glCompressedCopyTextureCHROMIUM(GL_TEXTURE_2D, 99995, 99996); + EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); - glCompressedCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], - textures_[1], 0, 0, 0, 0, 4, 4); - EXPECT_TRUE(glGetError() == GL_NO_ERROR); - } + glCompressedCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1]); + EXPECT_TRUE(glGetError() == GL_NO_ERROR); } // Validate that some basic GL state is not touched upon execution of // the extension. -TEST_P(GLCompressedCopyTextureCHROMIUMTest, BasicStatePreservation) { +TEST_F(GLCompressedCopyTextureCHROMIUMTest, BasicStatePreservation) { if (!GLTestHelper::HasExtension("GL_EXT_texture_compression_dxt1")) { LOG(INFO) << "GL_EXT_texture_compression_dxt1 not supported. Skipping test..."; return; } - CopyType copy_type = GetParam(); - glBindTexture(GL_TEXTURE_2D, textures_[0]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); @@ -394,13 +304,6 @@ TEST_P(GLCompressedCopyTextureCHROMIUMTest, BasicStatePreservation) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - if (copy_type == TexSubImage) { - glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, - 4, 4, 0, - sizeof(kInvalidCompressedImage), - kInvalidCompressedImage); - } - GLboolean reference_settings[2] = { GL_TRUE, GL_FALSE }; for (int x = 0; x < 2; ++x) { GLboolean setting = reference_settings[x]; @@ -413,14 +316,7 @@ TEST_P(GLCompressedCopyTextureCHROMIUMTest, BasicStatePreservation) { glDepthMask(setting); glActiveTexture(GL_TEXTURE1 + x); - - if (copy_type == TexImage) { - glCompressedCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], - textures_[1]); - } else { - glCompressedCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], - textures_[1], 0, 0, 0, 0, 4, 4); - } + glCompressedCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1]); EXPECT_TRUE(glGetError() == GL_NO_ERROR); EXPECT_EQ(setting, glIsEnabled(GL_DEPTH_TEST)); @@ -450,15 +346,13 @@ TEST_P(GLCompressedCopyTextureCHROMIUMTest, BasicStatePreservation) { // Verify that invocation of the extension does not modify the bound // texture state. -TEST_P(GLCompressedCopyTextureCHROMIUMTest, TextureStatePreserved) { +TEST_F(GLCompressedCopyTextureCHROMIUMTest, TextureStatePreserved) { if (!GLTestHelper::HasExtension("GL_EXT_texture_compression_dxt1")) { LOG(INFO) << "GL_EXT_texture_compression_dxt1 not supported. Skipping test..."; return; } - CopyType copy_type = GetParam(); - glBindTexture(GL_TEXTURE_2D, textures_[0]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); @@ -475,13 +369,6 @@ TEST_P(GLCompressedCopyTextureCHROMIUMTest, TextureStatePreserved) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - if (copy_type == TexSubImage) { - glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, - 4, 4, 0, - sizeof(kInvalidCompressedImage), - kInvalidCompressedImage); - } - GLuint texture_ids[2]; glGenTextures(2, texture_ids); @@ -491,12 +378,7 @@ TEST_P(GLCompressedCopyTextureCHROMIUMTest, TextureStatePreserved) { glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, texture_ids[1]); - if (copy_type == TexImage) { - glCompressedCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1]); - } else { - glCompressedCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], - textures_[1], 0, 0, 0, 0, 4, 4); - } + glCompressedCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1]); EXPECT_TRUE(GL_NO_ERROR == glGetError()); GLint active_texture = 0; @@ -519,253 +401,4 @@ TEST_P(GLCompressedCopyTextureCHROMIUMTest, TextureStatePreserved) { EXPECT_TRUE(GL_NO_ERROR == glGetError()); } -TEST_F(GLCompressedCopyTextureCHROMIUMTest, CopySubTextureDimension) { - if (!GLTestHelper::HasExtension("GL_EXT_texture_compression_dxt1")) { - LOG(INFO) << - "GL_EXT_texture_compression_dxt1 not supported. Skipping test..."; - return; - } - - glBindTexture(GL_TEXTURE_2D, textures_[0]); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, - 8, 8, 0, - sizeof(kCompressedImageDXT1RGB), - kCompressedImageDXT1RGB); - EXPECT_TRUE(glGetError() == GL_NO_ERROR); - - glBindTexture(GL_TEXTURE_2D, textures_[1]); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, - 8, 8, 0, - sizeof(kInvalidCompressedImageLarge), - kInvalidCompressedImageLarge); - - glCompressedCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], - textures_[1], 4, 4, 0, 0, 4, 4); - EXPECT_TRUE(GL_NO_ERROR == glGetError()); - - // Reset the destination texture as it might have been converted to RGBA. - glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, - 8, 8, 0, - sizeof(kInvalidCompressedImageLarge), - kInvalidCompressedImageLarge); - - // xoffset < 0 - glCompressedCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], - -4, 4, 0, 0, 4, 4); - EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); - - // x < 0 - glCompressedCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], - 4, 4, -4, 0, 4, 4); - EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); - - // xoffset + width > dest_width - glCompressedCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], - 8, 8, 0, 0, 4, 4); - EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); - - // x + width > source_width - glCompressedCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], - 0, 0, 8, 8, 4, 4); - EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); - - // xoffset not within block-boundary - glCompressedCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], - 3, 0, 0, 0, 4, 4); - EXPECT_TRUE(glGetError() == GL_INVALID_OPERATION); - - // x not within block-boundary - glCompressedCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], - 0, 0, 3, 0, 4, 4); - EXPECT_TRUE(glGetError() == GL_INVALID_OPERATION); -} - -TEST_F(GLCompressedCopyTextureCHROMIUMTest, CopySubTextureOffset) { - if (!GLTestHelper::HasExtension("GL_EXT_texture_compression_dxt1")) { - LOG(INFO) << - "GL_EXT_texture_compression_dxt1 not supported. Skipping test..."; - return; - } - - glBindTexture(GL_TEXTURE_2D, textures_[0]); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, - 8, 8, 0, - sizeof(kCompressedImageDXT1RGB), - kCompressedImageDXT1RGB); - EXPECT_TRUE(glGetError() == GL_NO_ERROR); - - glBindTexture(GL_TEXTURE_2D, textures_[1]); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, - 8, 8, 0, - sizeof(kInvalidCompressedImageLarge), - kInvalidCompressedImageLarge); - - // Load shader program. - GLuint program = LoadProgram(); - ASSERT_NE(program, 0u); - GLint position_loc = glGetAttribLocation(program, "a_position"); - GLint texture_loc = glGetUniformLocation(program, "u_texture"); - ASSERT_NE(position_loc, -1); - ASSERT_NE(texture_loc, -1); - glUseProgram(program); - - // Load geometry. - GLuint vbo = GLTestHelper::SetupUnitQuad(position_loc); - ASSERT_NE(vbo, 0u); - - // Load texture. - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, textures_[1]); - glUniform1i(texture_loc, 0); - - const uint8_t kBlack[1 * 4] = {0u, 0u, 0u, 255u}; - const uint8_t kRed[1 * 4] = {255u, 0u, 0u, 255u}; - const uint8_t kGreen[1 * 4] = {0u, 255u, 0u, 255u}; - const uint8_t kBlue[1 * 4] = {0u, 0u, 255u, 255u}; - - // Copy each block one by one in a clockwise fashion. Note that we reset the - // destination texture after each copy operation. That's because on some - // platforms we might fallback into replacing the compressed destination - // texture with an uncompressed one. - - // Move blue block up. - glCompressedCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], - textures_[1], 0, 0, 0, 4, 4, 4); - EXPECT_TRUE(glGetError() == GL_NO_ERROR); - - glDrawArrays(GL_TRIANGLES, 0, 6); - glFlush(); - GLTestHelper::CheckPixels(0, 0, 2, 2, 0, kBlue); - - glBindTexture(GL_TEXTURE_2D, textures_[1]); - glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, - 8, 8, 0, - sizeof(kInvalidCompressedImageLarge), - kInvalidCompressedImageLarge); - - // Move red block right. - glCompressedCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], - textures_[1], 4, 0, 0, 0, 4, 4); - EXPECT_TRUE(glGetError() == GL_NO_ERROR); - - glDrawArrays(GL_TRIANGLES, 0, 6); - glFlush(); - GLTestHelper::CheckPixels(2, 0, 2, 2, 0, kRed); - - glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, - 8, 8, 0, - sizeof(kInvalidCompressedImageLarge), - kInvalidCompressedImageLarge); - - // Move green block down. - glCompressedCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], - textures_[1], 4, 4, 4, 0, 4, 4); - EXPECT_TRUE(glGetError() == GL_NO_ERROR); - - glDrawArrays(GL_TRIANGLES, 0, 6); - glFlush(); - GLTestHelper::CheckPixels(2, 2, 2, 2, 0, kGreen); - - glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, - 8, 8, 0, - sizeof(kInvalidCompressedImageLarge), - kInvalidCompressedImageLarge); - - // Move black block left. - glCompressedCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], - textures_[1], 0, 4, 4, 4, 4, 4); - EXPECT_TRUE(glGetError() == GL_NO_ERROR); - - glDrawArrays(GL_TRIANGLES, 0, 6); - glFlush(); - GLTestHelper::CheckPixels(0, 2, 2, 2, 0, kBlack); - - EXPECT_TRUE(GL_NO_ERROR == glGetError()); -} - -TEST_F(GLCompressedCopyTextureCHROMIUMTest, CopySubTexturePreservation) { - if (!GLTestHelper::HasExtension("GL_EXT_texture_compression_dxt1")) { - LOG(INFO) << - "GL_EXT_texture_compression_dxt1 not supported. Skipping test..."; - return; - } - - glBindTexture(GL_TEXTURE_2D, textures_[0]); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, - 4, 4, 0, - sizeof(kCompressedImageDXT1), - kCompressedImageDXT1); - EXPECT_TRUE(glGetError() == GL_NO_ERROR); - - glBindTexture(GL_TEXTURE_2D, textures_[1]); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, - 8, 8, 0, - sizeof(kCompressedImageDXT1RGB), - kCompressedImageDXT1RGB); - - // Copy entire first texture into the second, replacing the green block: - // [R][R] - // [B][b] - glCompressedCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], - textures_[1], 4, 0, 0, 0, 4, 4); - EXPECT_TRUE(glGetError() == GL_NO_ERROR); - - // Load shader program. - GLuint program = LoadProgram(); - ASSERT_NE(program, 0u); - GLint position_loc = glGetAttribLocation(program, "a_position"); - GLint texture_loc = glGetUniformLocation(program, "u_texture"); - ASSERT_NE(position_loc, -1); - ASSERT_NE(texture_loc, -1); - glUseProgram(program); - - // Load geometry. - GLuint vbo = GLTestHelper::SetupUnitQuad(position_loc); - ASSERT_NE(vbo, 0u); - - // Load texture. - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, textures_[1]); - glUniform1i(texture_loc, 0); - - // Draw. - glDrawArrays(GL_TRIANGLES, 0, 6); - glFlush(); - - const uint8_t kBlack[1 * 4] = {0u, 0u, 0u, 255u}; - const uint8_t kRed[1 * 4] = {255u, 0u, 0u, 255u}; - const uint8_t kBlue[1 * 4] = {0u, 0u, 255u, 255u}; - - // Note that while destination texture is 8 x 8 pixels the viewport is only - // 4 x 4. - GLTestHelper::CheckPixels(0, 0, 4, 2, 0, kRed); - GLTestHelper::CheckPixels(0, 2, 2, 2, 0, kBlue); - GLTestHelper::CheckPixels(2, 2, 2, 2, 0, kBlack); - EXPECT_TRUE(GL_NO_ERROR == glGetError()); -} - } // namespace gpu diff --git a/mojo/gpu/mojo_gles2_impl_autogen.cc b/mojo/gpu/mojo_gles2_impl_autogen.cc index d035fe1..aca5f3f 100644 --- a/mojo/gpu/mojo_gles2_impl_autogen.cc +++ b/mojo/gpu/mojo_gles2_impl_autogen.cc @@ -1523,19 +1523,6 @@ void MojoGLES2Impl::CompressedCopyTextureCHROMIUM(GLenum target, MojoGLES2MakeCurrent(context_); glCompressedCopyTextureCHROMIUM(target, source_id, dest_id); } -void MojoGLES2Impl::CompressedCopySubTextureCHROMIUM(GLenum target, - GLenum source_id, - GLenum dest_id, - GLint xoffset, - GLint yoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height) { - MojoGLES2MakeCurrent(context_); - glCompressedCopySubTextureCHROMIUM(target, source_id, dest_id, xoffset, - yoffset, x, y, width, height); -} void MojoGLES2Impl::DrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, diff --git a/mojo/gpu/mojo_gles2_impl_autogen.h b/mojo/gpu/mojo_gles2_impl_autogen.h index b24a3e1..99fdad5 100644 --- a/mojo/gpu/mojo_gles2_impl_autogen.h +++ b/mojo/gpu/mojo_gles2_impl_autogen.h @@ -712,15 +712,6 @@ class MojoGLES2Impl : public gpu::gles2::GLES2Interface { void CompressedCopyTextureCHROMIUM(GLenum target, GLenum source_id, GLenum dest_id) override; - void CompressedCopySubTextureCHROMIUM(GLenum target, - GLenum source_id, - GLenum dest_id, - GLint xoffset, - GLint yoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height) override; void DrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, diff --git a/mojo/public/c/gles2/gles2_call_visitor_chromium_extension_autogen.h b/mojo/public/c/gles2/gles2_call_visitor_chromium_extension_autogen.h index 85c1016..9414658 100644 --- a/mojo/public/c/gles2/gles2_call_visitor_chromium_extension_autogen.h +++ b/mojo/public/c/gles2/gles2_call_visitor_chromium_extension_autogen.h @@ -225,19 +225,6 @@ VISIT_GL_CALL(CompressedCopyTextureCHROMIUM, void, (GLenum target, GLenum source_id, GLenum dest_id), (target, source_id, dest_id)) -VISIT_GL_CALL( - CompressedCopySubTextureCHROMIUM, - void, - (GLenum target, - GLenum source_id, - GLenum dest_id, - GLint xoffset, - GLint yoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height), - (target, source_id, dest_id, xoffset, yoffset, x, y, width, height)) VISIT_GL_CALL(DrawArraysInstancedANGLE, void, (GLenum mode, GLint first, GLsizei count, GLsizei primcount), |