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

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

Issue 11779023: Aura: A little lighter GL synchronization (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Bind the textures because client side expects it. Created 7 years, 11 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 | Annotate | Revision Log
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 <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 virtual void AddProcessingCommandsTime(base::TimeDelta) OVERRIDE; 579 virtual void AddProcessingCommandsTime(base::TimeDelta) OVERRIDE;
580 580
581 // Restores the current state to the user's settings. 581 // Restores the current state to the user's settings.
582 void RestoreCurrentFramebufferBindings(); 582 void RestoreCurrentFramebufferBindings();
583 void RestoreCurrentRenderbufferBindings(); 583 void RestoreCurrentRenderbufferBindings();
584 void RestoreCurrentTexture2DBindings(); 584 void RestoreCurrentTexture2DBindings();
585 585
586 // Sets DEPTH_TEST, STENCIL_TEST and color mask for the current framebuffer. 586 // Sets DEPTH_TEST, STENCIL_TEST and color mask for the current framebuffer.
587 void ApplyDirtyState(); 587 void ApplyDirtyState();
588 588
589 // Reapply the texture parameters to the given texture.
590 void BindAndApplyTextureParameters(TextureManager::TextureInfo* info);
591
592 // These check the state of the currently bound framebuffer or the 589 // These check the state of the currently bound framebuffer or the
593 // backbuffer if no framebuffer is bound. 590 // backbuffer if no framebuffer is bound.
594 bool BoundFramebufferHasColorAttachmentWithAlpha(); 591 bool BoundFramebufferHasColorAttachmentWithAlpha();
595 bool BoundFramebufferHasDepthAttachment(); 592 bool BoundFramebufferHasDepthAttachment();
596 bool BoundFramebufferHasStencilAttachment(); 593 bool BoundFramebufferHasStencilAttachment();
597 594
598 virtual error::ContextLostReason GetContextLostReason() OVERRIDE; 595 virtual error::ContextLostReason GetContextLostReason() OVERRIDE;
599 596
600 private: 597 private:
601 friend class ScopedGLErrorSuppressor; 598 friend class ScopedGLErrorSuppressor;
(...skipping 2956 matching lines...) Expand 10 before | Expand all | Expand 10 after
3558 GL_BACK, have_stencil ? state_.stencil_back_writemask : 0); 3555 GL_BACK, have_stencil ? state_.stencil_back_writemask : 0);
3559 EnableDisable( 3556 EnableDisable(
3560 GL_STENCIL_TEST, state_.enable_flags.stencil_test && have_stencil); 3557 GL_STENCIL_TEST, state_.enable_flags.stencil_test && have_stencil);
3561 EnableDisable(GL_CULL_FACE, state_.enable_flags.cull_face); 3558 EnableDisable(GL_CULL_FACE, state_.enable_flags.cull_face);
3562 EnableDisable(GL_SCISSOR_TEST, state_.enable_flags.scissor_test); 3559 EnableDisable(GL_SCISSOR_TEST, state_.enable_flags.scissor_test);
3563 EnableDisable(GL_BLEND, state_.enable_flags.blend); 3560 EnableDisable(GL_BLEND, state_.enable_flags.blend);
3564 clear_state_dirty_ = false; 3561 clear_state_dirty_ = false;
3565 } 3562 }
3566 } 3563 }
3567 3564
3568 void GLES2DecoderImpl::BindAndApplyTextureParameters(
3569 TextureManager::TextureInfo* info) {
3570 glBindTexture(info->target(), info->service_id());
3571 glTexParameteri(info->target(), GL_TEXTURE_MIN_FILTER, info->min_filter());
3572 glTexParameteri(info->target(), GL_TEXTURE_MAG_FILTER, info->mag_filter());
3573 glTexParameteri(info->target(), GL_TEXTURE_WRAP_S, info->wrap_s());
3574 glTexParameteri(info->target(), GL_TEXTURE_WRAP_T, info->wrap_t());
3575 }
3576
3577 GLuint GLES2DecoderImpl::GetBackbufferServiceId() const { 3565 GLuint GLES2DecoderImpl::GetBackbufferServiceId() const {
3578 return (offscreen_target_frame_buffer_.get()) ? 3566 return (offscreen_target_frame_buffer_.get()) ?
3579 offscreen_target_frame_buffer_->id() : 3567 offscreen_target_frame_buffer_->id() :
3580 (surface_ ? surface_->GetBackingFrameBufferObject() : 0); 3568 (surface_ ? surface_->GetBackingFrameBufferObject() : 0);
3581 } 3569 }
3582 3570
3583 void GLES2DecoderImpl::RestoreState() const { 3571 void GLES2DecoderImpl::RestoreState() const {
3584 state_.RestoreState(); 3572 state_.RestoreState();
3585 3573
3586 // TODO: Restore multisample bindings 3574 // TODO: Restore multisample bindings
(...skipping 6053 matching lines...) Expand 10 before | Expand all | Expand 10 after
9640 *reinterpret_cast<const MailboxName*>(mailbox), 9628 *reinterpret_cast<const MailboxName*>(mailbox),
9641 definition, 9629 definition,
9642 texture_manager())) { 9630 texture_manager())) {
9643 bool success = texture_manager()->Restore(info, definition); 9631 bool success = texture_manager()->Restore(info, definition);
9644 DCHECK(success); 9632 DCHECK(success);
9645 SetGLError(GL_INVALID_OPERATION, 9633 SetGLError(GL_INVALID_OPERATION,
9646 "glProduceTextureCHROMIUM", "invalid mailbox name"); 9634 "glProduceTextureCHROMIUM", "invalid mailbox name");
9647 return; 9635 return;
9648 } 9636 }
9649 9637
9650 BindAndApplyTextureParameters(info); 9638 glBindTexture(info->target(), info->service_id());
9651 } 9639 }
9652 9640
9653 void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target, 9641 void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target,
9654 const GLbyte* mailbox) { 9642 const GLbyte* mailbox) {
9655 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); 9643 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target);
9656 if (!info) { 9644 if (!info) {
9657 SetGLError(GL_INVALID_OPERATION, 9645 SetGLError(GL_INVALID_OPERATION,
9658 "glConsumeTextureCHROMIUM", "unknown texture for target"); 9646 "glConsumeTextureCHROMIUM", "unknown texture for target");
9659 return; 9647 return;
9660 } 9648 }
9661 9649
9662 scoped_ptr<TextureDefinition> definition( 9650 scoped_ptr<TextureDefinition> definition(
9663 group_->mailbox_manager()->ConsumeTexture( 9651 group_->mailbox_manager()->ConsumeTexture(
9664 target, 9652 target,
9665 *reinterpret_cast<const MailboxName*>(mailbox))); 9653 *reinterpret_cast<const MailboxName*>(mailbox)));
9666 if (!definition.get()) { 9654 if (!definition.get()) {
9667 SetGLError(GL_INVALID_OPERATION, 9655 SetGLError(GL_INVALID_OPERATION,
9668 "glConsumeTextureCHROMIUM", "invalid mailbox name"); 9656 "glConsumeTextureCHROMIUM", "invalid mailbox name");
9669 return; 9657 return;
9670 } 9658 }
9671 9659
9672 if (!texture_manager()->Restore(info, definition.release())) { 9660 if (!texture_manager()->Restore(info, definition.release())) {
9673 SetGLError(GL_INVALID_OPERATION, 9661 SetGLError(GL_INVALID_OPERATION,
9674 "glConsumeTextureCHROMIUM", "invalid texture"); 9662 "glConsumeTextureCHROMIUM", "invalid texture");
9675 return; 9663 return;
9676 } 9664 }
9677 9665
9678 BindAndApplyTextureParameters(info); 9666 glBindTexture(info->target(), info->service_id());
9679 } 9667 }
9680 9668
9681 void GLES2DecoderImpl::DoInsertEventMarkerEXT( 9669 void GLES2DecoderImpl::DoInsertEventMarkerEXT(
9682 GLsizei length, const GLchar* marker) { 9670 GLsizei length, const GLchar* marker) {
9683 if (!marker) { 9671 if (!marker) {
9684 marker = ""; 9672 marker = "";
9685 } 9673 }
9686 debug_marker_manager_.SetMarker( 9674 debug_marker_manager_.SetMarker(
9687 length ? std::string(marker, length) : std::string(marker)); 9675 length ? std::string(marker, length) : std::string(marker));
9688 } 9676 }
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
10006 return error::kNoError; 9994 return error::kNoError;
10007 } 9995 }
10008 9996
10009 // Include the auto-generated part of this file. We split this because it means 9997 // Include the auto-generated part of this file. We split this because it means
10010 // we can easily edit the non-auto generated parts right here in this file 9998 // we can easily edit the non-auto generated parts right here in this file
10011 // instead of having to edit some template or the code generator. 9999 // instead of having to edit some template or the code generator.
10012 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 10000 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
10013 10001
10014 } // namespace gles2 10002 } // namespace gles2
10015 } // namespace gpu 10003 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/GLES2/extensions/CHROMIUM/CHROMIUM_texture_mailbox.txt ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698