| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // A class to emulate GLES2 over command buffers. | 5 // A class to emulate GLES2 over command buffers. |
| 6 | 6 |
| 7 #include "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 8 | 8 |
| 9 #include <GLES2/gl2.h> | 9 #include <GLES2/gl2.h> |
| 10 #include <GLES2/gl2ext.h> | 10 #include <GLES2/gl2ext.h> |
| (...skipping 4308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4319 display_bounds.x(), | 4319 display_bounds.x(), |
| 4320 display_bounds.y(), | 4320 display_bounds.y(), |
| 4321 display_bounds.width(), | 4321 display_bounds.width(), |
| 4322 display_bounds.height(), | 4322 display_bounds.height(), |
| 4323 uv_rect.x(), | 4323 uv_rect.x(), |
| 4324 uv_rect.y(), | 4324 uv_rect.y(), |
| 4325 uv_rect.width(), | 4325 uv_rect.width(), |
| 4326 uv_rect.height()); | 4326 uv_rect.height()); |
| 4327 } | 4327 } |
| 4328 | 4328 |
| 4329 void GLES2Implementation::ScheduleCALayerCHROMIUM(GLuint contents_texture_id, |
| 4330 const GLfloat* contents_rect, |
| 4331 GLfloat opacity, |
| 4332 GLuint background_color, |
| 4333 const GLfloat* bounds_size, |
| 4334 const GLfloat* transform) { |
| 4335 size_t shm_size = 22 * sizeof(GLfloat); |
| 4336 ScopedTransferBufferPtr buffer(shm_size, helper_, transfer_buffer_); |
| 4337 if (!buffer.valid() || buffer.size() < shm_size) { |
| 4338 SetGLError(GL_OUT_OF_MEMORY, "GLES2::ScheduleCALayerCHROMIUM", |
| 4339 "out of memory"); |
| 4340 return; |
| 4341 } |
| 4342 GLfloat* mem = static_cast<GLfloat*>(buffer.address()); |
| 4343 memcpy(mem + 0, contents_rect, 4 * sizeof(GLfloat)); |
| 4344 memcpy(mem + 4, bounds_size, 2 * sizeof(GLfloat)); |
| 4345 memcpy(mem + 6, transform, 16 * sizeof(GLfloat)); |
| 4346 helper_->ScheduleCALayerCHROMIUM(contents_texture_id, opacity, |
| 4347 background_color, buffer.shm_id(), |
| 4348 buffer.offset()); |
| 4349 } |
| 4350 |
| 4329 GLboolean GLES2Implementation::EnableFeatureCHROMIUM( | 4351 GLboolean GLES2Implementation::EnableFeatureCHROMIUM( |
| 4330 const char* feature) { | 4352 const char* feature) { |
| 4331 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 4353 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
| 4332 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glEnableFeatureCHROMIUM(" | 4354 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glEnableFeatureCHROMIUM(" |
| 4333 << feature << ")"); | 4355 << feature << ")"); |
| 4334 TRACE_EVENT0("gpu", "GLES2::EnableFeatureCHROMIUM"); | 4356 TRACE_EVENT0("gpu", "GLES2::EnableFeatureCHROMIUM"); |
| 4335 typedef cmds::EnableFeatureCHROMIUM::Result Result; | 4357 typedef cmds::EnableFeatureCHROMIUM::Result Result; |
| 4336 Result* result = GetResultAs<Result*>(); | 4358 Result* result = GetResultAs<Result*>(); |
| 4337 if (!result) { | 4359 if (!result) { |
| 4338 return false; | 4360 return false; |
| (...skipping 2026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6365 CheckGLError(); | 6387 CheckGLError(); |
| 6366 } | 6388 } |
| 6367 | 6389 |
| 6368 // Include the auto-generated part of this file. We split this because it means | 6390 // Include the auto-generated part of this file. We split this because it means |
| 6369 // we can easily edit the non-auto generated parts right here in this file | 6391 // we can easily edit the non-auto generated parts right here in this file |
| 6370 // instead of having to edit some template or the code generator. | 6392 // instead of having to edit some template or the code generator. |
| 6371 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 6393 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
| 6372 | 6394 |
| 6373 } // namespace gles2 | 6395 } // namespace gles2 |
| 6374 } // namespace gpu | 6396 } // namespace gpu |
| OLD | NEW |