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

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

Issue 1492013002: Reland of Upgrade PixelStorei to ES3/WebGL2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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/context_state.h ('k') | gpu/command_buffer/service/context_state_autogen.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/context_state.cc
diff --git a/gpu/command_buffer/service/context_state.cc b/gpu/command_buffer/service/context_state.cc
index e8c00727cf43ce7bfdcb9647325d53bea20b3858..44ad3199c1de5b3af3634baa38e2ad420d25b8f1 100644
--- a/gpu/command_buffer/service/context_state.cc
+++ b/gpu/command_buffer/service/context_state.cc
@@ -270,8 +270,10 @@
GetBufferId(bound_copy_write_buffer.get()));
glBindBuffer(GL_PIXEL_PACK_BUFFER,
GetBufferId(bound_pixel_pack_buffer.get()));
+ UpdatePackParameters();
glBindBuffer(GL_PIXEL_UNPACK_BUFFER,
GetBufferId(bound_pixel_unpack_buffer.get()));
+ UpdateUnpackParameters();
glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER,
GetBufferId(bound_transform_feedback_buffer.get()));
glBindBuffer(GL_UNIFORM_BUFFER, GetBufferId(bound_uniform_buffer.get()));
@@ -442,6 +444,38 @@
}
}
+void ContextState::UpdatePackParameters() const {
+ if (!feature_info_->IsES3Capable())
+ return;
+ if (bound_pixel_pack_buffer.get()) {
+ glPixelStorei(GL_PACK_ROW_LENGTH, pack_row_length);
+ glPixelStorei(GL_PACK_SKIP_PIXELS, pack_skip_pixels);
+ glPixelStorei(GL_PACK_SKIP_ROWS, pack_skip_rows);
+ } else {
+ glPixelStorei(GL_PACK_ROW_LENGTH, 0);
+ glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
+ glPixelStorei(GL_PACK_SKIP_ROWS, 0);
+ }
+}
+
+void ContextState::UpdateUnpackParameters() const {
+ if (!feature_info_->IsES3Capable())
+ return;
+ if (bound_pixel_unpack_buffer.get()) {
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, unpack_row_length);
+ glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, unpack_image_height);
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, unpack_skip_pixels);
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, unpack_skip_rows);
+ glPixelStorei(GL_UNPACK_SKIP_IMAGES, unpack_skip_images);
+ } else {
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+ glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0);
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
+ glPixelStorei(GL_UNPACK_SKIP_IMAGES, 0);
+ }
+}
+
void ContextState::SetBoundBuffer(GLenum target, Buffer* buffer) {
switch (target) {
case GL_ARRAY_BUFFER:
@@ -458,9 +492,11 @@
break;
case GL_PIXEL_PACK_BUFFER:
bound_pixel_pack_buffer = buffer;
+ UpdatePackParameters();
break;
case GL_PIXEL_UNPACK_BUFFER:
bound_pixel_unpack_buffer = buffer;
+ UpdateUnpackParameters();
break;
case GL_TRANSFORM_FEEDBACK_BUFFER:
bound_transform_feedback_buffer = buffer;
@@ -488,9 +524,11 @@
}
if (bound_pixel_pack_buffer.get() == buffer) {
bound_pixel_pack_buffer = nullptr;
+ UpdatePackParameters();
}
if (bound_pixel_unpack_buffer.get() == buffer) {
bound_pixel_unpack_buffer = nullptr;
+ UpdateUnpackParameters();
}
if (bound_transform_feedback_buffer.get() == buffer) {
bound_transform_feedback_buffer = nullptr;
« no previous file with comments | « gpu/command_buffer/service/context_state.h ('k') | gpu/command_buffer/service/context_state_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698