Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 Buffer* bound_buffer = | |
| 5603 buffer_manager()->GetBufferInfoForTarget(&state_, target); | |
| 5604 if (target == GL_PIXEL_PACK_BUFFER) { | |
| 5605 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
| |
| 5606 bound_buffer ? state_.pack_row_length : 0); | |
| 5607 } else if (target == GL_PIXEL_UNPACK_BUFFER) { | |
| 5608 glPixelStorei(GL_UNPACK_ROW_LENGTH, | |
| 5609 bound_buffer ? state_.unpack_row_length : 0); | |
| 5610 glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, | |
| 5611 bound_buffer ? state_.unpack_image_height : 0); | |
| 5612 } | |
| 5613 glBindBuffer(target, bound_buffer ? bound_buffer->service_id() : 0); | |
| 5614 } | |
| 5615 | |
| 5603 void GLES2DecoderImpl::RestoreFramebufferBindings() const { | 5616 void GLES2DecoderImpl::RestoreFramebufferBindings() const { |
| 5604 GLuint service_id = | 5617 GLuint service_id = |
| 5605 framebuffer_state_.bound_draw_framebuffer.get() | 5618 framebuffer_state_.bound_draw_framebuffer.get() |
| 5606 ? framebuffer_state_.bound_draw_framebuffer->service_id() | 5619 ? framebuffer_state_.bound_draw_framebuffer->service_id() |
| 5607 : GetBackbufferServiceId(); | 5620 : GetBackbufferServiceId(); |
| 5608 if (!SupportsSeparateFramebufferBinds()) { | 5621 if (!SupportsSeparateFramebufferBinds()) { |
| 5609 glBindFramebufferEXT(GL_FRAMEBUFFER, service_id); | 5622 glBindFramebufferEXT(GL_FRAMEBUFFER, service_id); |
| 5610 } else { | 5623 } else { |
| 5611 glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER, service_id); | 5624 glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER, service_id); |
| 5612 service_id = framebuffer_state_.bound_read_framebuffer.get() | 5625 service_id = framebuffer_state_.bound_read_framebuffer.get() |
| (...skipping 13953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 19566 } | 19579 } |
| 19567 | 19580 |
| 19568 // Include the auto-generated part of this file. We split this because it means | 19581 // 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 | 19582 // 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. | 19583 // instead of having to edit some template or the code generator. |
| 19571 #include "base/macros.h" | 19584 #include "base/macros.h" |
| 19572 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 19585 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 19573 | 19586 |
| 19574 } // namespace gles2 | 19587 } // namespace gles2 |
| 19575 } // namespace gpu | 19588 } // namespace gpu |
| OLD | NEW |