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

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

Issue 2743663006: Allow switching DirectCompositionSurfaceWin between drawing modes. (Closed)
Patch Set: rebase Created 3 years, 9 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 1686 matching lines...) Expand 10 before | Expand all | Expand 10 after
1697 1697
1698 // Wrapper for glOverlayPromotionHintCHROMIUIM 1698 // Wrapper for glOverlayPromotionHintCHROMIUIM
1699 void DoOverlayPromotionHintCHROMIUM(GLuint client_id, 1699 void DoOverlayPromotionHintCHROMIUM(GLuint client_id,
1700 GLboolean promotion_hint, 1700 GLboolean promotion_hint,
1701 GLint display_x, 1701 GLint display_x,
1702 GLint display_y); 1702 GLint display_y);
1703 1703
1704 // Wrapper for glSetDrawRectangleCHROMIUM 1704 // Wrapper for glSetDrawRectangleCHROMIUM
1705 void DoSetDrawRectangleCHROMIUM(GLint x, GLint y, GLint width, GLint height); 1705 void DoSetDrawRectangleCHROMIUM(GLint x, GLint y, GLint width, GLint height);
1706 1706
1707 void DoSetEnableDCLayersCHROMIUM(GLboolean enable);
1708
1707 // Wrapper for glReadBuffer 1709 // Wrapper for glReadBuffer
1708 void DoReadBuffer(GLenum src); 1710 void DoReadBuffer(GLenum src);
1709 1711
1710 // Wrapper for glRenderbufferStorage. 1712 // Wrapper for glRenderbufferStorage.
1711 void DoRenderbufferStorage( 1713 void DoRenderbufferStorage(
1712 GLenum target, GLenum internalformat, GLsizei width, GLsizei height); 1714 GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
1713 1715
1714 // Handler for glRenderbufferStorageMultisampleCHROMIUM. 1716 // Handler for glRenderbufferStorageMultisampleCHROMIUM.
1715 void DoRenderbufferStorageMultisampleCHROMIUM( 1717 void DoRenderbufferStorageMultisampleCHROMIUM(
1716 GLenum target, GLsizei samples, GLenum internalformat, 1718 GLenum target, GLsizei samples, GLenum internalformat,
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
2362 int commands_to_process_; 2364 int commands_to_process_;
2363 2365
2364 bool has_robustness_extension_; 2366 bool has_robustness_extension_;
2365 error::ContextLostReason context_lost_reason_; 2367 error::ContextLostReason context_lost_reason_;
2366 bool context_was_lost_; 2368 bool context_was_lost_;
2367 bool reset_by_robustness_extension_; 2369 bool reset_by_robustness_extension_;
2368 bool supports_post_sub_buffer_; 2370 bool supports_post_sub_buffer_;
2369 bool supports_swap_buffers_with_bounds_; 2371 bool supports_swap_buffers_with_bounds_;
2370 bool supports_commit_overlay_planes_; 2372 bool supports_commit_overlay_planes_;
2371 bool supports_async_swap_; 2373 bool supports_async_swap_;
2372 bool supports_set_draw_rectangle_ = false; 2374 bool supports_dc_layers_ = false;
2373 2375
2374 // These flags are used to override the state of the shared feature_info_ 2376 // These flags are used to override the state of the shared feature_info_
2375 // member. Because the same FeatureInfo instance may be shared among many 2377 // member. Because the same FeatureInfo instance may be shared among many
2376 // contexts, the assumptions on the availablity of extensions in WebGL 2378 // contexts, the assumptions on the availablity of extensions in WebGL
2377 // contexts may be broken. These flags override the shared state to preserve 2379 // contexts may be broken. These flags override the shared state to preserve
2378 // WebGL semantics. 2380 // WebGL semantics.
2379 bool derivatives_explicitly_enabled_; 2381 bool derivatives_explicitly_enabled_;
2380 bool frag_depth_explicitly_enabled_; 2382 bool frag_depth_explicitly_enabled_;
2381 bool draw_buffers_explicitly_enabled_; 2383 bool draw_buffers_explicitly_enabled_;
2382 bool shader_texture_lod_explicitly_enabled_; 2384 bool shader_texture_lod_explicitly_enabled_;
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after
3587 .disable_post_sub_buffers_for_onscreen_surfaces && 3589 .disable_post_sub_buffers_for_onscreen_surfaces &&
3588 !surface->IsOffscreen()) 3590 !surface->IsOffscreen())
3589 supports_post_sub_buffer_ = false; 3591 supports_post_sub_buffer_ = false;
3590 3592
3591 supports_swap_buffers_with_bounds_ = surface->SupportsSwapBuffersWithBounds(); 3593 supports_swap_buffers_with_bounds_ = surface->SupportsSwapBuffersWithBounds();
3592 3594
3593 supports_commit_overlay_planes_ = surface->SupportsCommitOverlayPlanes(); 3595 supports_commit_overlay_planes_ = surface->SupportsCommitOverlayPlanes();
3594 3596
3595 supports_async_swap_ = surface->SupportsAsyncSwap(); 3597 supports_async_swap_ = surface->SupportsAsyncSwap();
3596 3598
3597 supports_set_draw_rectangle_ = 3599 supports_dc_layers_ = !offscreen && surface->SupportsDCLayers();
3598 !offscreen && surface->SupportsSetDrawRectangle();
3599 3600
3600 if (workarounds().reverse_point_sprite_coord_origin) { 3601 if (workarounds().reverse_point_sprite_coord_origin) {
3601 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); 3602 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT);
3602 } 3603 }
3603 3604
3604 if (workarounds().unbind_fbo_on_context_switch) { 3605 if (workarounds().unbind_fbo_on_context_switch) {
3605 context_->SetUnbindFboOnMakeCurrent(); 3606 context_->SetUnbindFboOnMakeCurrent();
3606 } 3607 }
3607 3608
3608 if (workarounds().gl_clear_broken) { 3609 if (workarounds().gl_clear_broken) {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
3764 caps.iosurface = true; 3765 caps.iosurface = true;
3765 #endif 3766 #endif
3766 3767
3767 caps.post_sub_buffer = supports_post_sub_buffer_; 3768 caps.post_sub_buffer = supports_post_sub_buffer_;
3768 caps.swap_buffers_with_bounds = supports_swap_buffers_with_bounds_; 3769 caps.swap_buffers_with_bounds = supports_swap_buffers_with_bounds_;
3769 caps.commit_overlay_planes = supports_commit_overlay_planes_; 3770 caps.commit_overlay_planes = supports_commit_overlay_planes_;
3770 caps.surfaceless = surfaceless_; 3771 caps.surfaceless = surfaceless_;
3771 bool is_offscreen = !!offscreen_target_frame_buffer_.get(); 3772 bool is_offscreen = !!offscreen_target_frame_buffer_.get();
3772 caps.flips_vertically = !is_offscreen && surface_->FlipsVertically(); 3773 caps.flips_vertically = !is_offscreen && surface_->FlipsVertically();
3773 caps.msaa_is_slow = workarounds().msaa_is_slow; 3774 caps.msaa_is_slow = workarounds().msaa_is_slow;
3774 caps.set_draw_rectangle = supports_set_draw_rectangle_; 3775 caps.dc_layers = supports_dc_layers_;
3775 3776
3776 caps.blend_equation_advanced = 3777 caps.blend_equation_advanced =
3777 feature_info_->feature_flags().blend_equation_advanced; 3778 feature_info_->feature_flags().blend_equation_advanced;
3778 caps.blend_equation_advanced_coherent = 3779 caps.blend_equation_advanced_coherent =
3779 feature_info_->feature_flags().blend_equation_advanced_coherent; 3780 feature_info_->feature_flags().blend_equation_advanced_coherent;
3780 caps.texture_rg = feature_info_->feature_flags().ext_texture_rg; 3781 caps.texture_rg = feature_info_->feature_flags().ext_texture_rg;
3781 caps.texture_half_float_linear = 3782 caps.texture_half_float_linear =
3782 feature_info_->feature_flags().enable_texture_half_float_linear; 3783 feature_info_->feature_flags().enable_texture_half_float_linear;
3783 caps.color_buffer_half_float_rgba = 3784 caps.color_buffer_half_float_rgba =
3784 feature_info_->feature_flags().enable_color_buffer_float || 3785 feature_info_->feature_flags().enable_color_buffer_float ||
(...skipping 1875 matching lines...) Expand 10 before | Expand all | Expand 10 after
5660 void GLES2DecoderImpl::OnFboChanged() const { 5661 void GLES2DecoderImpl::OnFboChanged() const {
5661 state_.fbo_binding_for_scissor_workaround_dirty = true; 5662 state_.fbo_binding_for_scissor_workaround_dirty = true;
5662 } 5663 }
5663 5664
5664 // Called after the FBO is checked for completeness. 5665 // Called after the FBO is checked for completeness.
5665 void GLES2DecoderImpl::OnUseFramebuffer() const { 5666 void GLES2DecoderImpl::OnUseFramebuffer() const {
5666 if (!state_.fbo_binding_for_scissor_workaround_dirty) 5667 if (!state_.fbo_binding_for_scissor_workaround_dirty)
5667 return; 5668 return;
5668 state_.fbo_binding_for_scissor_workaround_dirty = false; 5669 state_.fbo_binding_for_scissor_workaround_dirty = false;
5669 5670
5670 if (supports_set_draw_rectangle_) { 5671 if (supports_dc_layers_) {
5671 gfx::Vector2d draw_offset = GetBoundFramebufferDrawOffset(); 5672 gfx::Vector2d draw_offset = GetBoundFramebufferDrawOffset();
5672 glViewport(state_.viewport_x + draw_offset.x(), 5673 glViewport(state_.viewport_x + draw_offset.x(),
5673 state_.viewport_y + draw_offset.y(), state_.viewport_width, 5674 state_.viewport_y + draw_offset.y(), state_.viewport_width,
5674 state_.viewport_height); 5675 state_.viewport_height);
5675 } 5676 }
5676 5677
5677 if (workarounds().restore_scissor_on_fbo_change || 5678 if (workarounds().restore_scissor_on_fbo_change || supports_dc_layers_) {
5678 supports_set_draw_rectangle_) {
5679 // The driver forgets the correct scissor when modifying the FBO binding. 5679 // The driver forgets the correct scissor when modifying the FBO binding.
5680 gfx::Vector2d scissor_offset = GetBoundFramebufferDrawOffset(); 5680 gfx::Vector2d scissor_offset = GetBoundFramebufferDrawOffset();
5681 glScissor(state_.scissor_x + scissor_offset.x(), 5681 glScissor(state_.scissor_x + scissor_offset.x(),
5682 state_.scissor_y + scissor_offset.y(), state_.scissor_width, 5682 state_.scissor_y + scissor_offset.y(), state_.scissor_width,
5683 state_.scissor_height); 5683 state_.scissor_height);
5684 } 5684 }
5685 5685
5686 if (workarounds().restore_scissor_on_fbo_change) { 5686 if (workarounds().restore_scissor_on_fbo_change) {
5687 // crbug.com/222018 - Also on QualComm, the flush here avoids flicker, 5687 // crbug.com/222018 - Also on QualComm, the flush here avoids flicker,
5688 // it's unclear how this bug works. 5688 // it's unclear how this bug works.
(...skipping 3045 matching lines...) Expand 10 before | Expand all | Expand 10 after
8734 void GLES2DecoderImpl::DoSetDrawRectangleCHROMIUM(GLint x, 8734 void GLES2DecoderImpl::DoSetDrawRectangleCHROMIUM(GLint x,
8735 GLint y, 8735 GLint y,
8736 GLint width, 8736 GLint width,
8737 GLint height) { 8737 GLint height) {
8738 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER); 8738 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER);
8739 if (framebuffer) { 8739 if (framebuffer) {
8740 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSetDrawRectangleCHROMIUM", 8740 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSetDrawRectangleCHROMIUM",
8741 "framebuffer must not be bound"); 8741 "framebuffer must not be bound");
8742 return; 8742 return;
8743 } 8743 }
8744 if (!supports_set_draw_rectangle_) { 8744 if (!supports_dc_layers_) {
8745 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSetDrawRectangleCHROMIUM", 8745 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSetDrawRectangleCHROMIUM",
8746 "surface doesn't support SetDrawRectangle"); 8746 "surface doesn't support SetDrawRectangle");
8747 return; 8747 return;
8748 } 8748 }
8749 gfx::Rect rect(x, y, width, height); 8749 gfx::Rect rect(x, y, width, height);
8750 if (!surface_->SetDrawRectangle(rect)) { 8750 if (!surface_->SetDrawRectangle(rect)) {
8751 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSetDrawRectangleCHROMIUM", 8751 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSetDrawRectangleCHROMIUM",
8752 "failed on surface"); 8752 "failed on surface");
8753 } 8753 }
8754 OnFboChanged(); 8754 OnFboChanged();
8755 } 8755 }
8756 8756
8757 void GLES2DecoderImpl::DoSetEnableDCLayersCHROMIUM(GLboolean enable) {
8758 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER);
8759 if (framebuffer) {
8760 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSetEnableDCLayersCHROMIUM",
8761 "framebuffer must not be bound");
8762 return;
8763 }
8764 if (!supports_dc_layers_) {
8765 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSetEnableDCLayersCHROMIUM",
8766 "surface doesn't support SetDrawRectangle");
8767 return;
8768 }
8769 if (!surface_->SetEnableDCLayers(!!enable)) {
8770 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSetEnableDCLayersCHROMIUM",
8771 "failed on surface");
8772 }
8773 }
8774
8757 void GLES2DecoderImpl::DoReadBuffer(GLenum src) { 8775 void GLES2DecoderImpl::DoReadBuffer(GLenum src) {
8758 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER); 8776 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER);
8759 if (framebuffer) { 8777 if (framebuffer) {
8760 if (src == GL_BACK) { 8778 if (src == GL_BACK) {
8761 LOCAL_SET_GL_ERROR( 8779 LOCAL_SET_GL_ERROR(
8762 GL_INVALID_ENUM, "glReadBuffer", 8780 GL_INVALID_ENUM, "glReadBuffer",
8763 "invalid src for a named framebuffer"); 8781 "invalid src for a named framebuffer");
8764 return; 8782 return;
8765 } 8783 }
8766 framebuffer->set_read_buffer(src); 8784 framebuffer->set_read_buffer(src);
(...skipping 10729 matching lines...) Expand 10 before | Expand all | Expand 10 after
19496 } 19514 }
19497 19515
19498 // Include the auto-generated part of this file. We split this because it means 19516 // Include the auto-generated part of this file. We split this because it means
19499 // we can easily edit the non-auto generated parts right here in this file 19517 // we can easily edit the non-auto generated parts right here in this file
19500 // instead of having to edit some template or the code generator. 19518 // instead of having to edit some template or the code generator.
19501 #include "base/macros.h" 19519 #include "base/macros.h"
19502 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 19520 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
19503 19521
19504 } // namespace gles2 19522 } // namespace gles2
19505 } // namespace gpu 19523 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/common/gles2_cmd_ids_autogen.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698