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

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

Issue 1830453002: WebGL: GL_RGB emulation for IOSurface backed textures. [For reference only] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile error. Created 4 years, 9 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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 // Restores the current state to the user's settings. 676 // Restores the current state to the user's settings.
677 void RestoreCurrentFramebufferBindings(); 677 void RestoreCurrentFramebufferBindings();
678 678
679 // Sets DEPTH_TEST, STENCIL_TEST and color mask for the current framebuffer. 679 // Sets DEPTH_TEST, STENCIL_TEST and color mask for the current framebuffer.
680 void ApplyDirtyState(); 680 void ApplyDirtyState();
681 681
682 // These check the state of the currently bound framebuffer or the 682 // These check the state of the currently bound framebuffer or the
683 // backbuffer if no framebuffer is bound. 683 // backbuffer if no framebuffer is bound.
684 // Check with all attached and enabled color attachments. 684 // Check with all attached and enabled color attachments.
685 bool BoundFramebufferHasColorAttachmentWithAlpha(); 685 bool BoundFramebufferHasColorAttachmentWithAlpha();
686 bool BoundFramebufferEmulatingRGB();
686 bool BoundFramebufferHasDepthAttachment(); 687 bool BoundFramebufferHasDepthAttachment();
687 bool BoundFramebufferHasStencilAttachment(); 688 bool BoundFramebufferHasStencilAttachment();
688 689
689 error::ContextLostReason GetContextLostReason() override; 690 error::ContextLostReason GetContextLostReason() override;
690 691
691 // Overriden from ErrorStateClient. 692 // Overriden from ErrorStateClient.
692 void OnContextLostError() override; 693 void OnContextLostError() override;
693 void OnOutOfMemoryError() override; 694 void OnOutOfMemoryError() override;
694 695
695 // Ensure Renderbuffer corresponding to last DoBindRenderbuffer() is bound. 696 // Ensure Renderbuffer corresponding to last DoBindRenderbuffer() is bound.
(...skipping 4007 matching lines...) Expand 10 before | Expand all | Expand 10 after
4703 } 4704 }
4704 4705
4705 bool GLES2DecoderImpl::BoundFramebufferHasColorAttachmentWithAlpha() { 4706 bool GLES2DecoderImpl::BoundFramebufferHasColorAttachmentWithAlpha() {
4706 Framebuffer* framebuffer = 4707 Framebuffer* framebuffer =
4707 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT); 4708 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT);
4708 if (framebuffer) 4709 if (framebuffer)
4709 return framebuffer->HasAlphaMRT(); 4710 return framebuffer->HasAlphaMRT();
4710 return BackBufferHasAlpha(); 4711 return BackBufferHasAlpha();
4711 } 4712 }
4712 4713
4714 bool GLES2DecoderImpl::BoundFramebufferEmulatingRGB() {
4715 Framebuffer* framebuffer =
4716 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT);
4717 if (framebuffer)
4718 return framebuffer->EmulatingRGB();
4719 return false;
4720 }
4721
4713 bool GLES2DecoderImpl::BoundFramebufferHasDepthAttachment() { 4722 bool GLES2DecoderImpl::BoundFramebufferHasDepthAttachment() {
4714 Framebuffer* framebuffer = 4723 Framebuffer* framebuffer =
4715 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT); 4724 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT);
4716 if (framebuffer) { 4725 if (framebuffer) {
4717 return framebuffer->HasDepthAttachment(); 4726 return framebuffer->HasDepthAttachment();
4718 } 4727 }
4719 if (offscreen_target_frame_buffer_.get()) { 4728 if (offscreen_target_frame_buffer_.get()) {
4720 return offscreen_target_depth_format_ != 0; 4729 return offscreen_target_depth_format_ != 0;
4721 } 4730 }
4722 return back_buffer_has_depth_; 4731 return back_buffer_has_depth_;
4723 } 4732 }
4724 4733
4725 bool GLES2DecoderImpl::BoundFramebufferHasStencilAttachment() { 4734 bool GLES2DecoderImpl::BoundFramebufferHasStencilAttachment() {
4726 Framebuffer* framebuffer = 4735 Framebuffer* framebuffer =
4727 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT); 4736 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT);
4728 if (framebuffer) { 4737 if (framebuffer) {
4729 return framebuffer->HasStencilAttachment(); 4738 return framebuffer->HasStencilAttachment();
4730 } 4739 }
4731 if (offscreen_target_frame_buffer_.get()) { 4740 if (offscreen_target_frame_buffer_.get()) {
4732 return offscreen_target_stencil_format_ != 0 || 4741 return offscreen_target_stencil_format_ != 0 ||
4733 offscreen_target_depth_format_ == GL_DEPTH24_STENCIL8; 4742 offscreen_target_depth_format_ == GL_DEPTH24_STENCIL8;
4734 } 4743 }
4735 return back_buffer_has_stencil_; 4744 return back_buffer_has_stencil_;
4736 } 4745 }
4737 4746
4738 void GLES2DecoderImpl::ApplyDirtyState() { 4747 void GLES2DecoderImpl::ApplyDirtyState() {
4748 if (BoundFramebufferEmulatingRGB()) {
4749 Framebuffer* framebuffer =
4750 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT);
4751 if (framebuffer->HasUninitializedDrawBuffers()) {
4752 glClearColor(0.2f, 0.2f, 0.2f, 1.0f);
4753 state_.SetDeviceColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
4754 glClear(GL_COLOR_BUFFER_BIT);
4755 glClearColor(state_.color_clear_red, state_.color_clear_green,
4756 state_.color_clear_blue, state_.color_clear_alpha);
4757 framebuffer->SetDrawBuffersAsInitialized();
4758 framebuffer_state_.clear_state_dirty = true;
4759 }
4760 }
4761
4739 if (framebuffer_state_.clear_state_dirty) { 4762 if (framebuffer_state_.clear_state_dirty) {
4740 bool have_alpha = BoundFramebufferHasColorAttachmentWithAlpha(); 4763 bool have_alpha = BoundFramebufferHasColorAttachmentWithAlpha();
4741 state_.SetDeviceColorMask(state_.color_mask_red, 4764 state_.SetDeviceColorMask(state_.color_mask_red,
4742 state_.color_mask_green, 4765 state_.color_mask_green,
4743 state_.color_mask_blue, 4766 state_.color_mask_blue,
4744 state_.color_mask_alpha && have_alpha); 4767 state_.color_mask_alpha && have_alpha);
4745 4768
4746 bool have_depth = BoundFramebufferHasDepthAttachment(); 4769 bool have_depth = BoundFramebufferHasDepthAttachment();
4747 state_.SetDeviceDepthMask(state_.depth_mask && have_depth); 4770 state_.SetDeviceDepthMask(state_.depth_mask && have_depth);
4748 4771
(...skipping 11584 matching lines...) Expand 10 before | Expand all | Expand 10 after
16333 } 16356 }
16334 16357
16335 // Include the auto-generated part of this file. We split this because it means 16358 // Include the auto-generated part of this file. We split this because it means
16336 // we can easily edit the non-auto generated parts right here in this file 16359 // we can easily edit the non-auto generated parts right here in this file
16337 // instead of having to edit some template or the code generator. 16360 // instead of having to edit some template or the code generator.
16338 #include "base/macros.h" 16361 #include "base/macros.h"
16339 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 16362 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
16340 16363
16341 } // namespace gles2 16364 } // namespace gles2
16342 } // namespace gpu 16365 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/framebuffer_manager.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698