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 4987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4998 buffer.shm_id(), buffer.offset()); | 4998 buffer.shm_id(), buffer.offset()); |
4999 } | 4999 } |
5000 | 5000 |
5001 void GLES2Implementation::ScheduleDCLayerCHROMIUM( | 5001 void GLES2Implementation::ScheduleDCLayerCHROMIUM( |
5002 GLsizei num_textures, | 5002 GLsizei num_textures, |
5003 const GLuint* contents_texture_ids, | 5003 const GLuint* contents_texture_ids, |
5004 const GLfloat* contents_rect, | 5004 const GLfloat* contents_rect, |
5005 GLuint background_color, | 5005 GLuint background_color, |
5006 GLuint edge_aa_mask, | 5006 GLuint edge_aa_mask, |
5007 const GLfloat* bounds_rect, | 5007 const GLfloat* bounds_rect, |
5008 GLuint filter) { | 5008 GLuint filter, |
| 5009 GLsizei color_space_size, |
| 5010 const GLvoid* color_space) { |
5009 const size_t kRectsSize = 8 * sizeof(GLfloat); | 5011 const size_t kRectsSize = 8 * sizeof(GLfloat); |
5010 size_t textures_size = num_textures * sizeof(GLuint); | 5012 size_t textures_size = num_textures * sizeof(GLuint); |
5011 size_t shm_size = kRectsSize + textures_size; | 5013 size_t shm_size = kRectsSize + textures_size + color_space_size; |
5012 ScopedTransferBufferPtr buffer(shm_size, helper_, transfer_buffer_); | 5014 ScopedTransferBufferPtr buffer(shm_size, helper_, transfer_buffer_); |
5013 if (!buffer.valid() || buffer.size() < shm_size) { | 5015 if (!buffer.valid() || buffer.size() < shm_size) { |
5014 SetGLError(GL_OUT_OF_MEMORY, "GLES2::ScheduleDCLayerCHROMIUM", | 5016 SetGLError(GL_OUT_OF_MEMORY, "GLES2::ScheduleDCLayerCHROMIUM", |
5015 "out of memory"); | 5017 "out of memory"); |
5016 return; | 5018 return; |
5017 } | 5019 } |
5018 GLfloat* mem = static_cast<GLfloat*>(buffer.address()); | 5020 GLfloat* mem = static_cast<GLfloat*>(buffer.address()); |
5019 memcpy(mem + 0, contents_rect, 4 * sizeof(GLfloat)); | 5021 memcpy(mem + 0, contents_rect, 4 * sizeof(GLfloat)); |
5020 memcpy(mem + 4, bounds_rect, 4 * sizeof(GLfloat)); | 5022 memcpy(mem + 4, bounds_rect, 4 * sizeof(GLfloat)); |
5021 memcpy(static_cast<char*>(buffer.address()) + kRectsSize, | 5023 memcpy(static_cast<char*>(buffer.address()) + kRectsSize, |
5022 contents_texture_ids, textures_size); | 5024 contents_texture_ids, textures_size); |
| 5025 if (color_space_size) |
| 5026 memcpy(static_cast<char*>(buffer.address()) + kRectsSize + textures_size, |
| 5027 color_space, color_space_size); |
5023 helper_->ScheduleDCLayerCHROMIUM(num_textures, background_color, edge_aa_mask, | 5028 helper_->ScheduleDCLayerCHROMIUM(num_textures, background_color, edge_aa_mask, |
5024 filter, buffer.shm_id(), buffer.offset()); | 5029 filter, color_space_size, buffer.shm_id(), |
| 5030 buffer.offset()); |
5025 } | 5031 } |
5026 | 5032 |
5027 void GLES2Implementation::CommitOverlayPlanesCHROMIUM() { | 5033 void GLES2Implementation::CommitOverlayPlanesCHROMIUM() { |
5028 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 5034 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
5029 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] CommitOverlayPlanesCHROMIUM()"); | 5035 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] CommitOverlayPlanesCHROMIUM()"); |
5030 TRACE_EVENT0("gpu", "GLES2::CommitOverlayPlanesCHROMIUM"); | 5036 TRACE_EVENT0("gpu", "GLES2::CommitOverlayPlanesCHROMIUM"); |
5031 | 5037 |
5032 // Same flow control as GLES2Implementation::SwapBuffers (see comments there). | 5038 // Same flow control as GLES2Implementation::SwapBuffers (see comments there). |
5033 swap_buffers_tokens_.push(helper_->InsertToken()); | 5039 swap_buffers_tokens_.push(helper_->InsertToken()); |
5034 helper_->CommitOverlayPlanesCHROMIUM(); | 5040 helper_->CommitOverlayPlanesCHROMIUM(); |
(...skipping 2042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7077 CheckGLError(); | 7083 CheckGLError(); |
7078 } | 7084 } |
7079 | 7085 |
7080 // Include the auto-generated part of this file. We split this because it means | 7086 // Include the auto-generated part of this file. We split this because it means |
7081 // we can easily edit the non-auto generated parts right here in this file | 7087 // we can easily edit the non-auto generated parts right here in this file |
7082 // instead of having to edit some template or the code generator. | 7088 // instead of having to edit some template or the code generator. |
7083 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 7089 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
7084 | 7090 |
7085 } // namespace gles2 | 7091 } // namespace gles2 |
7086 } // namespace gpu | 7092 } // namespace gpu |
OLD | NEW |