diff options
9 files changed, 253 insertions, 499 deletions
diff --git a/content/common/gpu/media/android_video_decode_accelerator.cc b/content/common/gpu/media/android_video_decode_accelerator.cc index eb8ddca..de3888d 100644 --- a/content/common/gpu/media/android_video_decode_accelerator.cc +++ b/content/common/gpu/media/android_video_decode_accelerator.cc @@ -400,11 +400,16 @@ void AndroidVideoDecodeAccelerator::SendCurrentSurfaceToClient( 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; - copier_->DoCopyTextureWithTransform( - gl_decoder_.get(), GL_TEXTURE_EXTERNAL_OES, surface_texture_id_, - GL_TEXTURE_2D, picture_buffer_texture_id, GL_RGBA, GL_UNSIGNED_BYTE, - size_.width(), size_.height(), false, false, false, nullptr, - default_matrix); + copier_->DoCopyTextureWithTransform(gl_decoder_.get(), + GL_TEXTURE_EXTERNAL_OES, + surface_texture_id_, + picture_buffer_texture_id, + size_.width(), + size_.height(), + false, + false, + false, + default_matrix); // TODO(henryhsu): Pass (0, 0) as visible size will cause several test // cases failed. We should make sure |size_| is coded size or visible size. diff --git a/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_copy_texture.txt b/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_copy_texture.txt index 8329a2d..101c0f6 100644 --- a/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_copy_texture.txt +++ b/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_copy_texture.txt @@ -84,19 +84,13 @@ New Procedures and Functions INVALID_OPERATION is generated if the internal format of <source_id> is not one of formats from the table above. - INVALID_VALUE is generated if <target> is not GL_TEXTURE_2D, - GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, - GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, - GL_TEXTURE_CUBE_MAP_POSITIVE_Z, or GL_TEXTURE_CUBE_MAP_NEGATIVE_Z. + INVALID_VALUE is generated if <target> is not GL_TEXTURE_2D. INVALID_VALUE is generated if <source_id> or <dest_id> are not valid texture objects. INVALID_VALUE is generated if textures corresponding to <dest_id> have not - been bound as GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP object. - - INVALID_VALUE is generated if the bound target of textures corresponding to - <dest_id> doesn't match <target>. + been bound as GL_TEXTURE_2D object. INVALID_VALUE is generated if textures corresponding to <source_id> have not been bound as GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE_ARB or @@ -134,10 +128,7 @@ New Procedures and Functions INVALID_OPERATION is generated if source internal_format and destination internal_format are not one of the valid formats described above. - INVALID_VALUE is generated if <target> is not GL_TEXTURE_2D, - GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, - GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, - GL_TEXTURE_CUBE_MAP_POSITIVE_Z, or GL_TEXTURE_CUBE_MAP_NEGATIVE_Z. + INVALID_VALUE is generated if <target> is not GL_TEXTURE_2D. INVALID_OPERATION is generated if the destination texture has not been defined. @@ -179,4 +170,3 @@ Revision History 16/7/2014 Add GL_TEXTURE_RECTANGLE_ARB as valid source_id target 19/6/2015 Add arguments unpack_flip_y, unpack_premultiply_alpha, and unpack_unmultiply_alpha to both commands. - 6/8/2015 support GL_TEXTURE_CUBE_MAP destination target. diff --git a/gpu/command_buffer/common/gles2_cmd_utils.cc b/gpu/command_buffer/common/gles2_cmd_utils.cc index 098a9ee..e30e2e3 100644 --- a/gpu/command_buffer/common/gles2_cmd_utils.cc +++ b/gpu/command_buffer/common/gles2_cmd_utils.cc @@ -809,27 +809,6 @@ size_t GLES2Util::GLTargetToFaceIndex(uint32 target) { } } -uint32_t GLES2Util::GLTextureTargetToBindingTarget(uint32_t textarget) { - switch (textarget) { - case GL_TEXTURE_2D: - case GL_TEXTURE_EXTERNAL_OES: - case GL_TEXTURE_RECTANGLE_ARB: - case GL_TEXTURE_3D: - case GL_TEXTURE_2D_ARRAY: - return textarget; - case GL_TEXTURE_CUBE_MAP_POSITIVE_X: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: - return GL_TEXTURE_CUBE_MAP; - default: - NOTREACHED(); - return GL_TEXTURE_2D; - } -} - uint32 GLES2Util::GetGLReadPixelsImplementationFormat( uint32 internal_format) { switch (internal_format) { diff --git a/gpu/command_buffer/common/gles2_cmd_utils.h b/gpu/command_buffer/common/gles2_cmd_utils.h index 3e25c6f..806b297 100644 --- a/gpu/command_buffer/common/gles2_cmd_utils.h +++ b/gpu/command_buffer/common/gles2_cmd_utils.h @@ -137,8 +137,6 @@ class GLES2_UTILS_EXPORT GLES2Util { static size_t GLTargetToFaceIndex(uint32_t target); - static uint32_t GLTextureTargetToBindingTarget(uint32_t textarget); - static uint32_t GetGLReadPixelsImplementationFormat( uint32_t internal_format); diff --git a/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc b/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc index bfeef0b..a987a39 100644 --- a/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc +++ b/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc @@ -7,10 +7,8 @@ #include <algorithm> #include "base/basictypes.h" -#include "gpu/command_buffer/common/gles2_cmd_utils.h" #include "gpu/command_buffer/service/gl_utils.h" #include "gpu/command_buffer/service/gles2_cmd_decoder.h" -#include "gpu/command_buffer/service/texture_manager.h" #define SHADER(src) \ "#ifdef GL_ES\n" \ @@ -202,19 +200,15 @@ void DeleteShader(GLuint shader) { bool BindFramebufferTexture2D(GLenum target, GLuint texture_id, GLuint framebuffer) { - GLenum binding_target = - gpu::gles2::GLES2Util::GLTextureTargetToBindingTarget(target); - DCHECK(binding_target == GL_TEXTURE_2D || - binding_target == GL_TEXTURE_RECTANGLE_ARB || - binding_target == GL_TEXTURE_CUBE_MAP); + DCHECK(target == GL_TEXTURE_2D || target == GL_TEXTURE_RECTANGLE_ARB); glActiveTexture(GL_TEXTURE0); - glBindTexture(binding_target, texture_id); + glBindTexture(target, texture_id); // NVidia drivers require texture settings to be a certain way // or they won't report FRAMEBUFFER_COMPLETE. - glTexParameterf(binding_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameterf(binding_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexParameteri(binding_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(binding_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterf(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framebuffer); glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target, texture_id, 0); @@ -232,7 +226,6 @@ bool BindFramebufferTexture2D(GLenum target, void DoCopyTexImage2D(const gpu::gles2::GLES2Decoder* decoder, GLenum source_target, GLuint source_id, - GLenum dest_target, GLuint dest_id, GLenum dest_internal_format, GLsizei width, @@ -241,14 +234,12 @@ void DoCopyTexImage2D(const gpu::gles2::GLES2Decoder* decoder, DCHECK(source_target == GL_TEXTURE_2D || source_target == GL_TEXTURE_RECTANGLE_ARB); if (BindFramebufferTexture2D(source_target, source_id, framebuffer)) { - GLenum binding_target = - gpu::gles2::GLES2Util::GLTextureTargetToBindingTarget(dest_target); - glBindTexture(binding_target, dest_id); - glTexParameterf(binding_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameterf(binding_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexParameteri(binding_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(binding_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glCopyTexImage2D(dest_target, 0 /* level */, dest_internal_format, + glBindTexture(GL_TEXTURE_2D, dest_id); + 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); + glCopyTexImage2D(GL_TEXTURE_2D, 0 /* level */, dest_internal_format, 0 /* x */, 0 /* y */, width, height, 0 /* border */); } @@ -262,7 +253,6 @@ void DoCopyTexImage2D(const gpu::gles2::GLES2Decoder* decoder, void DoCopyTexSubImage2D(const gpu::gles2::GLES2Decoder* decoder, GLenum source_target, GLuint source_id, - GLenum dest_target, GLuint dest_id, GLint xoffset, GLint yoffset, @@ -274,15 +264,13 @@ void DoCopyTexSubImage2D(const gpu::gles2::GLES2Decoder* decoder, DCHECK(source_target == GL_TEXTURE_2D || source_target == GL_TEXTURE_RECTANGLE_ARB); if (BindFramebufferTexture2D(source_target, source_id, framebuffer)) { - GLenum binding_target = - gpu::gles2::GLES2Util::GLTextureTargetToBindingTarget(dest_target); - glBindTexture(binding_target, dest_id); - glTexParameterf(binding_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameterf(binding_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexParameteri(binding_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(binding_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glCopyTexSubImage2D(dest_target, 0 /* level */, xoffset, yoffset, source_x, - source_y, source_width, source_height); + glBindTexture(GL_TEXTURE_2D, dest_id); + 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); + glCopyTexSubImage2D(GL_TEXTURE_2D, 0 /* level */, xoffset, yoffset, + source_x, source_y, source_width, source_height); } decoder->RestoreTextureState(source_id); @@ -292,39 +280,6 @@ void DoCopyTexSubImage2D(const gpu::gles2::GLES2Decoder* decoder, decoder->RestoreFramebufferBindings(); } -class ScopedStagingTexture { - public: - ScopedStagingTexture() { - glGenTextures(1, &staging_texture_); - glBindTexture(GL_TEXTURE_2D, staging_texture_); - } - ~ScopedStagingTexture() { - glDeleteTextures(1, &staging_texture_); - staging_texture_ = 0; - } - - GLuint texture() const { return staging_texture_; } - - private: - GLuint staging_texture_; -}; - -bool NeedOneCopy(GLenum target, - const gpu::gles2::DecoderTextureState* texture_state) { - GLenum binding_target = - gpu::gles2::GLES2Util::GLTextureTargetToBindingTarget(target); - - if (binding_target != GL_TEXTURE_CUBE_MAP) - return false; - DCHECK(texture_state); - - // The drivers with |force_cube_complete| or - // |force_cube_map_positive_x_allocation| don't guarantee that the FBO binding - // cube map texture works. - return texture_state->force_cube_complete || - texture_state->force_cube_map_positive_x_allocation; -} - } // namespace namespace gpu { @@ -394,16 +349,13 @@ void CopyTextureCHROMIUMResourceManager::DoCopyTexture( GLenum source_target, GLuint source_id, GLenum source_internal_format, - GLenum dest_target, GLuint dest_id, GLenum dest_internal_format, - GLenum dest_type, GLsizei width, GLsizei height, bool flip_y, bool premultiply_alpha, - bool unpremultiply_alpha, - const gles2::DecoderTextureState* texture_state) { + bool unpremultiply_alpha) { bool premultiply_alpha_change = premultiply_alpha ^ unpremultiply_alpha; // GL_INVALID_OPERATION is generated if the currently bound framebuffer's // format does not contain a superset of the components required by the base @@ -417,16 +369,21 @@ void CopyTextureCHROMIUMResourceManager::DoCopyTexture( // so restrict this to GL_TEXTURE_2D. if (source_target == GL_TEXTURE_2D && !flip_y && !premultiply_alpha_change && source_format_contain_superset_of_dest_format) { - DoCopyTexImage2D(decoder, source_target, source_id, dest_target, dest_id, - dest_internal_format, width, height, framebuffer_); + DoCopyTexImage2D(decoder, + source_target, + source_id, + dest_id, + dest_internal_format, + width, + height, + framebuffer_); return; } // Use kIdentityMatrix if no transform passed in. - DoCopyTextureWithTransform( - decoder, source_target, source_id, dest_target, dest_id, - dest_internal_format, dest_type, width, height, flip_y, premultiply_alpha, - unpremultiply_alpha, texture_state, kIdentityMatrix); + DoCopyTextureWithTransform(decoder, source_target, source_id, dest_id, width, + height, flip_y, premultiply_alpha, + unpremultiply_alpha, kIdentityMatrix); } void CopyTextureCHROMIUMResourceManager::DoCopySubTexture( @@ -434,10 +391,8 @@ void CopyTextureCHROMIUMResourceManager::DoCopySubTexture( GLenum source_target, GLuint source_id, GLenum source_internal_format, - GLenum dest_target, GLuint dest_id, GLenum dest_internal_format, - GLenum dest_type, GLint xoffset, GLint yoffset, GLint x, @@ -450,8 +405,7 @@ void CopyTextureCHROMIUMResourceManager::DoCopySubTexture( GLsizei source_height, bool flip_y, bool premultiply_alpha, - bool unpremultiply_alpha, - const gles2::DecoderTextureState* texture_state) { + bool unpremultiply_alpha) { bool premultiply_alpha_change = premultiply_alpha ^ unpremultiply_alpha; // GL_INVALID_OPERATION is generated if the currently bound framebuffer's // format does not contain a superset of the components required by the base @@ -465,79 +419,40 @@ void CopyTextureCHROMIUMResourceManager::DoCopySubTexture( // so restrict this to GL_TEXTURE_2D. if (source_target == GL_TEXTURE_2D && !flip_y && !premultiply_alpha_change && source_format_contain_superset_of_dest_format) { - DoCopyTexSubImage2D(decoder, source_target, source_id, dest_target, dest_id, - xoffset, yoffset, x, y, width, height, framebuffer_); - return; - } - - if (NeedOneCopy(dest_target, texture_state)) { - ScopedStagingTexture staging_texture; - glTexImage2D(GL_TEXTURE_2D, 0, dest_internal_format, width, height, 0, - dest_internal_format, dest_type, nullptr); - DoCopyTextureInternal(decoder, source_target, source_id, GL_TEXTURE_2D, - staging_texture.texture(), 0, 0, x, y, width, height, - width, height, source_width, source_height, flip_y, - premultiply_alpha, unpremultiply_alpha, - kIdentityMatrix); - DoCopyTexSubImage2D(decoder, GL_TEXTURE_2D, staging_texture.texture(), - dest_target, dest_id, xoffset, yoffset, 0, 0, width, - height, framebuffer_); + DoCopyTexSubImage2D(decoder, source_target, source_id, dest_id, xoffset, + yoffset, x, y, width, height, framebuffer_); return; } - DoCopyTextureInternal( - decoder, source_target, source_id, dest_target, dest_id, xoffset, yoffset, - x, y, width, height, dest_width, dest_height, source_width, source_height, - flip_y, premultiply_alpha, unpremultiply_alpha, kIdentityMatrix); + DoCopyTextureInternal(decoder, source_target, source_id, dest_id, xoffset, + yoffset, x, y, width, height, dest_width, dest_height, + source_width, source_height, flip_y, premultiply_alpha, + unpremultiply_alpha, kIdentityMatrix); } void CopyTextureCHROMIUMResourceManager::DoCopyTextureWithTransform( const gles2::GLES2Decoder* decoder, GLenum source_target, GLuint source_id, - GLenum dest_target, GLuint dest_id, - GLenum dest_internal_format, - GLenum dest_type, GLsizei width, GLsizei height, bool flip_y, bool premultiply_alpha, bool unpremultiply_alpha, - const gles2::DecoderTextureState* texture_state, const GLfloat transform_matrix[16]) { GLsizei dest_width = width; GLsizei dest_height = height; - - if (NeedOneCopy(dest_target, texture_state)) { - // The |dest_id| texture cannot be bound to FBO. Create a staging - // GL_TEXTURE_2D texture, and copy the source texture to the staging - // texture, and copy the staging texture to the dest texture. - ScopedStagingTexture staging_texture; - glTexImage2D(GL_TEXTURE_2D, 0, dest_internal_format, width, height, 0, - dest_internal_format, dest_type, nullptr); - DoCopyTextureInternal(decoder, source_target, source_id, GL_TEXTURE_2D, - staging_texture.texture(), 0, 0, 0, 0, width, height, - width, height, width, height, flip_y, - premultiply_alpha, unpremultiply_alpha, - transform_matrix); - DoCopyTexImage2D(decoder, GL_TEXTURE_2D, staging_texture.texture(), - dest_target, dest_id, dest_internal_format, width, height, - framebuffer_); - return; - } - - DoCopyTextureInternal(decoder, source_target, source_id, dest_target, dest_id, - 0, 0, 0, 0, width, height, dest_width, dest_height, - width, height, flip_y, premultiply_alpha, - unpremultiply_alpha, transform_matrix); + DoCopyTextureInternal(decoder, source_target, source_id, dest_id, 0, 0, 0, 0, + width, height, dest_width, dest_height, width, height, + flip_y, premultiply_alpha, unpremultiply_alpha, + transform_matrix); } void CopyTextureCHROMIUMResourceManager::DoCopyTextureInternal( const gles2::GLES2Decoder* decoder, GLenum source_target, GLuint source_id, - GLenum dest_target, GLuint dest_id, GLint xoffset, GLint yoffset, @@ -629,7 +544,7 @@ void CopyTextureCHROMIUMResourceManager::DoCopyTextureInternal( else glUniform2f(info->half_size_handle, 0.5f, 0.5f); - if (BindFramebufferTexture2D(dest_target, dest_id, framebuffer_)) { + if (BindFramebufferTexture2D(GL_TEXTURE_2D, dest_id, framebuffer_)) { #ifndef NDEBUG // glValidateProgram of MACOSX validates FBO unlike other platforms, so // glValidateProgram must be called after FBO binding. crbug.com/463439 diff --git a/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h b/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h index 03502f3..f0438b4 100644 --- a/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h +++ b/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h @@ -14,7 +14,6 @@ namespace gpu { namespace gles2 { -struct DecoderTextureState; class GLES2Decoder; } // namespace gles2. @@ -35,25 +34,20 @@ class GPU_EXPORT CopyTextureCHROMIUMResourceManager { GLenum source_target, GLuint source_id, GLenum source_internal_format, - GLenum dest_target, GLuint dest_id, GLenum dest_internal_format, - GLenum dest_type, GLsizei width, GLsizei height, bool flip_y, bool premultiply_alpha, - bool unpremultiply_alpha, - const gles2::DecoderTextureState* texture_state); + bool unpremultiply_alpha); void DoCopySubTexture(const gles2::GLES2Decoder* decoder, GLenum source_target, GLuint source_id, GLenum source_internal_format, - GLenum dest_target, GLuint dest_id, GLenum dest_internal_format, - GLenum dest_type, GLint xoffset, GLint yoffset, GLint x, @@ -66,28 +60,22 @@ class GPU_EXPORT CopyTextureCHROMIUMResourceManager { GLsizei source_height, bool flip_y, bool premultiply_alpha, - bool unpremultiply_alpha, - const gles2::DecoderTextureState* texture_state); + bool unpremultiply_alpha); // This will apply a transform on the texture coordinates before sampling // the source texture and copying to the destination texture. The transform // matrix should be given in column-major form, so it can be passed // directly to GL. - void DoCopyTextureWithTransform( - const gles2::GLES2Decoder* decoder, - GLenum source_target, - GLuint source_id, - GLenum dest_target, - GLuint dest_id, - GLenum dest_internal_format, - GLenum dest_type, - GLsizei width, - GLsizei height, - bool flip_y, - bool premultiply_alpha, - bool unpremultiply_alpha, - const gles2::DecoderTextureState* texture_state, - const GLfloat transform_matrix[16]); + void DoCopyTextureWithTransform(const gles2::GLES2Decoder* decoder, + GLenum source_target, + GLuint source_id, + GLuint dest_id, + GLsizei width, + GLsizei height, + bool flip_y, + bool premultiply_alpha, + bool unpremultiply_alpha, + const GLfloat transform_matrix[16]); // The attributes used during invocation of the extension. static const GLuint kVertexPositionAttrib = 0; @@ -111,7 +99,6 @@ class GPU_EXPORT CopyTextureCHROMIUMResourceManager { void DoCopyTextureInternal(const gles2::GLES2Decoder* decoder, GLenum source_target, GLuint source_id, - GLenum dest_target, GLuint dest_id, GLint xoffset, GLint yoffset, diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 5c9b323..1541a77 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -12522,6 +12522,12 @@ bool GLES2DecoderImpl::ValidateCopyTextureCHROMIUM( return false; } + if (GL_TEXTURE_2D != target) { + LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, + "invalid texture target"); + return false; + } + Texture* source_texture = source_texture_ref->texture(); Texture* dest_texture = dest_texture_ref->texture(); if (source_texture == dest_texture) { @@ -12530,18 +12536,10 @@ bool GLES2DecoderImpl::ValidateCopyTextureCHROMIUM( return false; } - GLenum binding_target = GLES2Util::GLTextureTargetToBindingTarget(target); - if (dest_texture->target() != binding_target || - (GL_TEXTURE_2D != binding_target && - GL_TEXTURE_CUBE_MAP != binding_target)) { - LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, - "invalid texture target"); - return false; - } - - if (source_texture->target() != GL_TEXTURE_2D && - source_texture->target() != GL_TEXTURE_RECTANGLE_ARB && - source_texture->target() != GL_TEXTURE_EXTERNAL_OES) { + if (dest_texture->target() != GL_TEXTURE_2D || + (source_texture->target() != GL_TEXTURE_2D && + source_texture->target() != GL_TEXTURE_RECTANGLE_ARB && + source_texture->target() != GL_TEXTURE_EXTERNAL_OES)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "invalid texture target binding"); return false; @@ -12714,11 +12712,11 @@ void GLES2DecoderImpl::DoCopyTextureCHROMIUM( GLenum dest_internal_format = internal_format; int dest_width = 0; int dest_height = 0; - bool dest_level_defined = - dest_texture->GetLevelSize(target, 0, &dest_width, &dest_height, nullptr); + bool dest_level_defined = dest_texture->GetLevelSize( + GL_TEXTURE_2D, 0, &dest_width, &dest_height, nullptr); if (dest_level_defined) { - dest_texture->GetLevelType(target, 0, &dest_type_previous, + dest_texture->GetLevelType(GL_TEXTURE_2D, 0, &dest_type_previous, &dest_internal_format); } @@ -12729,21 +12727,22 @@ void GLES2DecoderImpl::DoCopyTextureCHROMIUM( dest_type_previous != dest_type) { // Ensure that the glTexImage2D succeeds. LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCopyTextureCHROMIUM"); - glBindTexture(dest_texture->target(), dest_texture->service_id()); - glTexImage2D(target, 0, internal_format, source_width, source_height, 0, - internal_format, dest_type, NULL); + glBindTexture(GL_TEXTURE_2D, dest_texture->service_id()); + glTexImage2D(GL_TEXTURE_2D, 0, internal_format, source_width, source_height, + 0, internal_format, dest_type, NULL); GLenum error = LOCAL_PEEK_GL_ERROR("glCopyTextureCHROMIUM"); if (error != GL_NO_ERROR) { - RestoreCurrentTextureBindings(&state_, dest_texture->target()); + RestoreCurrentTextureBindings(&state_, GL_TEXTURE_2D); return; } texture_manager()->SetLevelInfo( - dest_texture_ref, target, 0, internal_format, source_width, + dest_texture_ref, GL_TEXTURE_2D, 0, internal_format, source_width, source_height, 1, 0, internal_format, dest_type, gfx::Rect(source_width, source_height)); } else { - texture_manager()->SetLevelCleared(dest_texture_ref, target, 0, true); + texture_manager()->SetLevelCleared(dest_texture_ref, GL_TEXTURE_2D, 0, + true); } ScopedModifyPixels modify(dest_texture_ref); @@ -12752,8 +12751,8 @@ void GLES2DecoderImpl::DoCopyTextureCHROMIUM( bool unpack_premultiply_alpha_change = (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) { - glBindTexture(dest_texture->target(), dest_texture->service_id()); - if (image->CopyTexSubImage(target, gfx::Point(0, 0), + glBindTexture(GL_TEXTURE_2D, dest_texture->service_id()); + if (image->CopyTexSubImage(GL_TEXTURE_2D, gfx::Point(0, 0), gfx::Rect(0, 0, source_width, source_height))) { return; } @@ -12767,18 +12766,20 @@ void GLES2DecoderImpl::DoCopyTextureCHROMIUM( // TODO(hkuang): get the StreamTexture transform matrix in GPU process // instead of using kIdentityMatrix crbug.com/226218. copy_texture_CHROMIUM_->DoCopyTextureWithTransform( - this, source_texture->target(), source_texture->service_id(), target, - dest_texture->service_id(), internal_format, dest_type, source_width, - source_height, unpack_flip_y == GL_TRUE, - unpack_premultiply_alpha == GL_TRUE, unpack_unmultiply_alpha == GL_TRUE, - &texture_state_, kIdentityMatrix); + this, source_texture->target(), source_texture->service_id(), + dest_texture->service_id(), source_width, source_height, + unpack_flip_y == GL_TRUE, + unpack_premultiply_alpha == GL_TRUE, + unpack_unmultiply_alpha == GL_TRUE, + kIdentityMatrix); } else { copy_texture_CHROMIUM_->DoCopyTexture( this, source_texture->target(), source_texture->service_id(), - source_internal_format, target, dest_texture->service_id(), - internal_format, dest_type, source_width, source_height, - unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, - unpack_unmultiply_alpha == GL_TRUE, &texture_state_); + source_internal_format, dest_texture->service_id(), internal_format, + source_width, source_height, + unpack_flip_y == GL_TRUE, + unpack_premultiply_alpha == GL_TRUE, + unpack_unmultiply_alpha == GL_TRUE); } DoDidUseTexImageIfNeeded(source_texture, source_texture->target()); @@ -12803,10 +12804,6 @@ void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( TextureRef* dest_texture_ref = GetTexture(dest_id); Texture* source_texture = source_texture_ref->texture(); Texture* dest_texture = dest_texture_ref->texture(); - GLenum source_type = 0; - GLenum source_internal_format = 0; - source_texture->GetLevelType(source_texture->target(), 0, &source_type, - &source_internal_format); int source_width = 0; int source_height = 0; gfx::GLImage* image = @@ -12828,13 +12825,6 @@ void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( return; } - if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0, - width, height, 1, source_type)) { - LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", - "source texture bad dimensions."); - return; - } - // Check that this type of texture is allowed. if (!texture_manager()->ValidForTarget(source_texture->target(), 0, source_width, source_height, 1)) { @@ -12844,17 +12834,28 @@ void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( } } + 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, source_type)) { + LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", + "source texture bad dimensions."); + return; + } + GLenum dest_type = 0; GLenum dest_internal_format = 0; - bool dest_level_defined = - dest_texture->GetLevelType(target, 0, &dest_type, &dest_internal_format); + 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, "glCopySubTextureCHROMIUM", "destination texture is not defined"); return; } - if (!dest_texture->ValidForTexture(target, 0, xoffset, yoffset, 0, width, - height, 1, dest_type)) { + if (!dest_texture->ValidForTexture(dest_texture->target(), 0, xoffset, + yoffset, 0, width, height, 1, dest_type)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", "destination texture bad dimensions."); return; @@ -12887,8 +12888,8 @@ void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( int dest_width = 0; int dest_height = 0; - bool ok = - dest_texture->GetLevelSize(target, 0, &dest_width, &dest_height, nullptr); + 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) { @@ -12910,7 +12911,8 @@ void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( } } } else { - texture_manager()->SetLevelCleared(dest_texture_ref, target, 0, true); + texture_manager()->SetLevelCleared(dest_texture_ref, GL_TEXTURE_2D, 0, + true); } ScopedModifyPixels modify(dest_texture_ref); @@ -12919,8 +12921,8 @@ void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( bool unpack_premultiply_alpha_change = (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) { - glBindTexture(dest_texture->target(), dest_texture->service_id()); - if (image->CopyTexSubImage(target, gfx::Point(xoffset, yoffset), + glBindTexture(GL_TEXTURE_2D, dest_texture->service_id()); + if (image->CopyTexSubImage(GL_TEXTURE_2D, gfx::Point(xoffset, yoffset), gfx::Rect(x, y, width, height))) { return; } @@ -12932,11 +12934,12 @@ void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( // crbug.com/226218. copy_texture_CHROMIUM_->DoCopySubTexture( this, source_texture->target(), source_texture->service_id(), - source_internal_format, target, dest_texture->service_id(), - dest_internal_format, dest_type, xoffset, yoffset, x, y, width, height, - dest_width, dest_height, source_width, source_height, - unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, - unpack_unmultiply_alpha == GL_TRUE, &texture_state_); + source_internal_format, dest_texture->service_id(), dest_internal_format, + xoffset, yoffset, x, y, width, height, dest_width, dest_height, + source_width, source_height, + unpack_flip_y == GL_TRUE, + unpack_premultiply_alpha == GL_TRUE, + unpack_unmultiply_alpha == GL_TRUE); DoDidUseTexImageIfNeeded(source_texture, source_texture->target()); } @@ -13105,15 +13108,13 @@ void GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM(GLenum target, // instead of using kIdentityMatrix crbug.com/226218. copy_texture_CHROMIUM_->DoCopyTextureWithTransform( this, source_texture->target(), source_texture->service_id(), - GL_TEXTURE_2D, dest_texture->service_id(), GL_RGBA, GL_UNSIGNED_BYTE, - source_width, source_height, false, false, false, &texture_state_, - kIdentityMatrix); + dest_texture->service_id(), source_width, source_height, + false, false, false, kIdentityMatrix); } else { copy_texture_CHROMIUM_->DoCopyTexture( this, source_texture->target(), source_texture->service_id(), - source_internal_format, GL_TEXTURE_2D, dest_texture->service_id(), - GL_RGBA, GL_UNSIGNED_BYTE, source_width, source_height, false, false, - false, &texture_state_); + source_internal_format, dest_texture->service_id(), GL_RGBA, + source_width, source_height, false, false, false); } DoDidUseTexImageIfNeeded(source_texture, source_texture->target()); @@ -13301,9 +13302,8 @@ void GLES2DecoderImpl::DoCompressedCopySubTextureCHROMIUM(GLenum target, copy_texture_CHROMIUM_->DoCopyTexture( this, dest_texture->target(), dest_texture->service_id(), - dest_internal_format, GL_TEXTURE_2D, tmp_service_id, GL_RGBA, - GL_UNSIGNED_BYTE, dest_width, dest_height, false, false, false, - &texture_state_); + dest_internal_format, tmp_service_id, GL_RGBA, + dest_width, dest_height, false, false, false); // Redefine destination texture to use RGBA. glBindTexture(GL_TEXTURE_2D, dest_texture->service_id()); @@ -13319,9 +13319,9 @@ void GLES2DecoderImpl::DoCompressedCopySubTextureCHROMIUM(GLenum target, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect(dest_width, dest_height)); copy_texture_CHROMIUM_->DoCopyTexture( - this, GL_TEXTURE_2D, tmp_service_id, GL_RGBA, GL_TEXTURE_2D, - dest_texture->service_id(), GL_RGBA, GL_UNSIGNED_BYTE, dest_width, - dest_height, false, false, false, &texture_state_); + this, GL_TEXTURE_2D, tmp_service_id, GL_RGBA, + dest_texture->service_id(), GL_RGBA, + dest_width, dest_height, false, false, false); glDeleteTextures(1, &tmp_service_id); } @@ -13330,10 +13330,9 @@ void GLES2DecoderImpl::DoCompressedCopySubTextureCHROMIUM(GLenum target, // crbug.com/226218. copy_texture_CHROMIUM_->DoCopySubTexture( this, source_texture->target(), source_texture->service_id(), - source_internal_format, GL_TEXTURE_2D, dest_texture->service_id(), - GL_RGBA, GL_UNSIGNED_BYTE, xoffset, yoffset, x, y, width, height, - dest_width, dest_height, source_width, source_height, false, false, false, - &texture_state_); + source_internal_format, dest_texture->service_id(), GL_RGBA, + xoffset, yoffset, x, y, width, height, dest_width, dest_height, + source_width, source_height, false, false, false); DoDidUseTexImageIfNeeded(source_texture, source_texture->target()); } 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 5caad26..a256fff 100644 --- a/gpu/command_buffer/tests/gl_copy_texture_CHROMIUM_unittest.cc +++ b/gpu/command_buffer/tests/gl_copy_texture_CHROMIUM_unittest.cc @@ -10,11 +10,8 @@ #include <GLES2/gl2ext.h> #include <GLES2/gl2extchromium.h> -#include "base/command_line.h" -#include "base/strings/string_number_conversions.h" #include "gpu/command_buffer/tests/gl_manager.h" #include "gpu/command_buffer/tests/gl_test_utils.h" -#include "gpu/config/gpu_switches.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -26,56 +23,30 @@ const CopyType kCopyTypes[] = { TexImage, TexSubImage, }; - -const GLenum kDestinationFaces[] = { - GL_TEXTURE_2D, - GL_TEXTURE_CUBE_MAP_POSITIVE_X, -#if !defined(OS_ANDROID) - // linux_android_rel_ng crashs on glReadPixels() - // TODO(dshwang): exclude them for only Nvidia. crbug.com/527126 - // TODO(dshwang): handle Nvidia. crbug.com/528145 - GL_TEXTURE_CUBE_MAP_NEGATIVE_X, - GL_TEXTURE_CUBE_MAP_POSITIVE_Y, - GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, - GL_TEXTURE_CUBE_MAP_POSITIVE_Z, - GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, -#endif -}; -} // namespace +} // A collection of tests that exercise the GL_CHROMIUM_copy_texture extension. class GLCopyTextureCHROMIUMTest - : public testing::TestWithParam<::testing::tuple<CopyType, GLenum>> { + : public testing::Test, + public ::testing::WithParamInterface<CopyType> { protected: void SetUp() override { - base::CommandLine command_line(base::CommandLine::NO_PROGRAM); - // ANGLE and Nvidia fails without this workaround. crbug.com/518889 - command_line.AppendSwitchASCII(switches::kGpuDriverBugWorkarounds, - base::IntToString(gpu::FORCE_CUBE_COMPLETE)); - gl_.InitializeWithCommandLine(GLManager::Options(), &command_line); - DCHECK(gl_.workarounds().force_cube_complete); - - // textures_[0] is source texture and textures_[1] is destination texture. - glGenTextures(2, textures_); + gl_.Initialize(GLManager::Options()); - GLenum dest_target = ::testing::get<1>(GetParam()); - GLenum binding_target = - gpu::gles2::GLES2Util::GLTextureTargetToBindingTarget(dest_target); - - glBindTexture(binding_target, textures_[1]); + glGenTextures(2, textures_); + glBindTexture(GL_TEXTURE_2D, textures_[1]); // Some drivers (NVidia/SGX) require texture settings to be a certain way or // they won't report FRAMEBUFFER_COMPLETE. - glTexParameterf(binding_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameterf(binding_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexParameteri(binding_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(binding_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + 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); glGenFramebuffers(1, &framebuffer_id_); glBindFramebuffer(GL_FRAMEBUFFER, framebuffer_id_); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, dest_target, + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textures_[1], 0); - EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); } void TearDown() override { @@ -84,45 +55,18 @@ class GLCopyTextureCHROMIUMTest gl_.Destroy(); } - // Some drivers(Nvidia) require cube complete to do glReadPixels from the FBO. - // TODO(dshwang): handle Nvidia. crbug.com/528145 - void MakeCubeComplete(GLenum target, - GLint internalformat, - GLenum type, - GLsizei width, - GLsizei height) { - // Make the textures cube complete to bind it to FBO - GLenum binding_target = - gpu::gles2::GLES2Util::GLTextureTargetToBindingTarget(target); - if (binding_target == GL_TEXTURE_CUBE_MAP) { - glBindTexture(binding_target, textures_[1]); - for (unsigned i = 0; i < 6; i++) { - if (target == GL_TEXTURE_CUBE_MAP_POSITIVE_X + i) - continue; - glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, internalformat, - width, height, 0, internalformat, type, nullptr); - EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); - } - } - } - GLManager gl_; GLuint textures_[2]; GLuint framebuffer_id_; }; -INSTANTIATE_TEST_CASE_P( - GLCopyTextureCHROMIUMTests, - GLCopyTextureCHROMIUMTest, - ::testing::Combine(::testing::ValuesIn(kCopyTypes), - ::testing::ValuesIn(kDestinationFaces))); +INSTANTIATE_TEST_CASE_P(CopyType, + GLCopyTextureCHROMIUMTest, + ::testing::ValuesIn(kCopyTypes)); // Test to ensure that the basic functionality of the extension works. TEST_P(GLCopyTextureCHROMIUMTest, Basic) { - CopyType copy_type = ::testing::get<0>(GetParam()); - GLenum dest_target = ::testing::get<1>(GetParam()); - GLenum binding_target = - gpu::gles2::GLES2Util::GLTextureTargetToBindingTarget(dest_target); + CopyType copy_type = GetParam(); uint8 pixels[1 * 4] = { 255u, 0u, 0u, 255u }; glBindTexture(GL_TEXTURE_2D, textures_[0]); @@ -130,20 +74,18 @@ TEST_P(GLCopyTextureCHROMIUMTest, Basic) { pixels); if (copy_type == TexImage) { - glCopyTextureCHROMIUM(dest_target, textures_[0], textures_[1], GL_RGBA, + glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, GL_UNSIGNED_BYTE, false, false, false); } else { - glBindTexture(binding_target, textures_[1]); - glTexImage2D(dest_target, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, + glBindTexture(GL_TEXTURE_2D, textures_[1]); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); - glCopySubTextureCHROMIUM(dest_target, textures_[0], textures_[1], 0, 0, 0, + glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 0, 0, 1, 1, false, false, false); } EXPECT_TRUE(glGetError() == GL_NO_ERROR); - MakeCubeComplete(dest_target, GL_RGBA, GL_UNSIGNED_BYTE, 1, 1); - // Check the FB is still bound. GLint value = 0; glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); @@ -163,11 +105,7 @@ TEST_P(GLCopyTextureCHROMIUMTest, ImmutableTexture) { LOG(INFO) << "GL_EXT_texture_storage not supported. Skipping test..."; return; } - - CopyType copy_type = ::testing::get<0>(GetParam()); - GLenum dest_target = ::testing::get<1>(GetParam()); - GLenum binding_target = - gpu::gles2::GLES2Util::GLTextureTargetToBindingTarget(dest_target); + CopyType copy_type = GetParam(); uint8 pixels[1 * 4] = {255u, 0u, 0u, 255u}; @@ -176,33 +114,21 @@ TEST_P(GLCopyTextureCHROMIUMTest, ImmutableTexture) { glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixels); - glBindTexture(binding_target, textures_[1]); - glTexStorage2DEXT(binding_target, 1, GL_RGBA8_OES, 1, 1); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, dest_target, + glBindTexture(GL_TEXTURE_2D, textures_[1]); + glTexStorage2DEXT(GL_TEXTURE_2D, 1, GL_RGBA8_OES, 1, 1); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textures_[1], 0); EXPECT_TRUE(glGetError() == GL_NO_ERROR); if (copy_type == TexImage) { - glCopyTextureCHROMIUM(dest_target, textures_[0], textures_[1], GL_RGBA, + glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, GL_UNSIGNED_BYTE, false, false, false); EXPECT_TRUE(glGetError() == GL_INVALID_OPERATION); } else { - glCopySubTextureCHROMIUM(dest_target, textures_[0], textures_[1], 0, 0, 0, + glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 0, 0, 1, 1, false, false, false); EXPECT_TRUE(glGetError() == GL_NO_ERROR); - // Similar quirk to MakeCubeComplete() for immutable texture. - if (binding_target == GL_TEXTURE_CUBE_MAP) { - for (unsigned i = 0; i < 6; i++) { - if (dest_target == GL_TEXTURE_CUBE_MAP_POSITIVE_X + i) - continue; - glCopySubTextureCHROMIUM(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, - textures_[0], textures_[1], 0, 0, 0, 0, 1, 1, - false, false, false); - } - } - EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); - // Check the FB is still bound. GLint value = 0; glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); @@ -219,11 +145,7 @@ TEST_P(GLCopyTextureCHROMIUMTest, ImmutableTexture) { } TEST_P(GLCopyTextureCHROMIUMTest, InternalFormat) { - CopyType copy_type = ::testing::get<0>(GetParam()); - GLenum dest_target = ::testing::get<1>(GetParam()); - GLenum binding_target = - gpu::gles2::GLES2Util::GLTextureTargetToBindingTarget(dest_target); - + CopyType copy_type = GetParam(); GLint src_formats[] = {GL_ALPHA, GL_RGB, GL_RGBA, GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_BGRA_EXT}; GLint dest_formats[] = {GL_RGB, GL_RGBA}; @@ -237,29 +159,27 @@ TEST_P(GLCopyTextureCHROMIUMTest, InternalFormat) { EXPECT_TRUE(GL_NO_ERROR == glGetError()); if (copy_type == TexImage) { - glCopyTextureCHROMIUM(dest_target, textures_[0], textures_[1], - dest_formats[dest_index], GL_UNSIGNED_BYTE, false, - false, false); + glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], + dest_formats[dest_index], GL_UNSIGNED_BYTE, + false, false, false); } else { - glBindTexture(binding_target, textures_[1]); - glTexImage2D(dest_target, 0, dest_formats[dest_index], 1, 1, 0, + glBindTexture(GL_TEXTURE_2D, textures_[1]); + glTexImage2D(GL_TEXTURE_2D, 0, dest_formats[dest_index], 1, 1, 0, dest_formats[dest_index], GL_UNSIGNED_BYTE, nullptr); EXPECT_TRUE(GL_NO_ERROR == glGetError()); - glCopySubTextureCHROMIUM(dest_target, textures_[0], textures_[1], 0, 0, - 0, 0, 1, 1, false, false, false); + glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, + 0, 0, 0, 1, 1, false, false, false); } - EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()) - << "src_index:" << src_index << " dest_index:" << dest_index; + + EXPECT_TRUE(GL_NO_ERROR == glGetError()) << "src_index:" << src_index + << " dest_index:" << dest_index; } } } TEST_P(GLCopyTextureCHROMIUMTest, InternalFormatNotSupported) { - CopyType copy_type = ::testing::get<0>(GetParam()); - GLenum dest_target = ::testing::get<1>(GetParam()); - GLenum binding_target = - gpu::gles2::GLES2Util::GLTextureTargetToBindingTarget(dest_target); + CopyType copy_type = GetParam(); glBindTexture(GL_TEXTURE_2D, textures_[0]); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); @@ -271,16 +191,16 @@ TEST_P(GLCopyTextureCHROMIUMTest, InternalFormatNotSupported) { for (size_t dest_index = 0; dest_index < arraysize(unsupported_dest_formats); dest_index++) { if (copy_type == TexImage) { - glCopyTextureCHROMIUM(dest_target, textures_[0], textures_[1], + glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], unsupported_dest_formats[dest_index], GL_UNSIGNED_BYTE, false, false, false); } else { - glBindTexture(binding_target, textures_[1]); - glTexImage2D(dest_target, 0, unsupported_dest_formats[dest_index], 1, 1, + glBindTexture(GL_TEXTURE_2D, textures_[1]); + glTexImage2D(GL_TEXTURE_2D, 0, unsupported_dest_formats[dest_index], 1, 1, 0, unsupported_dest_formats[dest_index], GL_UNSIGNED_BYTE, nullptr); - glCopySubTextureCHROMIUM(dest_target, textures_[0], textures_[1], 0, 0, 0, - 0, 1, 1, false, false, false); + glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, + 0, 0, 1, 1, false, false, false); } EXPECT_TRUE(GL_INVALID_OPERATION == glGetError()) << "dest_index:" << dest_index; @@ -289,10 +209,7 @@ TEST_P(GLCopyTextureCHROMIUMTest, InternalFormatNotSupported) { // Test to ensure that the destination texture is redefined if the properties // are different. -TEST_P(GLCopyTextureCHROMIUMTest, RedefineDestinationTexture) { - GLenum dest_target = ::testing::get<1>(GetParam()); - GLenum binding_target = - gpu::gles2::GLES2Util::GLTextureTargetToBindingTarget(dest_target); +TEST_F(GLCopyTextureCHROMIUMTest, RedefineDestinationTexture) { uint8 pixels[4 * 4] = {255u, 0u, 0u, 255u, 255u, 0u, 0u, 255u, 255u, 0u, 0u, 255u, 255u, 0u, 0u, 255u}; @@ -300,35 +217,40 @@ TEST_P(GLCopyTextureCHROMIUMTest, RedefineDestinationTexture) { glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels); - glBindTexture(binding_target, textures_[1]); - glTexImage2D(dest_target, 0, GL_BGRA_EXT, 1, 1, 0, GL_BGRA_EXT, - GL_UNSIGNED_BYTE, pixels); + glBindTexture(GL_TEXTURE_2D, textures_[1]); + glTexImage2D(GL_TEXTURE_2D, + 0, + GL_BGRA_EXT, + 1, + 1, + 0, + GL_BGRA_EXT, + GL_UNSIGNED_BYTE, + pixels); EXPECT_TRUE(GL_NO_ERROR == glGetError()); // GL_INVALID_OPERATION due to "intrinsic format" != "internal format". - glTexSubImage2D(dest_target, 0, 0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, - pixels); + glTexSubImage2D( + GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixels); EXPECT_TRUE(GL_INVALID_OPERATION == glGetError()); // GL_INVALID_VALUE due to bad dimensions. - glTexSubImage2D(dest_target, 0, 1, 1, 1, 1, GL_BGRA_EXT, GL_UNSIGNED_BYTE, - pixels); + glTexSubImage2D( + GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_BGRA_EXT, GL_UNSIGNED_BYTE, pixels); EXPECT_TRUE(GL_INVALID_VALUE == glGetError()); // If the dest texture has different properties, glCopyTextureCHROMIUM() // redefines them. - glCopyTextureCHROMIUM(dest_target, textures_[0], textures_[1], GL_RGBA, + glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, GL_UNSIGNED_BYTE, false, false, false); EXPECT_TRUE(GL_NO_ERROR == glGetError()); // glTexSubImage2D() succeeds because textures_[1] is redefined into 2x2 // dimension and GL_RGBA format. - glBindTexture(binding_target, textures_[1]); - glTexSubImage2D(dest_target, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, - pixels); + glBindTexture(GL_TEXTURE_2D, textures_[1]); + glTexSubImage2D( + GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixels); EXPECT_TRUE(GL_NO_ERROR == glGetError()); - MakeCubeComplete(dest_target, GL_RGBA, GL_UNSIGNED_BYTE, 2, 2); - // Check the FB is still bound. GLint value = 0; glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); @@ -339,16 +261,7 @@ TEST_P(GLCopyTextureCHROMIUMTest, RedefineDestinationTexture) { EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), glCheckFramebufferStatus(GL_FRAMEBUFFER)); -#if defined(OS_MACOSX) || defined(OS_WIN) - // Despite of "MakeCubeComplete()" quirk, glReadPixels still fails on - // mac_chromium_rel_ng and win_chromium_rel_ng. - // TODO(dshwang): exclude it for only Nvidia. crbug.com/527126 - GLsizei size = 2 * 2 * 4; - scoped_ptr<uint8[]> read_pixels(new uint8[size]); - glReadPixels(0, 0, 2, 2, GL_RGBA, GL_UNSIGNED_BYTE, read_pixels.get()); -#else GLTestHelper::CheckPixels(1, 1, 1, 1, 0, &pixels[12]); -#endif EXPECT_TRUE(GL_NO_ERROR == glGetError()); } @@ -366,10 +279,7 @@ void glEnableDisable(GLint param, GLboolean value) { // Validate that some basic GL state is not touched upon execution of // the extension. TEST_P(GLCopyTextureCHROMIUMTest, BasicStatePreservation) { - CopyType copy_type = ::testing::get<0>(GetParam()); - GLenum dest_target = ::testing::get<1>(GetParam()); - GLenum binding_target = - gpu::gles2::GLES2Util::GLTextureTargetToBindingTarget(dest_target); + CopyType copy_type = GetParam(); uint8 pixels[1 * 4] = { 255u, 0u, 0u, 255u }; glBindFramebuffer(GL_FRAMEBUFFER, 0); @@ -379,8 +289,8 @@ TEST_P(GLCopyTextureCHROMIUMTest, BasicStatePreservation) { pixels); if (copy_type == TexSubImage) { - glBindTexture(binding_target, textures_[1]); - glTexImage2D(dest_target, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, + glBindTexture(GL_TEXTURE_2D, textures_[1]); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); } @@ -398,11 +308,11 @@ TEST_P(GLCopyTextureCHROMIUMTest, BasicStatePreservation) { glActiveTexture(GL_TEXTURE1 + x); if (copy_type == TexImage) { - glCopyTextureCHROMIUM(dest_target, textures_[0], textures_[1], GL_RGBA, + glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, GL_UNSIGNED_BYTE, false, false, false); } else { - glCopySubTextureCHROMIUM(dest_target, textures_[0], textures_[1], 0, 0, 0, - 0, 1, 1, false, false, false); + glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, + 0, 0, 1, 1, false, false, false); } EXPECT_TRUE(GL_NO_ERROR == glGetError()); @@ -434,13 +344,7 @@ TEST_P(GLCopyTextureCHROMIUMTest, BasicStatePreservation) { // Verify that invocation of the extension does not modify the bound // texture state. TEST_P(GLCopyTextureCHROMIUMTest, TextureStatePreserved) { - CopyType copy_type = ::testing::get<0>(GetParam()); - GLenum dest_target = ::testing::get<1>(GetParam()); - GLenum binding_target = - gpu::gles2::GLES2Util::GLTextureTargetToBindingTarget(dest_target); - GLenum get_binding_target = binding_target == GL_TEXTURE_2D - ? GL_TEXTURE_BINDING_2D - : GL_TEXTURE_BINDING_CUBE_MAP; + CopyType copy_type = GetParam(); // Setup the texture used for the extension invocation. uint8 pixels[1 * 4] = { 255u, 0u, 0u, 255u }; glBindTexture(GL_TEXTURE_2D, textures_[0]); @@ -448,8 +352,8 @@ TEST_P(GLCopyTextureCHROMIUMTest, TextureStatePreserved) { pixels); if (copy_type == TexSubImage) { - glBindTexture(binding_target, textures_[1]); - glTexImage2D(dest_target, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, + glBindTexture(GL_TEXTURE_2D, textures_[1]); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); } @@ -460,13 +364,13 @@ TEST_P(GLCopyTextureCHROMIUMTest, TextureStatePreserved) { glBindTexture(GL_TEXTURE_2D, texture_ids[0]); glActiveTexture(GL_TEXTURE1); - glBindTexture(binding_target, texture_ids[1]); + glBindTexture(GL_TEXTURE_2D, texture_ids[1]); if (copy_type == TexImage) { - glCopyTextureCHROMIUM(dest_target, textures_[0], textures_[1], GL_RGBA, + glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, GL_UNSIGNED_BYTE, false, false, false); } else { - glCopySubTextureCHROMIUM(dest_target, textures_[0], textures_[1], 0, 0, 0, + glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 0, 0, 1, 1, false, false, false); } EXPECT_TRUE(GL_NO_ERROR == glGetError()); @@ -476,9 +380,9 @@ TEST_P(GLCopyTextureCHROMIUMTest, TextureStatePreserved) { EXPECT_EQ(GL_TEXTURE1, active_texture); GLint bound_texture = 0; - glGetIntegerv(get_binding_target, &bound_texture); + glGetIntegerv(GL_TEXTURE_BINDING_2D, &bound_texture); EXPECT_EQ(texture_ids[1], static_cast<GLuint>(bound_texture)); - glBindTexture(binding_target, 0); + glBindTexture(GL_TEXTURE_2D, 0); bound_texture = 0; glActiveTexture(GL_TEXTURE0); @@ -494,10 +398,7 @@ TEST_P(GLCopyTextureCHROMIUMTest, TextureStatePreserved) { // Verify that invocation of the extension does not perturb the currently // bound FBO state. TEST_P(GLCopyTextureCHROMIUMTest, FBOStatePreserved) { - CopyType copy_type = ::testing::get<0>(GetParam()); - GLenum dest_target = ::testing::get<1>(GetParam()); - GLenum binding_target = - gpu::gles2::GLES2Util::GLTextureTargetToBindingTarget(dest_target); + CopyType copy_type = GetParam(); // Setup the texture used for the extension invocation. uint8 pixels[1 * 4] = { 255u, 0u, 0u, 255u }; glBindTexture(GL_TEXTURE_2D, textures_[0]); @@ -505,8 +406,8 @@ TEST_P(GLCopyTextureCHROMIUMTest, FBOStatePreserved) { pixels); if (copy_type == TexSubImage) { - glBindTexture(binding_target, textures_[1]); - glTexImage2D(dest_target, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, + glBindTexture(GL_TEXTURE_2D, textures_[1]); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); } @@ -538,16 +439,14 @@ TEST_P(GLCopyTextureCHROMIUMTest, FBOStatePreserved) { GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color); if (copy_type == TexImage) { - glCopyTextureCHROMIUM(dest_target, textures_[0], textures_[1], GL_RGBA, + glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, GL_UNSIGNED_BYTE, false, false, false); } else { - glCopySubTextureCHROMIUM(dest_target, textures_[0], textures_[1], 0, 0, 0, + glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 0, 0, 1, 1, false, false, false); } EXPECT_TRUE(GL_NO_ERROR == glGetError()); - MakeCubeComplete(dest_target, GL_RGBA, GL_UNSIGNED_BYTE, 1, 1); - EXPECT_TRUE(glIsFramebuffer(framebuffer_id)); // Ensure that reading from the framebuffer produces correct pixels. @@ -594,10 +493,7 @@ TEST_P(GLCopyTextureCHROMIUMTest, FBOStatePreserved) { } TEST_P(GLCopyTextureCHROMIUMTest, ProgramStatePreservation) { - CopyType copy_type = ::testing::get<0>(GetParam()); - GLenum dest_target = ::testing::get<1>(GetParam()); - GLenum binding_target = - gpu::gles2::GLES2Util::GLTextureTargetToBindingTarget(dest_target); + CopyType copy_type = GetParam(); // unbind the one created in setup. glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindTexture(GL_TEXTURE_2D, 0); @@ -652,18 +548,16 @@ TEST_P(GLCopyTextureCHROMIUMTest, ProgramStatePreservation) { glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels); if (copy_type == TexImage) { - glCopyTextureCHROMIUM(dest_target, textures_[0], textures_[1], GL_RGBA, + glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, GL_UNSIGNED_BYTE, false, false, false); } else { - glBindTexture(binding_target, textures_[1]); - glTexImage2D(dest_target, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, + glBindTexture(GL_TEXTURE_2D, textures_[1]); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); - glCopySubTextureCHROMIUM(dest_target, textures_[0], textures_[1], 0, 0, 0, + glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 0, 0, 1, 1, false, false, false); } - MakeCubeComplete(dest_target, GL_RGBA, GL_UNSIGNED_BYTE, 1, 1); - // test using program after glClear(GL_COLOR_BUFFER_BIT); EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, zero)); @@ -679,29 +573,24 @@ TEST_P(GLCopyTextureCHROMIUMTest, ProgramStatePreservation) { // Test that glCopyTextureCHROMIUM doesn't leak uninitialized textures. TEST_P(GLCopyTextureCHROMIUMTest, UninitializedSource) { - CopyType copy_type = ::testing::get<0>(GetParam()); - GLenum dest_target = ::testing::get<1>(GetParam()); - GLenum binding_target = - gpu::gles2::GLES2Util::GLTextureTargetToBindingTarget(dest_target); + CopyType copy_type = GetParam(); const GLsizei kWidth = 64, kHeight = 64; glBindTexture(GL_TEXTURE_2D, textures_[0]); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, kWidth, kHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); if (copy_type == TexImage) { - glCopyTextureCHROMIUM(dest_target, textures_[0], textures_[1], GL_RGBA, + glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, GL_UNSIGNED_BYTE, false, false, false); } else { - glBindTexture(binding_target, textures_[1]); - glTexImage2D(dest_target, 0, GL_RGBA, kWidth, kHeight, 0, GL_RGBA, + glBindTexture(GL_TEXTURE_2D, textures_[1]); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, kWidth, kHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); - glCopySubTextureCHROMIUM(dest_target, textures_[0], textures_[1], 0, 0, 0, + glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 0, 0, kWidth, kHeight, false, false, false); } EXPECT_TRUE(GL_NO_ERROR == glGetError()); - MakeCubeComplete(dest_target, GL_RGBA, GL_UNSIGNED_BYTE, kWidth, kHeight); - uint8 pixels[kHeight][kWidth][4] = {{{1}}}; glReadPixels(0, 0, kWidth, kHeight, GL_RGBA, GL_UNSIGNED_BYTE, pixels); for (int x = 0; x < kWidth; ++x) { @@ -716,47 +605,41 @@ TEST_P(GLCopyTextureCHROMIUMTest, UninitializedSource) { EXPECT_TRUE(GL_NO_ERROR == glGetError()); } -TEST_P(GLCopyTextureCHROMIUMTest, CopySubTextureDimension) { - GLenum dest_target = ::testing::get<1>(GetParam()); - GLenum binding_target = - gpu::gles2::GLES2Util::GLTextureTargetToBindingTarget(dest_target); +TEST_F(GLCopyTextureCHROMIUMTest, CopySubTextureDimension) { glBindTexture(GL_TEXTURE_2D, textures_[0]); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); - glBindTexture(binding_target, textures_[1]); - glTexImage2D(dest_target, 0, GL_RGBA, 3, 3, 0, GL_RGBA, GL_UNSIGNED_BYTE, + glBindTexture(GL_TEXTURE_2D, textures_[1]); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 3, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); - glCopySubTextureCHROMIUM(dest_target, textures_[0], textures_[1], 1, 1, 0, 0, - 1, 1, false, false, false); + glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 1, 1, 0, + 0, 1, 1, false, false, false); EXPECT_TRUE(GL_NO_ERROR == glGetError()); // xoffset < 0 - glCopySubTextureCHROMIUM(dest_target, textures_[0], textures_[1], -1, 1, 0, 0, - 1, 1, false, false, false); + glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], -1, 1, 0, + 0, 1, 1, false, false, false); EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); // x < 0 - glCopySubTextureCHROMIUM(dest_target, textures_[0], textures_[1], 1, 1, -1, 0, - 1, 1, false, false, false); + glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 1, 1, -1, + 0, 1, 1, false, false, false); EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); // xoffset + width > dest_width - glCopySubTextureCHROMIUM(dest_target, textures_[0], textures_[1], 2, 2, 0, 0, - 2, 2, false, false, false); + glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 2, 2, 0, + 0, 2, 2, false, false, false); EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); // x + width > source_width - glCopySubTextureCHROMIUM(dest_target, textures_[0], textures_[1], 0, 0, 1, 1, - 2, 2, false, false, false); + glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 1, + 1, 2, 2, false, false, false); EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); } -TEST_P(GLCopyTextureCHROMIUMTest, CopySubTextureOffset) { - GLenum dest_target = ::testing::get<1>(GetParam()); - GLenum binding_target = - gpu::gles2::GLES2Util::GLTextureTargetToBindingTarget(dest_target); +TEST_F(GLCopyTextureCHROMIUMTest, CopySubTextureOffset) { uint8 rgba_pixels[4 * 4] = {255u, 0u, 0u, @@ -779,22 +662,20 @@ TEST_P(GLCopyTextureCHROMIUMTest, CopySubTextureOffset) { uint8 transparent_pixels[4 * 4] = { 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u}; - glBindTexture(binding_target, textures_[1]); - glTexImage2D(dest_target, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, + glBindTexture(GL_TEXTURE_2D, textures_[1]); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, transparent_pixels); - glCopySubTextureCHROMIUM(dest_target, textures_[0], textures_[1], 1, 1, 0, 0, - 1, 1, false, false, false); + glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 1, 1, 0, + 0, 1, 1, false, false, false); EXPECT_TRUE(glGetError() == GL_NO_ERROR); - glCopySubTextureCHROMIUM(dest_target, textures_[0], textures_[1], 1, 0, 1, 0, - 1, 1, false, false, false); + glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 1, 0, 1, + 0, 1, 1, false, false, false); EXPECT_TRUE(glGetError() == GL_NO_ERROR); - glCopySubTextureCHROMIUM(dest_target, textures_[0], textures_[1], 0, 1, 0, 1, - 1, 1, false, false, false); + glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 1, 0, + 1, 1, 1, false, false, false); EXPECT_TRUE(glGetError() == GL_NO_ERROR); - MakeCubeComplete(dest_target, GL_RGBA, GL_UNSIGNED_BYTE, 2, 2); - // Check the FB is still bound. GLint value = 0; glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value); diff --git a/gpu/config/gpu_driver_bug_list_json.cc b/gpu/config/gpu_driver_bug_list_json.cc index e3b53dc..6900917 100644 --- a/gpu/config/gpu_driver_bug_list_json.cc +++ b/gpu/config/gpu_driver_bug_list_json.cc @@ -1522,7 +1522,7 @@ LONG_STRING_CONST( { "id": 130, "description": "NVIDIA fails glReadPixels from incomplete cube map texture", - "cr_bugs": [528145], + "cr_bugs": [518889], "gl_vendor": "NVIDIA.*", "features": [ "force_cube_complete" |