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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 734063004: Update from https://crrev.com/304418 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « gpu/command_buffer/service/feature_info.cc ('k') | gpu/config/gpu_driver_bug_list_json.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 7560 matching lines...) Expand 10 before | Expand all | Expand 10 after
7571 7571
7572 if (buffer != 0) { 7572 if (buffer != 0) {
7573 glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, buffer); 7573 glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, buffer);
7574 void* data; 7574 void* data;
7575 if (features().map_buffer_range) { 7575 if (features().map_buffer_range) {
7576 data = glMapBufferRange( 7576 data = glMapBufferRange(
7577 GL_PIXEL_PACK_BUFFER_ARB, 0, pixels_size, GL_MAP_READ_BIT); 7577 GL_PIXEL_PACK_BUFFER_ARB, 0, pixels_size, GL_MAP_READ_BIT);
7578 } else { 7578 } else {
7579 data = glMapBuffer(GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY); 7579 data = glMapBuffer(GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY);
7580 } 7580 }
7581 if (!data) {
7582 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, "glMapBuffer",
7583 "Unable to map memory for readback.");
7584 return;
7585 }
7581 memcpy(pixels, data, pixels_size); 7586 memcpy(pixels, data, pixels_size);
7582 // GL_PIXEL_PACK_BUFFER_ARB is currently unused, so we don't 7587 // GL_PIXEL_PACK_BUFFER_ARB is currently unused, so we don't
7583 // have to restore the state. 7588 // have to restore the state.
7584 glUnmapBuffer(GL_PIXEL_PACK_BUFFER_ARB); 7589 glUnmapBuffer(GL_PIXEL_PACK_BUFFER_ARB);
7585 glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, 0); 7590 glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, 0);
7586 glDeleteBuffersARB(1, &buffer); 7591 glDeleteBuffersARB(1, &buffer);
7587 } 7592 }
7588 7593
7589 if (result != NULL) { 7594 if (result != NULL) {
7590 *result = true; 7595 *result = true;
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
7772 glReadPixels( 7777 glReadPixels(
7773 read_x, ry, read_width, 1, format, type, dst + dest_row_offset); 7778 read_x, ry, read_width, 1, format, type, dst + dest_row_offset);
7774 } 7779 }
7775 dst += padded_row_size; 7780 dst += padded_row_size;
7776 } 7781 }
7777 } else { 7782 } else {
7778 if (async && features().use_async_readpixels) { 7783 if (async && features().use_async_readpixels) {
7779 GLuint buffer = 0; 7784 GLuint buffer = 0;
7780 glGenBuffersARB(1, &buffer); 7785 glGenBuffersARB(1, &buffer);
7781 glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, buffer); 7786 glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, buffer);
7782 glBufferData(GL_PIXEL_PACK_BUFFER_ARB, pixels_size, NULL, GL_STREAM_READ); 7787 // For ANGLE client version 2, GL_STREAM_READ is not available.
7788 const GLenum usage_hint =
7789 features().is_angle ? GL_STATIC_DRAW : GL_STREAM_READ;
7790 glBufferData(GL_PIXEL_PACK_BUFFER_ARB, pixels_size, NULL, usage_hint);
7783 GLenum error = glGetError(); 7791 GLenum error = glGetError();
7784 if (error == GL_NO_ERROR) { 7792 if (error == GL_NO_ERROR) {
7785 glReadPixels(x, y, width, height, format, type, 0); 7793 glReadPixels(x, y, width, height, format, type, 0);
7786 pending_readpixel_fences_.push(linked_ptr<FenceCallback>( 7794 pending_readpixel_fences_.push(linked_ptr<FenceCallback>(
7787 new FenceCallback())); 7795 new FenceCallback()));
7788 WaitForReadPixels(base::Bind( 7796 WaitForReadPixels(base::Bind(
7789 &GLES2DecoderImpl::FinishReadPixels, 7797 &GLES2DecoderImpl::FinishReadPixels,
7790 base::internal::SupportsWeakPtrBase::StaticAsWeakPtr 7798 base::internal::SupportsWeakPtrBase::StaticAsWeakPtr
7791 <GLES2DecoderImpl>(this), 7799 <GLES2DecoderImpl>(this),
7792 c, buffer)); 7800 c, buffer));
(...skipping 3615 matching lines...) Expand 10 before | Expand all | Expand 10 after
11408 } 11416 }
11409 } 11417 }
11410 11418
11411 // Include the auto-generated part of this file. We split this because it means 11419 // Include the auto-generated part of this file. We split this because it means
11412 // we can easily edit the non-auto generated parts right here in this file 11420 // we can easily edit the non-auto generated parts right here in this file
11413 // instead of having to edit some template or the code generator. 11421 // instead of having to edit some template or the code generator.
11414 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 11422 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
11415 11423
11416 } // namespace gles2 11424 } // namespace gles2
11417 } // namespace gpu 11425 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/feature_info.cc ('k') | gpu/config/gpu_driver_bug_list_json.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698