Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(721)

Side by Side Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 2849743002: Allow binding multiple textures to one DC Layer overlay. (Closed)
Patch Set: put texture id array in ScheduleDCLayer Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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(
5002 const GLfloat* contents_rect, 5002 GLsizei num_textures,
5003 GLuint background_color, 5003 const GLuint* contents_texture_ids,
5004 GLuint edge_aa_mask, 5004 const GLfloat* contents_rect,
5005 const GLfloat* bounds_rect, 5005 GLuint background_color,
5006 GLuint filter) { 5006 GLuint edge_aa_mask,
5007 size_t shm_size = 8 * sizeof(GLfloat); 5007 const GLfloat* bounds_rect,
5008 GLuint filter) {
5009 const size_t kRectsSize = 8 * sizeof(GLfloat);
5010 size_t textures_size = num_textures * sizeof(GLuint);
5011 size_t shm_size = kRectsSize + textures_size;
5008 ScopedTransferBufferPtr buffer(shm_size, helper_, transfer_buffer_); 5012 ScopedTransferBufferPtr buffer(shm_size, helper_, transfer_buffer_);
5009 if (!buffer.valid() || buffer.size() < shm_size) { 5013 if (!buffer.valid() || buffer.size() < shm_size) {
5010 SetGLError(GL_OUT_OF_MEMORY, "GLES2::ScheduleDCLayerCHROMIUM", 5014 SetGLError(GL_OUT_OF_MEMORY, "GLES2::ScheduleDCLayerCHROMIUM",
5011 "out of memory"); 5015 "out of memory");
5012 return; 5016 return;
5013 } 5017 }
5014 GLfloat* mem = static_cast<GLfloat*>(buffer.address()); 5018 GLfloat* mem = static_cast<GLfloat*>(buffer.address());
5015 memcpy(mem + 0, contents_rect, 4 * sizeof(GLfloat)); 5019 memcpy(mem + 0, contents_rect, 4 * sizeof(GLfloat));
5016 memcpy(mem + 4, bounds_rect, 4 * sizeof(GLfloat)); 5020 memcpy(mem + 4, bounds_rect, 4 * sizeof(GLfloat));
5017 helper_->ScheduleDCLayerCHROMIUM(contents_texture_id, background_color, 5021 memcpy(static_cast<char*>(buffer.address()) + kRectsSize,
5018 edge_aa_mask, filter, buffer.shm_id(), 5022 contents_texture_ids, textures_size);
5019 buffer.offset()); 5023 helper_->ScheduleDCLayerCHROMIUM(num_textures, background_color, edge_aa_mask,
5024 filter, buffer.shm_id(), buffer.offset());
5020 } 5025 }
5021 5026
5022 void GLES2Implementation::CommitOverlayPlanesCHROMIUM() { 5027 void GLES2Implementation::CommitOverlayPlanesCHROMIUM() {
5023 GPU_CLIENT_SINGLE_THREAD_CHECK(); 5028 GPU_CLIENT_SINGLE_THREAD_CHECK();
5024 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] CommitOverlayPlanesCHROMIUM()"); 5029 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] CommitOverlayPlanesCHROMIUM()");
5025 TRACE_EVENT0("gpu", "GLES2::CommitOverlayPlanesCHROMIUM"); 5030 TRACE_EVENT0("gpu", "GLES2::CommitOverlayPlanesCHROMIUM");
5026 5031
5027 // Same flow control as GLES2Implementation::SwapBuffers (see comments there). 5032 // Same flow control as GLES2Implementation::SwapBuffers (see comments there).
5028 swap_buffers_tokens_.push(helper_->InsertToken()); 5033 swap_buffers_tokens_.push(helper_->InsertToken());
5029 helper_->CommitOverlayPlanesCHROMIUM(); 5034 helper_->CommitOverlayPlanesCHROMIUM();
(...skipping 2042 matching lines...) Expand 10 before | Expand all | Expand 10 after
7072 CheckGLError(); 7077 CheckGLError();
7073 } 7078 }
7074 7079
7075 // Include the auto-generated part of this file. We split this because it means 7080 // 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 7081 // 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. 7082 // instead of having to edit some template or the code generator.
7078 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" 7083 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h"
7079 7084
7080 } // namespace gles2 7085 } // namespace gles2
7081 } // namespace gpu 7086 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gles2_cmd_helper_autogen.h ('k') | gpu/command_buffer/client/gles2_implementation_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698