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

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 706173005: Enable asynchronous glReadPixels on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/service/feature_info.cc ('k') | ui/gl/generate_bindings.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/gles2_cmd_decoder.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index c7fab686353c00671275af1f55d6f70938779f3e..1b48dd760ffad53f65393a26f9a4475a934c410d 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -7550,12 +7550,15 @@ void GLES2DecoderImpl::FinishReadPixels(
} else {
data = glMapBuffer(GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY);
}
- memcpy(pixels, data, pixels_size);
+ if (data)
piman 2014/11/11 22:54:31 In which case should data be NULL? Should we raise
+ memcpy(pixels, data, pixels_size);
// GL_PIXEL_PACK_BUFFER_ARB is currently unused, so we don't
// have to restore the state.
glUnmapBuffer(GL_PIXEL_PACK_BUFFER_ARB);
glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, 0);
glDeleteBuffersARB(1, &buffer);
+ if (!data)
+ return;
}
if (result != NULL) {
@@ -7751,7 +7754,10 @@ error::Error GLES2DecoderImpl::HandleReadPixels(uint32 immediate_data_size,
GLuint buffer = 0;
glGenBuffersARB(1, &buffer);
glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, buffer);
- glBufferData(GL_PIXEL_PACK_BUFFER_ARB, pixels_size, NULL, GL_STREAM_READ);
+ // For ANGLE client version 2, GL_STREAM_READ is not available.
+ const GLenum usage_hint =
+ features().is_angle ? GL_STATIC_DRAW : GL_STREAM_READ;
+ glBufferData(GL_PIXEL_PACK_BUFFER_ARB, pixels_size, NULL, usage_hint);
GLenum error = glGetError();
if (error == GL_NO_ERROR) {
glReadPixels(x, y, width, height, format, type, 0);
« no previous file with comments | « gpu/command_buffer/service/feature_info.cc ('k') | ui/gl/generate_bindings.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698