| OLD | NEW |
| 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 gl->BindTexture(image_target, staging_buffer->texture_id); | 297 gl->BindTexture(image_target, staging_buffer->texture_id); |
| 298 } | 298 } |
| 299 | 299 |
| 300 // Create and bind image. | 300 // Create and bind image. |
| 301 if (!staging_buffer->image_id) { | 301 if (!staging_buffer->image_id) { |
| 302 if (staging_buffer->gpu_memory_buffer) { | 302 if (staging_buffer->gpu_memory_buffer) { |
| 303 staging_buffer->image_id = gl->CreateImageCHROMIUM( | 303 staging_buffer->image_id = gl->CreateImageCHROMIUM( |
| 304 staging_buffer->gpu_memory_buffer->AsClientBuffer(), | 304 staging_buffer->gpu_memory_buffer->AsClientBuffer(), |
| 305 staging_buffer->size.width(), staging_buffer->size.height(), | 305 staging_buffer->size.width(), staging_buffer->size.height(), |
| 306 GLInternalFormat(resource_lock->format())); | 306 GLInternalFormat(resource_lock->format())); |
| 307 gl->BindTexImage2DCHROMIUM(image_target, staging_buffer->image_id); | 307 gl->BindTexImage2DCHROMIUM(image_target, staging_buffer->image_id, 0); |
| 308 } | 308 } |
| 309 } else { | 309 } else { |
| 310 gl->ReleaseTexImage2DCHROMIUM(image_target, staging_buffer->image_id); | 310 gl->ReleaseTexImage2DCHROMIUM(image_target, staging_buffer->image_id); |
| 311 gl->BindTexImage2DCHROMIUM(image_target, staging_buffer->image_id); | 311 gl->BindTexImage2DCHROMIUM(image_target, staging_buffer->image_id, 0); |
| 312 } | 312 } |
| 313 | 313 |
| 314 // Unbind staging texture. | 314 // Unbind staging texture. |
| 315 gl->BindTexture(image_target, 0); | 315 gl->BindTexture(image_target, 0); |
| 316 | 316 |
| 317 if (resource_provider_->use_sync_query()) { | 317 if (resource_provider_->use_sync_query()) { |
| 318 if (!staging_buffer->query_id) | 318 if (!staging_buffer->query_id) |
| 319 gl->GenQueriesEXT(1, &staging_buffer->query_id); | 319 gl->GenQueriesEXT(1, &staging_buffer->query_id); |
| 320 | 320 |
| 321 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) | 321 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 resource_lock->set_synchronized(!async_worker_context_enabled_); | 382 resource_lock->set_synchronized(!async_worker_context_enabled_); |
| 383 } | 383 } |
| 384 | 384 |
| 385 gfx::BufferUsage OneCopyRasterBufferProvider::StagingBufferUsage() const { | 385 gfx::BufferUsage OneCopyRasterBufferProvider::StagingBufferUsage() const { |
| 386 return use_partial_raster_ | 386 return use_partial_raster_ |
| 387 ? gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT | 387 ? gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT |
| 388 : gfx::BufferUsage::GPU_READ_CPU_READ_WRITE; | 388 : gfx::BufferUsage::GPU_READ_CPU_READ_WRITE; |
| 389 } | 389 } |
| 390 | 390 |
| 391 } // namespace cc | 391 } // namespace cc |
| OLD | NEW |