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

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

Issue 2760843002: Add readback path for CopyTextureCHROMIUM (Closed)
Patch Set: Created 3 years, 9 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 16464 matching lines...) Expand 10 before | Expand all | Expand 10 after
16475 case GL_SRGB8: 16475 case GL_SRGB8:
16476 case GL_RGB565: 16476 case GL_RGB565:
16477 case GL_RGB8UI: 16477 case GL_RGB8UI:
16478 case GL_SRGB8_ALPHA8: 16478 case GL_SRGB8_ALPHA8:
16479 case GL_RGB5_A1: 16479 case GL_RGB5_A1:
16480 case GL_RGBA4: 16480 case GL_RGBA4:
16481 case GL_RGBA8UI: 16481 case GL_RGBA8UI:
16482 valid_dest_format = feature_info_->IsWebGL2OrES3Context(); 16482 valid_dest_format = feature_info_->IsWebGL2OrES3Context();
16483 break; 16483 break;
16484 case GL_RGB9_E5: 16484 case GL_RGB9_E5:
16485 valid_dest_format = !gl_version_info().is_es;
16486 break;
16487 case GL_R16F: 16485 case GL_R16F:
16488 case GL_R32F: 16486 case GL_R32F:
16489 case GL_RG16F: 16487 case GL_RG16F:
16490 case GL_RG32F: 16488 case GL_RG32F:
16491 case GL_RGB16F: 16489 case GL_RGB16F:
16492 case GL_RGBA16F: 16490 case GL_RGBA16F:
16493 case GL_R11F_G11F_B10F: 16491 case GL_R11F_G11F_B10F:
16494 valid_dest_format = feature_info_->ext_color_buffer_float_available(); 16492 valid_dest_format = feature_info_->ext_color_buffer_float_available();
16495 break; 16493 break;
16496 case GL_RGB32F: 16494 case GL_RGB32F:
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
16547 bool flip_y, 16545 bool flip_y,
16548 bool premultiply_alpha, 16546 bool premultiply_alpha,
16549 bool unpremultiply_alpha) { 16547 bool unpremultiply_alpha) {
16550 bool premultiply_alpha_change = premultiply_alpha ^ unpremultiply_alpha; 16548 bool premultiply_alpha_change = premultiply_alpha ^ unpremultiply_alpha;
16551 bool source_format_color_renderable = 16549 bool source_format_color_renderable =
16552 Texture::ColorRenderable(GetFeatureInfo(), source_internal_format, false); 16550 Texture::ColorRenderable(GetFeatureInfo(), source_internal_format, false);
16553 bool dest_format_color_renderable = 16551 bool dest_format_color_renderable =
16554 Texture::ColorRenderable(GetFeatureInfo(), dest_internal_format, false); 16552 Texture::ColorRenderable(GetFeatureInfo(), dest_internal_format, false);
16555 std::string output_error_msg; 16553 std::string output_error_msg;
16556 16554
16555 switch (dest_internal_format) {
16556 #if defined(OS_MACOSX)
Zhenyao Mo 2017/03/20 17:05:40 Can we hook this up with a driver bug workaround s
qiankun 2017/03/21 08:47:13 I can do this.
qiankun 2017/03/29 09:00:10 I added the workaround for NVIDIA Mac. But it didn
16557 // RGB5_A1 is not color-renderable on NVIDIA Mac, see crbug.com/676209.
16558 case GL_RGB5_A1:
16559 return DRAW_AND_READBACK;
16560 #endif
16561 // RGB9_E5 isn't accepted by glCopyTexImage2D if underlying context is ES.
16562 case GL_RGB9_E5:
16563 if (gl_version_info().is_es)
16564 return DRAW_AND_READBACK;
16565 break;
16566 // SRGB format has color-space conversion issue, see
16567 // https://github.com/KhronosGroup/WebGL/issues/2165.
16568 // TODO(qiankun.miao@intel.com): revisit this once the above issue is
16569 // resolved.
Zhenyao Mo 2017/03/20 17:05:40 Can we not put them on DRAW_AND_READBACK path for
qiankun 2017/03/21 08:47:13 We cannot detect internalformat in texSubImage2D i
qiankun 2017/03/22 02:52:30 I put SRGB related formats here because current GP
16570 case GL_SRGB_EXT:
16571 case GL_SRGB_ALPHA_EXT:
16572 case GL_SRGB8:
16573 case GL_SRGB8_ALPHA8:
16574 if (feature_info_->IsWebGLContext())
16575 return DRAW_AND_READBACK;
16576 break;
16577 default:
16578 break;
16579 }
16580
16557 // CopyTexImage* should not allow internalformat of GL_BGRA_EXT and 16581 // CopyTexImage* should not allow internalformat of GL_BGRA_EXT and
16558 // GL_BGRA8_EXT. crbug.com/663086. 16582 // GL_BGRA8_EXT. crbug.com/663086.
16559 bool copy_tex_image_format_valid = 16583 bool copy_tex_image_format_valid =
16560 source_internal_format != GL_BGRA_EXT && 16584 source_internal_format != GL_BGRA_EXT &&
16561 dest_internal_format != GL_BGRA_EXT && 16585 dest_internal_format != GL_BGRA_EXT &&
16562 source_internal_format != GL_BGRA8_EXT && 16586 source_internal_format != GL_BGRA8_EXT &&
16563 dest_internal_format != GL_BGRA8_EXT && 16587 dest_internal_format != GL_BGRA8_EXT &&
16564 ValidateCopyTexFormatHelper(dest_internal_format, source_internal_format, 16588 ValidateCopyTexFormatHelper(dest_internal_format, source_internal_format,
16565 source_type, &output_error_msg); 16589 source_type, &output_error_msg);
16566 16590
(...skipping 2926 matching lines...) Expand 10 before | Expand all | Expand 10 after
19493 } 19517 }
19494 19518
19495 // Include the auto-generated part of this file. We split this because it means 19519 // Include the auto-generated part of this file. We split this because it means
19496 // we can easily edit the non-auto generated parts right here in this file 19520 // we can easily edit the non-auto generated parts right here in this file
19497 // instead of having to edit some template or the code generator. 19521 // instead of having to edit some template or the code generator.
19498 #include "base/macros.h" 19522 #include "base/macros.h"
19499 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 19523 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
19500 19524
19501 } // namespace gles2 19525 } // namespace gles2
19502 } // namespace gpu 19526 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698