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 <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 1672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1683 | 1683 |
1684 // Wrapper for glLinkProgram | 1684 // Wrapper for glLinkProgram |
1685 void DoLinkProgram(GLuint program); | 1685 void DoLinkProgram(GLuint program); |
1686 | 1686 |
1687 // Wrapper for glOverlayPromotionHintCHROMIUIM | 1687 // Wrapper for glOverlayPromotionHintCHROMIUIM |
1688 void DoOverlayPromotionHintCHROMIUM(GLuint client_id, | 1688 void DoOverlayPromotionHintCHROMIUM(GLuint client_id, |
1689 GLboolean promotion_hint, | 1689 GLboolean promotion_hint, |
1690 GLint display_x, | 1690 GLint display_x, |
1691 GLint display_y); | 1691 GLint display_y); |
1692 | 1692 |
1693 // Wrapper for glSetDrawRectangleCHROMIUM | |
1694 void DoSetDrawRectangleCHROMIUM(GLint x, GLint y, GLint width, GLint height); | |
1695 | |
1693 // Wrapper for glReadBuffer | 1696 // Wrapper for glReadBuffer |
1694 void DoReadBuffer(GLenum src); | 1697 void DoReadBuffer(GLenum src); |
1695 | 1698 |
1696 // Wrapper for glRenderbufferStorage. | 1699 // Wrapper for glRenderbufferStorage. |
1697 void DoRenderbufferStorage( | 1700 void DoRenderbufferStorage( |
1698 GLenum target, GLenum internalformat, GLsizei width, GLsizei height); | 1701 GLenum target, GLenum internalformat, GLsizei width, GLsizei height); |
1699 | 1702 |
1700 // Handler for glRenderbufferStorageMultisampleCHROMIUM. | 1703 // Handler for glRenderbufferStorageMultisampleCHROMIUM. |
1701 void DoRenderbufferStorageMultisampleCHROMIUM( | 1704 void DoRenderbufferStorageMultisampleCHROMIUM( |
1702 GLenum target, GLsizei samples, GLenum internalformat, | 1705 GLenum target, GLsizei samples, GLenum internalformat, |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2333 int commands_to_process_; | 2336 int commands_to_process_; |
2334 | 2337 |
2335 bool has_robustness_extension_; | 2338 bool has_robustness_extension_; |
2336 error::ContextLostReason context_lost_reason_; | 2339 error::ContextLostReason context_lost_reason_; |
2337 bool context_was_lost_; | 2340 bool context_was_lost_; |
2338 bool reset_by_robustness_extension_; | 2341 bool reset_by_robustness_extension_; |
2339 bool supports_post_sub_buffer_; | 2342 bool supports_post_sub_buffer_; |
2340 bool supports_swap_buffers_with_damage_; | 2343 bool supports_swap_buffers_with_damage_; |
2341 bool supports_commit_overlay_planes_; | 2344 bool supports_commit_overlay_planes_; |
2342 bool supports_async_swap_; | 2345 bool supports_async_swap_; |
2346 bool supports_set_draw_rectangle_ = false; | |
2343 | 2347 |
2344 // These flags are used to override the state of the shared feature_info_ | 2348 // These flags are used to override the state of the shared feature_info_ |
2345 // member. Because the same FeatureInfo instance may be shared among many | 2349 // member. Because the same FeatureInfo instance may be shared among many |
2346 // contexts, the assumptions on the availablity of extensions in WebGL | 2350 // contexts, the assumptions on the availablity of extensions in WebGL |
2347 // contexts may be broken. These flags override the shared state to preserve | 2351 // contexts may be broken. These flags override the shared state to preserve |
2348 // WebGL semantics. | 2352 // WebGL semantics. |
2349 bool derivatives_explicitly_enabled_; | 2353 bool derivatives_explicitly_enabled_; |
2350 bool frag_depth_explicitly_enabled_; | 2354 bool frag_depth_explicitly_enabled_; |
2351 bool draw_buffers_explicitly_enabled_; | 2355 bool draw_buffers_explicitly_enabled_; |
2352 bool shader_texture_lod_explicitly_enabled_; | 2356 bool shader_texture_lod_explicitly_enabled_; |
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3534 .disable_post_sub_buffers_for_onscreen_surfaces && | 3538 .disable_post_sub_buffers_for_onscreen_surfaces && |
3535 !surface->IsOffscreen()) | 3539 !surface->IsOffscreen()) |
3536 supports_post_sub_buffer_ = false; | 3540 supports_post_sub_buffer_ = false; |
3537 | 3541 |
3538 supports_swap_buffers_with_damage_ = surface->SupportsSwapBuffersWithDamage(); | 3542 supports_swap_buffers_with_damage_ = surface->SupportsSwapBuffersWithDamage(); |
3539 | 3543 |
3540 supports_commit_overlay_planes_ = surface->SupportsCommitOverlayPlanes(); | 3544 supports_commit_overlay_planes_ = surface->SupportsCommitOverlayPlanes(); |
3541 | 3545 |
3542 supports_async_swap_ = surface->SupportsAsyncSwap(); | 3546 supports_async_swap_ = surface->SupportsAsyncSwap(); |
3543 | 3547 |
3548 supports_set_draw_rectangle_ = | |
3549 !offscreen && surface->SupportsSetDrawRectangle(); | |
sunnyps
2017/01/28 01:33:58
nit: Won't surface->SupportsSetDrawRectangle only
| |
3550 | |
3544 if (workarounds().reverse_point_sprite_coord_origin) { | 3551 if (workarounds().reverse_point_sprite_coord_origin) { |
3545 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); | 3552 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); |
3546 } | 3553 } |
3547 | 3554 |
3548 if (workarounds().unbind_fbo_on_context_switch) { | 3555 if (workarounds().unbind_fbo_on_context_switch) { |
3549 context_->SetUnbindFboOnMakeCurrent(); | 3556 context_->SetUnbindFboOnMakeCurrent(); |
3550 } | 3557 } |
3551 | 3558 |
3552 if (workarounds().gl_clear_broken) { | 3559 if (workarounds().gl_clear_broken) { |
3553 DCHECK(!clear_framebuffer_blit_.get()); | 3560 DCHECK(!clear_framebuffer_blit_.get()); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3706 caps.iosurface = true; | 3713 caps.iosurface = true; |
3707 #endif | 3714 #endif |
3708 | 3715 |
3709 caps.post_sub_buffer = supports_post_sub_buffer_; | 3716 caps.post_sub_buffer = supports_post_sub_buffer_; |
3710 caps.swap_buffers_with_damage = supports_swap_buffers_with_damage_; | 3717 caps.swap_buffers_with_damage = supports_swap_buffers_with_damage_; |
3711 caps.commit_overlay_planes = supports_commit_overlay_planes_; | 3718 caps.commit_overlay_planes = supports_commit_overlay_planes_; |
3712 caps.surfaceless = surfaceless_; | 3719 caps.surfaceless = surfaceless_; |
3713 bool is_offscreen = !!offscreen_target_frame_buffer_.get(); | 3720 bool is_offscreen = !!offscreen_target_frame_buffer_.get(); |
3714 caps.flips_vertically = !is_offscreen && surface_->FlipsVertically(); | 3721 caps.flips_vertically = !is_offscreen && surface_->FlipsVertically(); |
3715 caps.msaa_is_slow = workarounds().msaa_is_slow; | 3722 caps.msaa_is_slow = workarounds().msaa_is_slow; |
3723 caps.set_draw_rectangle = supports_set_draw_rectangle_; | |
3716 | 3724 |
3717 caps.blend_equation_advanced = | 3725 caps.blend_equation_advanced = |
3718 feature_info_->feature_flags().blend_equation_advanced; | 3726 feature_info_->feature_flags().blend_equation_advanced; |
3719 caps.blend_equation_advanced_coherent = | 3727 caps.blend_equation_advanced_coherent = |
3720 feature_info_->feature_flags().blend_equation_advanced_coherent; | 3728 feature_info_->feature_flags().blend_equation_advanced_coherent; |
3721 caps.texture_rg = feature_info_->feature_flags().ext_texture_rg; | 3729 caps.texture_rg = feature_info_->feature_flags().ext_texture_rg; |
3722 caps.texture_half_float_linear = | 3730 caps.texture_half_float_linear = |
3723 feature_info_->feature_flags().enable_texture_half_float_linear; | 3731 feature_info_->feature_flags().enable_texture_half_float_linear; |
3724 caps.image_ycbcr_422 = | 3732 caps.image_ycbcr_422 = |
3725 feature_info_->feature_flags().chromium_image_ycbcr_422; | 3733 feature_info_->feature_flags().chromium_image_ycbcr_422; |
(...skipping 4909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8635 GL_TEXTURE_EXTERNAL_OES, 0); | 8643 GL_TEXTURE_EXTERNAL_OES, 0); |
8636 if (!image) { | 8644 if (!image) { |
8637 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glOverlayPromotionHintCHROMIUM", | 8645 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glOverlayPromotionHintCHROMIUM", |
8638 "texture has no StreamTextureImage"); | 8646 "texture has no StreamTextureImage"); |
8639 return; | 8647 return; |
8640 } | 8648 } |
8641 | 8649 |
8642 image->NotifyPromotionHint(promotion_hint != GL_FALSE, display_x, display_y); | 8650 image->NotifyPromotionHint(promotion_hint != GL_FALSE, display_x, display_y); |
8643 } | 8651 } |
8644 | 8652 |
8653 void GLES2DecoderImpl::DoSetDrawRectangleCHROMIUM(GLint x, | |
8654 GLint y, | |
8655 GLint width, | |
8656 GLint height) { | |
8657 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER); | |
8658 if (framebuffer) { | |
8659 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSetDrawRectangleCHROMIUM", | |
8660 "framebuffer must not be bound"); | |
8661 return; | |
8662 } | |
8663 if (!supports_set_draw_rectangle_) { | |
8664 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSetDrawRectangleCHROMIUM", | |
8665 "surface doesn't support SetDrawRectangle"); | |
8666 return; | |
8667 } | |
8668 gfx::Rect rect(x, y, width, height); | |
8669 if (!surface_->SetDrawRectangle(rect)) { | |
8670 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSetDrawRectangleCHROMIUM", | |
8671 "failed on surface"); | |
8672 } | |
8673 } | |
8674 | |
8645 void GLES2DecoderImpl::DoReadBuffer(GLenum src) { | 8675 void GLES2DecoderImpl::DoReadBuffer(GLenum src) { |
8646 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER); | 8676 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER); |
8647 if (framebuffer) { | 8677 if (framebuffer) { |
8648 if (src == GL_BACK) { | 8678 if (src == GL_BACK) { |
8649 LOCAL_SET_GL_ERROR( | 8679 LOCAL_SET_GL_ERROR( |
8650 GL_INVALID_ENUM, "glReadBuffer", | 8680 GL_INVALID_ENUM, "glReadBuffer", |
8651 "invalid src for a named framebuffer"); | 8681 "invalid src for a named framebuffer"); |
8652 return; | 8682 return; |
8653 } | 8683 } |
8654 framebuffer->set_read_buffer(src); | 8684 framebuffer->set_read_buffer(src); |
(...skipping 10478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
19133 } | 19163 } |
19134 | 19164 |
19135 // Include the auto-generated part of this file. We split this because it means | 19165 // Include the auto-generated part of this file. We split this because it means |
19136 // we can easily edit the non-auto generated parts right here in this file | 19166 // we can easily edit the non-auto generated parts right here in this file |
19137 // instead of having to edit some template or the code generator. | 19167 // instead of having to edit some template or the code generator. |
19138 #include "base/macros.h" | 19168 #include "base/macros.h" |
19139 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 19169 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
19140 | 19170 |
19141 } // namespace gles2 | 19171 } // namespace gles2 |
19142 } // namespace gpu | 19172 } // namespace gpu |
OLD | NEW |