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

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

Issue 2120713002: Fix use_image_texture_target inconsistencies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix content browsertests Created 4 years, 5 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
« no previous file with comments | « cc/output/renderer_settings.h ('k') | cc/output/renderer_settings_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/renderer_settings.h" 5 #include "cc/output/renderer_settings.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "cc/proto/renderer_settings.pb.h" 10 #include "cc/proto/renderer_settings.pb.h"
(...skipping 29 matching lines...) Expand all
40 proto->set_finish_rendering_on_resize(finish_rendering_on_resize); 40 proto->set_finish_rendering_on_resize(finish_rendering_on_resize);
41 proto->set_should_clear_root_render_pass(should_clear_root_render_pass); 41 proto->set_should_clear_root_render_pass(should_clear_root_render_pass);
42 proto->set_disable_display_vsync(disable_display_vsync); 42 proto->set_disable_display_vsync(disable_display_vsync);
43 proto->set_release_overlay_resources_after_gpu_query( 43 proto->set_release_overlay_resources_after_gpu_query(
44 release_overlay_resources_after_gpu_query); 44 release_overlay_resources_after_gpu_query);
45 proto->set_refresh_rate(refresh_rate); 45 proto->set_refresh_rate(refresh_rate);
46 proto->set_highp_threshold_min(highp_threshold_min); 46 proto->set_highp_threshold_min(highp_threshold_min);
47 proto->set_texture_id_allocation_chunk_size(texture_id_allocation_chunk_size); 47 proto->set_texture_id_allocation_chunk_size(texture_id_allocation_chunk_size);
48 proto->set_use_gpu_memory_buffer_resources(use_gpu_memory_buffer_resources); 48 proto->set_use_gpu_memory_buffer_resources(use_gpu_memory_buffer_resources);
49 proto->set_preferred_tile_format(preferred_tile_format); 49 proto->set_preferred_tile_format(preferred_tile_format);
50
51 for (const auto& target : buffer_to_texture_target_map) {
52 auto* proto_target = proto->add_buffer_to_texture_target();
53 proto_target->set_buffer_usage(static_cast<uint32_t>(target.first.first));
54 proto_target->set_buffer_format(static_cast<uint32_t>(target.first.second));
55 proto_target->set_texture_target(target.second);
56 }
50 } 57 }
51 58
52 void RendererSettings::FromProtobuf(const proto::RendererSettings& proto) { 59 void RendererSettings::FromProtobuf(const proto::RendererSettings& proto) {
53 allow_antialiasing = proto.allow_antialiasing(); 60 allow_antialiasing = proto.allow_antialiasing();
54 force_antialiasing = proto.force_antialiasing(); 61 force_antialiasing = proto.force_antialiasing();
55 force_blending_with_shaders = proto.force_blending_with_shaders(); 62 force_blending_with_shaders = proto.force_blending_with_shaders();
56 partial_swap_enabled = proto.partial_swap_enabled(); 63 partial_swap_enabled = proto.partial_swap_enabled();
57 finish_rendering_on_resize = proto.finish_rendering_on_resize(); 64 finish_rendering_on_resize = proto.finish_rendering_on_resize();
58 should_clear_root_render_pass = proto.should_clear_root_render_pass(); 65 should_clear_root_render_pass = proto.should_clear_root_render_pass();
59 disable_display_vsync = proto.disable_display_vsync(); 66 disable_display_vsync = proto.disable_display_vsync();
60 release_overlay_resources_after_gpu_query = 67 release_overlay_resources_after_gpu_query =
61 proto.release_overlay_resources_after_gpu_query(); 68 proto.release_overlay_resources_after_gpu_query();
62 refresh_rate = proto.refresh_rate(); 69 refresh_rate = proto.refresh_rate();
63 highp_threshold_min = proto.highp_threshold_min(); 70 highp_threshold_min = proto.highp_threshold_min();
64 texture_id_allocation_chunk_size = proto.texture_id_allocation_chunk_size(); 71 texture_id_allocation_chunk_size = proto.texture_id_allocation_chunk_size();
65 use_gpu_memory_buffer_resources = proto.use_gpu_memory_buffer_resources(); 72 use_gpu_memory_buffer_resources = proto.use_gpu_memory_buffer_resources();
66 73
67 DCHECK_LE(proto.preferred_tile_format(), 74 DCHECK_LE(proto.preferred_tile_format(),
68 static_cast<uint32_t>(RESOURCE_FORMAT_MAX)); 75 static_cast<uint32_t>(RESOURCE_FORMAT_MAX));
69 preferred_tile_format = 76 preferred_tile_format =
70 static_cast<ResourceFormat>(proto.preferred_tile_format()); 77 static_cast<ResourceFormat>(proto.preferred_tile_format());
78
79 // |buffer_to_texture_target_map| may contain existing values, so clear first.
80 buffer_to_texture_target_map.clear();
81 for (const auto& proto_target : proto.buffer_to_texture_target()) {
82 buffer_to_texture_target_map.insert(BufferToTextureTargetMap::value_type(
83 BufferToTextureTargetKey(
84 static_cast<gfx::BufferUsage>(proto_target.buffer_usage()),
85 static_cast<gfx::BufferFormat>(proto_target.buffer_format())),
86 proto_target.texture_target()));
87 }
71 } 88 }
72 89
73 bool RendererSettings::operator==(const RendererSettings& other) const { 90 bool RendererSettings::operator==(const RendererSettings& other) const {
74 return allow_antialiasing == other.allow_antialiasing && 91 return allow_antialiasing == other.allow_antialiasing &&
75 force_antialiasing == other.force_antialiasing && 92 force_antialiasing == other.force_antialiasing &&
76 force_blending_with_shaders == other.force_blending_with_shaders && 93 force_blending_with_shaders == other.force_blending_with_shaders &&
77 partial_swap_enabled == other.partial_swap_enabled && 94 partial_swap_enabled == other.partial_swap_enabled &&
78 finish_rendering_on_resize == other.finish_rendering_on_resize && 95 finish_rendering_on_resize == other.finish_rendering_on_resize &&
79 should_clear_root_render_pass == other.should_clear_root_render_pass && 96 should_clear_root_render_pass == other.should_clear_root_render_pass &&
80 disable_display_vsync == other.disable_display_vsync && 97 disable_display_vsync == other.disable_display_vsync &&
81 release_overlay_resources_after_gpu_query == 98 release_overlay_resources_after_gpu_query ==
82 other.release_overlay_resources_after_gpu_query && 99 other.release_overlay_resources_after_gpu_query &&
83 refresh_rate == other.refresh_rate && 100 refresh_rate == other.refresh_rate &&
84 highp_threshold_min == other.highp_threshold_min && 101 highp_threshold_min == other.highp_threshold_min &&
85 texture_id_allocation_chunk_size == 102 texture_id_allocation_chunk_size ==
86 other.texture_id_allocation_chunk_size && 103 other.texture_id_allocation_chunk_size &&
87 use_gpu_memory_buffer_resources == 104 use_gpu_memory_buffer_resources ==
88 other.use_gpu_memory_buffer_resources && 105 other.use_gpu_memory_buffer_resources &&
89 preferred_tile_format == other.preferred_tile_format; 106 preferred_tile_format == other.preferred_tile_format &&
107 buffer_to_texture_target_map == other.buffer_to_texture_target_map;
90 } 108 }
91 109
92 } // namespace cc 110 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/renderer_settings.h ('k') | cc/output/renderer_settings_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698