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

Unified Diff: ui/aura/mus/mus_context_factory.cc

Issue 2879463002: Initialize RendererSettings in ContextFactory (Closed)
Patch Set: Fix FakeContextFactory Created 3 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 side-by-side diff with in-line comments
Download patch
Index: ui/aura/mus/mus_context_factory.cc
diff --git a/ui/aura/mus/mus_context_factory.cc b/ui/aura/mus/mus_context_factory.cc
index 9517875318f35ee39d05ef00313a8b7970cf1c18..d8a3b208c5ca6e21fdb3c22134e4f114ee9c9525 100644
--- a/ui/aura/mus/mus_context_factory.cc
+++ b/ui/aura/mus/mus_context_factory.cc
@@ -4,16 +4,55 @@
#include "ui/aura/mus/mus_context_factory.h"
+#include "base/command_line.h"
#include "base/memory/ptr_util.h"
+#include "cc/base/switches.h"
#include "services/ui/public/cpp/gpu/gpu.h"
#include "ui/aura/mus/window_port_mus.h"
#include "ui/aura/window_tree_host.h"
+#include "ui/compositor/compositor_switches.h"
+#include "ui/display/display_switches.h"
+#include "ui/gfx/switches.h"
#include "ui/gl/gl_bindings.h"
namespace aura {
MusContextFactory::MusContextFactory(ui::Gpu* gpu)
- : gpu_(gpu), weak_ptr_factory_(this) {}
+ : gpu_(gpu), weak_ptr_factory_(this) {
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ renderer_settings_.partial_swap_enabled =
+ !command_line->HasSwitch(switches::kUIDisablePartialSwap);
+#if defined(OS_WIN)
+ renderer_settings_.finish_rendering_on_resize = true;
+#elif defined(OS_MACOSX)
+ renderer_settings_.release_overlay_resources_after_gpu_query = true;
+#endif
+ renderer_settings_.gl_composited_texture_quad_border =
danakj 2017/05/11 15:17:15 It won't take long for these to diverge from GPTF.
Alex Z. 2017/05/11 19:25:22 I added ui/compositor/compositor_util.* and put I
+ command_line->HasSwitch(cc::switches::kGlCompositedTextureQuadBorder);
+ renderer_settings_.show_overdraw_feedback =
+ command_line->HasSwitch(cc::switches::kShowOverdrawFeedback);
+ if (command_line->HasSwitch(switches::kUIEnableRGBA4444Textures))
+ renderer_settings_.preferred_tile_format = cc::RGBA_4444;
+ renderer_settings_.enable_color_correct_rendering =
+ command_line->HasSwitch(switches::kEnableColorCorrectRendering) ||
+ command_line->HasSwitch(switches::kEnableHDR);
+ // Populate buffer_to_texture_target_map for all buffer usage/formats.
+ for (int usage_idx = 0; usage_idx <= static_cast<int>(gfx::BufferUsage::LAST);
+ ++usage_idx) {
+ gfx::BufferUsage usage = static_cast<gfx::BufferUsage>(usage_idx);
+ for (int format_idx = 0;
+ format_idx <= static_cast<int>(gfx::BufferFormat::LAST);
+ ++format_idx) {
+ gfx::BufferFormat format = static_cast<gfx::BufferFormat>(format_idx);
+ // TODO(sad): http://crbug.com/675431
+ uint32_t target = GL_TEXTURE_2D;
danakj 2017/05/11 15:17:15 This makes sharing the code harder, but we could p
Alex Z. 2017/05/11 17:28:32 This used to be ui::Compositor getting the texture
danakj 2017/05/11 17:34:53 Like if you need different behaviour in GPTF than
+ renderer_settings_
+ .buffer_to_texture_target_map[std::make_pair(usage, format)] = target;
+ }
+ }
+ renderer_settings_.disallow_non_exact_resource_reuse =
+ command_line->HasSwitch(cc::switches::kDisallowNonExactResourceReuse);
+}
MusContextFactory::~MusContextFactory() {}
@@ -62,12 +101,6 @@ double MusContextFactory::GetRefreshRate() const {
return 60.0;
}
-uint32_t MusContextFactory::GetImageTextureTarget(gfx::BufferFormat format,
- gfx::BufferUsage usage) {
- // TODO(sad): http://crbug.com/675431
- return GL_TEXTURE_2D;
-}
-
gpu::GpuMemoryBufferManager* MusContextFactory::GetGpuMemoryBufferManager() {
return gpu_->gpu_memory_buffer_manager();
}
@@ -76,4 +109,8 @@ cc::TaskGraphRunner* MusContextFactory::GetTaskGraphRunner() {
return raster_thread_helper_.task_graph_runner();
}
+const cc::RendererSettings& MusContextFactory::GetRendererSettings() const {
+ return renderer_settings_;
+}
+
} // namespace aura

Powered by Google App Engine
This is Rietveld 408576698