| 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 4750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4761 | 4761 |
| 4762 void GLES2Implementation::ScheduleCALayerCHROMIUM(GLuint contents_texture_id, | 4762 void GLES2Implementation::ScheduleCALayerCHROMIUM(GLuint contents_texture_id, |
| 4763 const GLfloat* contents_rect, | 4763 const GLfloat* contents_rect, |
| 4764 GLfloat opacity, | 4764 GLfloat opacity, |
| 4765 GLuint background_color, | 4765 GLuint background_color, |
| 4766 GLuint edge_aa_mask, | 4766 GLuint edge_aa_mask, |
| 4767 const GLfloat* bounds_rect, | 4767 const GLfloat* bounds_rect, |
| 4768 GLboolean is_clipped, | 4768 GLboolean is_clipped, |
| 4769 const GLfloat* clip_rect, | 4769 const GLfloat* clip_rect, |
| 4770 GLint sorting_context_id, | 4770 GLint sorting_context_id, |
| 4771 const GLfloat* transform) { | 4771 const GLfloat* transform, |
| 4772 GLuint filter) { |
| 4772 size_t shm_size = 28 * sizeof(GLfloat); | 4773 size_t shm_size = 28 * sizeof(GLfloat); |
| 4773 ScopedTransferBufferPtr buffer(shm_size, helper_, transfer_buffer_); | 4774 ScopedTransferBufferPtr buffer(shm_size, helper_, transfer_buffer_); |
| 4774 if (!buffer.valid() || buffer.size() < shm_size) { | 4775 if (!buffer.valid() || buffer.size() < shm_size) { |
| 4775 SetGLError(GL_OUT_OF_MEMORY, "GLES2::ScheduleCALayerCHROMIUM", | 4776 SetGLError(GL_OUT_OF_MEMORY, "GLES2::ScheduleCALayerCHROMIUM", |
| 4776 "out of memory"); | 4777 "out of memory"); |
| 4777 return; | 4778 return; |
| 4778 } | 4779 } |
| 4779 GLfloat* mem = static_cast<GLfloat*>(buffer.address()); | 4780 GLfloat* mem = static_cast<GLfloat*>(buffer.address()); |
| 4780 memcpy(mem + 0, contents_rect, 4 * sizeof(GLfloat)); | 4781 memcpy(mem + 0, contents_rect, 4 * sizeof(GLfloat)); |
| 4781 memcpy(mem + 4, bounds_rect, 4 * sizeof(GLfloat)); | 4782 memcpy(mem + 4, bounds_rect, 4 * sizeof(GLfloat)); |
| 4782 memcpy(mem + 8, clip_rect, 4 * sizeof(GLfloat)); | 4783 memcpy(mem + 8, clip_rect, 4 * sizeof(GLfloat)); |
| 4783 memcpy(mem + 12, transform, 16 * sizeof(GLfloat)); | 4784 memcpy(mem + 12, transform, 16 * sizeof(GLfloat)); |
| 4784 helper_->ScheduleCALayerCHROMIUM(contents_texture_id, opacity, | 4785 helper_->ScheduleCALayerCHROMIUM(contents_texture_id, opacity, |
| 4785 background_color, edge_aa_mask, is_clipped, | 4786 background_color, edge_aa_mask, is_clipped, |
| 4786 sorting_context_id, buffer.shm_id(), | 4787 sorting_context_id, filter, buffer.shm_id(), |
| 4787 buffer.offset()); | 4788 buffer.offset()); |
| 4788 } | 4789 } |
| 4789 | 4790 |
| 4790 void GLES2Implementation::CommitOverlayPlanesCHROMIUM() { | 4791 void GLES2Implementation::CommitOverlayPlanesCHROMIUM() { |
| 4791 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 4792 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
| 4792 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] CommitOverlayPlanesCHROMIUM()"); | 4793 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] CommitOverlayPlanesCHROMIUM()"); |
| 4793 TRACE_EVENT0("gpu", "GLES2::CommitOverlayPlanesCHROMIUM"); | 4794 TRACE_EVENT0("gpu", "GLES2::CommitOverlayPlanesCHROMIUM"); |
| 4794 | 4795 |
| 4795 // Same flow control as GLES2Implementation::SwapBuffers (see comments there). | 4796 // Same flow control as GLES2Implementation::SwapBuffers (see comments there). |
| 4796 swap_buffers_tokens_.push(helper_->InsertToken()); | 4797 swap_buffers_tokens_.push(helper_->InsertToken()); |
| (...skipping 2080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6877 cached_extensions_.clear(); | 6878 cached_extensions_.clear(); |
| 6878 } | 6879 } |
| 6879 | 6880 |
| 6880 // Include the auto-generated part of this file. We split this because it means | 6881 // Include the auto-generated part of this file. We split this because it means |
| 6881 // we can easily edit the non-auto generated parts right here in this file | 6882 // we can easily edit the non-auto generated parts right here in this file |
| 6882 // instead of having to edit some template or the code generator. | 6883 // instead of having to edit some template or the code generator. |
| 6883 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 6884 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
| 6884 | 6885 |
| 6885 } // namespace gles2 | 6886 } // namespace gles2 |
| 6886 } // namespace gpu | 6887 } // namespace gpu |
| OLD | NEW |