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

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 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
2339 int commands_to_process_; 2342 int commands_to_process_;
2340 2343
2341 bool has_robustness_extension_; 2344 bool has_robustness_extension_;
2342 error::ContextLostReason context_lost_reason_; 2345 error::ContextLostReason context_lost_reason_;
2343 bool context_was_lost_; 2346 bool context_was_lost_;
2344 bool reset_by_robustness_extension_; 2347 bool reset_by_robustness_extension_;
2345 bool supports_post_sub_buffer_; 2348 bool supports_post_sub_buffer_;
2346 bool supports_swap_buffers_with_bounds_; 2349 bool supports_swap_buffers_with_bounds_;
2347 bool supports_commit_overlay_planes_; 2350 bool supports_commit_overlay_planes_;
2348 bool supports_async_swap_; 2351 bool supports_async_swap_;
2352 bool supports_set_draw_rectangle_ = false;
2349 2353
2350 // These flags are used to override the state of the shared feature_info_ 2354 // These flags are used to override the state of the shared feature_info_
2351 // member. Because the same FeatureInfo instance may be shared among many 2355 // member. Because the same FeatureInfo instance may be shared among many
2352 // contexts, the assumptions on the availablity of extensions in WebGL 2356 // contexts, the assumptions on the availablity of extensions in WebGL
2353 // contexts may be broken. These flags override the shared state to preserve 2357 // contexts may be broken. These flags override the shared state to preserve
2354 // WebGL semantics. 2358 // WebGL semantics.
2355 bool derivatives_explicitly_enabled_; 2359 bool derivatives_explicitly_enabled_;
2356 bool frag_depth_explicitly_enabled_; 2360 bool frag_depth_explicitly_enabled_;
2357 bool draw_buffers_explicitly_enabled_; 2361 bool draw_buffers_explicitly_enabled_;
2358 bool shader_texture_lod_explicitly_enabled_; 2362 bool shader_texture_lod_explicitly_enabled_;
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after
3553 .disable_post_sub_buffers_for_onscreen_surfaces && 3557 .disable_post_sub_buffers_for_onscreen_surfaces &&
3554 !surface->IsOffscreen()) 3558 !surface->IsOffscreen())
3555 supports_post_sub_buffer_ = false; 3559 supports_post_sub_buffer_ = false;
3556 3560
3557 supports_swap_buffers_with_bounds_ = surface->SupportsSwapBuffersWithBounds(); 3561 supports_swap_buffers_with_bounds_ = surface->SupportsSwapBuffersWithBounds();
3558 3562
3559 supports_commit_overlay_planes_ = surface->SupportsCommitOverlayPlanes(); 3563 supports_commit_overlay_planes_ = surface->SupportsCommitOverlayPlanes();
3560 3564
3561 supports_async_swap_ = surface->SupportsAsyncSwap(); 3565 supports_async_swap_ = surface->SupportsAsyncSwap();
3562 3566
3567 supports_set_draw_rectangle_ =
3568 !offscreen && surface->SupportsSetDrawRectangle();
3569
3563 if (workarounds().reverse_point_sprite_coord_origin) { 3570 if (workarounds().reverse_point_sprite_coord_origin) {
3564 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); 3571 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT);
3565 } 3572 }
3566 3573
3567 if (workarounds().unbind_fbo_on_context_switch) { 3574 if (workarounds().unbind_fbo_on_context_switch) {
3568 context_->SetUnbindFboOnMakeCurrent(); 3575 context_->SetUnbindFboOnMakeCurrent();
3569 } 3576 }
3570 3577
3571 if (workarounds().gl_clear_broken) { 3578 if (workarounds().gl_clear_broken) {
3572 DCHECK(!clear_framebuffer_blit_.get()); 3579 DCHECK(!clear_framebuffer_blit_.get());
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
3727 caps.iosurface = true; 3734 caps.iosurface = true;
3728 #endif 3735 #endif
3729 3736
3730 caps.post_sub_buffer = supports_post_sub_buffer_; 3737 caps.post_sub_buffer = supports_post_sub_buffer_;
3731 caps.swap_buffers_with_bounds = supports_swap_buffers_with_bounds_; 3738 caps.swap_buffers_with_bounds = supports_swap_buffers_with_bounds_;
3732 caps.commit_overlay_planes = supports_commit_overlay_planes_; 3739 caps.commit_overlay_planes = supports_commit_overlay_planes_;
3733 caps.surfaceless = surfaceless_; 3740 caps.surfaceless = surfaceless_;
3734 bool is_offscreen = !!offscreen_target_frame_buffer_.get(); 3741 bool is_offscreen = !!offscreen_target_frame_buffer_.get();
3735 caps.flips_vertically = !is_offscreen && surface_->FlipsVertically(); 3742 caps.flips_vertically = !is_offscreen && surface_->FlipsVertically();
3736 caps.msaa_is_slow = workarounds().msaa_is_slow; 3743 caps.msaa_is_slow = workarounds().msaa_is_slow;
3744 caps.set_draw_rectangle = supports_set_draw_rectangle_;
3737 3745
3738 caps.blend_equation_advanced = 3746 caps.blend_equation_advanced =
3739 feature_info_->feature_flags().blend_equation_advanced; 3747 feature_info_->feature_flags().blend_equation_advanced;
3740 caps.blend_equation_advanced_coherent = 3748 caps.blend_equation_advanced_coherent =
3741 feature_info_->feature_flags().blend_equation_advanced_coherent; 3749 feature_info_->feature_flags().blend_equation_advanced_coherent;
3742 caps.texture_rg = feature_info_->feature_flags().ext_texture_rg; 3750 caps.texture_rg = feature_info_->feature_flags().ext_texture_rg;
3743 caps.texture_half_float_linear = 3751 caps.texture_half_float_linear =
3744 feature_info_->feature_flags().enable_texture_half_float_linear; 3752 feature_info_->feature_flags().enable_texture_half_float_linear;
3745 caps.color_buffer_float = 3753 caps.color_buffer_float =
3746 feature_info_->feature_flags().enable_color_buffer_float; 3754 feature_info_->feature_flags().enable_color_buffer_float;
(...skipping 4928 matching lines...) Expand 10 before | Expand all | Expand 10 after
8675 GL_TEXTURE_EXTERNAL_OES, 0); 8683 GL_TEXTURE_EXTERNAL_OES, 0);
8676 if (!image) { 8684 if (!image) {
8677 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glOverlayPromotionHintCHROMIUM", 8685 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glOverlayPromotionHintCHROMIUM",
8678 "texture has no StreamTextureImage"); 8686 "texture has no StreamTextureImage");
8679 return; 8687 return;
8680 } 8688 }
8681 8689
8682 image->NotifyPromotionHint(promotion_hint != GL_FALSE, display_x, display_y); 8690 image->NotifyPromotionHint(promotion_hint != GL_FALSE, display_x, display_y);
8683 } 8691 }
8684 8692
8693 void GLES2DecoderImpl::DoSetDrawRectangleCHROMIUM(GLint x,
8694 GLint y,
8695 GLint width,
8696 GLint height) {
8697 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER);
8698 if (framebuffer) {
8699 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSetDrawRectangleCHROMIUM",
8700 "framebuffer must not be bound");
8701 return;
8702 }
8703 if (!supports_set_draw_rectangle_) {
8704 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSetDrawRectangleCHROMIUM",
8705 "surface doesn't support SetDrawRectangle");
8706 return;
8707 }
8708 gfx::Rect rect(x, y, width, height);
8709 if (!surface_->SetDrawRectangle(rect)) {
8710 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSetDrawRectangleCHROMIUM",
8711 "failed on surface");
8712 }
8713 }
8714
8685 void GLES2DecoderImpl::DoReadBuffer(GLenum src) { 8715 void GLES2DecoderImpl::DoReadBuffer(GLenum src) {
8686 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER); 8716 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER);
8687 if (framebuffer) { 8717 if (framebuffer) {
8688 if (src == GL_BACK) { 8718 if (src == GL_BACK) {
8689 LOCAL_SET_GL_ERROR( 8719 LOCAL_SET_GL_ERROR(
8690 GL_INVALID_ENUM, "glReadBuffer", 8720 GL_INVALID_ENUM, "glReadBuffer",
8691 "invalid src for a named framebuffer"); 8721 "invalid src for a named framebuffer");
8692 return; 8722 return;
8693 } 8723 }
8694 framebuffer->set_read_buffer(src); 8724 framebuffer->set_read_buffer(src);
(...skipping 10612 matching lines...) Expand 10 before | Expand all | Expand 10 after
19307 } 19337 }
19308 19338
19309 // Include the auto-generated part of this file. We split this because it means 19339 // Include the auto-generated part of this file. We split this because it means
19310 // we can easily edit the non-auto generated parts right here in this file 19340 // we can easily edit the non-auto generated parts right here in this file
19311 // instead of having to edit some template or the code generator. 19341 // instead of having to edit some template or the code generator.
19312 #include "base/macros.h" 19342 #include "base/macros.h"
19313 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 19343 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
19314 19344
19315 } // namespace gles2 19345 } // namespace gles2
19316 } // namespace gpu 19346 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698