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 <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 | 643 |
644 virtual void ClearAllAttributes() const OVERRIDE; | 644 virtual void ClearAllAttributes() const OVERRIDE; |
645 virtual void RestoreAllAttributes() const OVERRIDE; | 645 virtual void RestoreAllAttributes() const OVERRIDE; |
646 | 646 |
647 virtual QueryManager* GetQueryManager() OVERRIDE { | 647 virtual QueryManager* GetQueryManager() OVERRIDE { |
648 return query_manager_.get(); | 648 return query_manager_.get(); |
649 } | 649 } |
650 virtual VertexArrayManager* GetVertexArrayManager() OVERRIDE { | 650 virtual VertexArrayManager* GetVertexArrayManager() OVERRIDE { |
651 return vertex_array_manager_.get(); | 651 return vertex_array_manager_.get(); |
652 } | 652 } |
| 653 virtual ImageManager* GetImageManager() OVERRIDE { |
| 654 return image_manager_.get(); |
| 655 } |
653 virtual bool ProcessPendingQueries() OVERRIDE; | 656 virtual bool ProcessPendingQueries() OVERRIDE; |
654 virtual bool HasMoreIdleWork() OVERRIDE; | 657 virtual bool HasMoreIdleWork() OVERRIDE; |
655 virtual void PerformIdleWork() OVERRIDE; | 658 virtual void PerformIdleWork() OVERRIDE; |
656 | 659 |
657 virtual void WaitForReadPixels(base::Closure callback) OVERRIDE; | 660 virtual void WaitForReadPixels(base::Closure callback) OVERRIDE; |
658 | 661 |
659 virtual void SetResizeCallback( | 662 virtual void SetResizeCallback( |
660 const base::Callback<void(gfx::Size, float)>& callback) OVERRIDE; | 663 const base::Callback<void(gfx::Size, float)>& callback) OVERRIDE; |
661 | 664 |
662 virtual Logger* GetLogger() OVERRIDE; | 665 virtual Logger* GetLogger() OVERRIDE; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 } | 802 } |
800 | 803 |
801 TextureManager* texture_manager() { | 804 TextureManager* texture_manager() { |
802 return group_->texture_manager(); | 805 return group_->texture_manager(); |
803 } | 806 } |
804 | 807 |
805 MailboxManager* mailbox_manager() { | 808 MailboxManager* mailbox_manager() { |
806 return group_->mailbox_manager(); | 809 return group_->mailbox_manager(); |
807 } | 810 } |
808 | 811 |
809 ImageManager* image_manager() { | 812 ImageManager* image_manager() { return image_manager_.get(); } |
810 return group_->image_manager(); | |
811 } | |
812 | 813 |
813 VertexArrayManager* vertex_array_manager() { | 814 VertexArrayManager* vertex_array_manager() { |
814 return vertex_array_manager_.get(); | 815 return vertex_array_manager_.get(); |
815 } | 816 } |
816 | 817 |
817 MemoryTracker* memory_tracker() { | 818 MemoryTracker* memory_tracker() { |
818 return group_->memory_tracker(); | 819 return group_->memory_tracker(); |
819 } | 820 } |
820 | 821 |
821 bool EnsureGPUMemoryAvailable(size_t estimated_size) { | 822 bool EnsureGPUMemoryAvailable(size_t estimated_size) { |
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1734 | 1735 |
1735 // The copy that is used as the destination for multi-sample resolves. | 1736 // The copy that is used as the destination for multi-sample resolves. |
1736 scoped_ptr<BackFramebuffer> offscreen_resolved_frame_buffer_; | 1737 scoped_ptr<BackFramebuffer> offscreen_resolved_frame_buffer_; |
1737 scoped_ptr<BackTexture> offscreen_resolved_color_texture_; | 1738 scoped_ptr<BackTexture> offscreen_resolved_color_texture_; |
1738 GLenum offscreen_saved_color_format_; | 1739 GLenum offscreen_saved_color_format_; |
1739 | 1740 |
1740 scoped_ptr<QueryManager> query_manager_; | 1741 scoped_ptr<QueryManager> query_manager_; |
1741 | 1742 |
1742 scoped_ptr<VertexArrayManager> vertex_array_manager_; | 1743 scoped_ptr<VertexArrayManager> vertex_array_manager_; |
1743 | 1744 |
| 1745 scoped_ptr<ImageManager> image_manager_; |
| 1746 |
1744 base::Callback<void(gfx::Size, float)> resize_callback_; | 1747 base::Callback<void(gfx::Size, float)> resize_callback_; |
1745 | 1748 |
1746 WaitSyncPointCallback wait_sync_point_callback_; | 1749 WaitSyncPointCallback wait_sync_point_callback_; |
1747 | 1750 |
1748 ShaderCacheCallback shader_cache_callback_; | 1751 ShaderCacheCallback shader_cache_callback_; |
1749 | 1752 |
1750 scoped_ptr<AsyncPixelTransferManager> async_pixel_transfer_manager_; | 1753 scoped_ptr<AsyncPixelTransferManager> async_pixel_transfer_manager_; |
1751 | 1754 |
1752 // The format of the back buffer_ | 1755 // The format of the back buffer_ |
1753 GLenum back_buffer_color_format_; | 1756 GLenum back_buffer_color_format_; |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2406 | 2409 |
2407 state_.default_vertex_attrib_manager->Initialize( | 2410 state_.default_vertex_attrib_manager->Initialize( |
2408 group_->max_vertex_attribs(), | 2411 group_->max_vertex_attribs(), |
2409 feature_info_->workarounds().init_vertex_attributes); | 2412 feature_info_->workarounds().init_vertex_attributes); |
2410 | 2413 |
2411 // vertex_attrib_manager is set to default_vertex_attrib_manager by this call | 2414 // vertex_attrib_manager is set to default_vertex_attrib_manager by this call |
2412 DoBindVertexArrayOES(0); | 2415 DoBindVertexArrayOES(0); |
2413 | 2416 |
2414 query_manager_.reset(new QueryManager(this, feature_info_.get())); | 2417 query_manager_.reset(new QueryManager(this, feature_info_.get())); |
2415 | 2418 |
| 2419 image_manager_.reset(new ImageManager); |
| 2420 |
2416 util_.set_num_compressed_texture_formats( | 2421 util_.set_num_compressed_texture_formats( |
2417 validators_->compressed_texture_format.GetValues().size()); | 2422 validators_->compressed_texture_format.GetValues().size()); |
2418 | 2423 |
2419 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { | 2424 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { |
2420 // We have to enable vertex array 0 on OpenGL or it won't render. Note that | 2425 // We have to enable vertex array 0 on OpenGL or it won't render. Note that |
2421 // OpenGL ES 2.0 does not have this issue. | 2426 // OpenGL ES 2.0 does not have this issue. |
2422 glEnableVertexAttribArray(0); | 2427 glEnableVertexAttribArray(0); |
2423 } | 2428 } |
2424 glGenBuffersARB(1, &attrib_0_buffer_id_); | 2429 glGenBuffersARB(1, &attrib_0_buffer_id_); |
2425 glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_); | 2430 glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_); |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2670 supports_post_sub_buffer_ = false; | 2675 supports_post_sub_buffer_ = false; |
2671 | 2676 |
2672 if (feature_info_->workarounds().reverse_point_sprite_coord_origin) { | 2677 if (feature_info_->workarounds().reverse_point_sprite_coord_origin) { |
2673 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); | 2678 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); |
2674 } | 2679 } |
2675 | 2680 |
2676 if (feature_info_->workarounds().unbind_fbo_on_context_switch) { | 2681 if (feature_info_->workarounds().unbind_fbo_on_context_switch) { |
2677 context_->SetUnbindFboOnMakeCurrent(); | 2682 context_->SetUnbindFboOnMakeCurrent(); |
2678 } | 2683 } |
2679 | 2684 |
2680 if (feature_info_->workarounds().release_image_after_use) { | |
2681 image_manager()->SetReleaseAfterUse(); | |
2682 } | |
2683 | |
2684 // Only compositor contexts are known to use only the subset of GL | 2685 // Only compositor contexts are known to use only the subset of GL |
2685 // that can be safely migrated between the iGPU and the dGPU. Mark | 2686 // that can be safely migrated between the iGPU and the dGPU. Mark |
2686 // those contexts as safe to forcibly transition between the GPUs. | 2687 // those contexts as safe to forcibly transition between the GPUs. |
2687 // http://crbug.com/180876, http://crbug.com/227228 | 2688 // http://crbug.com/180876, http://crbug.com/227228 |
2688 if (!offscreen) | 2689 if (!offscreen) |
2689 context_->SetSafeToForceGpuSwitch(); | 2690 context_->SetSafeToForceGpuSwitch(); |
2690 | 2691 |
2691 async_pixel_transfer_manager_.reset( | 2692 async_pixel_transfer_manager_.reset( |
2692 AsyncPixelTransferManager::Create(context.get())); | 2693 AsyncPixelTransferManager::Create(context.get())); |
2693 async_pixel_transfer_manager_->Initialize(texture_manager()); | 2694 async_pixel_transfer_manager_->Initialize(texture_manager()); |
(...skipping 20 matching lines...) Expand all Loading... |
2714 caps.discard_framebuffer = | 2715 caps.discard_framebuffer = |
2715 feature_info_->feature_flags().ext_discard_framebuffer; | 2716 feature_info_->feature_flags().ext_discard_framebuffer; |
2716 caps.sync_query = feature_info_->feature_flags().chromium_sync_query; | 2717 caps.sync_query = feature_info_->feature_flags().chromium_sync_query; |
2717 | 2718 |
2718 #if defined(OS_MACOSX) | 2719 #if defined(OS_MACOSX) |
2719 // This is unconditionally true on mac, no need to test for it at runtime. | 2720 // This is unconditionally true on mac, no need to test for it at runtime. |
2720 caps.iosurface = true; | 2721 caps.iosurface = true; |
2721 #endif | 2722 #endif |
2722 | 2723 |
2723 caps.post_sub_buffer = supports_post_sub_buffer_; | 2724 caps.post_sub_buffer = supports_post_sub_buffer_; |
2724 caps.map_image = !!image_manager(); | 2725 caps.map_image = true; |
2725 | 2726 |
2726 return caps; | 2727 return caps; |
2727 } | 2728 } |
2728 | 2729 |
2729 void GLES2DecoderImpl::UpdateCapabilities() { | 2730 void GLES2DecoderImpl::UpdateCapabilities() { |
2730 util_.set_num_compressed_texture_formats( | 2731 util_.set_num_compressed_texture_formats( |
2731 validators_->compressed_texture_format.GetValues().size()); | 2732 validators_->compressed_texture_format.GetValues().size()); |
2732 util_.set_num_shader_binary_formats( | 2733 util_.set_num_shader_binary_formats( |
2733 validators_->shader_binary_format.GetValues().size()); | 2734 validators_->shader_binary_format.GetValues().size()); |
2734 } | 2735 } |
(...skipping 8181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10916 } | 10917 } |
10917 } | 10918 } |
10918 | 10919 |
10919 // Include the auto-generated part of this file. We split this because it means | 10920 // Include the auto-generated part of this file. We split this because it means |
10920 // we can easily edit the non-auto generated parts right here in this file | 10921 // we can easily edit the non-auto generated parts right here in this file |
10921 // instead of having to edit some template or the code generator. | 10922 // instead of having to edit some template or the code generator. |
10922 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10923 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
10923 | 10924 |
10924 } // namespace gles2 | 10925 } // namespace gles2 |
10925 } // namespace gpu | 10926 } // namespace gpu |
OLD | NEW |