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 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1689 | 1689 |
1690 // Wrapper for glLinkProgram | 1690 // Wrapper for glLinkProgram |
1691 void DoLinkProgram(GLuint program); | 1691 void DoLinkProgram(GLuint program); |
1692 | 1692 |
1693 // Wrapper for glOverlayPromotionHintCHROMIUIM | 1693 // Wrapper for glOverlayPromotionHintCHROMIUIM |
1694 void DoOverlayPromotionHintCHROMIUM(GLuint client_id, | 1694 void DoOverlayPromotionHintCHROMIUM(GLuint client_id, |
1695 GLboolean promotion_hint, | 1695 GLboolean promotion_hint, |
1696 GLint display_x, | 1696 GLint display_x, |
1697 GLint display_y); | 1697 GLint display_y); |
1698 | 1698 |
| 1699 // Wrapper for glSetDrawRectangleCHROMIUM |
| 1700 void DoSetDrawRectangleCHROMIUM(GLint x, GLint y, GLint width, GLint height); |
| 1701 |
1699 // Wrapper for glReadBuffer | 1702 // Wrapper for glReadBuffer |
1700 void DoReadBuffer(GLenum src); | 1703 void DoReadBuffer(GLenum src); |
1701 | 1704 |
1702 // Wrapper for glRenderbufferStorage. | 1705 // Wrapper for glRenderbufferStorage. |
1703 void DoRenderbufferStorage( | 1706 void DoRenderbufferStorage( |
1704 GLenum target, GLenum internalformat, GLsizei width, GLsizei height); | 1707 GLenum target, GLenum internalformat, GLsizei width, GLsizei height); |
1705 | 1708 |
1706 // Handler for glRenderbufferStorageMultisampleCHROMIUM. | 1709 // Handler for glRenderbufferStorageMultisampleCHROMIUM. |
1707 void DoRenderbufferStorageMultisampleCHROMIUM( | 1710 void DoRenderbufferStorageMultisampleCHROMIUM( |
1708 GLenum target, GLsizei samples, GLenum internalformat, | 1711 GLenum target, GLsizei samples, GLenum internalformat, |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2341 int commands_to_process_; | 2344 int commands_to_process_; |
2342 | 2345 |
2343 bool has_robustness_extension_; | 2346 bool has_robustness_extension_; |
2344 error::ContextLostReason context_lost_reason_; | 2347 error::ContextLostReason context_lost_reason_; |
2345 bool context_was_lost_; | 2348 bool context_was_lost_; |
2346 bool reset_by_robustness_extension_; | 2349 bool reset_by_robustness_extension_; |
2347 bool supports_post_sub_buffer_; | 2350 bool supports_post_sub_buffer_; |
2348 bool supports_swap_buffers_with_bounds_; | 2351 bool supports_swap_buffers_with_bounds_; |
2349 bool supports_commit_overlay_planes_; | 2352 bool supports_commit_overlay_planes_; |
2350 bool supports_async_swap_; | 2353 bool supports_async_swap_; |
| 2354 bool supports_set_draw_rectangle_ = false; |
2351 | 2355 |
2352 // These flags are used to override the state of the shared feature_info_ | 2356 // These flags are used to override the state of the shared feature_info_ |
2353 // member. Because the same FeatureInfo instance may be shared among many | 2357 // member. Because the same FeatureInfo instance may be shared among many |
2354 // contexts, the assumptions on the availablity of extensions in WebGL | 2358 // contexts, the assumptions on the availablity of extensions in WebGL |
2355 // contexts may be broken. These flags override the shared state to preserve | 2359 // contexts may be broken. These flags override the shared state to preserve |
2356 // WebGL semantics. | 2360 // WebGL semantics. |
2357 bool derivatives_explicitly_enabled_; | 2361 bool derivatives_explicitly_enabled_; |
2358 bool frag_depth_explicitly_enabled_; | 2362 bool frag_depth_explicitly_enabled_; |
2359 bool draw_buffers_explicitly_enabled_; | 2363 bool draw_buffers_explicitly_enabled_; |
2360 bool shader_texture_lod_explicitly_enabled_; | 2364 bool shader_texture_lod_explicitly_enabled_; |
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3555 .disable_post_sub_buffers_for_onscreen_surfaces && | 3559 .disable_post_sub_buffers_for_onscreen_surfaces && |
3556 !surface->IsOffscreen()) | 3560 !surface->IsOffscreen()) |
3557 supports_post_sub_buffer_ = false; | 3561 supports_post_sub_buffer_ = false; |
3558 | 3562 |
3559 supports_swap_buffers_with_bounds_ = surface->SupportsSwapBuffersWithBounds(); | 3563 supports_swap_buffers_with_bounds_ = surface->SupportsSwapBuffersWithBounds(); |
3560 | 3564 |
3561 supports_commit_overlay_planes_ = surface->SupportsCommitOverlayPlanes(); | 3565 supports_commit_overlay_planes_ = surface->SupportsCommitOverlayPlanes(); |
3562 | 3566 |
3563 supports_async_swap_ = surface->SupportsAsyncSwap(); | 3567 supports_async_swap_ = surface->SupportsAsyncSwap(); |
3564 | 3568 |
| 3569 supports_set_draw_rectangle_ = |
| 3570 !offscreen && surface->SupportsSetDrawRectangle(); |
| 3571 |
3565 if (workarounds().reverse_point_sprite_coord_origin) { | 3572 if (workarounds().reverse_point_sprite_coord_origin) { |
3566 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); | 3573 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); |
3567 } | 3574 } |
3568 | 3575 |
3569 if (workarounds().unbind_fbo_on_context_switch) { | 3576 if (workarounds().unbind_fbo_on_context_switch) { |
3570 context_->SetUnbindFboOnMakeCurrent(); | 3577 context_->SetUnbindFboOnMakeCurrent(); |
3571 } | 3578 } |
3572 | 3579 |
3573 if (workarounds().gl_clear_broken) { | 3580 if (workarounds().gl_clear_broken) { |
3574 DCHECK(!clear_framebuffer_blit_.get()); | 3581 DCHECK(!clear_framebuffer_blit_.get()); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3729 caps.iosurface = true; | 3736 caps.iosurface = true; |
3730 #endif | 3737 #endif |
3731 | 3738 |
3732 caps.post_sub_buffer = supports_post_sub_buffer_; | 3739 caps.post_sub_buffer = supports_post_sub_buffer_; |
3733 caps.swap_buffers_with_bounds = supports_swap_buffers_with_bounds_; | 3740 caps.swap_buffers_with_bounds = supports_swap_buffers_with_bounds_; |
3734 caps.commit_overlay_planes = supports_commit_overlay_planes_; | 3741 caps.commit_overlay_planes = supports_commit_overlay_planes_; |
3735 caps.surfaceless = surfaceless_; | 3742 caps.surfaceless = surfaceless_; |
3736 bool is_offscreen = !!offscreen_target_frame_buffer_.get(); | 3743 bool is_offscreen = !!offscreen_target_frame_buffer_.get(); |
3737 caps.flips_vertically = !is_offscreen && surface_->FlipsVertically(); | 3744 caps.flips_vertically = !is_offscreen && surface_->FlipsVertically(); |
3738 caps.msaa_is_slow = workarounds().msaa_is_slow; | 3745 caps.msaa_is_slow = workarounds().msaa_is_slow; |
| 3746 caps.set_draw_rectangle = supports_set_draw_rectangle_; |
3739 | 3747 |
3740 caps.blend_equation_advanced = | 3748 caps.blend_equation_advanced = |
3741 feature_info_->feature_flags().blend_equation_advanced; | 3749 feature_info_->feature_flags().blend_equation_advanced; |
3742 caps.blend_equation_advanced_coherent = | 3750 caps.blend_equation_advanced_coherent = |
3743 feature_info_->feature_flags().blend_equation_advanced_coherent; | 3751 feature_info_->feature_flags().blend_equation_advanced_coherent; |
3744 caps.texture_rg = feature_info_->feature_flags().ext_texture_rg; | 3752 caps.texture_rg = feature_info_->feature_flags().ext_texture_rg; |
3745 caps.texture_half_float_linear = | 3753 caps.texture_half_float_linear = |
3746 feature_info_->feature_flags().enable_texture_half_float_linear; | 3754 feature_info_->feature_flags().enable_texture_half_float_linear; |
3747 caps.color_buffer_float = | 3755 caps.color_buffer_float = |
3748 feature_info_->feature_flags().enable_color_buffer_float; | 3756 feature_info_->feature_flags().enable_color_buffer_float; |
(...skipping 4937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8686 GL_TEXTURE_EXTERNAL_OES, 0); | 8694 GL_TEXTURE_EXTERNAL_OES, 0); |
8687 if (!image) { | 8695 if (!image) { |
8688 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glOverlayPromotionHintCHROMIUM", | 8696 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glOverlayPromotionHintCHROMIUM", |
8689 "texture has no StreamTextureImage"); | 8697 "texture has no StreamTextureImage"); |
8690 return; | 8698 return; |
8691 } | 8699 } |
8692 | 8700 |
8693 image->NotifyPromotionHint(promotion_hint != GL_FALSE, display_x, display_y); | 8701 image->NotifyPromotionHint(promotion_hint != GL_FALSE, display_x, display_y); |
8694 } | 8702 } |
8695 | 8703 |
| 8704 void GLES2DecoderImpl::DoSetDrawRectangleCHROMIUM(GLint x, |
| 8705 GLint y, |
| 8706 GLint width, |
| 8707 GLint height) { |
| 8708 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER); |
| 8709 if (framebuffer) { |
| 8710 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSetDrawRectangleCHROMIUM", |
| 8711 "framebuffer must not be bound"); |
| 8712 return; |
| 8713 } |
| 8714 if (!supports_set_draw_rectangle_) { |
| 8715 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSetDrawRectangleCHROMIUM", |
| 8716 "surface doesn't support SetDrawRectangle"); |
| 8717 return; |
| 8718 } |
| 8719 gfx::Rect rect(x, y, width, height); |
| 8720 if (!surface_->SetDrawRectangle(rect)) { |
| 8721 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSetDrawRectangleCHROMIUM", |
| 8722 "failed on surface"); |
| 8723 } |
| 8724 } |
| 8725 |
8696 void GLES2DecoderImpl::DoReadBuffer(GLenum src) { | 8726 void GLES2DecoderImpl::DoReadBuffer(GLenum src) { |
8697 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER); | 8727 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER); |
8698 if (framebuffer) { | 8728 if (framebuffer) { |
8699 if (src == GL_BACK) { | 8729 if (src == GL_BACK) { |
8700 LOCAL_SET_GL_ERROR( | 8730 LOCAL_SET_GL_ERROR( |
8701 GL_INVALID_ENUM, "glReadBuffer", | 8731 GL_INVALID_ENUM, "glReadBuffer", |
8702 "invalid src for a named framebuffer"); | 8732 "invalid src for a named framebuffer"); |
8703 return; | 8733 return; |
8704 } | 8734 } |
8705 framebuffer->set_read_buffer(src); | 8735 framebuffer->set_read_buffer(src); |
(...skipping 10540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19246 } | 19276 } |
19247 | 19277 |
19248 // Include the auto-generated part of this file. We split this because it means | 19278 // Include the auto-generated part of this file. We split this because it means |
19249 // we can easily edit the non-auto generated parts right here in this file | 19279 // we can easily edit the non-auto generated parts right here in this file |
19250 // instead of having to edit some template or the code generator. | 19280 // instead of having to edit some template or the code generator. |
19251 #include "base/macros.h" | 19281 #include "base/macros.h" |
19252 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 19282 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
19253 | 19283 |
19254 } // namespace gles2 | 19284 } // namespace gles2 |
19255 } // namespace gpu | 19285 } // namespace gpu |
OLD | NEW |