Chromium Code Reviews| 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 4714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4725 memcpy(mem + 0, contents_rect, 4 * sizeof(GLfloat)); | 4725 memcpy(mem + 0, contents_rect, 4 * sizeof(GLfloat)); |
| 4726 memcpy(mem + 4, bounds_rect, 4 * sizeof(GLfloat)); | 4726 memcpy(mem + 4, bounds_rect, 4 * sizeof(GLfloat)); |
| 4727 memcpy(mem + 8, clip_rect, 4 * sizeof(GLfloat)); | 4727 memcpy(mem + 8, clip_rect, 4 * sizeof(GLfloat)); |
| 4728 memcpy(mem + 12, transform, 16 * sizeof(GLfloat)); | 4728 memcpy(mem + 12, transform, 16 * sizeof(GLfloat)); |
| 4729 helper_->ScheduleCALayerCHROMIUM(contents_texture_id, opacity, | 4729 helper_->ScheduleCALayerCHROMIUM(contents_texture_id, opacity, |
| 4730 background_color, edge_aa_mask, is_clipped, | 4730 background_color, edge_aa_mask, is_clipped, |
| 4731 sorting_context_id, filter, buffer.shm_id(), | 4731 sorting_context_id, filter, buffer.shm_id(), |
| 4732 buffer.offset()); | 4732 buffer.offset()); |
| 4733 } | 4733 } |
| 4734 | 4734 |
| 4735 void GLES2Implementation::ScheduleCALayerInUseQueryCHROMIUM( | |
| 4736 GLuint n, | |
| 4737 const GLuint* textures) { | |
| 4738 size_t shm_size = n * sizeof(GLuint); | |
| 4739 ScopedTransferBufferPtr buffer(shm_size, helper_, transfer_buffer_); | |
| 4740 if (!buffer.valid() || buffer.size() < shm_size) { | |
| 4741 SetGLError(GL_OUT_OF_MEMORY, "GLES2::ScheduleCALayerInUseQueryCHROMIUM", | |
| 4742 "out of memory"); | |
| 4743 return; | |
| 4744 } | |
| 4745 GLfloat* mem = static_cast<GLfloat*>(buffer.address()); | |
|
piman
2016/06/14 00:58:55
nit: not GLfloat... GLuint if you want to, but I t
erikchen
2016/06/14 01:47:51
No longer necessary by using PUTn type.
| |
| 4746 memcpy(mem, textures, shm_size); | |
| 4747 helper_->ScheduleCALayerInUseQueryCHROMIUMImmediate(n); | |
| 4748 } | |
| 4749 | |
| 4735 void GLES2Implementation::CommitOverlayPlanesCHROMIUM() { | 4750 void GLES2Implementation::CommitOverlayPlanesCHROMIUM() { |
| 4736 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 4751 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
| 4737 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] CommitOverlayPlanesCHROMIUM()"); | 4752 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] CommitOverlayPlanesCHROMIUM()"); |
| 4738 TRACE_EVENT0("gpu", "GLES2::CommitOverlayPlanesCHROMIUM"); | 4753 TRACE_EVENT0("gpu", "GLES2::CommitOverlayPlanesCHROMIUM"); |
| 4739 | 4754 |
| 4740 // Same flow control as GLES2Implementation::SwapBuffers (see comments there). | 4755 // Same flow control as GLES2Implementation::SwapBuffers (see comments there). |
| 4741 swap_buffers_tokens_.push(helper_->InsertToken()); | 4756 swap_buffers_tokens_.push(helper_->InsertToken()); |
| 4742 helper_->CommitOverlayPlanesCHROMIUM(); | 4757 helper_->CommitOverlayPlanesCHROMIUM(); |
| 4743 helper_->CommandBufferHelper::Flush(); | 4758 helper_->CommandBufferHelper::Flush(); |
| 4744 if (swap_buffers_tokens_.size() > kMaxSwapBuffers + 1) { | 4759 if (swap_buffers_tokens_.size() > kMaxSwapBuffers + 1) { |
| (...skipping 2087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6832 cached_extensions_.clear(); | 6847 cached_extensions_.clear(); |
| 6833 } | 6848 } |
| 6834 | 6849 |
| 6835 // Include the auto-generated part of this file. We split this because it means | 6850 // Include the auto-generated part of this file. We split this because it means |
| 6836 // we can easily edit the non-auto generated parts right here in this file | 6851 // we can easily edit the non-auto generated parts right here in this file |
| 6837 // instead of having to edit some template or the code generator. | 6852 // instead of having to edit some template or the code generator. |
| 6838 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 6853 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
| 6839 | 6854 |
| 6840 } // namespace gles2 | 6855 } // namespace gles2 |
| 6841 } // namespace gpu | 6856 } // namespace gpu |
| OLD | NEW |