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

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

Issue 2121043002: 16 bpp video stream capture, render and WebGL usage - Realsense R200 & SR300 support. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tests: cc, skcanvas_video_renderer, wrtcrecorder... Fake capture supports Y16. Created 4 years, 2 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 10578 matching lines...) Expand 10 before | Expand all | Expand 10 after
10589 accepted_formats.push_back(GL_RGBA_INTEGER); 10589 accepted_formats.push_back(GL_RGBA_INTEGER);
10590 accepted_types.push_back(GL_INT); 10590 accepted_types.push_back(GL_INT);
10591 break; 10591 break;
10592 case GL_RGB10_A2: 10592 case GL_RGB10_A2:
10593 accepted_formats.push_back(GL_RGBA); 10593 accepted_formats.push_back(GL_RGBA);
10594 accepted_types.push_back(GL_UNSIGNED_BYTE); 10594 accepted_types.push_back(GL_UNSIGNED_BYTE);
10595 // Special case with an extra supported format/type. 10595 // Special case with an extra supported format/type.
10596 accepted_formats.push_back(GL_RGBA); 10596 accepted_formats.push_back(GL_RGBA);
10597 accepted_types.push_back(GL_UNSIGNED_INT_2_10_10_10_REV); 10597 accepted_types.push_back(GL_UNSIGNED_INT_2_10_10_10_REV);
10598 break; 10598 break;
10599 case GL_R32F:
10600 if (validators_->read_pixel_format.IsValid(GL_RED)) {
10601 accepted_formats.push_back(GL_RED);
10602 accepted_types.push_back(GL_FLOAT);
Ken Russell (switch to Gerrit) 2016/09/30 23:01:29 Where is it specified that ReadPixels with type GL
10603 }
10604 // Fall through.
10599 default: 10605 default:
10600 accepted_formats.push_back(GL_RGBA); 10606 accepted_formats.push_back(GL_RGBA);
10601 { 10607 {
10602 GLenum src_type = GetBoundReadFrameBufferTextureType(); 10608 GLenum src_type = GetBoundReadFrameBufferTextureType();
10603 switch (src_type) { 10609 switch (src_type) {
10604 case GL_HALF_FLOAT: 10610 case GL_HALF_FLOAT:
10605 case GL_HALF_FLOAT_OES: 10611 case GL_HALF_FLOAT_OES:
10606 case GL_FLOAT: 10612 case GL_FLOAT:
10607 case GL_UNSIGNED_INT_10F_11F_11F_REV: 10613 case GL_UNSIGNED_INT_10F_11F_11F_REV:
10608 accepted_types.push_back(GL_FLOAT); 10614 accepted_types.push_back(GL_FLOAT);
(...skipping 4399 matching lines...) Expand 10 before | Expand all | Expand 10 after
15008 source_texture->GetLevelType(source_texture->target(), 0, &source_type, 15014 source_texture->GetLevelType(source_texture->target(), 0, &source_type,
15009 &source_internal_format); 15015 &source_internal_format);
15010 15016
15011 // The destination format should be GL_RGB, or GL_RGBA. GL_ALPHA, 15017 // The destination format should be GL_RGB, or GL_RGBA. GL_ALPHA,
15012 // GL_LUMINANCE, and GL_LUMINANCE_ALPHA are not supported because they are not 15018 // GL_LUMINANCE, and GL_LUMINANCE_ALPHA are not supported because they are not
15013 // renderable on some platforms. 15019 // renderable on some platforms.
15014 bool valid_dest_format = 15020 bool valid_dest_format =
15015 dest_internal_format == GL_RGB || dest_internal_format == GL_RGBA || 15021 dest_internal_format == GL_RGB || dest_internal_format == GL_RGBA ||
15016 dest_internal_format == GL_RGB8 || dest_internal_format == GL_RGBA8 || 15022 dest_internal_format == GL_RGB8 || dest_internal_format == GL_RGBA8 ||
15017 dest_internal_format == GL_BGRA_EXT || 15023 dest_internal_format == GL_BGRA_EXT ||
15018 dest_internal_format == GL_BGRA8_EXT; 15024 dest_internal_format == GL_BGRA8_EXT ||
15025 ((dest_internal_format == GL_R16UI || dest_internal_format == GL_R8 ||
15026 dest_internal_format == GL_RG8) &&
15027 feature_info_->feature_flags().ext_texture_rg);
Ken Russell (switch to Gerrit) 2016/09/30 23:01:30 EXT_texture_rg doesn't provide the GL_R16UI format
15019 bool valid_source_format = 15028 bool valid_source_format =
15020 source_internal_format == GL_RED || source_internal_format == GL_ALPHA || 15029 source_internal_format == GL_RED || source_internal_format == GL_ALPHA ||
15021 source_internal_format == GL_RGB || source_internal_format == GL_RGBA || 15030 source_internal_format == GL_RGB || source_internal_format == GL_RGBA ||
15022 source_internal_format == GL_RGB8 || source_internal_format == GL_RGBA8 || 15031 source_internal_format == GL_RGB8 || source_internal_format == GL_RGBA8 ||
15023 source_internal_format == GL_LUMINANCE || 15032 source_internal_format == GL_LUMINANCE ||
15024 source_internal_format == GL_LUMINANCE_ALPHA || 15033 source_internal_format == GL_LUMINANCE_ALPHA ||
15025 source_internal_format == GL_BGRA_EXT || 15034 source_internal_format == GL_BGRA_EXT ||
15026 source_internal_format == GL_BGRA8_EXT || 15035 source_internal_format == GL_BGRA8_EXT ||
15027 source_internal_format == GL_RGB_YCBCR_420V_CHROMIUM || 15036 source_internal_format == GL_RGB_YCBCR_420V_CHROMIUM ||
15028 source_internal_format == GL_RGB_YCBCR_422_CHROMIUM; 15037 source_internal_format == GL_RGB_YCBCR_422_CHROMIUM ||
15038 source_internal_format == GL_RG_EXT ||
Ken Russell (switch to Gerrit) 2016/09/30 23:01:29 Why is support for GL_RG_EXT here not gated by fea
15039 ((source_internal_format == GL_R32F ||
15040 source_internal_format == GL_R16F) &&
15041 validators_->texture_internal_format.IsValid(source_internal_format));
Ken Russell (switch to Gerrit) 2016/09/30 23:01:30 Why does this check of source_internal_format agai
15042
15043 // TODO(astojilj): to check if renderable, check ext_color_buffer_(half)float.
15044 // It is, for now, checked in Extensions3DUtil::canUseCopyTextureCHROMIUM.
Ken Russell (switch to Gerrit) 2016/09/30 23:01:30 This is a pretty significant TODO. Could you pleas
15045 if (dest_internal_format == GL_R32F || dest_internal_format == GL_R16F)
15046 valid_dest_format =
15047 validators_->texture_internal_format.IsValid(dest_internal_format);
Ken Russell (switch to Gerrit) 2016/09/30 23:01:30 Why is this logic separate from the computation of
15048
15029 if (!valid_source_format) { 15049 if (!valid_source_format) {
15030 std::string msg = "invalid source internal format " + 15050 std::string msg = "invalid source internal format " +
15031 GLES2Util::GetStringEnum(source_internal_format); 15051 GLES2Util::GetStringEnum(source_internal_format);
15032 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, 15052 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name,
15033 msg.c_str()); 15053 msg.c_str());
15034 return false; 15054 return false;
15035 } 15055 }
15036 if (!valid_dest_format) { 15056 if (!valid_dest_format) {
15037 std::string msg = "invalid dest internal format " + 15057 std::string msg = "invalid dest internal format " +
15038 GLES2Util::GetStringEnum(dest_internal_format); 15058 GLES2Util::GetStringEnum(dest_internal_format);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
15097 GLenum dest_type, 15117 GLenum dest_type,
15098 GLboolean unpack_flip_y, 15118 GLboolean unpack_flip_y,
15099 GLboolean unpack_premultiply_alpha, 15119 GLboolean unpack_premultiply_alpha,
15100 GLboolean unpack_unmultiply_alpha) { 15120 GLboolean unpack_unmultiply_alpha) {
15101 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopyTextureCHROMIUM"); 15121 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopyTextureCHROMIUM");
15102 static const char kFunctionName[] = "glCopyTextureCHROMIUM"; 15122 static const char kFunctionName[] = "glCopyTextureCHROMIUM";
15103 15123
15104 TextureRef* source_texture_ref = GetTexture(source_id); 15124 TextureRef* source_texture_ref = GetTexture(source_id);
15105 TextureRef* dest_texture_ref = GetTexture(dest_id); 15125 TextureRef* dest_texture_ref = GetTexture(dest_id);
15106 15126
15127 GLenum format =
15128 TextureManager::ExtractFormatFromStorageFormat(internal_format);
15107 if (!texture_manager()->ValidateTextureParameters( 15129 if (!texture_manager()->ValidateTextureParameters(
15108 GetErrorState(), kFunctionName, true, internal_format, dest_type, 15130 GetErrorState(), kFunctionName, true, format, dest_type,
15109 internal_format, 0)) 15131 internal_format, 0))
15110 return; 15132 return;
15111 15133
15112 if (!ValidateCopyTextureCHROMIUMTextures(kFunctionName, source_texture_ref, 15134 if (!ValidateCopyTextureCHROMIUMTextures(kFunctionName, source_texture_ref,
15113 dest_texture_ref)) { 15135 dest_texture_ref)) {
15114 return; 15136 return;
15115 } 15137 }
15116 15138
15117 if (!ValidateCopyTextureCHROMIUMInternalFormats( 15139 if (!ValidateCopyTextureCHROMIUMInternalFormats(
15118 kFunctionName, source_texture_ref, internal_format)) { 15140 kFunctionName, source_texture_ref, internal_format)) {
(...skipping 2624 matching lines...) Expand 10 before | Expand all | Expand 10 after
17743 } 17765 }
17744 17766
17745 // Include the auto-generated part of this file. We split this because it means 17767 // Include the auto-generated part of this file. We split this because it means
17746 // we can easily edit the non-auto generated parts right here in this file 17768 // we can easily edit the non-auto generated parts right here in this file
17747 // instead of having to edit some template or the code generator. 17769 // instead of having to edit some template or the code generator.
17748 #include "base/macros.h" 17770 #include "base/macros.h"
17749 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 17771 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
17750 17772
17751 } // namespace gles2 17773 } // namespace gles2
17752 } // namespace gpu 17774 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698