| 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 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1730 | 1731 |
| 1731 // The copy that is used as the destination for multi-sample resolves. | 1732 // The copy that is used as the destination for multi-sample resolves. |
| 1732 scoped_ptr<BackFramebuffer> offscreen_resolved_frame_buffer_; | 1733 scoped_ptr<BackFramebuffer> offscreen_resolved_frame_buffer_; |
| 1733 scoped_ptr<BackTexture> offscreen_resolved_color_texture_; | 1734 scoped_ptr<BackTexture> offscreen_resolved_color_texture_; |
| 1734 GLenum offscreen_saved_color_format_; | 1735 GLenum offscreen_saved_color_format_; |
| 1735 | 1736 |
| 1736 scoped_ptr<QueryManager> query_manager_; | 1737 scoped_ptr<QueryManager> query_manager_; |
| 1737 | 1738 |
| 1738 scoped_ptr<VertexArrayManager> vertex_array_manager_; | 1739 scoped_ptr<VertexArrayManager> vertex_array_manager_; |
| 1739 | 1740 |
| 1741 scoped_ptr<ImageManager> image_manager_; |
| 1742 |
| 1740 base::Callback<void(gfx::Size, float)> resize_callback_; | 1743 base::Callback<void(gfx::Size, float)> resize_callback_; |
| 1741 | 1744 |
| 1742 WaitSyncPointCallback wait_sync_point_callback_; | 1745 WaitSyncPointCallback wait_sync_point_callback_; |
| 1743 | 1746 |
| 1744 ShaderCacheCallback shader_cache_callback_; | 1747 ShaderCacheCallback shader_cache_callback_; |
| 1745 | 1748 |
| 1746 scoped_ptr<AsyncPixelTransferManager> async_pixel_transfer_manager_; | 1749 scoped_ptr<AsyncPixelTransferManager> async_pixel_transfer_manager_; |
| 1747 | 1750 |
| 1748 // The format of the back buffer_ | 1751 // The format of the back buffer_ |
| 1749 GLenum back_buffer_color_format_; | 1752 GLenum back_buffer_color_format_; |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2402 | 2405 |
| 2403 state_.default_vertex_attrib_manager->Initialize( | 2406 state_.default_vertex_attrib_manager->Initialize( |
| 2404 group_->max_vertex_attribs(), | 2407 group_->max_vertex_attribs(), |
| 2405 feature_info_->workarounds().init_vertex_attributes); | 2408 feature_info_->workarounds().init_vertex_attributes); |
| 2406 | 2409 |
| 2407 // vertex_attrib_manager is set to default_vertex_attrib_manager by this call | 2410 // vertex_attrib_manager is set to default_vertex_attrib_manager by this call |
| 2408 DoBindVertexArrayOES(0); | 2411 DoBindVertexArrayOES(0); |
| 2409 | 2412 |
| 2410 query_manager_.reset(new QueryManager(this, feature_info_.get())); | 2413 query_manager_.reset(new QueryManager(this, feature_info_.get())); |
| 2411 | 2414 |
| 2415 image_manager_.reset(new ImageManager); |
| 2416 |
| 2412 util_.set_num_compressed_texture_formats( | 2417 util_.set_num_compressed_texture_formats( |
| 2413 validators_->compressed_texture_format.GetValues().size()); | 2418 validators_->compressed_texture_format.GetValues().size()); |
| 2414 | 2419 |
| 2415 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { | 2420 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { |
| 2416 // We have to enable vertex array 0 on OpenGL or it won't render. Note that | 2421 // We have to enable vertex array 0 on OpenGL or it won't render. Note that |
| 2417 // OpenGL ES 2.0 does not have this issue. | 2422 // OpenGL ES 2.0 does not have this issue. |
| 2418 glEnableVertexAttribArray(0); | 2423 glEnableVertexAttribArray(0); |
| 2419 } | 2424 } |
| 2420 glGenBuffersARB(1, &attrib_0_buffer_id_); | 2425 glGenBuffersARB(1, &attrib_0_buffer_id_); |
| 2421 glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_); | 2426 glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_); |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2666 supports_post_sub_buffer_ = false; | 2671 supports_post_sub_buffer_ = false; |
| 2667 | 2672 |
| 2668 if (feature_info_->workarounds().reverse_point_sprite_coord_origin) { | 2673 if (feature_info_->workarounds().reverse_point_sprite_coord_origin) { |
| 2669 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); | 2674 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); |
| 2670 } | 2675 } |
| 2671 | 2676 |
| 2672 if (feature_info_->workarounds().unbind_fbo_on_context_switch) { | 2677 if (feature_info_->workarounds().unbind_fbo_on_context_switch) { |
| 2673 context_->SetUnbindFboOnMakeCurrent(); | 2678 context_->SetUnbindFboOnMakeCurrent(); |
| 2674 } | 2679 } |
| 2675 | 2680 |
| 2676 if (feature_info_->workarounds().release_image_after_use) { | |
| 2677 image_manager()->SetReleaseAfterUse(); | |
| 2678 } | |
| 2679 | |
| 2680 // Only compositor contexts are known to use only the subset of GL | 2681 // Only compositor contexts are known to use only the subset of GL |
| 2681 // that can be safely migrated between the iGPU and the dGPU. Mark | 2682 // that can be safely migrated between the iGPU and the dGPU. Mark |
| 2682 // those contexts as safe to forcibly transition between the GPUs. | 2683 // those contexts as safe to forcibly transition between the GPUs. |
| 2683 // http://crbug.com/180876, http://crbug.com/227228 | 2684 // http://crbug.com/180876, http://crbug.com/227228 |
| 2684 if (!offscreen) | 2685 if (!offscreen) |
| 2685 context_->SetSafeToForceGpuSwitch(); | 2686 context_->SetSafeToForceGpuSwitch(); |
| 2686 | 2687 |
| 2687 async_pixel_transfer_manager_.reset( | 2688 async_pixel_transfer_manager_.reset( |
| 2688 AsyncPixelTransferManager::Create(context.get())); | 2689 AsyncPixelTransferManager::Create(context.get())); |
| 2689 async_pixel_transfer_manager_->Initialize(texture_manager()); | 2690 async_pixel_transfer_manager_->Initialize(texture_manager()); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2710 caps.discard_framebuffer = | 2711 caps.discard_framebuffer = |
| 2711 feature_info_->feature_flags().ext_discard_framebuffer; | 2712 feature_info_->feature_flags().ext_discard_framebuffer; |
| 2712 caps.sync_query = feature_info_->feature_flags().chromium_sync_query; | 2713 caps.sync_query = feature_info_->feature_flags().chromium_sync_query; |
| 2713 | 2714 |
| 2714 #if defined(OS_MACOSX) | 2715 #if defined(OS_MACOSX) |
| 2715 // This is unconditionally true on mac, no need to test for it at runtime. | 2716 // This is unconditionally true on mac, no need to test for it at runtime. |
| 2716 caps.iosurface = true; | 2717 caps.iosurface = true; |
| 2717 #endif | 2718 #endif |
| 2718 | 2719 |
| 2719 caps.post_sub_buffer = supports_post_sub_buffer_; | 2720 caps.post_sub_buffer = supports_post_sub_buffer_; |
| 2720 caps.map_image = !!image_manager(); | 2721 caps.map_image = true; |
| 2721 | 2722 |
| 2722 return caps; | 2723 return caps; |
| 2723 } | 2724 } |
| 2724 | 2725 |
| 2725 void GLES2DecoderImpl::UpdateCapabilities() { | 2726 void GLES2DecoderImpl::UpdateCapabilities() { |
| 2726 util_.set_num_compressed_texture_formats( | 2727 util_.set_num_compressed_texture_formats( |
| 2727 validators_->compressed_texture_format.GetValues().size()); | 2728 validators_->compressed_texture_format.GetValues().size()); |
| 2728 util_.set_num_shader_binary_formats( | 2729 util_.set_num_shader_binary_formats( |
| 2729 validators_->shader_binary_format.GetValues().size()); | 2730 validators_->shader_binary_format.GetValues().size()); |
| 2730 } | 2731 } |
| (...skipping 8154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10885 } | 10886 } |
| 10886 } | 10887 } |
| 10887 | 10888 |
| 10888 // Include the auto-generated part of this file. We split this because it means | 10889 // Include the auto-generated part of this file. We split this because it means |
| 10889 // we can easily edit the non-auto generated parts right here in this file | 10890 // we can easily edit the non-auto generated parts right here in this file |
| 10890 // instead of having to edit some template or the code generator. | 10891 // instead of having to edit some template or the code generator. |
| 10891 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10892 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 10892 | 10893 |
| 10893 } // namespace gles2 | 10894 } // namespace gles2 |
| 10894 } // namespace gpu | 10895 } // namespace gpu |
| OLD | NEW |