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

Side by Side Diff: ui/aura/mus/mus_context_factory.cc

Issue 2895273002: Unified the use of BufferToTextureTargetMap for all the Processes (Closed)
Patch Set: Unified the use of BufferToTextureTargetMap for all the Processes Created 3 years, 6 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ui/aura/mus/mus_context_factory.h" 5 #include "ui/aura/mus/mus_context_factory.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "cc/base/switches.h" 9 #include "cc/base/switches.h"
10 #include "services/ui/public/cpp/gpu/gpu.h" 10 #include "services/ui/public/cpp/gpu/gpu.h"
11 #include "ui/aura/mus/window_port_mus.h" 11 #include "ui/aura/mus/window_port_mus.h"
12 #include "ui/aura/window_tree_host.h" 12 #include "ui/aura/window_tree_host.h"
13 #include "ui/compositor/compositor_switches.h" 13 #include "ui/compositor/compositor_switches.h"
14 #include "ui/compositor/compositor_util.h" 14 #include "ui/compositor/compositor_util.h"
15 #include "ui/display/display_switches.h" 15 #include "ui/display/display_switches.h"
16 #include "ui/gfx/switches.h" 16 #include "ui/gfx/switches.h"
17 #include "ui/gl/gl_bindings.h" 17 #include "ui/gl/gl_bindings.h"
18 18
19 namespace aura { 19 namespace aura {
20 20
21 cc::BufferToTextureTargetMap GetBufferToTextureTargetMap() {
22 cc::BufferToTextureTargetMap image_targets;
23 for (int usage_idx = 0; usage_idx <= static_cast<int>(gfx::BufferUsage::LAST);
24 ++usage_idx) {
25 gfx::BufferUsage usage = static_cast<gfx::BufferUsage>(usage_idx);
26 for (int format_idx = 0;
27 format_idx <= static_cast<int>(gfx::BufferFormat::LAST);
28 ++format_idx) {
29 gfx::BufferFormat format = static_cast<gfx::BufferFormat>(format_idx);
30 image_targets[std::make_pair(usage, format)] = GL_TEXTURE_2D;
31 }
32 }
33 return image_targets;
34 }
35
21 MusContextFactory::MusContextFactory(ui::Gpu* gpu) 36 MusContextFactory::MusContextFactory(ui::Gpu* gpu)
22 : gpu_(gpu), 37 : gpu_(gpu),
23 renderer_settings_(ui::CreateRendererSettings( 38 renderer_settings_(
24 [](gfx::BufferFormat format, gfx::BufferUsage usage) -> uint32_t { 39 ui::CreateRendererSettings(GetBufferToTextureTargetMap())),
25 // TODO(sad): http://crbug.com/675431
danakj 2017/06/28 17:00:19 Keep this TODO where we set them to GL_TEXTURE_2D
sujith 2017/06/29 06:21:50 Done.
26 return GL_TEXTURE_2D;
27 })),
28 weak_ptr_factory_(this) {} 40 weak_ptr_factory_(this) {}
29 41
30 MusContextFactory::~MusContextFactory() {} 42 MusContextFactory::~MusContextFactory() {}
31 43
32 void MusContextFactory::OnEstablishedGpuChannel( 44 void MusContextFactory::OnEstablishedGpuChannel(
33 base::WeakPtr<ui::Compositor> compositor, 45 base::WeakPtr<ui::Compositor> compositor,
34 scoped_refptr<gpu::GpuChannelHost> gpu_channel) { 46 scoped_refptr<gpu::GpuChannelHost> gpu_channel) {
35 if (!compositor) 47 if (!compositor)
36 return; 48 return;
37 WindowTreeHost* host = 49 WindowTreeHost* host =
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 91
80 cc::TaskGraphRunner* MusContextFactory::GetTaskGraphRunner() { 92 cc::TaskGraphRunner* MusContextFactory::GetTaskGraphRunner() {
81 return raster_thread_helper_.task_graph_runner(); 93 return raster_thread_helper_.task_graph_runner();
82 } 94 }
83 95
84 const cc::ResourceSettings& MusContextFactory::GetResourceSettings() const { 96 const cc::ResourceSettings& MusContextFactory::GetResourceSettings() const {
85 return renderer_settings_.resource_settings; 97 return renderer_settings_.resource_settings;
86 } 98 }
87 99
88 } // namespace aura 100 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698