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

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

Issue 2680703003: Reland of Select correct copy method for DoCopySubTexture (Closed)
Patch Set: fix perf regression on chromeos 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_apply_framebuffer_attachment_cmaa _intel.h" 5 #include "gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa _intel.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "gpu/command_buffer/service/framebuffer_manager.h" 8 #include "gpu/command_buffer/service/framebuffer_manager.h"
9 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" 9 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h"
10 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 10 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 const bool rgba_immutable = 249 const bool rgba_immutable =
250 texture->texture()->IsImmutable() && 250 texture->texture()->IsImmutable() &&
251 TextureManager::ExtractFormatFromStorageFormat(internal_format) == 251 TextureManager::ExtractFormatFromStorageFormat(internal_format) ==
252 GL_RGBA; 252 GL_RGBA;
253 const bool do_copy = !rgba_immutable; 253 const bool do_copy = !rgba_immutable;
254 254
255 // CMAA Effect 255 // CMAA Effect
256 if (do_copy) { 256 if (do_copy) {
257 ApplyCMAAEffectTexture(source_texture, rgba8_texture_, do_copy); 257 ApplyCMAAEffectTexture(source_texture, rgba8_texture_, do_copy);
258 258
259 // Source format for DoCopySubTexture is always GL_RGBA8.
260 CopyTextureMethod method = DIRECT_COPY;
261 bool copy_tex_image_format_valid =
262 !GLES2Util::IsIntegerFormat(internal_format) &&
263 GLES2Util::GetColorEncodingFromInternalFormat(internal_format) !=
264 GL_SRGB &&
265 internal_format != GL_BGRA_EXT && internal_format != GL_BGRA8_EXT;
266 if (GLES2Util::IsSizedColorFormat(internal_format)) {
267 int dr, dg, db, da;
268 GLES2Util::GetColorFormatComponentSizes(internal_format, 0, &dr, &dg,
269 &db, &da);
270 if ((dr > 0 && dr != 8) || (dg > 0 && dg != 8) ||
271 (db > 0 && db != 8) || (da > 0 && da != 8)) {
272 copy_tex_image_format_valid = false;
273 }
274 }
275 if (!copy_tex_image_format_valid)
276 method = DIRECT_DRAW;
277 bool color_renderable =
qiankun 2017/02/14 03:21:33 Immutable RGB8 texture was treated as non-color-re
278 Texture::ColorRenderable(decoder->GetFeatureInfo(), internal_format,
279 texture->texture()->IsImmutable());
280 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)
281 // glDrawArrays is faster than glCopyTexSubImage2D on IA Mesa driver,
282 // although opposite in Android.
283 // TODO(dshwang): After Mesa fixes this issue, remove this hack.
284 // https://bugs.freedesktop.org/show_bug.cgi?id=98478, crbug.com/535198.
285 if (color_renderable)
286 method = DIRECT_DRAW;
287 #endif
288 if (method == DIRECT_DRAW && !color_renderable)
289 method = DRAW_AND_COPY;
290
259 copier->DoCopySubTexture( 291 copier->DoCopySubTexture(
260 decoder, GL_TEXTURE_2D, rgba8_texture_, 0, GL_RGBA8, GL_TEXTURE_2D, 292 decoder, GL_TEXTURE_2D, rgba8_texture_, 0, GL_RGBA8, GL_TEXTURE_2D,
261 source_texture, 0, internal_format, 0, 0, 0, 0, width_, height_, 293 source_texture, 0, internal_format, 0, 0, 0, 0, width_, height_,
262 width_, height_, width_, height_, false, false, false, DIRECT_DRAW); 294 width_, height_, width_, height_, false, false, false, method);
263 } else { 295 } else {
264 ApplyCMAAEffectTexture(source_texture, source_texture, do_copy); 296 ApplyCMAAEffectTexture(source_texture, source_texture, do_copy);
265 } 297 }
266 298
267 decoder->RestoreTextureState(source_texture); 299 decoder->RestoreTextureState(source_texture);
268 } 300 }
269 } 301 }
270 302
271 // Restore state 303 // Restore state
272 decoder->RestoreAllAttributes(); 304 decoder->RestoreAllAttributes();
(...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after
1850 \n#endif\n 1882 \n#endif\n
1851 \n#if defined DISPLAY_EDGES\n 1883 \n#if defined DISPLAY_EDGES\n
1852 DisplayEdges(); 1884 DisplayEdges();
1853 \n#endif\n 1885 \n#endif\n
1854 } 1886 }
1855 ); 1887 );
1856 /* clang-format on */ 1888 /* clang-format on */
1857 1889
1858 } // namespace gles2 1890 } // namespace gles2
1859 } // namespace gpu 1891 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/common/gles2_cmd_utils.cc ('k') | gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698