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 <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 | 742 |
743 // static | 743 // static |
744 const unsigned int GLES2Decoder::kDefaultStencilMask = | 744 const unsigned int GLES2Decoder::kDefaultStencilMask = |
745 static_cast<unsigned int>(-1); | 745 static_cast<unsigned int>(-1); |
746 | 746 |
747 bool GLES2Decoder::GetServiceTextureId(uint32 client_texture_id, | 747 bool GLES2Decoder::GetServiceTextureId(uint32 client_texture_id, |
748 uint32* service_texture_id) { | 748 uint32* service_texture_id) { |
749 return false; | 749 return false; |
750 } | 750 } |
751 | 751 |
| 752 uint32 GLES2Decoder::GetAndClearBackbufferClearBitsForTest() { |
| 753 return 0; |
| 754 } |
| 755 |
752 GLES2Decoder::GLES2Decoder() | 756 GLES2Decoder::GLES2Decoder() |
753 : initialized_(false), | 757 : initialized_(false), |
754 debug_(false), | 758 debug_(false), |
755 log_commands_(false), | 759 log_commands_(false), |
756 unsafe_es3_apis_enabled_(false) { | 760 unsafe_es3_apis_enabled_(false) { |
757 } | 761 } |
758 | 762 |
759 GLES2Decoder::~GLES2Decoder() { | 763 GLES2Decoder::~GLES2Decoder() { |
760 } | 764 } |
761 | 765 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 const ContextState* GetContextState() override { return &state_; } | 864 const ContextState* GetContextState() override { return &state_; } |
861 | 865 |
862 void SetShaderCacheCallback(const ShaderCacheCallback& callback) override; | 866 void SetShaderCacheCallback(const ShaderCacheCallback& callback) override; |
863 void SetWaitSyncPointCallback(const WaitSyncPointCallback& callback) override; | 867 void SetWaitSyncPointCallback(const WaitSyncPointCallback& callback) override; |
864 void SetFenceSyncReleaseCallback( | 868 void SetFenceSyncReleaseCallback( |
865 const FenceSyncReleaseCallback& callback) override; | 869 const FenceSyncReleaseCallback& callback) override; |
866 void SetWaitFenceSyncCallback(const WaitFenceSyncCallback& callback) override; | 870 void SetWaitFenceSyncCallback(const WaitFenceSyncCallback& callback) override; |
867 | 871 |
868 void SetIgnoreCachedStateForTest(bool ignore) override; | 872 void SetIgnoreCachedStateForTest(bool ignore) override; |
869 void SetForceShaderNameHashingForTest(bool force) override; | 873 void SetForceShaderNameHashingForTest(bool force) override; |
| 874 uint32 GetAndClearBackbufferClearBitsForTest() override; |
870 void ProcessFinishedAsyncTransfers(); | 875 void ProcessFinishedAsyncTransfers(); |
871 | 876 |
872 bool GetServiceTextureId(uint32 client_texture_id, | 877 bool GetServiceTextureId(uint32 client_texture_id, |
873 uint32* service_texture_id) override; | 878 uint32* service_texture_id) override; |
874 | 879 |
875 uint32 GetTextureUploadCount() override; | 880 uint32 GetTextureUploadCount() override; |
876 base::TimeDelta GetTotalTextureUploadTime() override; | 881 base::TimeDelta GetTotalTextureUploadTime() override; |
877 base::TimeDelta GetTotalProcessingCommandsTime() override; | 882 base::TimeDelta GetTotalProcessingCommandsTime() override; |
878 void AddProcessingCommandsTime(base::TimeDelta) override; | 883 void AddProcessingCommandsTime(base::TimeDelta) override; |
879 | 884 |
(...skipping 4023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4903 } | 4908 } |
4904 | 4909 |
4905 void GLES2DecoderImpl::SetIgnoreCachedStateForTest(bool ignore) { | 4910 void GLES2DecoderImpl::SetIgnoreCachedStateForTest(bool ignore) { |
4906 state_.SetIgnoreCachedStateForTest(ignore); | 4911 state_.SetIgnoreCachedStateForTest(ignore); |
4907 } | 4912 } |
4908 | 4913 |
4909 void GLES2DecoderImpl::SetForceShaderNameHashingForTest(bool force) { | 4914 void GLES2DecoderImpl::SetForceShaderNameHashingForTest(bool force) { |
4910 force_shader_name_hashing_for_test = force; | 4915 force_shader_name_hashing_for_test = force; |
4911 } | 4916 } |
4912 | 4917 |
| 4918 // Added specifically for testing backbuffer_needs_clear_bits unittests. |
| 4919 uint32 GLES2DecoderImpl::GetAndClearBackbufferClearBitsForTest() { |
| 4920 uint32 clear_bits = backbuffer_needs_clear_bits_; |
| 4921 backbuffer_needs_clear_bits_ = 0; |
| 4922 return clear_bits; |
| 4923 } |
| 4924 |
4913 void GLES2DecoderImpl::OnFboChanged() const { | 4925 void GLES2DecoderImpl::OnFboChanged() const { |
4914 if (workarounds().restore_scissor_on_fbo_change) | 4926 if (workarounds().restore_scissor_on_fbo_change) |
4915 state_.fbo_binding_for_scissor_workaround_dirty = true; | 4927 state_.fbo_binding_for_scissor_workaround_dirty = true; |
4916 | 4928 |
4917 if (workarounds().gl_begin_gl_end_on_fbo_change_to_backbuffer) { | 4929 if (workarounds().gl_begin_gl_end_on_fbo_change_to_backbuffer) { |
4918 GLint bound_fbo_unsigned = -1; | 4930 GLint bound_fbo_unsigned = -1; |
4919 glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &bound_fbo_unsigned); | 4931 glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &bound_fbo_unsigned); |
4920 GLuint bound_fbo = static_cast<GLuint>(bound_fbo_unsigned); | 4932 GLuint bound_fbo = static_cast<GLuint>(bound_fbo_unsigned); |
4921 if (surface_ && surface_->GetBackingFrameBufferObject() == bound_fbo) | 4933 if (surface_ && surface_->GetBackingFrameBufferObject() == bound_fbo) |
4922 surface_->NotifyWasBound(); | 4934 surface_->NotifyWasBound(); |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5123 texture_manager(), | 5135 texture_manager(), |
5124 attachments[i], | 5136 attachments[i], |
5125 false); | 5137 false); |
5126 } else { | 5138 } else { |
5127 switch (attachments[i]) { | 5139 switch (attachments[i]) { |
5128 case GL_COLOR_EXT: | 5140 case GL_COLOR_EXT: |
5129 backbuffer_needs_clear_bits_ |= GL_COLOR_BUFFER_BIT; | 5141 backbuffer_needs_clear_bits_ |= GL_COLOR_BUFFER_BIT; |
5130 break; | 5142 break; |
5131 case GL_DEPTH_EXT: | 5143 case GL_DEPTH_EXT: |
5132 backbuffer_needs_clear_bits_ |= GL_DEPTH_BUFFER_BIT; | 5144 backbuffer_needs_clear_bits_ |= GL_DEPTH_BUFFER_BIT; |
| 5145 break; |
5133 case GL_STENCIL_EXT: | 5146 case GL_STENCIL_EXT: |
5134 backbuffer_needs_clear_bits_ |= GL_STENCIL_BUFFER_BIT; | 5147 backbuffer_needs_clear_bits_ |= GL_STENCIL_BUFFER_BIT; |
5135 break; | 5148 break; |
5136 default: | 5149 default: |
5137 NOTREACHED(); | 5150 NOTREACHED(); |
5138 break; | 5151 break; |
5139 } | 5152 } |
5140 } | 5153 } |
5141 } | 5154 } |
5142 | 5155 |
(...skipping 10343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15486 return error::kNoError; | 15499 return error::kNoError; |
15487 } | 15500 } |
15488 | 15501 |
15489 // Include the auto-generated part of this file. We split this because it means | 15502 // Include the auto-generated part of this file. We split this because it means |
15490 // we can easily edit the non-auto generated parts right here in this file | 15503 // we can easily edit the non-auto generated parts right here in this file |
15491 // instead of having to edit some template or the code generator. | 15504 // instead of having to edit some template or the code generator. |
15492 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 15505 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
15493 | 15506 |
15494 } // namespace gles2 | 15507 } // namespace gles2 |
15495 } // namespace gpu | 15508 } // namespace gpu |
OLD | NEW |