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

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

Issue 1881883002: SRGB_EXT is a valid format of texture in WebGL1.0 and ES2.0 contexts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Correct texture format parameter Created 4 years, 7 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 11424 matching lines...) Expand 10 before | Expand all | Expand 10 after
11435 } else { 11435 } else {
11436 if (!pixels_shm_id && pixels_shm_offset) 11436 if (!pixels_shm_id && pixels_shm_offset)
11437 return error::kInvalidArguments; 11437 return error::kInvalidArguments;
11438 // When reading from client buffer, the command buffer client side took 11438 // When reading from client buffer, the command buffer client side took
11439 // the responsibility to take the pixels from the client buffer and 11439 // the responsibility to take the pixels from the client buffer and
11440 // unpack them according to the full ES3 pack parameters as source, all 11440 // unpack them according to the full ES3 pack parameters as source, all
11441 // parameters for 0 (except for alignment) as destination mem for the 11441 // parameters for 0 (except for alignment) as destination mem for the
11442 // service side. 11442 // service side.
11443 params.alignment = state_.unpack_alignment; 11443 params.alignment = state_.unpack_alignment;
11444 } 11444 }
11445
11446 // When the client is providing ES 2.0 or WebGL 1.0 contexts, but the
11447 // command buffer is running on top of desktop GL or ES 3.0, it would
11448 // have to translate these unsized internal formats to the appropriate
11449 // sized internal formats.
11450 if ((internal_format == GL_SRGB_EXT ||
11451 internal_format == GL_SRGB_ALPHA_EXT) &&
11452 (feature_info_->context_type() == CONTEXT_TYPE_WEBGL2 ||
11453 feature_info_->context_type() == CONTEXT_TYPE_OPENGLES3)) {
Zhenyao Mo 2016/04/27 17:12:26 I just realized we have a different place for such
xinghua.cao 2016/04/28 09:59:27 I have put this mapping in gl_gl_api_implementatio
11454 if (internal_format == GL_SRGB_EXT) {
11455 internal_format = GL_SRGB8;
11456 format = GL_RGB;
11457 } else if (internal_format == GL_SRGB_ALPHA_EXT) {
11458 internal_format = GL_SRGB8_ALPHA8;
11459 format = GL_RGBA;
11460 }
11461 }
11462
11445 uint32_t pixels_size; 11463 uint32_t pixels_size;
11446 uint32_t skip_size; 11464 uint32_t skip_size;
11447 uint32_t padding; 11465 uint32_t padding;
11448 if (!GLES2Util::ComputeImageDataSizesES3(width, height, 1, 11466 if (!GLES2Util::ComputeImageDataSizesES3(width, height, 1,
11449 format, type, 11467 format, type,
11450 params, 11468 params,
11451 &pixels_size, 11469 &pixels_size,
11452 nullptr, 11470 nullptr,
11453 nullptr, 11471 nullptr,
11454 &skip_size, 11472 &skip_size,
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
12001 return error::kInvalidArguments; 12019 return error::kInvalidArguments;
12002 params = state_.GetUnpackParams(ContextState::k2D); 12020 params = state_.GetUnpackParams(ContextState::k2D);
12003 } else { 12021 } else {
12004 // When reading from client buffer, the command buffer client side took 12022 // When reading from client buffer, the command buffer client side took
12005 // the responsibility to take the pixels from the client buffer and 12023 // the responsibility to take the pixels from the client buffer and
12006 // unpack them according to the full ES3 pack parameters as source, all 12024 // unpack them according to the full ES3 pack parameters as source, all
12007 // parameters for 0 (except for alignment) as destination mem for the 12025 // parameters for 0 (except for alignment) as destination mem for the
12008 // service side. 12026 // service side.
12009 params.alignment = state_.unpack_alignment; 12027 params.alignment = state_.unpack_alignment;
12010 } 12028 }
12029
12030 // When the client is providing ES 2.0 or WebGL 1.0 contexts, but the
12031 // command buffer is running on top of desktop GL or ES 3.0, it would
12032 // have to translate these unsized internal formats to the appropriate
12033 // sized internal formats.
12034 if ((format == GL_SRGB_EXT || format == GL_SRGB_ALPHA_EXT) &&
Zhenyao Mo 2016/04/27 17:12:26 Same here. Let's do the mapping in ui/gl/gl_gl_api
12035 (feature_info_->context_type() == CONTEXT_TYPE_WEBGL2 ||
12036 feature_info_->context_type() == CONTEXT_TYPE_OPENGLES3)) {
12037 if (format == GL_SRGB_EXT) {
12038 format = GL_RGB;
12039 } else if (format == GL_SRGB_ALPHA_EXT) {
12040 format = GL_RGBA;
12041 }
12042 }
12043
12011 uint32_t pixels_size; 12044 uint32_t pixels_size;
12012 uint32_t skip_size; 12045 uint32_t skip_size;
12013 uint32_t padding; 12046 uint32_t padding;
12014 if (!GLES2Util::ComputeImageDataSizesES3(width, height, 1, 12047 if (!GLES2Util::ComputeImageDataSizesES3(width, height, 1,
12015 format, type, 12048 format, type,
12016 params, 12049 params,
12017 &pixels_size, 12050 &pixels_size,
12018 nullptr, 12051 nullptr,
12019 nullptr, 12052 nullptr,
12020 &skip_size, 12053 &skip_size,
(...skipping 4336 matching lines...) Expand 10 before | Expand all | Expand 10 after
16357 } 16390 }
16358 16391
16359 // Include the auto-generated part of this file. We split this because it means 16392 // Include the auto-generated part of this file. We split this because it means
16360 // we can easily edit the non-auto generated parts right here in this file 16393 // we can easily edit the non-auto generated parts right here in this file
16361 // instead of having to edit some template or the code generator. 16394 // instead of having to edit some template or the code generator.
16362 #include "base/macros.h" 16395 #include "base/macros.h"
16363 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 16396 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
16364 16397
16365 } // namespace gles2 16398 } // namespace gles2
16366 } // namespace gpu 16399 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698