| 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 2209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2220 int frame_number_; | 2220 int frame_number_; |
| 2221 | 2221 |
| 2222 // Number of commands remaining to be processed in DoCommands(). | 2222 // Number of commands remaining to be processed in DoCommands(). |
| 2223 int commands_to_process_; | 2223 int commands_to_process_; |
| 2224 | 2224 |
| 2225 bool has_robustness_extension_; | 2225 bool has_robustness_extension_; |
| 2226 error::ContextLostReason context_lost_reason_; | 2226 error::ContextLostReason context_lost_reason_; |
| 2227 bool context_was_lost_; | 2227 bool context_was_lost_; |
| 2228 bool reset_by_robustness_extension_; | 2228 bool reset_by_robustness_extension_; |
| 2229 bool supports_post_sub_buffer_; | 2229 bool supports_post_sub_buffer_; |
| 2230 bool supports_commit_overlay_planes_; |
| 2230 bool supports_async_swap_; | 2231 bool supports_async_swap_; |
| 2231 | 2232 |
| 2232 ContextType context_type_; | 2233 ContextType context_type_; |
| 2233 | 2234 |
| 2234 // These flags are used to override the state of the shared feature_info_ | 2235 // These flags are used to override the state of the shared feature_info_ |
| 2235 // member. Because the same FeatureInfo instance may be shared among many | 2236 // member. Because the same FeatureInfo instance may be shared among many |
| 2236 // contexts, the assumptions on the availablity of extensions in WebGL | 2237 // contexts, the assumptions on the availablity of extensions in WebGL |
| 2237 // contexts may be broken. These flags override the shared state to preserve | 2238 // contexts may be broken. These flags override the shared state to preserve |
| 2238 // WebGL semantics. | 2239 // WebGL semantics. |
| 2239 bool derivatives_explicitly_enabled_; | 2240 bool derivatives_explicitly_enabled_; |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2766 backbuffer_needs_clear_bits_(0), | 2767 backbuffer_needs_clear_bits_(0), |
| 2767 current_decoder_error_(error::kNoError), | 2768 current_decoder_error_(error::kNoError), |
| 2768 validators_(group_->feature_info()->validators()), | 2769 validators_(group_->feature_info()->validators()), |
| 2769 feature_info_(group_->feature_info()), | 2770 feature_info_(group_->feature_info()), |
| 2770 frame_number_(0), | 2771 frame_number_(0), |
| 2771 has_robustness_extension_(false), | 2772 has_robustness_extension_(false), |
| 2772 context_lost_reason_(error::kUnknown), | 2773 context_lost_reason_(error::kUnknown), |
| 2773 context_was_lost_(false), | 2774 context_was_lost_(false), |
| 2774 reset_by_robustness_extension_(false), | 2775 reset_by_robustness_extension_(false), |
| 2775 supports_post_sub_buffer_(false), | 2776 supports_post_sub_buffer_(false), |
| 2777 supports_commit_overlay_planes_(false), |
| 2776 supports_async_swap_(false), | 2778 supports_async_swap_(false), |
| 2777 context_type_(CONTEXT_TYPE_OPENGLES2), | 2779 context_type_(CONTEXT_TYPE_OPENGLES2), |
| 2778 derivatives_explicitly_enabled_(false), | 2780 derivatives_explicitly_enabled_(false), |
| 2779 frag_depth_explicitly_enabled_(false), | 2781 frag_depth_explicitly_enabled_(false), |
| 2780 draw_buffers_explicitly_enabled_(false), | 2782 draw_buffers_explicitly_enabled_(false), |
| 2781 shader_texture_lod_explicitly_enabled_(false), | 2783 shader_texture_lod_explicitly_enabled_(false), |
| 2782 compile_shader_always_succeeds_(false), | 2784 compile_shader_always_succeeds_(false), |
| 2783 lose_context_when_out_of_memory_(false), | 2785 lose_context_when_out_of_memory_(false), |
| 2784 service_logging_(base::CommandLine::InitializedForCurrentProcess() | 2786 service_logging_(base::CommandLine::InitializedForCurrentProcess() |
| 2785 ? base::CommandLine::ForCurrentProcess()->HasSwitch( | 2787 ? base::CommandLine::ForCurrentProcess()->HasSwitch( |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3217 glClearColor(0.0f, 0.0f, 0.0f, 0.0f); | 3219 glClearColor(0.0f, 0.0f, 0.0f, 0.0f); |
| 3218 } | 3220 } |
| 3219 } | 3221 } |
| 3220 | 3222 |
| 3221 supports_post_sub_buffer_ = surface->SupportsPostSubBuffer(); | 3223 supports_post_sub_buffer_ = surface->SupportsPostSubBuffer(); |
| 3222 if (feature_info_->workarounds() | 3224 if (feature_info_->workarounds() |
| 3223 .disable_post_sub_buffers_for_onscreen_surfaces && | 3225 .disable_post_sub_buffers_for_onscreen_surfaces && |
| 3224 !surface->IsOffscreen()) | 3226 !surface->IsOffscreen()) |
| 3225 supports_post_sub_buffer_ = false; | 3227 supports_post_sub_buffer_ = false; |
| 3226 | 3228 |
| 3229 supports_commit_overlay_planes_ = surface->SupportsCommitOverlayPlanes(); |
| 3230 |
| 3227 supports_async_swap_ = surface->SupportsAsyncSwap(); | 3231 supports_async_swap_ = surface->SupportsAsyncSwap(); |
| 3228 | 3232 |
| 3229 if (feature_info_->workarounds().reverse_point_sprite_coord_origin) { | 3233 if (feature_info_->workarounds().reverse_point_sprite_coord_origin) { |
| 3230 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); | 3234 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); |
| 3231 } | 3235 } |
| 3232 | 3236 |
| 3233 if (feature_info_->workarounds().unbind_fbo_on_context_switch) { | 3237 if (feature_info_->workarounds().unbind_fbo_on_context_switch) { |
| 3234 context_->SetUnbindFboOnMakeCurrent(); | 3238 context_->SetUnbindFboOnMakeCurrent(); |
| 3235 } | 3239 } |
| 3236 | 3240 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3360 caps.discard_framebuffer = | 3364 caps.discard_framebuffer = |
| 3361 feature_info_->feature_flags().ext_discard_framebuffer; | 3365 feature_info_->feature_flags().ext_discard_framebuffer; |
| 3362 caps.sync_query = feature_info_->feature_flags().chromium_sync_query; | 3366 caps.sync_query = feature_info_->feature_flags().chromium_sync_query; |
| 3363 | 3367 |
| 3364 #if defined(OS_MACOSX) | 3368 #if defined(OS_MACOSX) |
| 3365 // This is unconditionally true on mac, no need to test for it at runtime. | 3369 // This is unconditionally true on mac, no need to test for it at runtime. |
| 3366 caps.iosurface = true; | 3370 caps.iosurface = true; |
| 3367 #endif | 3371 #endif |
| 3368 | 3372 |
| 3369 caps.post_sub_buffer = supports_post_sub_buffer_; | 3373 caps.post_sub_buffer = supports_post_sub_buffer_; |
| 3374 caps.commit_overlay_planes = supports_commit_overlay_planes_; |
| 3370 caps.image = true; | 3375 caps.image = true; |
| 3371 caps.surfaceless = surfaceless_; | 3376 caps.surfaceless = surfaceless_; |
| 3372 | 3377 |
| 3373 caps.blend_equation_advanced = | 3378 caps.blend_equation_advanced = |
| 3374 feature_info_->feature_flags().blend_equation_advanced; | 3379 feature_info_->feature_flags().blend_equation_advanced; |
| 3375 caps.blend_equation_advanced_coherent = | 3380 caps.blend_equation_advanced_coherent = |
| 3376 feature_info_->feature_flags().blend_equation_advanced_coherent; | 3381 feature_info_->feature_flags().blend_equation_advanced_coherent; |
| 3377 caps.texture_rg = feature_info_->feature_flags().ext_texture_rg; | 3382 caps.texture_rg = feature_info_->feature_flags().ext_texture_rg; |
| 3378 caps.image_ycbcr_422 = | 3383 caps.image_ycbcr_422 = |
| 3379 feature_info_->feature_flags().chromium_image_ycbcr_422; | 3384 feature_info_->feature_flags().chromium_image_ycbcr_422; |
| (...skipping 8613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11993 if (result == gfx::SwapResult::SWAP_FAILED) { | 11998 if (result == gfx::SwapResult::SWAP_FAILED) { |
| 11994 LOG(ERROR) << "Context lost because SwapBuffers failed."; | 11999 LOG(ERROR) << "Context lost because SwapBuffers failed."; |
| 11995 if (!CheckResetStatus()) { | 12000 if (!CheckResetStatus()) { |
| 11996 MarkContextLost(error::kUnknown); | 12001 MarkContextLost(error::kUnknown); |
| 11997 group_->LoseContexts(error::kUnknown); | 12002 group_->LoseContexts(error::kUnknown); |
| 11998 } | 12003 } |
| 11999 } | 12004 } |
| 12000 } | 12005 } |
| 12001 | 12006 |
| 12002 void GLES2DecoderImpl::DoCommitOverlayPlanes() { | 12007 void GLES2DecoderImpl::DoCommitOverlayPlanes() { |
| 12003 // TODO(watk): crbug.com/560592 | 12008 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCommitOverlayPlanes"); |
| 12004 NOTIMPLEMENTED(); | 12009 if (supports_async_swap_) { |
| 12010 surface_->CommitOverlayPlanesAsync(base::Bind( |
| 12011 &GLES2DecoderImpl::FinishSwapBuffers, base::AsWeakPtr(this))); |
| 12012 } else { |
| 12013 FinishSwapBuffers(surface_->CommitOverlayPlanes()); |
| 12014 } |
| 12005 } | 12015 } |
| 12006 | 12016 |
| 12007 void GLES2DecoderImpl::DoSwapInterval(int interval) { | 12017 void GLES2DecoderImpl::DoSwapInterval(int interval) { |
| 12008 context_->SetSwapInterval(interval); | 12018 context_->SetSwapInterval(interval); |
| 12009 } | 12019 } |
| 12010 | 12020 |
| 12011 error::Error GLES2DecoderImpl::HandleEnableFeatureCHROMIUM( | 12021 error::Error GLES2DecoderImpl::HandleEnableFeatureCHROMIUM( |
| 12012 uint32 immediate_data_size, | 12022 uint32 immediate_data_size, |
| 12013 const void* cmd_data) { | 12023 const void* cmd_data) { |
| 12014 const gles2::cmds::EnableFeatureCHROMIUM& c = | 12024 const gles2::cmds::EnableFeatureCHROMIUM& c = |
| (...skipping 3521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15536 return error::kNoError; | 15546 return error::kNoError; |
| 15537 } | 15547 } |
| 15538 | 15548 |
| 15539 // Include the auto-generated part of this file. We split this because it means | 15549 // Include the auto-generated part of this file. We split this because it means |
| 15540 // we can easily edit the non-auto generated parts right here in this file | 15550 // we can easily edit the non-auto generated parts right here in this file |
| 15541 // instead of having to edit some template or the code generator. | 15551 // instead of having to edit some template or the code generator. |
| 15542 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 15552 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 15543 | 15553 |
| 15544 } // namespace gles2 | 15554 } // namespace gles2 |
| 15545 } // namespace gpu | 15555 } // namespace gpu |
| OLD | NEW |