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 "mojo/gles2/command_buffer_client_impl.h" | 5 #include "mojo/gles2/command_buffer_client_impl.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/process/process_handle.h" | 10 #include "base/process/process_handle.h" |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 return capabilities_; | 245 return capabilities_; |
246 } | 246 } |
247 | 247 |
248 int32_t CommandBufferClientImpl::CreateImage(ClientBuffer buffer, | 248 int32_t CommandBufferClientImpl::CreateImage(ClientBuffer buffer, |
249 size_t width, | 249 size_t width, |
250 size_t height, | 250 size_t height, |
251 unsigned internalformat) { | 251 unsigned internalformat) { |
252 int32 new_id = ++next_image_id_; | 252 int32 new_id = ++next_image_id_; |
253 | 253 |
254 mojo::SizePtr size = mojo::Size::New(); | 254 mojo::SizePtr size = mojo::Size::New(); |
255 size->width = width; | 255 size->width = static_cast<int32_t>(width); |
256 size->height = height; | 256 size->height = static_cast<int32_t>(height); |
257 | 257 |
258 MojoGpuMemoryBufferImpl* gpu_memory_buffer = | 258 MojoGpuMemoryBufferImpl* gpu_memory_buffer = |
259 MojoGpuMemoryBufferImpl::FromClientBuffer(buffer); | 259 MojoGpuMemoryBufferImpl::FromClientBuffer(buffer); |
260 gfx::GpuMemoryBufferHandle handle = gpu_memory_buffer->GetHandle(); | 260 gfx::GpuMemoryBufferHandle handle = gpu_memory_buffer->GetHandle(); |
261 | 261 |
262 bool requires_sync_point = false; | 262 bool requires_sync_point = false; |
263 base::SharedMemoryHandle dupd_handle = | 263 base::SharedMemoryHandle dupd_handle = |
264 base::SharedMemory::DuplicateHandle(handle.handle); | 264 base::SharedMemory::DuplicateHandle(handle.handle); |
265 #if defined(OS_WIN) | 265 #if defined(OS_WIN) |
266 HANDLE platform_handle = dupd_handle; | 266 HANDLE platform_handle = dupd_handle; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 void CommandBufferClientImpl::DestroyImage(int32 id) { | 303 void CommandBufferClientImpl::DestroyImage(int32 id) { |
304 command_buffer_->DestroyImage(id); | 304 command_buffer_->DestroyImage(id); |
305 } | 305 } |
306 | 306 |
307 int32_t CommandBufferClientImpl::CreateGpuMemoryBufferImage( | 307 int32_t CommandBufferClientImpl::CreateGpuMemoryBufferImage( |
308 size_t width, | 308 size_t width, |
309 size_t height, | 309 size_t height, |
310 unsigned internalformat, | 310 unsigned internalformat, |
311 unsigned usage) { | 311 unsigned usage) { |
312 scoped_ptr<gfx::GpuMemoryBuffer> buffer(MojoGpuMemoryBufferImpl::Create( | 312 scoped_ptr<gfx::GpuMemoryBuffer> buffer(MojoGpuMemoryBufferImpl::Create( |
313 gfx::Size(width, height), | 313 gfx::Size(static_cast<int>(width), static_cast<int>(height)), |
314 gpu::ImageFactory::ImageFormatToGpuMemoryBufferFormat(internalformat), | 314 gpu::ImageFactory::ImageFormatToGpuMemoryBufferFormat(internalformat), |
315 gpu::ImageFactory::ImageUsageToGpuMemoryBufferUsage(usage))); | 315 gpu::ImageFactory::ImageUsageToGpuMemoryBufferUsage(usage))); |
316 if (!buffer) | 316 if (!buffer) |
317 return -1; | 317 return -1; |
318 | 318 |
319 return CreateImage(buffer->AsClientBuffer(), width, height, internalformat); | 319 return CreateImage(buffer->AsClientBuffer(), width, height, internalformat); |
320 } | 320 } |
321 | 321 |
322 uint32_t CommandBufferClientImpl::InsertSyncPoint() { | 322 uint32_t CommandBufferClientImpl::InsertSyncPoint() { |
323 command_buffer_->InsertSyncPoint(true); | 323 command_buffer_->InsertSyncPoint(true); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 | 388 |
389 void CommandBufferClientImpl::SetLock(base::Lock* lock) { | 389 void CommandBufferClientImpl::SetLock(base::Lock* lock) { |
390 } | 390 } |
391 | 391 |
392 bool CommandBufferClientImpl::IsGpuChannelLost() { | 392 bool CommandBufferClientImpl::IsGpuChannelLost() { |
393 // This is only possible for out-of-process command buffers. | 393 // This is only possible for out-of-process command buffers. |
394 return false; | 394 return false; |
395 } | 395 } |
396 | 396 |
397 } // namespace gles2 | 397 } // namespace gles2 |
OLD | NEW |