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 4420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4431 uv_rect.x(), | 4431 uv_rect.x(), |
4432 uv_rect.y(), | 4432 uv_rect.y(), |
4433 uv_rect.width(), | 4433 uv_rect.width(), |
4434 uv_rect.height()); | 4434 uv_rect.height()); |
4435 } | 4435 } |
4436 | 4436 |
4437 void GLES2Implementation::ScheduleCALayerCHROMIUM(GLuint contents_texture_id, | 4437 void GLES2Implementation::ScheduleCALayerCHROMIUM(GLuint contents_texture_id, |
4438 const GLfloat* contents_rect, | 4438 const GLfloat* contents_rect, |
4439 GLfloat opacity, | 4439 GLfloat opacity, |
4440 GLuint background_color, | 4440 GLuint background_color, |
4441 const GLfloat* bounds_size, | 4441 GLuint edge_aa_mask, |
| 4442 const GLfloat* bounds_rect, |
| 4443 GLboolean is_clipped, |
| 4444 const GLfloat* clip_rect, |
| 4445 GLint sorting_context_id, |
4442 const GLfloat* transform) { | 4446 const GLfloat* transform) { |
4443 size_t shm_size = 22 * sizeof(GLfloat); | 4447 size_t shm_size = 28 * sizeof(GLfloat); |
4444 ScopedTransferBufferPtr buffer(shm_size, helper_, transfer_buffer_); | 4448 ScopedTransferBufferPtr buffer(shm_size, helper_, transfer_buffer_); |
4445 if (!buffer.valid() || buffer.size() < shm_size) { | 4449 if (!buffer.valid() || buffer.size() < shm_size) { |
4446 SetGLError(GL_OUT_OF_MEMORY, "GLES2::ScheduleCALayerCHROMIUM", | 4450 SetGLError(GL_OUT_OF_MEMORY, "GLES2::ScheduleCALayerCHROMIUM", |
4447 "out of memory"); | 4451 "out of memory"); |
4448 return; | 4452 return; |
4449 } | 4453 } |
4450 GLfloat* mem = static_cast<GLfloat*>(buffer.address()); | 4454 GLfloat* mem = static_cast<GLfloat*>(buffer.address()); |
4451 memcpy(mem + 0, contents_rect, 4 * sizeof(GLfloat)); | 4455 memcpy(mem + 0, contents_rect, 4 * sizeof(GLfloat)); |
4452 memcpy(mem + 4, bounds_size, 2 * sizeof(GLfloat)); | 4456 memcpy(mem + 4, bounds_rect, 4 * sizeof(GLfloat)); |
4453 memcpy(mem + 6, transform, 16 * sizeof(GLfloat)); | 4457 memcpy(mem + 8, clip_rect, 4 * sizeof(GLfloat)); |
| 4458 memcpy(mem + 12, transform, 16 * sizeof(GLfloat)); |
4454 helper_->ScheduleCALayerCHROMIUM(contents_texture_id, opacity, | 4459 helper_->ScheduleCALayerCHROMIUM(contents_texture_id, opacity, |
4455 background_color, buffer.shm_id(), | 4460 background_color, edge_aa_mask, is_clipped, |
| 4461 sorting_context_id, buffer.shm_id(), |
4456 buffer.offset()); | 4462 buffer.offset()); |
4457 } | 4463 } |
4458 | 4464 |
4459 void GLES2Implementation::CommitOverlayPlanesCHROMIUM() { | 4465 void GLES2Implementation::CommitOverlayPlanesCHROMIUM() { |
4460 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 4466 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
4461 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] CommitOverlayPlanesCHROMIUM()"); | 4467 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] CommitOverlayPlanesCHROMIUM()"); |
4462 TRACE_EVENT0("gpu", "GLES2::CommitOverlayPlanesCHROMIUM"); | 4468 TRACE_EVENT0("gpu", "GLES2::CommitOverlayPlanesCHROMIUM"); |
4463 | 4469 |
4464 // Same flow control as GLES2Implementation::SwapBuffers (see comments there). | 4470 // Same flow control as GLES2Implementation::SwapBuffers (see comments there). |
4465 swap_buffers_tokens_.push(helper_->InsertToken()); | 4471 swap_buffers_tokens_.push(helper_->InsertToken()); |
(...skipping 2073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6539 CheckGLError(); | 6545 CheckGLError(); |
6540 } | 6546 } |
6541 | 6547 |
6542 // Include the auto-generated part of this file. We split this because it means | 6548 // Include the auto-generated part of this file. We split this because it means |
6543 // we can easily edit the non-auto generated parts right here in this file | 6549 // we can easily edit the non-auto generated parts right here in this file |
6544 // instead of having to edit some template or the code generator. | 6550 // instead of having to edit some template or the code generator. |
6545 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 6551 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
6546 | 6552 |
6547 } // namespace gles2 | 6553 } // namespace gles2 |
6548 } // namespace gpu | 6554 } // namespace gpu |
OLD | NEW |