Chromium Code Reviews| 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 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 620 | 620 |
| 621 virtual void ClearAllAttributes() const OVERRIDE; | 621 virtual void ClearAllAttributes() const OVERRIDE; |
| 622 virtual void RestoreAllAttributes() const OVERRIDE; | 622 virtual void RestoreAllAttributes() const OVERRIDE; |
| 623 | 623 |
| 624 virtual QueryManager* GetQueryManager() OVERRIDE { | 624 virtual QueryManager* GetQueryManager() OVERRIDE { |
| 625 return query_manager_.get(); | 625 return query_manager_.get(); |
| 626 } | 626 } |
| 627 virtual VertexArrayManager* GetVertexArrayManager() OVERRIDE { | 627 virtual VertexArrayManager* GetVertexArrayManager() OVERRIDE { |
| 628 return vertex_array_manager_.get(); | 628 return vertex_array_manager_.get(); |
| 629 } | 629 } |
| 630 virtual ImageManager* GetImageManager() OVERRIDE { | |
| 631 return image_manager_.get(); | |
| 632 } | |
| 630 virtual bool ProcessPendingQueries() OVERRIDE; | 633 virtual bool ProcessPendingQueries() OVERRIDE; |
| 631 virtual bool HasMoreIdleWork() OVERRIDE; | 634 virtual bool HasMoreIdleWork() OVERRIDE; |
| 632 virtual void PerformIdleWork() OVERRIDE; | 635 virtual void PerformIdleWork() OVERRIDE; |
| 633 | 636 |
| 634 virtual void WaitForReadPixels(base::Closure callback) OVERRIDE; | 637 virtual void WaitForReadPixels(base::Closure callback) OVERRIDE; |
| 635 | 638 |
| 636 virtual void SetResizeCallback( | 639 virtual void SetResizeCallback( |
| 637 const base::Callback<void(gfx::Size, float)>& callback) OVERRIDE; | 640 const base::Callback<void(gfx::Size, float)>& callback) OVERRIDE; |
| 638 | 641 |
| 639 virtual Logger* GetLogger() OVERRIDE; | 642 virtual Logger* GetLogger() OVERRIDE; |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 773 } | 776 } |
| 774 | 777 |
| 775 TextureManager* texture_manager() { | 778 TextureManager* texture_manager() { |
| 776 return group_->texture_manager(); | 779 return group_->texture_manager(); |
| 777 } | 780 } |
| 778 | 781 |
| 779 MailboxManager* mailbox_manager() { | 782 MailboxManager* mailbox_manager() { |
| 780 return group_->mailbox_manager(); | 783 return group_->mailbox_manager(); |
| 781 } | 784 } |
| 782 | 785 |
| 783 ImageManager* image_manager() { | 786 ImageManager* image_manager() { return image_manager_.get(); } |
| 784 return group_->image_manager(); | |
| 785 } | |
| 786 | 787 |
| 787 VertexArrayManager* vertex_array_manager() { | 788 VertexArrayManager* vertex_array_manager() { |
| 788 return vertex_array_manager_.get(); | 789 return vertex_array_manager_.get(); |
| 789 } | 790 } |
| 790 | 791 |
| 791 MemoryTracker* memory_tracker() { | 792 MemoryTracker* memory_tracker() { |
| 792 return group_->memory_tracker(); | 793 return group_->memory_tracker(); |
| 793 } | 794 } |
| 794 | 795 |
| 795 bool EnsureGPUMemoryAvailable(size_t estimated_size) { | 796 bool EnsureGPUMemoryAvailable(size_t estimated_size) { |
| (...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1704 | 1705 |
| 1705 // The copy that is used as the destination for multi-sample resolves. | 1706 // The copy that is used as the destination for multi-sample resolves. |
| 1706 scoped_ptr<BackFramebuffer> offscreen_resolved_frame_buffer_; | 1707 scoped_ptr<BackFramebuffer> offscreen_resolved_frame_buffer_; |
| 1707 scoped_ptr<BackTexture> offscreen_resolved_color_texture_; | 1708 scoped_ptr<BackTexture> offscreen_resolved_color_texture_; |
| 1708 GLenum offscreen_saved_color_format_; | 1709 GLenum offscreen_saved_color_format_; |
| 1709 | 1710 |
| 1710 scoped_ptr<QueryManager> query_manager_; | 1711 scoped_ptr<QueryManager> query_manager_; |
| 1711 | 1712 |
| 1712 scoped_ptr<VertexArrayManager> vertex_array_manager_; | 1713 scoped_ptr<VertexArrayManager> vertex_array_manager_; |
| 1713 | 1714 |
| 1715 scoped_ptr<ImageManager> image_manager_; | |
| 1716 | |
| 1714 base::Callback<void(gfx::Size, float)> resize_callback_; | 1717 base::Callback<void(gfx::Size, float)> resize_callback_; |
| 1715 | 1718 |
| 1716 WaitSyncPointCallback wait_sync_point_callback_; | 1719 WaitSyncPointCallback wait_sync_point_callback_; |
| 1717 | 1720 |
| 1718 ShaderCacheCallback shader_cache_callback_; | 1721 ShaderCacheCallback shader_cache_callback_; |
| 1719 | 1722 |
| 1720 scoped_ptr<AsyncPixelTransferManager> async_pixel_transfer_manager_; | 1723 scoped_ptr<AsyncPixelTransferManager> async_pixel_transfer_manager_; |
| 1721 | 1724 |
| 1722 // The format of the back buffer_ | 1725 // The format of the back buffer_ |
| 1723 GLenum back_buffer_color_format_; | 1726 GLenum back_buffer_color_format_; |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2376 | 2379 |
| 2377 state_.default_vertex_attrib_manager->Initialize( | 2380 state_.default_vertex_attrib_manager->Initialize( |
| 2378 group_->max_vertex_attribs(), | 2381 group_->max_vertex_attribs(), |
| 2379 feature_info_->workarounds().init_vertex_attributes); | 2382 feature_info_->workarounds().init_vertex_attributes); |
| 2380 | 2383 |
| 2381 // vertex_attrib_manager is set to default_vertex_attrib_manager by this call | 2384 // vertex_attrib_manager is set to default_vertex_attrib_manager by this call |
| 2382 DoBindVertexArrayOES(0); | 2385 DoBindVertexArrayOES(0); |
| 2383 | 2386 |
| 2384 query_manager_.reset(new QueryManager(this, feature_info_.get())); | 2387 query_manager_.reset(new QueryManager(this, feature_info_.get())); |
| 2385 | 2388 |
| 2389 image_manager_.reset(new ImageManager); | |
| 2390 | |
| 2386 util_.set_num_compressed_texture_formats( | 2391 util_.set_num_compressed_texture_formats( |
| 2387 validators_->compressed_texture_format.GetValues().size()); | 2392 validators_->compressed_texture_format.GetValues().size()); |
| 2388 | 2393 |
| 2389 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { | 2394 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { |
| 2390 // We have to enable vertex array 0 on OpenGL or it won't render. Note that | 2395 // We have to enable vertex array 0 on OpenGL or it won't render. Note that |
| 2391 // OpenGL ES 2.0 does not have this issue. | 2396 // OpenGL ES 2.0 does not have this issue. |
| 2392 glEnableVertexAttribArray(0); | 2397 glEnableVertexAttribArray(0); |
| 2393 } | 2398 } |
| 2394 glGenBuffersARB(1, &attrib_0_buffer_id_); | 2399 glGenBuffersARB(1, &attrib_0_buffer_id_); |
| 2395 glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_); | 2400 glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_); |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2640 supports_post_sub_buffer_ = false; | 2645 supports_post_sub_buffer_ = false; |
| 2641 | 2646 |
| 2642 if (feature_info_->workarounds().reverse_point_sprite_coord_origin) { | 2647 if (feature_info_->workarounds().reverse_point_sprite_coord_origin) { |
| 2643 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); | 2648 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); |
| 2644 } | 2649 } |
| 2645 | 2650 |
| 2646 if (feature_info_->workarounds().unbind_fbo_on_context_switch) { | 2651 if (feature_info_->workarounds().unbind_fbo_on_context_switch) { |
| 2647 context_->SetUnbindFboOnMakeCurrent(); | 2652 context_->SetUnbindFboOnMakeCurrent(); |
| 2648 } | 2653 } |
| 2649 | 2654 |
| 2650 if (feature_info_->workarounds().release_image_after_use) { | |
| 2651 image_manager()->SetReleaseAfterUse(); | |
| 2652 } | |
| 2653 | |
| 2654 // Only compositor contexts are known to use only the subset of GL | 2655 // Only compositor contexts are known to use only the subset of GL |
| 2655 // that can be safely migrated between the iGPU and the dGPU. Mark | 2656 // that can be safely migrated between the iGPU and the dGPU. Mark |
| 2656 // those contexts as safe to forcibly transition between the GPUs. | 2657 // those contexts as safe to forcibly transition between the GPUs. |
| 2657 // http://crbug.com/180876, http://crbug.com/227228 | 2658 // http://crbug.com/180876, http://crbug.com/227228 |
| 2658 if (!offscreen) | 2659 if (!offscreen) |
| 2659 context_->SetSafeToForceGpuSwitch(); | 2660 context_->SetSafeToForceGpuSwitch(); |
| 2660 | 2661 |
| 2661 async_pixel_transfer_manager_.reset( | 2662 async_pixel_transfer_manager_.reset( |
| 2662 AsyncPixelTransferManager::Create(context.get())); | 2663 AsyncPixelTransferManager::Create(context.get())); |
| 2663 async_pixel_transfer_manager_->Initialize(texture_manager()); | 2664 async_pixel_transfer_manager_->Initialize(texture_manager()); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 2686 caps.discard_framebuffer = | 2687 caps.discard_framebuffer = |
| 2687 feature_info_->feature_flags().ext_discard_framebuffer; | 2688 feature_info_->feature_flags().ext_discard_framebuffer; |
| 2688 caps.sync_query = feature_info_->feature_flags().chromium_sync_query; | 2689 caps.sync_query = feature_info_->feature_flags().chromium_sync_query; |
| 2689 | 2690 |
| 2690 #if defined(OS_MACOSX) | 2691 #if defined(OS_MACOSX) |
| 2691 // This is unconditionally true on mac, no need to test for it at runtime. | 2692 // This is unconditionally true on mac, no need to test for it at runtime. |
| 2692 caps.iosurface = true; | 2693 caps.iosurface = true; |
| 2693 #endif | 2694 #endif |
| 2694 | 2695 |
| 2695 caps.post_sub_buffer = supports_post_sub_buffer_; | 2696 caps.post_sub_buffer = supports_post_sub_buffer_; |
| 2696 caps.map_image = !!image_manager(); | 2697 caps.map_image = true; |
|
no sievers
2014/07/01 22:49:07
should probably get rid of this capability flag
reveman
2014/07/02 14:47:54
I think we still need this for ppapi.
| |
| 2697 | 2698 |
| 2698 return caps; | 2699 return caps; |
| 2699 } | 2700 } |
| 2700 | 2701 |
| 2701 void GLES2DecoderImpl::UpdateCapabilities() { | 2702 void GLES2DecoderImpl::UpdateCapabilities() { |
| 2702 util_.set_num_compressed_texture_formats( | 2703 util_.set_num_compressed_texture_formats( |
| 2703 validators_->compressed_texture_format.GetValues().size()); | 2704 validators_->compressed_texture_format.GetValues().size()); |
| 2704 util_.set_num_shader_binary_formats( | 2705 util_.set_num_shader_binary_formats( |
| 2705 validators_->shader_binary_format.GetValues().size()); | 2706 validators_->shader_binary_format.GetValues().size()); |
| 2706 } | 2707 } |
| (...skipping 8098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10805 } | 10806 } |
| 10806 } | 10807 } |
| 10807 | 10808 |
| 10808 // Include the auto-generated part of this file. We split this because it means | 10809 // Include the auto-generated part of this file. We split this because it means |
| 10809 // we can easily edit the non-auto generated parts right here in this file | 10810 // we can easily edit the non-auto generated parts right here in this file |
| 10810 // instead of having to edit some template or the code generator. | 10811 // instead of having to edit some template or the code generator. |
| 10811 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10812 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 10812 | 10813 |
| 10813 } // namespace gles2 | 10814 } // namespace gles2 |
| 10814 } // namespace gpu | 10815 } // namespace gpu |
| OLD | NEW |