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

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

Issue 2788793003: gpu: Support other buffer targets for ScopedBufferBinder (Closed)
Patch Set: Added support for other buffer targets Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder_mock.h » ('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 496068d0bc88846a638199415e4c4ef24c495176..064772e6b48e7fc94d66c020e7a1e01cd8ebc341 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -547,9 +547,6 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient {
void RestoreActiveTextureUnitBinding(unsigned int target) const override {
state_.RestoreActiveTextureUnitBinding(target);
}
- void RestoreBufferBinding(unsigned int target) const override {
- state_.RestoreBufferBinding(target);
- }
void RestoreBufferBindings() const override {
state_.RestoreBufferBindings();
}
@@ -563,6 +560,7 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient {
void RestoreVertexAttribArray(unsigned index) override {
RestoreStateForAttrib(index, true);
}
+ void RestoreBufferBinding(unsigned int target) override;
void RestoreFramebufferBindings() const override;
void RestoreRenderbufferBindings() override;
void RestoreTextureState(unsigned service_id) const override;
@@ -5600,6 +5598,21 @@ void GLES2DecoderImpl::RestoreState(const ContextState* prev_state) {
state_.RestoreState(prev_state);
}
+void GLES2DecoderImpl::RestoreBufferBinding(unsigned int target) {
+ Buffer* bound_buffer =
+ buffer_manager()->GetBufferInfoForTarget(&state_, target);
+ if (target == GL_PIXEL_PACK_BUFFER) {
+ glPixelStorei(GL_PACK_ROW_LENGTH,
piman 2017/04/04 17:48:43 We should only do these if we're on an ES3 context
Chandan 2017/04/04 18:18:45 Thanks. As I see, these two methods are private.
piman 2017/04/04 19:59:14 Alternatively, move this code to ContextState.
Chandan 2017/04/05 11:23:52 The idea was to reuse BufferManager::GetBufferInfo
+ bound_buffer ? state_.pack_row_length : 0);
+ } else if (target == GL_PIXEL_UNPACK_BUFFER) {
+ glPixelStorei(GL_UNPACK_ROW_LENGTH,
+ bound_buffer ? state_.unpack_row_length : 0);
+ glPixelStorei(GL_UNPACK_IMAGE_HEIGHT,
+ bound_buffer ? state_.unpack_image_height : 0);
+ }
+ glBindBuffer(target, bound_buffer ? bound_buffer->service_id() : 0);
+}
+
void GLES2DecoderImpl::RestoreFramebufferBindings() const {
GLuint service_id =
framebuffer_state_.bound_draw_framebuffer.get()
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder_mock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698