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

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

Issue 1203793003: Remove flip_y, premultiply_alpha, unmultiply_alpha support in command buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years, 5 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 <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 1871 matching lines...) Expand 10 before | Expand all | Expand 10 after
1882 1882
1883 // All the state for this context. 1883 // All the state for this context.
1884 ContextState state_; 1884 ContextState state_;
1885 1885
1886 // Current width and height of the offscreen frame buffer. 1886 // Current width and height of the offscreen frame buffer.
1887 gfx::Size offscreen_size_; 1887 gfx::Size offscreen_size_;
1888 1888
1889 // Util to help with GL. 1889 // Util to help with GL.
1890 GLES2Util util_; 1890 GLES2Util util_;
1891 1891
1892 // unpack flip y as last set by glPixelStorei
1893 bool unpack_flip_y_;
1894
1895 // unpack (un)premultiply alpha as last set by glPixelStorei
1896 bool unpack_premultiply_alpha_;
1897 bool unpack_unpremultiply_alpha_;
1898
1899 // The buffer we bind to attrib 0 since OpenGL requires it (ES does not). 1892 // The buffer we bind to attrib 0 since OpenGL requires it (ES does not).
1900 GLuint attrib_0_buffer_id_; 1893 GLuint attrib_0_buffer_id_;
1901 1894
1902 // The value currently in attrib_0. 1895 // The value currently in attrib_0.
1903 Vec4 attrib_0_value_; 1896 Vec4 attrib_0_value_;
1904 1897
1905 // Whether or not the attrib_0 buffer holds the attrib_0_value. 1898 // Whether or not the attrib_0 buffer holds the attrib_0_value.
1906 bool attrib_0_buffer_matches_value_; 1899 bool attrib_0_buffer_matches_value_;
1907 1900
1908 // The size of attrib 0. 1901 // The size of attrib 0.
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
2501 2494
2502 GLES2Decoder* GLES2Decoder::Create(ContextGroup* group) { 2495 GLES2Decoder* GLES2Decoder::Create(ContextGroup* group) {
2503 return new GLES2DecoderImpl(group); 2496 return new GLES2DecoderImpl(group);
2504 } 2497 }
2505 2498
2506 GLES2DecoderImpl::GLES2DecoderImpl(ContextGroup* group) 2499 GLES2DecoderImpl::GLES2DecoderImpl(ContextGroup* group)
2507 : GLES2Decoder(), 2500 : GLES2Decoder(),
2508 group_(group), 2501 group_(group),
2509 logger_(&debug_marker_manager_), 2502 logger_(&debug_marker_manager_),
2510 state_(group_->feature_info(), this, &logger_), 2503 state_(group_->feature_info(), this, &logger_),
2511 unpack_flip_y_(false),
2512 unpack_premultiply_alpha_(false),
2513 unpack_unpremultiply_alpha_(false),
2514 attrib_0_buffer_id_(0), 2504 attrib_0_buffer_id_(0),
2515 attrib_0_buffer_matches_value_(true), 2505 attrib_0_buffer_matches_value_(true),
2516 attrib_0_size_(0), 2506 attrib_0_size_(0),
2517 fixed_attrib_buffer_id_(0), 2507 fixed_attrib_buffer_id_(0),
2518 fixed_attrib_buffer_size_(0), 2508 fixed_attrib_buffer_size_(0),
2519 offscreen_target_color_format_(0), 2509 offscreen_target_color_format_(0),
2520 offscreen_target_depth_format_(0), 2510 offscreen_target_depth_format_(0),
2521 offscreen_target_stencil_format_(0), 2511 offscreen_target_stencil_format_(0),
2522 offscreen_target_samples_(0), 2512 offscreen_target_samples_(0),
2523 offscreen_target_buffer_preserved_(true), 2513 offscreen_target_buffer_preserved_(true),
(...skipping 2761 matching lines...) Expand 10 before | Expand all | Expand 10 after
5285 *num_written = 1; 5275 *num_written = 1;
5286 if (params) { 5276 if (params) {
5287 TextureUnit& unit = state_.texture_units[state_.active_texture_unit]; 5277 TextureUnit& unit = state_.texture_units[state_.active_texture_unit];
5288 if (unit.bound_texture_rectangle_arb.get()) { 5278 if (unit.bound_texture_rectangle_arb.get()) {
5289 *params = unit.bound_texture_rectangle_arb->client_id(); 5279 *params = unit.bound_texture_rectangle_arb->client_id();
5290 } else { 5280 } else {
5291 *params = 0; 5281 *params = 0;
5292 } 5282 }
5293 } 5283 }
5294 return true; 5284 return true;
5295 case GL_UNPACK_FLIP_Y_CHROMIUM:
5296 *num_written = 1;
5297 if (params) {
5298 params[0] = unpack_flip_y_;
5299 }
5300 return true;
5301 case GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM:
5302 *num_written = 1;
5303 if (params) {
5304 params[0] = unpack_premultiply_alpha_;
5305 }
5306 return true;
5307 case GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM:
5308 *num_written = 1;
5309 if (params) {
5310 params[0] = unpack_unpremultiply_alpha_;
5311 }
5312 return true;
5313 case GL_BIND_GENERATES_RESOURCE_CHROMIUM: 5285 case GL_BIND_GENERATES_RESOURCE_CHROMIUM:
5314 *num_written = 1; 5286 *num_written = 1;
5315 if (params) { 5287 if (params) {
5316 params[0] = group_->bind_generates_resource() ? 1 : 0; 5288 params[0] = group_->bind_generates_resource() ? 1 : 0;
5317 } 5289 }
5318 return true; 5290 return true;
5319 default: 5291 default:
5320 if (pname >= GL_DRAW_BUFFER0_ARB && 5292 if (pname >= GL_DRAW_BUFFER0_ARB &&
5321 pname < GL_DRAW_BUFFER0_ARB + group_->max_draw_buffers()) { 5293 pname < GL_DRAW_BUFFER0_ARB + group_->max_draw_buffers()) {
5322 *num_written = 1; 5294 *num_written = 1;
(...skipping 3167 matching lines...) Expand 10 before | Expand all | Expand 10 after
8490 } 8462 }
8491 switch (pname) { 8463 switch (pname) {
8492 case GL_PACK_ALIGNMENT: 8464 case GL_PACK_ALIGNMENT:
8493 case GL_UNPACK_ALIGNMENT: 8465 case GL_UNPACK_ALIGNMENT:
8494 if (!validators_->pixel_store_alignment.IsValid(param)) { 8466 if (!validators_->pixel_store_alignment.IsValid(param)) {
8495 LOCAL_SET_GL_ERROR( 8467 LOCAL_SET_GL_ERROR(
8496 GL_INVALID_VALUE, "glPixelStorei", "param GL_INVALID_VALUE"); 8468 GL_INVALID_VALUE, "glPixelStorei", "param GL_INVALID_VALUE");
8497 return error::kNoError; 8469 return error::kNoError;
8498 } 8470 }
8499 break; 8471 break;
8500 case GL_UNPACK_FLIP_Y_CHROMIUM:
8501 unpack_flip_y_ = (param != 0);
8502 return error::kNoError;
8503 case GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM:
8504 unpack_premultiply_alpha_ = (param != 0);
8505 return error::kNoError;
8506 case GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM:
8507 unpack_unpremultiply_alpha_ = (param != 0);
8508 return error::kNoError;
8509 default: 8472 default:
8510 break; 8473 break;
8511 } 8474 }
8512 glPixelStorei(pname, param); 8475 glPixelStorei(pname, param);
8513 switch (pname) { 8476 switch (pname) {
8514 case GL_PACK_ALIGNMENT: 8477 case GL_PACK_ALIGNMENT:
8515 state_.pack_alignment = param; 8478 state_.pack_alignment = param;
8516 break; 8479 break;
8517 case GL_PACK_REVERSE_ROW_ORDER_ANGLE: 8480 case GL_PACK_REVERSE_ROW_ORDER_ANGLE:
8518 state_.pack_reverse_row_order = (param != 0); 8481 state_.pack_reverse_row_order = (param != 0);
(...skipping 3507 matching lines...) Expand 10 before | Expand all | Expand 10 after
12026 GLenum target, 11989 GLenum target,
12027 GLuint source_id, 11990 GLuint source_id,
12028 GLuint dest_id, 11991 GLuint dest_id,
12029 GLenum internal_format, 11992 GLenum internal_format,
12030 GLenum dest_type, 11993 GLenum dest_type,
12031 GLboolean unpack_flip_y, 11994 GLboolean unpack_flip_y,
12032 GLboolean unpack_premultiply_alpha, 11995 GLboolean unpack_premultiply_alpha,
12033 GLboolean unpack_unmultiply_alpha) { 11996 GLboolean unpack_unmultiply_alpha) {
12034 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopyTextureCHROMIUM"); 11997 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopyTextureCHROMIUM");
12035 11998
12036 // TODO(zmo): Get rid of the following three lines when we begin to pass
12037 // in meaningful data to these three arguments in blink.
12038 unpack_flip_y = unpack_flip_y_;
12039 unpack_premultiply_alpha = unpack_premultiply_alpha_;
12040 unpack_unmultiply_alpha = unpack_unpremultiply_alpha_;
12041
12042 TextureRef* source_texture_ref = GetTexture(source_id); 11999 TextureRef* source_texture_ref = GetTexture(source_id);
12043 TextureRef* dest_texture_ref = GetTexture(dest_id); 12000 TextureRef* dest_texture_ref = GetTexture(dest_id);
12044 Texture* source_texture = source_texture_ref->texture(); 12001 Texture* source_texture = source_texture_ref->texture();
12045 Texture* dest_texture = dest_texture_ref->texture(); 12002 Texture* dest_texture = dest_texture_ref->texture();
12046 int source_width = 0; 12003 int source_width = 0;
12047 int source_height = 0; 12004 int source_height = 0;
12048 gfx::GLImage* image = 12005 gfx::GLImage* image =
12049 source_texture->GetLevelImage(source_texture->target(), 0); 12006 source_texture->GetLevelImage(source_texture->target(), 0);
12050 if (image) { 12007 if (image) {
12051 gfx::Size size = image->GetSize(); 12008 gfx::Size size = image->GetSize();
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
12196 GLint yoffset, 12153 GLint yoffset,
12197 GLint x, 12154 GLint x,
12198 GLint y, 12155 GLint y,
12199 GLsizei width, 12156 GLsizei width,
12200 GLsizei height, 12157 GLsizei height,
12201 GLboolean unpack_flip_y, 12158 GLboolean unpack_flip_y,
12202 GLboolean unpack_premultiply_alpha, 12159 GLboolean unpack_premultiply_alpha,
12203 GLboolean unpack_unmultiply_alpha) { 12160 GLboolean unpack_unmultiply_alpha) {
12204 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopySubTextureCHROMIUM"); 12161 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopySubTextureCHROMIUM");
12205 12162
12206 // TODO(zmo): Get rid of the following three lines when we begin to pass
12207 // in meaningful data to these three arguments in blink.
12208 unpack_flip_y = unpack_flip_y_;
12209 unpack_premultiply_alpha = unpack_premultiply_alpha_;
12210 unpack_unmultiply_alpha = unpack_unpremultiply_alpha_;
12211
12212 TextureRef* source_texture_ref = GetTexture(source_id); 12163 TextureRef* source_texture_ref = GetTexture(source_id);
12213 TextureRef* dest_texture_ref = GetTexture(dest_id); 12164 TextureRef* dest_texture_ref = GetTexture(dest_id);
12214 Texture* source_texture = source_texture_ref->texture(); 12165 Texture* source_texture = source_texture_ref->texture();
12215 Texture* dest_texture = dest_texture_ref->texture(); 12166 Texture* dest_texture = dest_texture_ref->texture();
12216 int source_width = 0; 12167 int source_width = 0;
12217 int source_height = 0; 12168 int source_height = 0;
12218 gfx::GLImage* image = 12169 gfx::GLImage* image =
12219 source_texture->GetLevelImage(source_texture->target(), 0); 12170 source_texture->GetLevelImage(source_texture->target(), 0);
12220 if (image) { 12171 if (image) {
12221 gfx::Size size = image->GetSize(); 12172 gfx::Size size = image->GetSize();
(...skipping 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after
13727 } 13678 }
13728 } 13679 }
13729 13680
13730 // Include the auto-generated part of this file. We split this because it means 13681 // Include the auto-generated part of this file. We split this because it means
13731 // we can easily edit the non-auto generated parts right here in this file 13682 // we can easily edit the non-auto generated parts right here in this file
13732 // instead of having to edit some template or the code generator. 13683 // instead of having to edit some template or the code generator.
13733 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 13684 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
13734 13685
13735 } // namespace gles2 13686 } // namespace gles2
13736 } // namespace gpu 13687 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698