| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/compositor/compositor_util.h" |
| 6 |
| 7 #include "base/command_line.h" |
| 8 #include "cc/base/switches.h" |
| 9 #include "cc/output/renderer_settings.h" |
| 10 #include "ui/compositor/compositor_switches.h" |
| 11 #include "ui/display/display_switches.h" |
| 12 #include "ui/gfx/switches.h" |
| 13 |
| 14 namespace ui { |
| 15 |
| 16 cc::RendererSettings CreateRendererSettings(uint32_t ( |
| 17 *get_texture_target)(gfx::BufferFormat format, gfx::BufferUsage usage)) { |
| 18 cc::RendererSettings renderer_settings; |
| 19 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 20 renderer_settings.partial_swap_enabled = |
| 21 !command_line->HasSwitch(switches::kUIDisablePartialSwap); |
| 22 #if defined(OS_WIN) |
| 23 renderer_settings.finish_rendering_on_resize = true; |
| 24 #elif defined(OS_MACOSX) |
| 25 renderer_settings.release_overlay_resources_after_gpu_query = true; |
| 26 #endif |
| 27 renderer_settings.gl_composited_texture_quad_border = |
| 28 command_line->HasSwitch(cc::switches::kGlCompositedTextureQuadBorder); |
| 29 renderer_settings.show_overdraw_feedback = |
| 30 command_line->HasSwitch(cc::switches::kShowOverdrawFeedback); |
| 31 if (command_line->HasSwitch(switches::kUIEnableRGBA4444Textures)) |
| 32 renderer_settings.preferred_tile_format = cc::RGBA_4444; |
| 33 renderer_settings.enable_color_correct_rendering = |
| 34 command_line->HasSwitch(switches::kEnableColorCorrectRendering) || |
| 35 command_line->HasSwitch(switches::kEnableHDR); |
| 36 // Populate buffer_to_texture_target_map for all buffer usage/formats. |
| 37 for (int usage_idx = 0; usage_idx <= static_cast<int>(gfx::BufferUsage::LAST); |
| 38 ++usage_idx) { |
| 39 gfx::BufferUsage usage = static_cast<gfx::BufferUsage>(usage_idx); |
| 40 for (int format_idx = 0; |
| 41 format_idx <= static_cast<int>(gfx::BufferFormat::LAST); |
| 42 ++format_idx) { |
| 43 gfx::BufferFormat format = static_cast<gfx::BufferFormat>(format_idx); |
| 44 renderer_settings |
| 45 .buffer_to_texture_target_map[std::make_pair(usage, format)] = |
| 46 get_texture_target(format, usage); |
| 47 } |
| 48 } |
| 49 renderer_settings.disallow_non_exact_resource_reuse = |
| 50 command_line->HasSwitch(cc::switches::kDisallowNonExactResourceReuse); |
| 51 |
| 52 return renderer_settings; |
| 53 } |
| 54 |
| 55 } // namespace ui |
| OLD | NEW |