Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 2656563002: Support cube map dest target for CopyTextureCHROMIUM extension (Closed)
Patch Set: fix nits Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 16394 matching lines...) Expand 10 before | Expand all | Expand 10 after
16405 // INVALID_OPERATION is already generated by 16405 // INVALID_OPERATION is already generated by
16406 // ValidateCopyTextureCHROMIUMInternalFormats. 16406 // ValidateCopyTextureCHROMIUMInternalFormats.
16407 if (method == NOT_COPYABLE) { 16407 if (method == NOT_COPYABLE) {
16408 return; 16408 return;
16409 } 16409 }
16410 16410
16411 // Draw to a fbo attaching level 0 of an intermediate texture, 16411 // Draw to a fbo attaching level 0 of an intermediate texture,
16412 // then copy from the fbo to dest texture level with glCopyTexImage2D. 16412 // then copy from the fbo to dest texture level with glCopyTexImage2D.
16413 // For WebGL 1.0 or OpenGL ES 2.0, DIRECT_DRAW path isn't available for 16413 // For WebGL 1.0 or OpenGL ES 2.0, DIRECT_DRAW path isn't available for
16414 // dest_level > 0 due to level > 0 isn't supported by glFramebufferTexture2D 16414 // dest_level > 0 due to level > 0 isn't supported by glFramebufferTexture2D
16415 // in ES2 context. Go to DRAW_AND_COPY path in this case. 16415 // in ES2 context. DIRECT_DRAW path isn't available for cube map dest texture
16416 // either due to it may be cube map incomplete. Go to DRAW_AND_COPY path in
16417 // these cases.
16416 // TODO(qiankun.miao@intel.com): for WebGL 2.0 or OpenGL ES 3.0, both 16418 // TODO(qiankun.miao@intel.com): for WebGL 2.0 or OpenGL ES 3.0, both
16417 // DIRECT_DRAW path for dest_level > 0 and DIRECT_COPY path for source_level > 16419 // DIRECT_DRAW path for dest_level > 0 and DIRECT_COPY path for source_level >
16418 // 0 are not available due to a framebuffer completeness bug: 16420 // 0 are not available due to a framebuffer completeness bug:
16419 // crbug.com/678526. Once the bug is fixed, the limitation for WebGL 2.0 and 16421 // crbug.com/678526. Once the bug is fixed, the limitation for WebGL 2.0 and
16420 // OpenGL ES 3.0 can be lifted. 16422 // OpenGL ES 3.0 can be lifted.
16421 if ((dest_level > 0 && method == DIRECT_DRAW) || 16423 if (((dest_level > 0 || dest_binding_target == GL_TEXTURE_CUBE_MAP) &&
16424 method == DIRECT_DRAW) ||
16422 (source_level > 0 && method == DIRECT_COPY)) { 16425 (source_level > 0 && method == DIRECT_COPY)) {
16423 method = DRAW_AND_COPY; 16426 method = DRAW_AND_COPY;
16424 } 16427 }
16425 16428
16426 if (feature_info_->feature_flags().desktop_srgb_support) { 16429 if (feature_info_->feature_flags().desktop_srgb_support) {
16427 bool enable_framebuffer_srgb = 16430 bool enable_framebuffer_srgb =
16428 GetColorEncodingFromInternalFormat(source_internal_format) == GL_SRGB || 16431 GetColorEncodingFromInternalFormat(source_internal_format) == GL_SRGB ||
16429 GetColorEncodingFromInternalFormat(internal_format) == GL_SRGB; 16432 GetColorEncodingFromInternalFormat(internal_format) == GL_SRGB;
16430 state_.EnableDisableFramebufferSRGB(enable_framebuffer_srgb); 16433 state_.EnableDisableFramebufferSRGB(enable_framebuffer_srgb);
16431 } 16434 }
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
16669 // INVALID_OPERATION is already generated by 16672 // INVALID_OPERATION is already generated by
16670 // ValidateCopyTextureCHROMIUMInternalFormats. 16673 // ValidateCopyTextureCHROMIUMInternalFormats.
16671 if (method == NOT_COPYABLE) { 16674 if (method == NOT_COPYABLE) {
16672 return; 16675 return;
16673 } 16676 }
16674 16677
16675 // Draw to a fbo attaching level 0 of an intermediate texture, 16678 // Draw to a fbo attaching level 0 of an intermediate texture,
16676 // then copy from the fbo to dest texture level with glCopyTexImage2D. 16679 // then copy from the fbo to dest texture level with glCopyTexImage2D.
16677 // For WebGL 1.0 or OpenGL ES 2.0, DIRECT_DRAW path isn't available for 16680 // For WebGL 1.0 or OpenGL ES 2.0, DIRECT_DRAW path isn't available for
16678 // dest_level > 0 due to level > 0 isn't supported by glFramebufferTexture2D 16681 // dest_level > 0 due to level > 0 isn't supported by glFramebufferTexture2D
16679 // in ES2 context. Go to DRAW_AND_COPY path in this case. 16682 // in ES2 context. DIRECT_DRAW path isn't available for cube map dest texture
16683 // either due to it may be cube map incomplete. Go to DRAW_AND_COPY path in
16684 // these cases.
16680 // TODO(qiankun.miao@intel.com): for WebGL 2.0 or OpenGL ES 3.0, both 16685 // TODO(qiankun.miao@intel.com): for WebGL 2.0 or OpenGL ES 3.0, both
16681 // DIRECT_DRAW path for dest_level > 0 and DIRECT_COPY path for source_level > 16686 // DIRECT_DRAW path for dest_level > 0 and DIRECT_COPY path for source_level >
16682 // 0 are not available due to a framebuffer completeness bug: 16687 // 0 are not available due to a framebuffer completeness bug:
16683 // crbug.com/678526. Once the bug is fixed, the limitation for WebGL 2.0 and 16688 // crbug.com/678526. Once the bug is fixed, the limitation for WebGL 2.0 and
16684 // OpenGL ES 3.0 can be lifted. 16689 // OpenGL ES 3.0 can be lifted.
16685 if ((dest_level > 0 && method == DIRECT_DRAW) || 16690 if (((dest_level > 0 || dest_binding_target == GL_TEXTURE_CUBE_MAP) &&
16691 method == DIRECT_DRAW) ||
16686 (source_level > 0 && method == DIRECT_COPY)) { 16692 (source_level > 0 && method == DIRECT_COPY)) {
16687 method = DRAW_AND_COPY; 16693 method = DRAW_AND_COPY;
16688 } 16694 }
16689 16695
16690 if (feature_info_->feature_flags().desktop_srgb_support) { 16696 if (feature_info_->feature_flags().desktop_srgb_support) {
16691 bool enable_framebuffer_srgb = 16697 bool enable_framebuffer_srgb =
16692 GetColorEncodingFromInternalFormat(source_internal_format) == GL_SRGB || 16698 GetColorEncodingFromInternalFormat(source_internal_format) == GL_SRGB ||
16693 GetColorEncodingFromInternalFormat(dest_internal_format) == GL_SRGB; 16699 GetColorEncodingFromInternalFormat(dest_internal_format) == GL_SRGB;
16694 state_.EnableDisableFramebufferSRGB(enable_framebuffer_srgb); 16700 state_.EnableDisableFramebufferSRGB(enable_framebuffer_srgb);
16695 } 16701 }
(...skipping 2501 matching lines...) Expand 10 before | Expand all | Expand 10 after
19197 } 19203 }
19198 19204
19199 // Include the auto-generated part of this file. We split this because it means 19205 // Include the auto-generated part of this file. We split this because it means
19200 // we can easily edit the non-auto generated parts right here in this file 19206 // we can easily edit the non-auto generated parts right here in this file
19201 // instead of having to edit some template or the code generator. 19207 // instead of having to edit some template or the code generator.
19202 #include "base/macros.h" 19208 #include "base/macros.h"
19203 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 19209 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
19204 19210
19205 } // namespace gles2 19211 } // namespace gles2
19206 } // namespace gpu 19212 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698