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

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

Issue 19579008: Revert "Revert 210138 "Perform glReadPixels with PBOs in the gpu, if PBO..."" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: previous upload reverts the revert, here are the changes Created 7 years, 5 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 | Annotate | Revision Log
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 <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 2218 matching lines...) Expand 10 before | Expand all | Expand 10 after
2229 } 2229 }
2230 2230
2231 if (bound_pixel_pack_transfer_buffer_id_) { 2231 if (bound_pixel_pack_transfer_buffer_id_) {
2232 GLuint offset = ToGLuint(pixels); 2232 GLuint offset = ToGLuint(pixels);
2233 BufferTracker::Buffer* buffer = GetBoundPixelUnpackTransferBufferIfValid( 2233 BufferTracker::Buffer* buffer = GetBoundPixelUnpackTransferBufferIfValid(
2234 bound_pixel_pack_transfer_buffer_id_, 2234 bound_pixel_pack_transfer_buffer_id_,
2235 "glReadPixels", offset, padded_row_size * height); 2235 "glReadPixels", offset, padded_row_size * height);
2236 if (buffer && buffer->shm_id() != -1) { 2236 if (buffer && buffer->shm_id() != -1) {
2237 helper_->ReadPixels(xoffset, yoffset, width, height, format, type, 2237 helper_->ReadPixels(xoffset, yoffset, width, height, format, type,
2238 buffer->shm_id(), buffer->shm_offset(), 2238 buffer->shm_id(), buffer->shm_offset(),
2239 0, 0); 2239 0, 0, true);
2240 buffer->set_transfer_ready_token(helper_->InsertToken());
2241 CheckGLError(); 2240 CheckGLError();
2242 } 2241 }
2243 return; 2242 return;
2244 } 2243 }
2245 2244
2246 if (!pixels) { 2245 if (!pixels) {
2247 SetGLError(GL_INVALID_OPERATION, "glReadPixels", "pixels = NULL"); 2246 SetGLError(GL_INVALID_OPERATION, "glReadPixels", "pixels = NULL");
2248 return; 2247 return;
2249 } 2248 }
2250 2249
(...skipping 11 matching lines...) Expand all
2262 // NOTE: We must look up the address of the result area AFTER allocation 2261 // NOTE: We must look up the address of the result area AFTER allocation
2263 // of the transfer buffer since the transfer buffer may be reallocated. 2262 // of the transfer buffer since the transfer buffer may be reallocated.
2264 Result* result = GetResultAs<Result*>(); 2263 Result* result = GetResultAs<Result*>();
2265 if (!result) { 2264 if (!result) {
2266 return; 2265 return;
2267 } 2266 }
2268 *result = 0; // mark as failed. 2267 *result = 0; // mark as failed.
2269 helper_->ReadPixels( 2268 helper_->ReadPixels(
2270 xoffset, yoffset, width, num_rows, format, type, 2269 xoffset, yoffset, width, num_rows, format, type,
2271 buffer.shm_id(), buffer.offset(), 2270 buffer.shm_id(), buffer.offset(),
2272 GetResultShmId(), GetResultShmOffset()); 2271 GetResultShmId(), GetResultShmOffset(),
2272 false);
2273 WaitForCmd(); 2273 WaitForCmd();
2274 if (*result != 0) { 2274 if (*result != 0) {
2275 // when doing a y-flip we have to iterate through top-to-bottom chunks 2275 // when doing a y-flip we have to iterate through top-to-bottom chunks
2276 // of the dst. The service side handles reversing the rows within a 2276 // of the dst. The service side handles reversing the rows within a
2277 // chunk. 2277 // chunk.
2278 int8* rows_dst; 2278 int8* rows_dst;
2279 if (pack_reverse_row_order_) { 2279 if (pack_reverse_row_order_) {
2280 rows_dst = dest + (height - num_rows) * padded_row_size; 2280 rows_dst = dest + (height - num_rows) * padded_row_size;
2281 } else { 2281 } else {
2282 rows_dst = dest; 2282 rows_dst = dest;
(...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after
3825 CheckGLError(); 3825 CheckGLError();
3826 } 3826 }
3827 3827
3828 // Include the auto-generated part of this file. We split this because it means 3828 // Include the auto-generated part of this file. We split this because it means
3829 // we can easily edit the non-auto generated parts right here in this file 3829 // we can easily edit the non-auto generated parts right here in this file
3830 // instead of having to edit some template or the code generator. 3830 // instead of having to edit some template or the code generator.
3831 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" 3831 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h"
3832 3832
3833 } // namespace gles2 3833 } // namespace gles2
3834 } // namespace gpu 3834 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gles2_cmd_helper_autogen.h ('k') | gpu/command_buffer/client/gles2_implementation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698