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

Side by Side Diff: cc/raster/one_copy_raster_buffer_provider.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/raster/one_copy_raster_buffer_provider.h ('k') | cc/resources/resource_provider.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/one_copy_raster_buffer_provider.h" 5 #include "cc/raster/one_copy_raster_buffer_provider.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 const RasterSource::PlaybackSettings& playback_settings, 212 const RasterSource::PlaybackSettings& playback_settings,
213 uint64_t previous_content_id, 213 uint64_t previous_content_id,
214 uint64_t new_content_id) { 214 uint64_t new_content_id) {
215 // Allocate GpuMemoryBuffer if necessary. If using partial raster, we 215 // Allocate GpuMemoryBuffer if necessary. If using partial raster, we
216 // must allocate a buffer with BufferUsage CPU_READ_WRITE_PERSISTENT. 216 // must allocate a buffer with BufferUsage CPU_READ_WRITE_PERSISTENT.
217 if (!staging_buffer->gpu_memory_buffer) { 217 if (!staging_buffer->gpu_memory_buffer) {
218 staging_buffer->gpu_memory_buffer = 218 staging_buffer->gpu_memory_buffer =
219 resource_provider_->gpu_memory_buffer_manager() 219 resource_provider_->gpu_memory_buffer_manager()
220 ->AllocateGpuMemoryBuffer( 220 ->AllocateGpuMemoryBuffer(
221 staging_buffer->size, BufferFormat(resource->format()), 221 staging_buffer->size, BufferFormat(resource->format()),
222 use_partial_raster_ 222 StagingBufferUsage(), gpu::kNullSurfaceHandle);
223 ? gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT
224 : gfx::BufferUsage::GPU_READ_CPU_READ_WRITE,
225 gpu::kNullSurfaceHandle);
226 } 223 }
227 224
228 gfx::Rect playback_rect = raster_full_rect; 225 gfx::Rect playback_rect = raster_full_rect;
229 if (use_partial_raster_ && previous_content_id) { 226 if (use_partial_raster_ && previous_content_id) {
230 // Reduce playback rect to dirty region if the content id of the staging 227 // Reduce playback rect to dirty region if the content id of the staging
231 // buffer matches the prevous content id. 228 // buffer matches the prevous content id.
232 if (previous_content_id == staging_buffer->content_id) 229 if (previous_content_id == staging_buffer->content_id)
233 playback_rect.Intersect(raster_dirty_rect); 230 playback_rect.Intersect(raster_dirty_rect);
234 } 231 }
235 232
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 uint64_t new_content_id) { 273 uint64_t new_content_id) {
277 ContextProvider::ScopedContextLock scoped_context(worker_context_provider_); 274 ContextProvider::ScopedContextLock scoped_context(worker_context_provider_);
278 gpu::gles2::GLES2Interface* gl = scoped_context.ContextGL(); 275 gpu::gles2::GLES2Interface* gl = scoped_context.ContextGL();
279 DCHECK(gl); 276 DCHECK(gl);
280 277
281 // Create texture after synchronizing with compositor. 278 // Create texture after synchronizing with compositor.
282 ResourceProvider::ScopedTextureProvider scoped_texture( 279 ResourceProvider::ScopedTextureProvider scoped_texture(
283 gl, resource_lock, async_worker_context_enabled_); 280 gl, resource_lock, async_worker_context_enabled_);
284 281
285 unsigned resource_texture_id = scoped_texture.texture_id(); 282 unsigned resource_texture_id = scoped_texture.texture_id();
286 unsigned image_target = 283 unsigned image_target = resource_provider_->GetImageTextureTarget(
287 resource_provider_->GetImageTextureTarget(resource_lock->format()); 284 StagingBufferUsage(), staging_buffer->format);
288 285
289 // Create and bind staging texture. 286 // Create and bind staging texture.
290 if (!staging_buffer->texture_id) { 287 if (!staging_buffer->texture_id) {
291 gl->GenTextures(1, &staging_buffer->texture_id); 288 gl->GenTextures(1, &staging_buffer->texture_id);
292 gl->BindTexture(image_target, staging_buffer->texture_id); 289 gl->BindTexture(image_target, staging_buffer->texture_id);
293 gl->TexParameteri(image_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 290 gl->TexParameteri(image_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
294 gl->TexParameteri(image_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 291 gl->TexParameteri(image_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
295 gl->TexParameteri(image_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 292 gl->TexParameteri(image_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
296 gl->TexParameteri(image_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 293 gl->TexParameteri(image_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
297 } else { 294 } else {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 // Barrier to sync worker context output to cc context. 373 // Barrier to sync worker context output to cc context.
377 gl->OrderingBarrierCHROMIUM(); 374 gl->OrderingBarrierCHROMIUM();
378 375
379 // Generate sync token after the barrier for cross context synchronization. 376 // Generate sync token after the barrier for cross context synchronization.
380 gpu::SyncToken resource_sync_token; 377 gpu::SyncToken resource_sync_token;
381 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, resource_sync_token.GetData()); 378 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, resource_sync_token.GetData());
382 resource_lock->set_sync_token(resource_sync_token); 379 resource_lock->set_sync_token(resource_sync_token);
383 resource_lock->set_synchronized(!async_worker_context_enabled_); 380 resource_lock->set_synchronized(!async_worker_context_enabled_);
384 } 381 }
385 382
383 gfx::BufferUsage OneCopyRasterBufferProvider::StagingBufferUsage() const {
384 return use_partial_raster_
385 ? gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT
386 : gfx::BufferUsage::GPU_READ_CPU_READ_WRITE;
387 }
388
386 } // namespace cc 389 } // namespace cc
OLDNEW
« no previous file with comments | « cc/raster/one_copy_raster_buffer_provider.h ('k') | cc/resources/resource_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698