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/gl2ext.h> | 9 #include <GLES2/gl2ext.h> |
| 10 #include <GLES2/gl2extchromium.h> | 10 #include <GLES2/gl2extchromium.h> |
| (...skipping 2185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2196 CopyRectToBuffer( | 2196 CopyRectToBuffer( |
| 2197 pixels, height, unpadded_row_size, src_padded_row_size, unpack_flip_y_, | 2197 pixels, height, unpadded_row_size, src_padded_row_size, unpack_flip_y_, |
| 2198 buffer.address(), padded_row_size); | 2198 buffer.address(), padded_row_size); |
| 2199 helper_->TexImage2D( | 2199 helper_->TexImage2D( |
| 2200 target, level, internalformat, width, height, format, type, | 2200 target, level, internalformat, width, height, format, type, |
| 2201 buffer.shm_id(), buffer.offset()); | 2201 buffer.shm_id(), buffer.offset()); |
| 2202 CheckGLError(); | 2202 CheckGLError(); |
| 2203 return; | 2203 return; |
| 2204 } | 2204 } |
| 2205 | 2205 |
| 2206 // Check if we can allocate shared memory to send it. | |
| 2207 int32 mapped_shm_id = 0; | |
| 2208 unsigned int mapped_shm_offset = 0; | |
| 2209 void* mem = mapped_memory_->Alloc(size, &mapped_shm_id, &mapped_shm_offset); | |
| 2210 if (mem) { | |
| 2211 CopyRectToBuffer( | |
| 2212 pixels, height, unpadded_row_size, src_padded_row_size, unpack_flip_y_, | |
| 2213 mem, padded_row_size); | |
| 2214 helper_->TexImage2D( | |
| 2215 target, level, internalformat, width, height, format, type, | |
| 2216 mapped_shm_id, mapped_shm_offset); | |
| 2217 CheckGLError(); | |
| 2218 mapped_memory_->FreePendingToken(mem, helper_->InsertToken()); | |
|
piman
2015/06/08 21:12:35
Can you force a shallow flush here? Without it, th
David Yen
2015/06/08 21:34:06
Done. Although in order to do this in my new versi
| |
| 2219 return; | |
| 2220 } | |
| 2221 | |
| 2206 // No, so send it using TexSubImage2D. | 2222 // No, so send it using TexSubImage2D. |
| 2207 helper_->TexImage2D( | 2223 helper_->TexImage2D( |
| 2208 target, level, internalformat, width, height, format, type, | 2224 target, level, internalformat, width, height, format, type, |
| 2209 0, 0); | 2225 0, 0); |
| 2210 TexSubImage2DImpl( | 2226 TexSubImage2DImpl( |
| 2211 target, level, 0, 0, width, height, format, type, unpadded_row_size, | 2227 target, level, 0, 0, width, height, format, type, unpadded_row_size, |
| 2212 pixels, src_padded_row_size, GL_TRUE, &buffer, padded_row_size); | 2228 pixels, src_padded_row_size, GL_TRUE, &buffer, padded_row_size); |
| 2213 CheckGLError(); | 2229 CheckGLError(); |
| 2214 } | 2230 } |
| 2215 | 2231 |
| (...skipping 3514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5730 CheckGLError(); | 5746 CheckGLError(); |
| 5731 } | 5747 } |
| 5732 | 5748 |
| 5733 // Include the auto-generated part of this file. We split this because it means | 5749 // Include the auto-generated part of this file. We split this because it means |
| 5734 // we can easily edit the non-auto generated parts right here in this file | 5750 // we can easily edit the non-auto generated parts right here in this file |
| 5735 // instead of having to edit some template or the code generator. | 5751 // instead of having to edit some template or the code generator. |
| 5736 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 5752 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
| 5737 | 5753 |
| 5738 } // namespace gles2 | 5754 } // namespace gles2 |
| 5739 } // namespace gpu | 5755 } // namespace gpu |
| OLD | NEW |