Skip to content

Commit

Permalink
gpu: support GL_TEXTURE_CUBE_MAP destination target to Copy(Sub)Textu…
Browse files Browse the repository at this point in the history
…reCHROMIUM.

It makes it possible to optimize WebGL.

TEST=gl_tests GLCopyTextureCHROMIUMTests/GLCopyTextureCHROMIUMTest.*
BUG=517548

Review URL: https://codereview.chromium.org/1275773003

Cr-Commit-Position: refs/heads/master@{#347354}
  • Loading branch information
ds-hwang authored and Commit bot committed Sep 4, 2015
1 parent 2a238a6 commit fa25f0e
Show file tree
Hide file tree
Showing 9 changed files with 499 additions and 253 deletions.
15 changes: 5 additions & 10 deletions content/common/gpu/media/android_video_decode_accelerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -389,16 +389,11 @@ 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_,
picture_buffer_texture_id,
size_.width(),
size_.height(),
false,
false,
false,
default_matrix);
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);

// 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.
Expand Down
16 changes: 13 additions & 3 deletions gpu/GLES2/extensions/CHROMIUM/CHROMIUM_copy_texture.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,19 @@ 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.
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 <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 object.
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>.

INVALID_VALUE is generated if textures corresponding to <source_id> have not
been bound as GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE_ARB or
Expand Down Expand Up @@ -126,7 +132,10 @@ 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.
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_OPERATION is generated if the destination texture has not been
defined.
Expand Down Expand Up @@ -163,3 +172,4 @@ 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.
21 changes: 21 additions & 0 deletions gpu/command_buffer/common/gles2_cmd_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,27 @@ 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) {
Expand Down
2 changes: 2 additions & 0 deletions gpu/command_buffer/common/gles2_cmd_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ 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);

Expand Down
Loading

0 comments on commit fa25f0e

Please sign in to comment.