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

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

Issue 2788793003: gpu: Support other buffer targets for ScopedBufferBinder (Closed)
Patch Set: Update{Pack,Unpack}Parameters() made public 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 unified diff | Download patch
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 <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 void RestoreState(const ContextState* prev_state) override; 540 void RestoreState(const ContextState* prev_state) override;
541 541
542 void RestoreActiveTexture() const override { state_.RestoreActiveTexture(); } 542 void RestoreActiveTexture() const override { state_.RestoreActiveTexture(); }
543 void RestoreAllTextureUnitBindings( 543 void RestoreAllTextureUnitBindings(
544 const ContextState* prev_state) const override { 544 const ContextState* prev_state) const override {
545 state_.RestoreAllTextureUnitBindings(prev_state); 545 state_.RestoreAllTextureUnitBindings(prev_state);
546 } 546 }
547 void RestoreActiveTextureUnitBinding(unsigned int target) const override { 547 void RestoreActiveTextureUnitBinding(unsigned int target) const override {
548 state_.RestoreActiveTextureUnitBinding(target); 548 state_.RestoreActiveTextureUnitBinding(target);
549 } 549 }
550 void RestoreBufferBinding(unsigned int target) const override {
551 state_.RestoreBufferBinding(target);
552 }
553 void RestoreBufferBindings() const override { 550 void RestoreBufferBindings() const override {
554 state_.RestoreBufferBindings(); 551 state_.RestoreBufferBindings();
555 } 552 }
556 void RestoreGlobalState() const override { state_.RestoreGlobalState(NULL); } 553 void RestoreGlobalState() const override { state_.RestoreGlobalState(NULL); }
557 void RestoreProgramBindings() const override { 554 void RestoreProgramBindings() const override {
558 state_.RestoreProgramSettings(nullptr, false); 555 state_.RestoreProgramSettings(nullptr, false);
559 } 556 }
560 void RestoreTextureUnitBindings(unsigned unit) const override { 557 void RestoreTextureUnitBindings(unsigned unit) const override {
561 state_.RestoreTextureUnitBindings(unit, NULL); 558 state_.RestoreTextureUnitBindings(unit, NULL);
562 } 559 }
563 void RestoreVertexAttribArray(unsigned index) override { 560 void RestoreVertexAttribArray(unsigned index) override {
564 RestoreStateForAttrib(index, true); 561 RestoreStateForAttrib(index, true);
565 } 562 }
563 void RestoreBufferBinding(unsigned int target) override;
566 void RestoreFramebufferBindings() const override; 564 void RestoreFramebufferBindings() const override;
567 void RestoreRenderbufferBindings() override; 565 void RestoreRenderbufferBindings() override;
568 void RestoreTextureState(unsigned service_id) const override; 566 void RestoreTextureState(unsigned service_id) const override;
569 567
570 void ClearAllAttributes() const override; 568 void ClearAllAttributes() const override;
571 void RestoreAllAttributes() const override; 569 void RestoreAllAttributes() const override;
572 570
573 QueryManager* GetQueryManager() override { return query_manager_.get(); } 571 QueryManager* GetQueryManager() override { return query_manager_.get(); }
574 TransformFeedbackManager* GetTransformFeedbackManager() override { 572 TransformFeedbackManager* GetTransformFeedbackManager() override {
575 return transform_feedback_manager_.get(); 573 return transform_feedback_manager_.get();
(...skipping 5017 matching lines...) Expand 10 before | Expand all | Expand 10 after
5593 void GLES2DecoderImpl::RestoreState(const ContextState* prev_state) { 5591 void GLES2DecoderImpl::RestoreState(const ContextState* prev_state) {
5594 TRACE_EVENT1("gpu", "GLES2DecoderImpl::RestoreState", 5592 TRACE_EVENT1("gpu", "GLES2DecoderImpl::RestoreState",
5595 "context", logger_.GetLogPrefix()); 5593 "context", logger_.GetLogPrefix());
5596 // Restore the Framebuffer first because of bugs in Intel drivers. 5594 // Restore the Framebuffer first because of bugs in Intel drivers.
5597 // Intel drivers incorrectly clip the viewport settings to 5595 // Intel drivers incorrectly clip the viewport settings to
5598 // the size of the current framebuffer object. 5596 // the size of the current framebuffer object.
5599 RestoreFramebufferBindings(); 5597 RestoreFramebufferBindings();
5600 state_.RestoreState(prev_state); 5598 state_.RestoreState(prev_state);
5601 } 5599 }
5602 5600
5601 void GLES2DecoderImpl::RestoreBufferBinding(unsigned int target) {
5602 if (target == GL_PIXEL_PACK_BUFFER) {
5603 state_.UpdatePackParameters();
5604 } else if (target == GL_PIXEL_UNPACK_BUFFER) {
5605 state_.UpdateUnpackParameters();
5606 }
5607 Buffer* bound_buffer =
5608 buffer_manager()->GetBufferInfoForTarget(&state_, target);
5609 glBindBuffer(target, bound_buffer ? bound_buffer->service_id() : 0);
5610 }
5611
5603 void GLES2DecoderImpl::RestoreFramebufferBindings() const { 5612 void GLES2DecoderImpl::RestoreFramebufferBindings() const {
5604 GLuint service_id = 5613 GLuint service_id =
5605 framebuffer_state_.bound_draw_framebuffer.get() 5614 framebuffer_state_.bound_draw_framebuffer.get()
5606 ? framebuffer_state_.bound_draw_framebuffer->service_id() 5615 ? framebuffer_state_.bound_draw_framebuffer->service_id()
5607 : GetBackbufferServiceId(); 5616 : GetBackbufferServiceId();
5608 if (!SupportsSeparateFramebufferBinds()) { 5617 if (!SupportsSeparateFramebufferBinds()) {
5609 glBindFramebufferEXT(GL_FRAMEBUFFER, service_id); 5618 glBindFramebufferEXT(GL_FRAMEBUFFER, service_id);
5610 } else { 5619 } else {
5611 glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER, service_id); 5620 glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER, service_id);
5612 service_id = framebuffer_state_.bound_read_framebuffer.get() 5621 service_id = framebuffer_state_.bound_read_framebuffer.get()
(...skipping 13953 matching lines...) Expand 10 before | Expand all | Expand 10 after
19566 } 19575 }
19567 19576
19568 // Include the auto-generated part of this file. We split this because it means 19577 // Include the auto-generated part of this file. We split this because it means
19569 // we can easily edit the non-auto generated parts right here in this file 19578 // we can easily edit the non-auto generated parts right here in this file
19570 // instead of having to edit some template or the code generator. 19579 // instead of having to edit some template or the code generator.
19571 #include "base/macros.h" 19580 #include "base/macros.h"
19572 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 19581 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
19573 19582
19574 } // namespace gles2 19583 } // namespace gles2
19575 } // namespace gpu 19584 } // namespace gpu
OLDNEW
« 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