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

Side by Side Diff: cc/raster/gpu_raster_buffer_provider.cc

Issue 2007593005: Remove the concept of OutputSurface from ResourceProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: resourceprovider-no-outputsurface: moreccptcompile Created 4 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 unified diff | Download patch
« no previous file with comments | « cc/raster/gpu_raster_buffer_provider.h ('k') | cc/raster/gpu_rasterizer.h » ('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/raster/gpu_raster_buffer_provider.h" 5 #include "cc/raster/gpu_raster_buffer_provider.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 29 matching lines...) Expand all
40 void Playback( 40 void Playback(
41 const RasterSource* raster_source, 41 const RasterSource* raster_source,
42 const gfx::Rect& raster_full_rect, 42 const gfx::Rect& raster_full_rect,
43 const gfx::Rect& raster_dirty_rect, 43 const gfx::Rect& raster_dirty_rect,
44 uint64_t new_content_id, 44 uint64_t new_content_id,
45 float scale, 45 float scale,
46 const RasterSource::PlaybackSettings& playback_settings) override { 46 const RasterSource::PlaybackSettings& playback_settings) override {
47 TRACE_EVENT0("cc", "RasterBufferImpl::Playback"); 47 TRACE_EVENT0("cc", "RasterBufferImpl::Playback");
48 // GPU raster doesn't do low res tiles, so should always include images. 48 // GPU raster doesn't do low res tiles, so should always include images.
49 DCHECK(!playback_settings.skip_images); 49 DCHECK(!playback_settings.skip_images);
50 ContextProvider* context_provider = rasterizer_->resource_provider()
51 ->output_surface()
52 ->worker_context_provider();
53 DCHECK(context_provider);
54 50
55 ContextProvider::ScopedContextLock scoped_context(context_provider); 51 ContextProvider::ScopedContextLock scoped_context(
52 rasterizer_->worker_context_provider());
56 53
57 gfx::Rect playback_rect = raster_full_rect; 54 gfx::Rect playback_rect = raster_full_rect;
58 if (resource_has_previous_content_) { 55 if (resource_has_previous_content_) {
59 playback_rect.Intersect(raster_dirty_rect); 56 playback_rect.Intersect(raster_dirty_rect);
60 } 57 }
61 DCHECK(!playback_rect.IsEmpty()) 58 DCHECK(!playback_rect.IsEmpty())
62 << "Why are we rastering a tile that's not dirty?"; 59 << "Why are we rastering a tile that's not dirty?";
63 60
64 // TODO(danakj): Implement partial raster with raster_dirty_rect. 61 // TODO(danakj): Implement partial raster with raster_dirty_rect.
65 // Rasterize source into resource. 62 // Rasterize source into resource.
(...skipping 15 matching lines...) Expand all
81 private: 78 private:
82 GpuRasterizer* rasterizer_; 79 GpuRasterizer* rasterizer_;
83 ResourceProvider::ScopedWriteLockGr lock_; 80 ResourceProvider::ScopedWriteLockGr lock_;
84 bool resource_has_previous_content_; 81 bool resource_has_previous_content_;
85 82
86 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); 83 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl);
87 }; 84 };
88 85
89 } // namespace 86 } // namespace
90 87
91 // static
92 std::unique_ptr<RasterBufferProvider> GpuRasterBufferProvider::Create(
93 ContextProvider* context_provider,
94 ResourceProvider* resource_provider,
95 bool use_distance_field_text,
96 int gpu_rasterization_msaa_sample_count) {
97 return base::WrapUnique<RasterBufferProvider>(new GpuRasterBufferProvider(
98 context_provider, resource_provider, use_distance_field_text,
99 gpu_rasterization_msaa_sample_count));
100 }
101
102 GpuRasterBufferProvider::GpuRasterBufferProvider( 88 GpuRasterBufferProvider::GpuRasterBufferProvider(
103 ContextProvider* context_provider, 89 ContextProvider* compositor_context_provider,
90 ContextProvider* worker_context_provider,
104 ResourceProvider* resource_provider, 91 ResourceProvider* resource_provider,
105 bool use_distance_field_text, 92 bool use_distance_field_text,
106 int gpu_rasterization_msaa_sample_count) 93 int gpu_rasterization_msaa_sample_count)
107 : rasterizer_(new GpuRasterizer(context_provider, 94 : compositor_context_provider_(compositor_context_provider),
95 rasterizer_(new GpuRasterizer(worker_context_provider,
108 resource_provider, 96 resource_provider,
109 use_distance_field_text, 97 use_distance_field_text,
110 gpu_rasterization_msaa_sample_count)) {} 98 gpu_rasterization_msaa_sample_count)) {
99 DCHECK(compositor_context_provider_);
100 }
111 101
112 GpuRasterBufferProvider::~GpuRasterBufferProvider() {} 102 GpuRasterBufferProvider::~GpuRasterBufferProvider() {}
113 103
114 std::unique_ptr<RasterBuffer> GpuRasterBufferProvider::AcquireBufferForRaster( 104 std::unique_ptr<RasterBuffer> GpuRasterBufferProvider::AcquireBufferForRaster(
115 const Resource* resource, 105 const Resource* resource,
116 uint64_t resource_content_id, 106 uint64_t resource_content_id,
117 uint64_t previous_content_id) { 107 uint64_t previous_content_id) {
118 return std::unique_ptr<RasterBuffer>(new RasterBufferImpl( 108 return std::unique_ptr<RasterBuffer>(new RasterBufferImpl(
119 rasterizer_.get(), resource, resource_content_id, previous_content_id)); 109 rasterizer_.get(), resource, resource_content_id, previous_content_id));
120 } 110 }
121 111
122 void GpuRasterBufferProvider::ReleaseBufferForRaster( 112 void GpuRasterBufferProvider::ReleaseBufferForRaster(
123 std::unique_ptr<RasterBuffer> buffer) { 113 std::unique_ptr<RasterBuffer> buffer) {
124 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. 114 // Nothing to do here. RasterBufferImpl destructor cleans up after itself.
125 } 115 }
126 116
127 void GpuRasterBufferProvider::OrderingBarrier() { 117 void GpuRasterBufferProvider::OrderingBarrier() {
128 TRACE_EVENT0("cc", "GpuRasterBufferProvider::OrderingBarrier"); 118 TRACE_EVENT0("cc", "GpuRasterBufferProvider::OrderingBarrier");
129 119 compositor_context_provider_->ContextGL()->OrderingBarrierCHROMIUM();
130 rasterizer_->resource_provider()
131 ->output_surface()
132 ->context_provider()
133 ->ContextGL()
134 ->OrderingBarrierCHROMIUM();
135 } 120 }
136 121
137 ResourceFormat GpuRasterBufferProvider::GetResourceFormat( 122 ResourceFormat GpuRasterBufferProvider::GetResourceFormat(
138 bool must_support_alpha) const { 123 bool must_support_alpha) const {
139 return rasterizer_->resource_provider()->best_render_buffer_format(); 124 return rasterizer_->resource_provider()->best_render_buffer_format();
140 } 125 }
141 126
142 bool GpuRasterBufferProvider::GetResourceRequiresSwizzle( 127 bool GpuRasterBufferProvider::GetResourceRequiresSwizzle(
143 bool must_support_alpha) const { 128 bool must_support_alpha) const {
144 // This doesn't require a swizzle because we rasterize to the correct format. 129 // This doesn't require a swizzle because we rasterize to the correct format.
145 return false; 130 return false;
146 } 131 }
147 132
148 void GpuRasterBufferProvider::Shutdown() {} 133 void GpuRasterBufferProvider::Shutdown() {}
149 134
150 } // namespace cc 135 } // namespace cc
OLDNEW
« no previous file with comments | « cc/raster/gpu_raster_buffer_provider.h ('k') | cc/raster/gpu_rasterizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698