OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/view_manager/gles2/command_buffer_driver.h" | 5 #include "components/view_manager/gles2/command_buffer_driver.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
10 #include "components/view_manager/gles2/command_buffer_type_conversions.h" | 10 #include "components/view_manager/gles2/command_buffer_type_conversions.h" |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 int32_t internal_format) { | 241 int32_t internal_format) { |
242 if (!MakeCurrent()) | 242 if (!MakeCurrent()) |
243 return; | 243 return; |
244 | 244 |
245 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); | 245 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); |
246 if (image_manager->LookupImage(id)) { | 246 if (image_manager->LookupImage(id)) { |
247 LOG(ERROR) << "Image already exists with same ID."; | 247 LOG(ERROR) << "Image already exists with same ID."; |
248 return; | 248 return; |
249 } | 249 } |
250 | 250 |
251 gfx::GpuMemoryBuffer::Format gpu_format = | 251 gfx::BufferFormat gpu_format = static_cast<gfx::BufferFormat>(format); |
252 static_cast<gfx::GpuMemoryBuffer::Format>(format); | |
253 if (!gpu::ImageFactory::IsGpuMemoryBufferFormatSupported( | 252 if (!gpu::ImageFactory::IsGpuMemoryBufferFormatSupported( |
254 gpu_format, decoder_->GetCapabilities())) { | 253 gpu_format, decoder_->GetCapabilities())) { |
255 LOG(ERROR) << "Format is not supported."; | 254 LOG(ERROR) << "Format is not supported."; |
256 return; | 255 return; |
257 } | 256 } |
258 | 257 |
259 gfx::Size gfx_size = size.To<gfx::Size>(); | 258 gfx::Size gfx_size = size.To<gfx::Size>(); |
260 if (!gpu::ImageFactory::IsImageSizeValidForGpuMemoryBufferFormat( | 259 if (!gpu::ImageFactory::IsImageSizeValidForGpuMemoryBufferFormat( |
261 gfx_size, gpu_format)) { | 260 gfx_size, gpu_format)) { |
262 LOG(ERROR) << "Invalid image size for format."; | 261 LOG(ERROR) << "Invalid image size for format."; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 | 353 |
355 void CommandBufferDriver::DestroyDecoder() { | 354 void CommandBufferDriver::DestroyDecoder() { |
356 if (decoder_) { | 355 if (decoder_) { |
357 bool have_context = decoder_->MakeCurrent(); | 356 bool have_context = decoder_->MakeCurrent(); |
358 decoder_->Destroy(have_context); | 357 decoder_->Destroy(have_context); |
359 decoder_.reset(); | 358 decoder_.reset(); |
360 } | 359 } |
361 } | 360 } |
362 | 361 |
363 } // namespace gles2 | 362 } // namespace gles2 |
OLD | NEW |