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 1674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1685 | 1685 |
1686 // Wrapper for glLinkProgram | 1686 // Wrapper for glLinkProgram |
1687 void DoLinkProgram(GLuint program); | 1687 void DoLinkProgram(GLuint program); |
1688 | 1688 |
1689 // Wrapper for glOverlayPromotionHintCHROMIUIM | 1689 // Wrapper for glOverlayPromotionHintCHROMIUIM |
1690 void DoOverlayPromotionHintCHROMIUM(GLuint client_id, | 1690 void DoOverlayPromotionHintCHROMIUM(GLuint client_id, |
1691 GLboolean promotion_hint, | 1691 GLboolean promotion_hint, |
1692 GLint display_x, | 1692 GLint display_x, |
1693 GLint display_y); | 1693 GLint display_y); |
1694 | 1694 |
| 1695 // Wrapper for glSetDrawRectangleCHROMIUM |
| 1696 void DoSetDrawRectangleCHROMIUM(GLint x, GLint y, GLint width, GLint height); |
| 1697 |
1695 // Wrapper for glReadBuffer | 1698 // Wrapper for glReadBuffer |
1696 void DoReadBuffer(GLenum src); | 1699 void DoReadBuffer(GLenum src); |
1697 | 1700 |
1698 // Wrapper for glRenderbufferStorage. | 1701 // Wrapper for glRenderbufferStorage. |
1699 void DoRenderbufferStorage( | 1702 void DoRenderbufferStorage( |
1700 GLenum target, GLenum internalformat, GLsizei width, GLsizei height); | 1703 GLenum target, GLenum internalformat, GLsizei width, GLsizei height); |
1701 | 1704 |
1702 // Handler for glRenderbufferStorageMultisampleCHROMIUM. | 1705 // Handler for glRenderbufferStorageMultisampleCHROMIUM. |
1703 void DoRenderbufferStorageMultisampleCHROMIUM( | 1706 void DoRenderbufferStorageMultisampleCHROMIUM( |
1704 GLenum target, GLsizei samples, GLenum internalformat, | 1707 GLenum target, GLsizei samples, GLenum internalformat, |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2337 int commands_to_process_; | 2340 int commands_to_process_; |
2338 | 2341 |
2339 bool has_robustness_extension_; | 2342 bool has_robustness_extension_; |
2340 error::ContextLostReason context_lost_reason_; | 2343 error::ContextLostReason context_lost_reason_; |
2341 bool context_was_lost_; | 2344 bool context_was_lost_; |
2342 bool reset_by_robustness_extension_; | 2345 bool reset_by_robustness_extension_; |
2343 bool supports_post_sub_buffer_; | 2346 bool supports_post_sub_buffer_; |
2344 bool supports_swap_buffers_with_damage_; | 2347 bool supports_swap_buffers_with_damage_; |
2345 bool supports_commit_overlay_planes_; | 2348 bool supports_commit_overlay_planes_; |
2346 bool supports_async_swap_; | 2349 bool supports_async_swap_; |
| 2350 bool supports_set_draw_rectangle_ = false; |
2347 | 2351 |
2348 // These flags are used to override the state of the shared feature_info_ | 2352 // These flags are used to override the state of the shared feature_info_ |
2349 // member. Because the same FeatureInfo instance may be shared among many | 2353 // member. Because the same FeatureInfo instance may be shared among many |
2350 // contexts, the assumptions on the availablity of extensions in WebGL | 2354 // contexts, the assumptions on the availablity of extensions in WebGL |
2351 // contexts may be broken. These flags override the shared state to preserve | 2355 // contexts may be broken. These flags override the shared state to preserve |
2352 // WebGL semantics. | 2356 // WebGL semantics. |
2353 bool derivatives_explicitly_enabled_; | 2357 bool derivatives_explicitly_enabled_; |
2354 bool frag_depth_explicitly_enabled_; | 2358 bool frag_depth_explicitly_enabled_; |
2355 bool draw_buffers_explicitly_enabled_; | 2359 bool draw_buffers_explicitly_enabled_; |
2356 bool shader_texture_lod_explicitly_enabled_; | 2360 bool shader_texture_lod_explicitly_enabled_; |
(...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3541 .disable_post_sub_buffers_for_onscreen_surfaces && | 3545 .disable_post_sub_buffers_for_onscreen_surfaces && |
3542 !surface->IsOffscreen()) | 3546 !surface->IsOffscreen()) |
3543 supports_post_sub_buffer_ = false; | 3547 supports_post_sub_buffer_ = false; |
3544 | 3548 |
3545 supports_swap_buffers_with_damage_ = surface->SupportsSwapBuffersWithDamage(); | 3549 supports_swap_buffers_with_damage_ = surface->SupportsSwapBuffersWithDamage(); |
3546 | 3550 |
3547 supports_commit_overlay_planes_ = surface->SupportsCommitOverlayPlanes(); | 3551 supports_commit_overlay_planes_ = surface->SupportsCommitOverlayPlanes(); |
3548 | 3552 |
3549 supports_async_swap_ = surface->SupportsAsyncSwap(); | 3553 supports_async_swap_ = surface->SupportsAsyncSwap(); |
3550 | 3554 |
| 3555 supports_set_draw_rectangle_ = |
| 3556 !offscreen && surface->SupportsSetDrawRectangle(); |
| 3557 |
3551 if (workarounds().reverse_point_sprite_coord_origin) { | 3558 if (workarounds().reverse_point_sprite_coord_origin) { |
3552 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); | 3559 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); |
3553 } | 3560 } |
3554 | 3561 |
3555 if (workarounds().unbind_fbo_on_context_switch) { | 3562 if (workarounds().unbind_fbo_on_context_switch) { |
3556 context_->SetUnbindFboOnMakeCurrent(); | 3563 context_->SetUnbindFboOnMakeCurrent(); |
3557 } | 3564 } |
3558 | 3565 |
3559 if (workarounds().gl_clear_broken) { | 3566 if (workarounds().gl_clear_broken) { |
3560 DCHECK(!clear_framebuffer_blit_.get()); | 3567 DCHECK(!clear_framebuffer_blit_.get()); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3713 caps.iosurface = true; | 3720 caps.iosurface = true; |
3714 #endif | 3721 #endif |
3715 | 3722 |
3716 caps.post_sub_buffer = supports_post_sub_buffer_; | 3723 caps.post_sub_buffer = supports_post_sub_buffer_; |
3717 caps.swap_buffers_with_damage = supports_swap_buffers_with_damage_; | 3724 caps.swap_buffers_with_damage = supports_swap_buffers_with_damage_; |
3718 caps.commit_overlay_planes = supports_commit_overlay_planes_; | 3725 caps.commit_overlay_planes = supports_commit_overlay_planes_; |
3719 caps.surfaceless = surfaceless_; | 3726 caps.surfaceless = surfaceless_; |
3720 bool is_offscreen = !!offscreen_target_frame_buffer_.get(); | 3727 bool is_offscreen = !!offscreen_target_frame_buffer_.get(); |
3721 caps.flips_vertically = !is_offscreen && surface_->FlipsVertically(); | 3728 caps.flips_vertically = !is_offscreen && surface_->FlipsVertically(); |
3722 caps.msaa_is_slow = workarounds().msaa_is_slow; | 3729 caps.msaa_is_slow = workarounds().msaa_is_slow; |
| 3730 caps.set_draw_rectangle = supports_set_draw_rectangle_; |
3723 | 3731 |
3724 caps.blend_equation_advanced = | 3732 caps.blend_equation_advanced = |
3725 feature_info_->feature_flags().blend_equation_advanced; | 3733 feature_info_->feature_flags().blend_equation_advanced; |
3726 caps.blend_equation_advanced_coherent = | 3734 caps.blend_equation_advanced_coherent = |
3727 feature_info_->feature_flags().blend_equation_advanced_coherent; | 3735 feature_info_->feature_flags().blend_equation_advanced_coherent; |
3728 caps.texture_rg = feature_info_->feature_flags().ext_texture_rg; | 3736 caps.texture_rg = feature_info_->feature_flags().ext_texture_rg; |
3729 caps.texture_half_float_linear = | 3737 caps.texture_half_float_linear = |
3730 feature_info_->feature_flags().enable_texture_half_float_linear; | 3738 feature_info_->feature_flags().enable_texture_half_float_linear; |
3731 caps.image_ycbcr_422 = | 3739 caps.image_ycbcr_422 = |
3732 feature_info_->feature_flags().chromium_image_ycbcr_422; | 3740 feature_info_->feature_flags().chromium_image_ycbcr_422; |
(...skipping 4909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8642 GL_TEXTURE_EXTERNAL_OES, 0); | 8650 GL_TEXTURE_EXTERNAL_OES, 0); |
8643 if (!image) { | 8651 if (!image) { |
8644 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glOverlayPromotionHintCHROMIUM", | 8652 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glOverlayPromotionHintCHROMIUM", |
8645 "texture has no StreamTextureImage"); | 8653 "texture has no StreamTextureImage"); |
8646 return; | 8654 return; |
8647 } | 8655 } |
8648 | 8656 |
8649 image->NotifyPromotionHint(promotion_hint != GL_FALSE, display_x, display_y); | 8657 image->NotifyPromotionHint(promotion_hint != GL_FALSE, display_x, display_y); |
8650 } | 8658 } |
8651 | 8659 |
| 8660 void GLES2DecoderImpl::DoSetDrawRectangleCHROMIUM(GLint x, |
| 8661 GLint y, |
| 8662 GLint width, |
| 8663 GLint height) { |
| 8664 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER); |
| 8665 if (framebuffer) { |
| 8666 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSetDrawRectangleCHROMIUM", |
| 8667 "framebuffer must not be bound"); |
| 8668 return; |
| 8669 } |
| 8670 if (!supports_set_draw_rectangle_) { |
| 8671 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSetDrawRectangleCHROMIUM", |
| 8672 "surface doesn't support SetDrawRectangle"); |
| 8673 return; |
| 8674 } |
| 8675 gfx::Rect rect(x, y, width, height); |
| 8676 if (!surface_->SetDrawRectangle(rect)) { |
| 8677 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSetDrawRectangleCHROMIUM", |
| 8678 "failed on surface"); |
| 8679 } |
| 8680 } |
| 8681 |
8652 void GLES2DecoderImpl::DoReadBuffer(GLenum src) { | 8682 void GLES2DecoderImpl::DoReadBuffer(GLenum src) { |
8653 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER); | 8683 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER); |
8654 if (framebuffer) { | 8684 if (framebuffer) { |
8655 if (src == GL_BACK) { | 8685 if (src == GL_BACK) { |
8656 LOCAL_SET_GL_ERROR( | 8686 LOCAL_SET_GL_ERROR( |
8657 GL_INVALID_ENUM, "glReadBuffer", | 8687 GL_INVALID_ENUM, "glReadBuffer", |
8658 "invalid src for a named framebuffer"); | 8688 "invalid src for a named framebuffer"); |
8659 return; | 8689 return; |
8660 } | 8690 } |
8661 framebuffer->set_read_buffer(src); | 8691 framebuffer->set_read_buffer(src); |
(...skipping 10535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19197 } | 19227 } |
19198 | 19228 |
19199 // Include the auto-generated part of this file. We split this because it means | 19229 // Include the auto-generated part of this file. We split this because it means |
19200 // we can easily edit the non-auto generated parts right here in this file | 19230 // we can easily edit the non-auto generated parts right here in this file |
19201 // instead of having to edit some template or the code generator. | 19231 // instead of having to edit some template or the code generator. |
19202 #include "base/macros.h" | 19232 #include "base/macros.h" |
19203 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 19233 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
19204 | 19234 |
19205 } // namespace gles2 | 19235 } // namespace gles2 |
19206 } // namespace gpu | 19236 } // namespace gpu |
OLD | NEW |