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 4980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4991 "out of memory"); | 4991 "out of memory"); |
4992 return; | 4992 return; |
4993 } | 4993 } |
4994 GLfloat* mem = static_cast<GLfloat*>(buffer.address()); | 4994 GLfloat* mem = static_cast<GLfloat*>(buffer.address()); |
4995 memcpy(mem + 0, clip_rect, 4 * sizeof(GLfloat)); | 4995 memcpy(mem + 0, clip_rect, 4 * sizeof(GLfloat)); |
4996 memcpy(mem + 4, transform, 16 * sizeof(GLfloat)); | 4996 memcpy(mem + 4, transform, 16 * sizeof(GLfloat)); |
4997 helper_->ScheduleDCLayerSharedStateCHROMIUM(opacity, is_clipped, z_order, | 4997 helper_->ScheduleDCLayerSharedStateCHROMIUM(opacity, is_clipped, z_order, |
4998 buffer.shm_id(), buffer.offset()); | 4998 buffer.shm_id(), buffer.offset()); |
4999 } | 4999 } |
5000 | 5000 |
5001 void GLES2Implementation::ScheduleDCLayerCHROMIUM(GLuint contents_texture_id, | 5001 void GLES2Implementation::ScheduleDCLayerCHROMIUM(const GLfloat* contents_rect, |
5002 const GLfloat* contents_rect, | |
5003 GLuint background_color, | 5002 GLuint background_color, |
5004 GLuint edge_aa_mask, | 5003 GLuint edge_aa_mask, |
5005 const GLfloat* bounds_rect, | 5004 const GLfloat* bounds_rect, |
5006 GLuint filter) { | 5005 GLuint filter) { |
5007 size_t shm_size = 8 * sizeof(GLfloat); | 5006 size_t shm_size = 8 * sizeof(GLfloat); |
5008 ScopedTransferBufferPtr buffer(shm_size, helper_, transfer_buffer_); | 5007 ScopedTransferBufferPtr buffer(shm_size, helper_, transfer_buffer_); |
5009 if (!buffer.valid() || buffer.size() < shm_size) { | 5008 if (!buffer.valid() || buffer.size() < shm_size) { |
5010 SetGLError(GL_OUT_OF_MEMORY, "GLES2::ScheduleDCLayerCHROMIUM", | 5009 SetGLError(GL_OUT_OF_MEMORY, "GLES2::ScheduleDCLayerCHROMIUM", |
5011 "out of memory"); | 5010 "out of memory"); |
5012 return; | 5011 return; |
5013 } | 5012 } |
5014 GLfloat* mem = static_cast<GLfloat*>(buffer.address()); | 5013 GLfloat* mem = static_cast<GLfloat*>(buffer.address()); |
5015 memcpy(mem + 0, contents_rect, 4 * sizeof(GLfloat)); | 5014 memcpy(mem + 0, contents_rect, 4 * sizeof(GLfloat)); |
5016 memcpy(mem + 4, bounds_rect, 4 * sizeof(GLfloat)); | 5015 memcpy(mem + 4, bounds_rect, 4 * sizeof(GLfloat)); |
5017 helper_->ScheduleDCLayerCHROMIUM(contents_texture_id, background_color, | 5016 helper_->ScheduleDCLayerCHROMIUM(background_color, edge_aa_mask, filter, |
5018 edge_aa_mask, filter, buffer.shm_id(), | 5017 buffer.shm_id(), buffer.offset()); |
5019 buffer.offset()); | |
5020 } | 5018 } |
5021 | 5019 |
5022 void GLES2Implementation::CommitOverlayPlanesCHROMIUM() { | 5020 void GLES2Implementation::CommitOverlayPlanesCHROMIUM() { |
5023 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 5021 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
5024 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] CommitOverlayPlanesCHROMIUM()"); | 5022 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] CommitOverlayPlanesCHROMIUM()"); |
5025 TRACE_EVENT0("gpu", "GLES2::CommitOverlayPlanesCHROMIUM"); | 5023 TRACE_EVENT0("gpu", "GLES2::CommitOverlayPlanesCHROMIUM"); |
5026 | 5024 |
5027 // Same flow control as GLES2Implementation::SwapBuffers (see comments there). | 5025 // Same flow control as GLES2Implementation::SwapBuffers (see comments there). |
5028 swap_buffers_tokens_.push(helper_->InsertToken()); | 5026 swap_buffers_tokens_.push(helper_->InsertToken()); |
5029 helper_->CommitOverlayPlanesCHROMIUM(); | 5027 helper_->CommitOverlayPlanesCHROMIUM(); |
(...skipping 2042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7072 CheckGLError(); | 7070 CheckGLError(); |
7073 } | 7071 } |
7074 | 7072 |
7075 // Include the auto-generated part of this file. We split this because it means | 7073 // Include the auto-generated part of this file. We split this because it means |
7076 // we can easily edit the non-auto generated parts right here in this file | 7074 // we can easily edit the non-auto generated parts right here in this file |
7077 // instead of having to edit some template or the code generator. | 7075 // instead of having to edit some template or the code generator. |
7078 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 7076 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
7079 | 7077 |
7080 } // namespace gles2 | 7078 } // namespace gles2 |
7081 } // namespace gpu | 7079 } // namespace gpu |
OLD | NEW |