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

Side by Side Diff: cc/output/program_binding.cc

Issue 2677893003: cc: Add color conversion support to all DrawQuad types (Closed)
Patch Set: Update w/2681223002 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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "cc/output/program_binding.h" 5 #include "cc/output/program_binding.h"
6 6
7 #include "base/trace_event/trace_event.h" 7 #include "base/trace_event/trace_event.h"
8 #include "cc/output/geometry_binding.h" 8 #include "cc/output/geometry_binding.h"
9 #include "gpu/GLES2/gl2extchromium.h" 9 #include "gpu/GLES2/gl2extchromium.h"
10 #include "gpu/command_buffer/client/gles2_interface.h" 10 #include "gpu/command_buffer/client/gles2_interface.h"
(...skipping 14 matching lines...) Expand all
25 premultiplied_alpha_ == other.premultiplied_alpha_ && 25 premultiplied_alpha_ == other.premultiplied_alpha_ &&
26 has_background_color_ == other.has_background_color_ && 26 has_background_color_ == other.has_background_color_ &&
27 mask_mode_ == other.mask_mode_ && 27 mask_mode_ == other.mask_mode_ &&
28 mask_for_background_ == other.mask_for_background_ && 28 mask_for_background_ == other.mask_for_background_ &&
29 has_color_matrix_ == other.has_color_matrix_ && 29 has_color_matrix_ == other.has_color_matrix_ &&
30 yuv_alpha_texture_mode_ == other.yuv_alpha_texture_mode_ && 30 yuv_alpha_texture_mode_ == other.yuv_alpha_texture_mode_ &&
31 uv_texture_mode_ == other.uv_texture_mode_ && 31 uv_texture_mode_ == other.uv_texture_mode_ &&
32 color_conversion_mode_ == other.color_conversion_mode_; 32 color_conversion_mode_ == other.color_conversion_mode_;
33 } 33 }
34 34
35 bool ProgramKey::operator!=(const ProgramKey& other) const {
36 return !(*this == other);
37 }
38
35 // static 39 // static
36 ProgramKey ProgramKey::DebugBorder() { 40 ProgramKey ProgramKey::DebugBorder() {
37 ProgramKey result; 41 ProgramKey result;
38 result.type_ = PROGRAM_TYPE_DEBUG_BORDER; 42 result.type_ = PROGRAM_TYPE_DEBUG_BORDER;
39 return result; 43 return result;
40 } 44 }
41 45
42 // static 46 // static
43 ProgramKey ProgramKey::SolidColor(AAMode aa_mode) { 47 ProgramKey ProgramKey::SolidColor(AAMode aa_mode) {
44 ProgramKey result; 48 ProgramKey result;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 result.type_ = PROGRAM_TYPE_VIDEO_STREAM; 107 result.type_ = PROGRAM_TYPE_VIDEO_STREAM;
104 result.precision_ = precision; 108 result.precision_ = precision;
105 result.sampler_ = SAMPLER_TYPE_EXTERNAL_OES; 109 result.sampler_ = SAMPLER_TYPE_EXTERNAL_OES;
106 return result; 110 return result;
107 } 111 }
108 112
109 // static 113 // static
110 ProgramKey ProgramKey::YUVVideo(TexCoordPrecision precision, 114 ProgramKey ProgramKey::YUVVideo(TexCoordPrecision precision,
111 SamplerType sampler, 115 SamplerType sampler,
112 YUVAlphaTextureMode yuv_alpha_texture_mode, 116 YUVAlphaTextureMode yuv_alpha_texture_mode,
113 UVTextureMode uv_texture_mode, 117 UVTextureMode uv_texture_mode) {
114 ColorConversionMode color_conversion_mode) {
115 ProgramKey result; 118 ProgramKey result;
116 result.type_ = PROGRAM_TYPE_YUV_VIDEO; 119 result.type_ = PROGRAM_TYPE_YUV_VIDEO;
117 result.precision_ = precision; 120 result.precision_ = precision;
118 result.sampler_ = sampler; 121 result.sampler_ = sampler;
119 result.yuv_alpha_texture_mode_ = yuv_alpha_texture_mode; 122 result.yuv_alpha_texture_mode_ = yuv_alpha_texture_mode;
120 DCHECK(yuv_alpha_texture_mode == YUV_NO_ALPHA_TEXTURE || 123 DCHECK(yuv_alpha_texture_mode == YUV_NO_ALPHA_TEXTURE ||
121 yuv_alpha_texture_mode == YUV_HAS_ALPHA_TEXTURE); 124 yuv_alpha_texture_mode == YUV_HAS_ALPHA_TEXTURE);
122 result.uv_texture_mode_ = uv_texture_mode; 125 result.uv_texture_mode_ = uv_texture_mode;
123 DCHECK(uv_texture_mode == UV_TEXTURE_MODE_UV || 126 DCHECK(uv_texture_mode == UV_TEXTURE_MODE_UV ||
124 uv_texture_mode == UV_TEXTURE_MODE_U_V); 127 uv_texture_mode == UV_TEXTURE_MODE_U_V);
125 result.color_conversion_mode_ = color_conversion_mode;
126 return result; 128 return result;
127 } 129 }
128 130
129 ProgramBindingBase::ProgramBindingBase() 131 ProgramBindingBase::ProgramBindingBase()
130 : program_(0), 132 : program_(0),
131 vertex_shader_id_(0), 133 vertex_shader_id_(0),
132 fragment_shader_id_(0), 134 fragment_shader_id_(0),
133 initialized_(false) {} 135 initialized_(false) {}
134 136
135 ProgramBindingBase::~ProgramBindingBase() { 137 ProgramBindingBase::~ProgramBindingBase() {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 context->DeleteShader(fragment_shader_id_); 252 context->DeleteShader(fragment_shader_id_);
251 fragment_shader_id_ = 0; 253 fragment_shader_id_ = 0;
252 } 254 }
253 } 255 }
254 256
255 bool ProgramBindingBase::IsContextLost(GLES2Interface* context) { 257 bool ProgramBindingBase::IsContextLost(GLES2Interface* context) {
256 return context->GetGraphicsResetStatusKHR() != GL_NO_ERROR; 258 return context->GetGraphicsResetStatusKHR() != GL_NO_ERROR;
257 } 259 }
258 260
259 } // namespace cc 261 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698