| 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 <list> | 10 #include <list> |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 bool BoundFramebufferHasColorAttachmentWithAlpha(bool all_draw_buffers); | 675 bool BoundFramebufferHasColorAttachmentWithAlpha(bool all_draw_buffers); |
| 676 bool BoundFramebufferHasDepthAttachment(); | 676 bool BoundFramebufferHasDepthAttachment(); |
| 677 bool BoundFramebufferHasStencilAttachment(); | 677 bool BoundFramebufferHasStencilAttachment(); |
| 678 | 678 |
| 679 error::ContextLostReason GetContextLostReason() override; | 679 error::ContextLostReason GetContextLostReason() override; |
| 680 | 680 |
| 681 // Overridden from FramebufferManager::TextureDetachObserver: | 681 // Overridden from FramebufferManager::TextureDetachObserver: |
| 682 void OnTextureRefDetachedFromFramebuffer(TextureRef* texture) override; | 682 void OnTextureRefDetachedFromFramebuffer(TextureRef* texture) override; |
| 683 | 683 |
| 684 // Overriden from ErrorStateClient. | 684 // Overriden from ErrorStateClient. |
| 685 void OnContextLostError() override; |
| 685 void OnOutOfMemoryError() override; | 686 void OnOutOfMemoryError() override; |
| 686 | 687 |
| 687 // Ensure Renderbuffer corresponding to last DoBindRenderbuffer() is bound. | 688 // Ensure Renderbuffer corresponding to last DoBindRenderbuffer() is bound. |
| 688 void EnsureRenderbufferBound(); | 689 void EnsureRenderbufferBound(); |
| 689 | 690 |
| 690 // Helpers to facilitate calling into compatible extensions. | 691 // Helpers to facilitate calling into compatible extensions. |
| 691 static void RenderbufferStorageMultisampleHelper( | 692 static void RenderbufferStorageMultisampleHelper( |
| 692 const FeatureInfo* feature_info, | 693 const FeatureInfo* feature_info, |
| 693 GLenum target, | 694 GLenum target, |
| 694 GLsizei samples, | 695 GLsizei samples, |
| (...skipping 1940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2635 // mailing list archives. It also implicitly enables the desktop GL | 2636 // mailing list archives. It also implicitly enables the desktop GL |
| 2636 // capability GL_POINT_SPRITE to provide access to the gl_PointCoord | 2637 // capability GL_POINT_SPRITE to provide access to the gl_PointCoord |
| 2637 // variable in fragment shaders. | 2638 // variable in fragment shaders. |
| 2638 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { | 2639 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { |
| 2639 glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); | 2640 glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); |
| 2640 glEnable(GL_POINT_SPRITE); | 2641 glEnable(GL_POINT_SPRITE); |
| 2641 } | 2642 } |
| 2642 | 2643 |
| 2643 has_robustness_extension_ = | 2644 has_robustness_extension_ = |
| 2644 context->HasExtension("GL_ARB_robustness") || | 2645 context->HasExtension("GL_ARB_robustness") || |
| 2646 context->HasExtension("GL_KHR_robustness") || |
| 2645 context->HasExtension("GL_EXT_robustness"); | 2647 context->HasExtension("GL_EXT_robustness"); |
| 2646 | 2648 |
| 2647 if (!InitializeShaderTranslator()) { | 2649 if (!InitializeShaderTranslator()) { |
| 2648 return false; | 2650 return false; |
| 2649 } | 2651 } |
| 2650 | 2652 |
| 2651 state_.viewport_width = size.width(); | 2653 state_.viewport_width = size.width(); |
| 2652 state_.viewport_height = size.height(); | 2654 state_.viewport_height = size.height(); |
| 2653 | 2655 |
| 2654 GLint viewport_params[4] = { 0 }; | 2656 GLint viewport_params[4] = { 0 }; |
| (...skipping 7072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9727 bool GLES2DecoderImpl::WasContextLostByRobustnessExtension() { | 9729 bool GLES2DecoderImpl::WasContextLostByRobustnessExtension() { |
| 9728 return WasContextLost() && reset_by_robustness_extension_; | 9730 return WasContextLost() && reset_by_robustness_extension_; |
| 9729 } | 9731 } |
| 9730 | 9732 |
| 9731 void GLES2DecoderImpl::LoseContext(uint32 reset_status) { | 9733 void GLES2DecoderImpl::LoseContext(uint32 reset_status) { |
| 9732 // Only loses the context once. | 9734 // Only loses the context once. |
| 9733 if (reset_status_ != GL_NO_ERROR) { | 9735 if (reset_status_ != GL_NO_ERROR) { |
| 9734 return; | 9736 return; |
| 9735 } | 9737 } |
| 9736 | 9738 |
| 9739 if (workarounds().use_virtualized_gl_contexts) { |
| 9740 // If the context is virtual, the real context being guilty does not ensure |
| 9741 // that the virtual context is guilty. |
| 9742 if (reset_status == GL_GUILTY_CONTEXT_RESET_ARB) { |
| 9743 reset_status = GL_UNKNOWN_CONTEXT_RESET_ARB; |
| 9744 } |
| 9745 } else if (reset_status == GL_UNKNOWN_CONTEXT_RESET_ARB && |
| 9746 has_robustness_extension_) { |
| 9747 // If the reason for the call was a GL error, we can try to determine the |
| 9748 // reset status more accurately. |
| 9749 GLenum driver_status = glGetGraphicsResetStatusARB(); |
| 9750 if (driver_status == GL_GUILTY_CONTEXT_RESET_ARB || |
| 9751 driver_status == GL_INNOCENT_CONTEXT_RESET_ARB) { |
| 9752 reset_status = driver_status; |
| 9753 } |
| 9754 } |
| 9755 |
| 9737 // Marks this context as lost. | 9756 // Marks this context as lost. |
| 9738 reset_status_ = reset_status; | 9757 reset_status_ = reset_status; |
| 9739 current_decoder_error_ = error::kLostContext; | 9758 current_decoder_error_ = error::kLostContext; |
| 9740 } | 9759 } |
| 9741 | 9760 |
| 9742 error::Error GLES2DecoderImpl::HandleInsertSyncPointCHROMIUM( | 9761 error::Error GLES2DecoderImpl::HandleInsertSyncPointCHROMIUM( |
| 9743 uint32 immediate_data_size, | 9762 uint32 immediate_data_size, |
| 9744 const void* cmd_data) { | 9763 const void* cmd_data) { |
| 9745 return error::kUnknownCommand; | 9764 return error::kUnknownCommand; |
| 9746 } | 9765 } |
| (...skipping 1471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11218 ProcessFinishedAsyncTransfers(); | 11237 ProcessFinishedAsyncTransfers(); |
| 11219 return error::kNoError; | 11238 return error::kNoError; |
| 11220 } | 11239 } |
| 11221 | 11240 |
| 11222 void GLES2DecoderImpl::OnTextureRefDetachedFromFramebuffer( | 11241 void GLES2DecoderImpl::OnTextureRefDetachedFromFramebuffer( |
| 11223 TextureRef* texture_ref) { | 11242 TextureRef* texture_ref) { |
| 11224 Texture* texture = texture_ref->texture(); | 11243 Texture* texture = texture_ref->texture(); |
| 11225 DoDidUseTexImageIfNeeded(texture, texture->target()); | 11244 DoDidUseTexImageIfNeeded(texture, texture->target()); |
| 11226 } | 11245 } |
| 11227 | 11246 |
| 11247 void GLES2DecoderImpl::OnContextLostError() { |
| 11248 group_->LoseContexts(GL_UNKNOWN_CONTEXT_RESET_ARB); |
| 11249 } |
| 11250 |
| 11228 void GLES2DecoderImpl::OnOutOfMemoryError() { | 11251 void GLES2DecoderImpl::OnOutOfMemoryError() { |
| 11229 if (lose_context_when_out_of_memory_) { | 11252 if (lose_context_when_out_of_memory_) { |
| 11230 group_->LoseContexts(GL_UNKNOWN_CONTEXT_RESET_ARB); | 11253 group_->LoseContexts(GL_UNKNOWN_CONTEXT_RESET_ARB); |
| 11231 LoseContext(GL_GUILTY_CONTEXT_RESET_ARB); | |
| 11232 } | 11254 } |
| 11233 } | 11255 } |
| 11234 | 11256 |
| 11235 // Include the auto-generated part of this file. We split this because it means | 11257 // Include the auto-generated part of this file. We split this because it means |
| 11236 // we can easily edit the non-auto generated parts right here in this file | 11258 // we can easily edit the non-auto generated parts right here in this file |
| 11237 // instead of having to edit some template or the code generator. | 11259 // instead of having to edit some template or the code generator. |
| 11238 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 11260 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 11239 | 11261 |
| 11240 } // namespace gles2 | 11262 } // namespace gles2 |
| 11241 } // namespace gpu | 11263 } // namespace gpu |
| OLD | NEW |