Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 2646243002: Use IDCompositionSurface to implement DirectCompositionSurfaceWin. (Closed)
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1675 matching lines...) Expand 10 before | Expand all | Expand 10 after
1686 1686
1687 // Wrapper for glLinkProgram 1687 // Wrapper for glLinkProgram
1688 void DoLinkProgram(GLuint program); 1688 void DoLinkProgram(GLuint program);
1689 1689
1690 // Wrapper for glOverlayPromotionHintCHROMIUIM 1690 // Wrapper for glOverlayPromotionHintCHROMIUIM
1691 void DoOverlayPromotionHintCHROMIUM(GLuint client_id, 1691 void DoOverlayPromotionHintCHROMIUM(GLuint client_id,
1692 GLboolean promotion_hint, 1692 GLboolean promotion_hint,
1693 GLint display_x, 1693 GLint display_x,
1694 GLint display_y); 1694 GLint display_y);
1695 1695
1696 // Wrapper for glSetDrawRectangleCHROMIUM
1697 void DoSetDrawRectangleCHROMIUM(GLint x, GLint y, GLint width, GLint height);
1698
1696 // Wrapper for glReadBuffer 1699 // Wrapper for glReadBuffer
1697 void DoReadBuffer(GLenum src); 1700 void DoReadBuffer(GLenum src);
1698 1701
1699 // Wrapper for glRenderbufferStorage. 1702 // Wrapper for glRenderbufferStorage.
1700 void DoRenderbufferStorage( 1703 void DoRenderbufferStorage(
1701 GLenum target, GLenum internalformat, GLsizei width, GLsizei height); 1704 GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
1702 1705
1703 // Handler for glRenderbufferStorageMultisampleCHROMIUM. 1706 // Handler for glRenderbufferStorageMultisampleCHROMIUM.
1704 void DoRenderbufferStorageMultisampleCHROMIUM( 1707 void DoRenderbufferStorageMultisampleCHROMIUM(
1705 GLenum target, GLsizei samples, GLenum internalformat, 1708 GLenum target, GLsizei samples, GLenum internalformat,
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
2338 int commands_to_process_; 2341 int commands_to_process_;
2339 2342
2340 bool has_robustness_extension_; 2343 bool has_robustness_extension_;
2341 error::ContextLostReason context_lost_reason_; 2344 error::ContextLostReason context_lost_reason_;
2342 bool context_was_lost_; 2345 bool context_was_lost_;
2343 bool reset_by_robustness_extension_; 2346 bool reset_by_robustness_extension_;
2344 bool supports_post_sub_buffer_; 2347 bool supports_post_sub_buffer_;
2345 bool supports_swap_buffers_with_bounds_; 2348 bool supports_swap_buffers_with_bounds_;
2346 bool supports_commit_overlay_planes_; 2349 bool supports_commit_overlay_planes_;
2347 bool supports_async_swap_; 2350 bool supports_async_swap_;
2351 bool supports_set_draw_rectangle_ = false;
2348 2352
2349 // These flags are used to override the state of the shared feature_info_ 2353 // These flags are used to override the state of the shared feature_info_
2350 // member. Because the same FeatureInfo instance may be shared among many 2354 // member. Because the same FeatureInfo instance may be shared among many
2351 // contexts, the assumptions on the availablity of extensions in WebGL 2355 // contexts, the assumptions on the availablity of extensions in WebGL
2352 // contexts may be broken. These flags override the shared state to preserve 2356 // contexts may be broken. These flags override the shared state to preserve
2353 // WebGL semantics. 2357 // WebGL semantics.
2354 bool derivatives_explicitly_enabled_; 2358 bool derivatives_explicitly_enabled_;
2355 bool frag_depth_explicitly_enabled_; 2359 bool frag_depth_explicitly_enabled_;
2356 bool draw_buffers_explicitly_enabled_; 2360 bool draw_buffers_explicitly_enabled_;
2357 bool shader_texture_lod_explicitly_enabled_; 2361 bool shader_texture_lod_explicitly_enabled_;
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after
3552 .disable_post_sub_buffers_for_onscreen_surfaces && 3556 .disable_post_sub_buffers_for_onscreen_surfaces &&
3553 !surface->IsOffscreen()) 3557 !surface->IsOffscreen())
3554 supports_post_sub_buffer_ = false; 3558 supports_post_sub_buffer_ = false;
3555 3559
3556 supports_swap_buffers_with_bounds_ = surface->SupportsSwapBuffersWithBounds(); 3560 supports_swap_buffers_with_bounds_ = surface->SupportsSwapBuffersWithBounds();
3557 3561
3558 supports_commit_overlay_planes_ = surface->SupportsCommitOverlayPlanes(); 3562 supports_commit_overlay_planes_ = surface->SupportsCommitOverlayPlanes();
3559 3563
3560 supports_async_swap_ = surface->SupportsAsyncSwap(); 3564 supports_async_swap_ = surface->SupportsAsyncSwap();
3561 3565
3566 supports_set_draw_rectangle_ =
3567 !offscreen && surface->SupportsSetDrawRectangle();
3568
3562 if (workarounds().reverse_point_sprite_coord_origin) { 3569 if (workarounds().reverse_point_sprite_coord_origin) {
3563 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); 3570 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT);
3564 } 3571 }
3565 3572
3566 if (workarounds().unbind_fbo_on_context_switch) { 3573 if (workarounds().unbind_fbo_on_context_switch) {
3567 context_->SetUnbindFboOnMakeCurrent(); 3574 context_->SetUnbindFboOnMakeCurrent();
3568 } 3575 }
3569 3576
3570 if (workarounds().gl_clear_broken) { 3577 if (workarounds().gl_clear_broken) {
3571 DCHECK(!clear_framebuffer_blit_.get()); 3578 DCHECK(!clear_framebuffer_blit_.get());
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
3726 caps.iosurface = true; 3733 caps.iosurface = true;
3727 #endif 3734 #endif
3728 3735
3729 caps.post_sub_buffer = supports_post_sub_buffer_; 3736 caps.post_sub_buffer = supports_post_sub_buffer_;
3730 caps.swap_buffers_with_bounds = supports_swap_buffers_with_bounds_; 3737 caps.swap_buffers_with_bounds = supports_swap_buffers_with_bounds_;
3731 caps.commit_overlay_planes = supports_commit_overlay_planes_; 3738 caps.commit_overlay_planes = supports_commit_overlay_planes_;
3732 caps.surfaceless = surfaceless_; 3739 caps.surfaceless = surfaceless_;
3733 bool is_offscreen = !!offscreen_target_frame_buffer_.get(); 3740 bool is_offscreen = !!offscreen_target_frame_buffer_.get();
3734 caps.flips_vertically = !is_offscreen && surface_->FlipsVertically(); 3741 caps.flips_vertically = !is_offscreen && surface_->FlipsVertically();
3735 caps.msaa_is_slow = workarounds().msaa_is_slow; 3742 caps.msaa_is_slow = workarounds().msaa_is_slow;
3743 caps.set_draw_rectangle = supports_set_draw_rectangle_;
3736 3744
3737 caps.blend_equation_advanced = 3745 caps.blend_equation_advanced =
3738 feature_info_->feature_flags().blend_equation_advanced; 3746 feature_info_->feature_flags().blend_equation_advanced;
3739 caps.blend_equation_advanced_coherent = 3747 caps.blend_equation_advanced_coherent =
3740 feature_info_->feature_flags().blend_equation_advanced_coherent; 3748 feature_info_->feature_flags().blend_equation_advanced_coherent;
3741 caps.texture_rg = feature_info_->feature_flags().ext_texture_rg; 3749 caps.texture_rg = feature_info_->feature_flags().ext_texture_rg;
3742 caps.texture_half_float_linear = 3750 caps.texture_half_float_linear =
3743 feature_info_->feature_flags().enable_texture_half_float_linear; 3751 feature_info_->feature_flags().enable_texture_half_float_linear;
3744 caps.color_buffer_float = 3752 caps.color_buffer_float =
3745 feature_info_->feature_flags().enable_color_buffer_float; 3753 feature_info_->feature_flags().enable_color_buffer_float;
(...skipping 4928 matching lines...) Expand 10 before | Expand all | Expand 10 after
8674 GL_TEXTURE_EXTERNAL_OES, 0); 8682 GL_TEXTURE_EXTERNAL_OES, 0);
8675 if (!image) { 8683 if (!image) {
8676 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glOverlayPromotionHintCHROMIUM", 8684 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glOverlayPromotionHintCHROMIUM",
8677 "texture has no StreamTextureImage"); 8685 "texture has no StreamTextureImage");
8678 return; 8686 return;
8679 } 8687 }
8680 8688
8681 image->NotifyPromotionHint(promotion_hint != GL_FALSE, display_x, display_y); 8689 image->NotifyPromotionHint(promotion_hint != GL_FALSE, display_x, display_y);
8682 } 8690 }
8683 8691
8692 void GLES2DecoderImpl::DoSetDrawRectangleCHROMIUM(GLint x,
8693 GLint y,
8694 GLint width,
8695 GLint height) {
8696 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER);
8697 if (framebuffer) {
8698 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSetDrawRectangleCHROMIUM",
8699 "framebuffer must not be bound");
8700 return;
8701 }
8702 if (!supports_set_draw_rectangle_) {
8703 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSetDrawRectangleCHROMIUM",
8704 "surface doesn't support SetDrawRectangle");
8705 return;
8706 }
8707 gfx::Rect rect(x, y, width, height);
8708 if (!surface_->SetDrawRectangle(rect)) {
8709 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSetDrawRectangleCHROMIUM",
8710 "failed on surface");
8711 }
8712 }
8713
8684 void GLES2DecoderImpl::DoReadBuffer(GLenum src) { 8714 void GLES2DecoderImpl::DoReadBuffer(GLenum src) {
8685 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER); 8715 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER);
8686 if (framebuffer) { 8716 if (framebuffer) {
8687 if (src == GL_BACK) { 8717 if (src == GL_BACK) {
8688 LOCAL_SET_GL_ERROR( 8718 LOCAL_SET_GL_ERROR(
8689 GL_INVALID_ENUM, "glReadBuffer", 8719 GL_INVALID_ENUM, "glReadBuffer",
8690 "invalid src for a named framebuffer"); 8720 "invalid src for a named framebuffer");
8691 return; 8721 return;
8692 } 8722 }
8693 framebuffer->set_read_buffer(src); 8723 framebuffer->set_read_buffer(src);
(...skipping 10557 matching lines...) Expand 10 before | Expand all | Expand 10 after
19251 } 19281 }
19252 19282
19253 // Include the auto-generated part of this file. We split this because it means 19283 // Include the auto-generated part of this file. We split this because it means
19254 // we can easily edit the non-auto generated parts right here in this file 19284 // we can easily edit the non-auto generated parts right here in this file
19255 // instead of having to edit some template or the code generator. 19285 // instead of having to edit some template or the code generator.
19256 #include "base/macros.h" 19286 #include "base/macros.h"
19257 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 19287 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
19258 19288
19259 } // namespace gles2 19289 } // namespace gles2
19260 } // namespace gpu 19290 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698