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 <cmath> | 10 #include <cmath> |
(...skipping 11 matching lines...) Expand all Loading... | |
22 #include "base/numerics/safe_math.h" | 22 #include "base/numerics/safe_math.h" |
23 #include "base/strings/string_number_conversions.h" | 23 #include "base/strings/string_number_conversions.h" |
24 #include "base/trace_event/trace_event.h" | 24 #include "base/trace_event/trace_event.h" |
25 #include "base/trace_event/trace_event_synthetic_delay.h" | 25 #include "base/trace_event/trace_event_synthetic_delay.h" |
26 #include "build/build_config.h" | 26 #include "build/build_config.h" |
27 #define GLES2_GPU_SERVICE 1 | 27 #define GLES2_GPU_SERVICE 1 |
28 #include "gpu/command_buffer/common/debug_marker_manager.h" | 28 #include "gpu/command_buffer/common/debug_marker_manager.h" |
29 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 29 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
30 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 30 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
31 #include "gpu/command_buffer/common/mailbox.h" | 31 #include "gpu/command_buffer/common/mailbox.h" |
32 #include "gpu/command_buffer/service/async_pixel_transfer_delegate.h" | |
33 #include "gpu/command_buffer/service/async_pixel_transfer_manager.h" | |
34 #include "gpu/command_buffer/service/buffer_manager.h" | 32 #include "gpu/command_buffer/service/buffer_manager.h" |
35 #include "gpu/command_buffer/service/context_group.h" | 33 #include "gpu/command_buffer/service/context_group.h" |
36 #include "gpu/command_buffer/service/context_state.h" | 34 #include "gpu/command_buffer/service/context_state.h" |
37 #include "gpu/command_buffer/service/error_state.h" | 35 #include "gpu/command_buffer/service/error_state.h" |
38 #include "gpu/command_buffer/service/feature_info.h" | 36 #include "gpu/command_buffer/service/feature_info.h" |
39 #include "gpu/command_buffer/service/framebuffer_manager.h" | 37 #include "gpu/command_buffer/service/framebuffer_manager.h" |
40 #include "gpu/command_buffer/service/gl_utils.h" | 38 #include "gpu/command_buffer/service/gl_utils.h" |
41 #include "gpu/command_buffer/service/gles2_cmd_clear_framebuffer.h" | 39 #include "gpu/command_buffer/service/gles2_cmd_clear_framebuffer.h" |
42 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" | 40 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" |
43 #include "gpu/command_buffer/service/gles2_cmd_validation.h" | 41 #include "gpu/command_buffer/service/gles2_cmd_validation.h" |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
551 | 549 |
552 struct FenceCallback { | 550 struct FenceCallback { |
553 FenceCallback() | 551 FenceCallback() |
554 : fence(gfx::GLFence::Create()) { | 552 : fence(gfx::GLFence::Create()) { |
555 DCHECK(fence); | 553 DCHECK(fence); |
556 } | 554 } |
557 std::vector<base::Closure> callbacks; | 555 std::vector<base::Closure> callbacks; |
558 scoped_ptr<gfx::GLFence> fence; | 556 scoped_ptr<gfx::GLFence> fence; |
559 }; | 557 }; |
560 | 558 |
561 class AsyncUploadTokenCompletionObserver | |
562 : public AsyncPixelTransferCompletionObserver { | |
563 public: | |
564 explicit AsyncUploadTokenCompletionObserver(uint32 async_upload_token) | |
565 : async_upload_token_(async_upload_token) { | |
566 } | |
567 | |
568 void DidComplete(const AsyncMemoryParams& mem_params) override { | |
569 DCHECK(mem_params.buffer().get()); | |
570 void* data = mem_params.GetDataAddress(); | |
571 AsyncUploadSync* sync = static_cast<AsyncUploadSync*>(data); | |
572 sync->SetAsyncUploadToken(async_upload_token_); | |
573 } | |
574 | |
575 private: | |
576 ~AsyncUploadTokenCompletionObserver() override {} | |
577 | |
578 uint32 async_upload_token_; | |
579 | |
580 DISALLOW_COPY_AND_ASSIGN(AsyncUploadTokenCompletionObserver); | |
581 }; | |
582 | |
583 // } // anonymous namespace. | 559 // } // anonymous namespace. |
584 | 560 |
585 // static | 561 // static |
586 const unsigned int GLES2Decoder::kDefaultStencilMask = | 562 const unsigned int GLES2Decoder::kDefaultStencilMask = |
587 static_cast<unsigned int>(-1); | 563 static_cast<unsigned int>(-1); |
588 | 564 |
589 bool GLES2Decoder::GetServiceTextureId(uint32 client_texture_id, | 565 bool GLES2Decoder::GetServiceTextureId(uint32 client_texture_id, |
590 uint32* service_texture_id) { | 566 uint32* service_texture_id) { |
591 return false; | 567 return false; |
592 } | 568 } |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
701 | 677 |
702 void BeginDecoding() override; | 678 void BeginDecoding() override; |
703 void EndDecoding() override; | 679 void EndDecoding() override; |
704 | 680 |
705 ErrorState* GetErrorState() override; | 681 ErrorState* GetErrorState() override; |
706 const ContextState* GetContextState() override { return &state_; } | 682 const ContextState* GetContextState() override { return &state_; } |
707 | 683 |
708 void SetShaderCacheCallback(const ShaderCacheCallback& callback) override; | 684 void SetShaderCacheCallback(const ShaderCacheCallback& callback) override; |
709 void SetWaitSyncPointCallback(const WaitSyncPointCallback& callback) override; | 685 void SetWaitSyncPointCallback(const WaitSyncPointCallback& callback) override; |
710 | 686 |
711 AsyncPixelTransferManager* GetAsyncPixelTransferManager() override; | |
712 void ResetAsyncPixelTransferManagerForTest() override; | |
713 void SetAsyncPixelTransferManagerForTest( | |
714 AsyncPixelTransferManager* manager) override; | |
715 void SetIgnoreCachedStateForTest(bool ignore) override; | 687 void SetIgnoreCachedStateForTest(bool ignore) override; |
716 void ProcessFinishedAsyncTransfers(); | 688 void ProcessFinishedAsyncTransfers(); |
717 | 689 |
718 bool GetServiceTextureId(uint32 client_texture_id, | 690 bool GetServiceTextureId(uint32 client_texture_id, |
719 uint32* service_texture_id) override; | 691 uint32* service_texture_id) override; |
720 | 692 |
721 uint32 GetTextureUploadCount() override; | 693 uint32 GetTextureUploadCount() override; |
722 base::TimeDelta GetTotalTextureUploadTime() override; | 694 base::TimeDelta GetTotalTextureUploadTime() override; |
723 base::TimeDelta GetTotalProcessingCommandsTime() override; | 695 base::TimeDelta GetTotalProcessingCommandsTime() override; |
724 void AddProcessingCommandsTime(base::TimeDelta) override; | 696 void AddProcessingCommandsTime(base::TimeDelta) override; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
789 void DeleteRenderbuffersHelper(GLsizei n, const GLuint* client_ids); | 761 void DeleteRenderbuffersHelper(GLsizei n, const GLuint* client_ids); |
790 bool GenValuebuffersCHROMIUMHelper(GLsizei n, const GLuint* client_ids); | 762 bool GenValuebuffersCHROMIUMHelper(GLsizei n, const GLuint* client_ids); |
791 void DeleteValuebuffersCHROMIUMHelper(GLsizei n, const GLuint* client_ids); | 763 void DeleteValuebuffersCHROMIUMHelper(GLsizei n, const GLuint* client_ids); |
792 bool GenQueriesEXTHelper(GLsizei n, const GLuint* client_ids); | 764 bool GenQueriesEXTHelper(GLsizei n, const GLuint* client_ids); |
793 void DeleteQueriesEXTHelper(GLsizei n, const GLuint* client_ids); | 765 void DeleteQueriesEXTHelper(GLsizei n, const GLuint* client_ids); |
794 bool GenVertexArraysOESHelper(GLsizei n, const GLuint* client_ids); | 766 bool GenVertexArraysOESHelper(GLsizei n, const GLuint* client_ids); |
795 void DeleteVertexArraysOESHelper(GLsizei n, const GLuint* client_ids); | 767 void DeleteVertexArraysOESHelper(GLsizei n, const GLuint* client_ids); |
796 bool GenPathsCHROMIUMHelper(GLuint first_client_id, GLsizei range); | 768 bool GenPathsCHROMIUMHelper(GLuint first_client_id, GLsizei range); |
797 bool DeletePathsCHROMIUMHelper(GLuint first_client_id, GLsizei range); | 769 bool DeletePathsCHROMIUMHelper(GLuint first_client_id, GLsizei range); |
798 | 770 |
799 // Helper for async upload token completion notification callback. | |
800 base::Closure AsyncUploadTokenCompletionClosure(uint32 async_upload_token, | |
801 uint32 sync_data_shm_id, | |
802 uint32 sync_data_shm_offset); | |
803 | |
804 | |
805 | |
806 // Workarounds | 771 // Workarounds |
807 void OnFboChanged() const; | 772 void OnFboChanged() const; |
808 void OnUseFramebuffer() const; | 773 void OnUseFramebuffer() const; |
809 | 774 |
810 error::ContextLostReason GetContextLostReasonFromResetStatus( | 775 error::ContextLostReason GetContextLostReasonFromResetStatus( |
811 GLenum reset_status) const; | 776 GLenum reset_status) const; |
812 | 777 |
813 // TODO(gman): Cache these pointers? | 778 // TODO(gman): Cache these pointers? |
814 BufferManager* buffer_manager() { | 779 BufferManager* buffer_manager() { |
815 return group_->buffer_manager(); | 780 return group_->buffer_manager(); |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1015 GLint xoffset, | 980 GLint xoffset, |
1016 GLint yoffset, | 981 GLint yoffset, |
1017 GLint zoffset, | 982 GLint zoffset, |
1018 GLsizei width, | 983 GLsizei width, |
1019 GLsizei height, | 984 GLsizei height, |
1020 GLsizei depth, | 985 GLsizei depth, |
1021 GLenum format, | 986 GLenum format, |
1022 GLenum type, | 987 GLenum type, |
1023 const void * data); | 988 const void * data); |
1024 | 989 |
1025 // Extra validation for async tex(Sub)Image2D. | |
1026 bool ValidateAsyncTransfer( | |
1027 const char* function_name, | |
1028 TextureRef* texture_ref, | |
1029 GLenum target, | |
1030 GLint level, | |
1031 const void * data); | |
1032 | |
1033 // Wrapper for TexImageIOSurface2DCHROMIUM. | 990 // Wrapper for TexImageIOSurface2DCHROMIUM. |
1034 void DoTexImageIOSurface2DCHROMIUM( | 991 void DoTexImageIOSurface2DCHROMIUM( |
1035 GLenum target, | 992 GLenum target, |
1036 GLsizei width, | 993 GLsizei width, |
1037 GLsizei height, | 994 GLsizei height, |
1038 GLuint io_surface_id, | 995 GLuint io_surface_id, |
1039 GLuint plane); | 996 GLuint plane); |
1040 | 997 |
1041 void DoCopyTextureCHROMIUM(GLenum target, | 998 void DoCopyTextureCHROMIUM(GLenum target, |
1042 GLuint source_id, | 999 GLuint source_id, |
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1976 scoped_ptr<VertexArrayManager> vertex_array_manager_; | 1933 scoped_ptr<VertexArrayManager> vertex_array_manager_; |
1977 | 1934 |
1978 scoped_ptr<ImageManager> image_manager_; | 1935 scoped_ptr<ImageManager> image_manager_; |
1979 | 1936 |
1980 base::Callback<void(gfx::Size, float)> resize_callback_; | 1937 base::Callback<void(gfx::Size, float)> resize_callback_; |
1981 | 1938 |
1982 WaitSyncPointCallback wait_sync_point_callback_; | 1939 WaitSyncPointCallback wait_sync_point_callback_; |
1983 | 1940 |
1984 ShaderCacheCallback shader_cache_callback_; | 1941 ShaderCacheCallback shader_cache_callback_; |
1985 | 1942 |
1986 scoped_ptr<AsyncPixelTransferManager> async_pixel_transfer_manager_; | |
1987 | |
1988 // The format of the back buffer_ | 1943 // The format of the back buffer_ |
1989 GLenum back_buffer_color_format_; | 1944 GLenum back_buffer_color_format_; |
1990 bool back_buffer_has_depth_; | 1945 bool back_buffer_has_depth_; |
1991 bool back_buffer_has_stencil_; | 1946 bool back_buffer_has_stencil_; |
1992 | 1947 |
1993 // Tracks read buffer and draw buffer for backbuffer, whether it's onscreen | 1948 // Tracks read buffer and draw buffer for backbuffer, whether it's onscreen |
1994 // or offscreen. | 1949 // or offscreen. |
1995 // TODO(zmo): when ES3 APIs are exposed to Nacl, make sure read_buffer_ | 1950 // TODO(zmo): when ES3 APIs are exposed to Nacl, make sure read_buffer_ |
1996 // setting is set correctly when SwapBuffers(). | 1951 // setting is set correctly when SwapBuffers(). |
1997 GLenum back_buffer_read_buffer_; | 1952 GLenum back_buffer_read_buffer_; |
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3046 context_->SetUnbindFboOnMakeCurrent(); | 3001 context_->SetUnbindFboOnMakeCurrent(); |
3047 } | 3002 } |
3048 | 3003 |
3049 // Only compositor contexts are known to use only the subset of GL | 3004 // Only compositor contexts are known to use only the subset of GL |
3050 // that can be safely migrated between the iGPU and the dGPU. Mark | 3005 // that can be safely migrated between the iGPU and the dGPU. Mark |
3051 // those contexts as safe to forcibly transition between the GPUs. | 3006 // those contexts as safe to forcibly transition between the GPUs. |
3052 // http://crbug.com/180876, http://crbug.com/227228 | 3007 // http://crbug.com/180876, http://crbug.com/227228 |
3053 if (!offscreen) | 3008 if (!offscreen) |
3054 context_->SetSafeToForceGpuSwitch(); | 3009 context_->SetSafeToForceGpuSwitch(); |
3055 | 3010 |
3056 async_pixel_transfer_manager_.reset( | |
3057 AsyncPixelTransferManager::Create(context.get())); | |
3058 async_pixel_transfer_manager_->Initialize(texture_manager()); | |
3059 | |
3060 if (workarounds().gl_clear_broken) { | 3011 if (workarounds().gl_clear_broken) { |
3061 DCHECK(!clear_framebuffer_blit_.get()); | 3012 DCHECK(!clear_framebuffer_blit_.get()); |
3062 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glClearWorkaroundInit"); | 3013 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glClearWorkaroundInit"); |
3063 clear_framebuffer_blit_.reset(new ClearFramebufferResourceManager(this)); | 3014 clear_framebuffer_blit_.reset(new ClearFramebufferResourceManager(this)); |
3064 if (LOCAL_PEEK_GL_ERROR("glClearWorkaroundInit") != GL_NO_ERROR) | 3015 if (LOCAL_PEEK_GL_ERROR("glClearWorkaroundInit") != GL_NO_ERROR) |
3065 return false; | 3016 return false; |
3066 } | 3017 } |
3067 | 3018 |
3068 framebuffer_manager()->AddObserver(this); | 3019 framebuffer_manager()->AddObserver(this); |
3069 | 3020 |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3605 | 3556 |
3606 framebuffer_state_.clear_state_dirty = true; | 3557 framebuffer_state_.clear_state_dirty = true; |
3607 | 3558 |
3608 return true; | 3559 return true; |
3609 } | 3560 } |
3610 | 3561 |
3611 void GLES2DecoderImpl::ProcessFinishedAsyncTransfers() { | 3562 void GLES2DecoderImpl::ProcessFinishedAsyncTransfers() { |
3612 ProcessPendingReadPixels(false); | 3563 ProcessPendingReadPixels(false); |
3613 if (engine() && query_manager_.get()) | 3564 if (engine() && query_manager_.get()) |
3614 query_manager_->ProcessPendingTransferQueries(); | 3565 query_manager_->ProcessPendingTransferQueries(); |
3615 | |
3616 // TODO(epenner): Is there a better place to do this? | |
3617 // This needs to occur before we execute any batch of commands | |
3618 // from the client, as the client may have recieved an async | |
3619 // completion while issuing those commands. | |
3620 // "DidFlushStart" would be ideal if we had such a callback. | |
3621 async_pixel_transfer_manager_->BindCompletedAsyncTransfers(); | |
3622 } | 3566 } |
3623 | 3567 |
3624 static void RebindCurrentFramebuffer( | 3568 static void RebindCurrentFramebuffer( |
3625 GLenum target, | 3569 GLenum target, |
3626 Framebuffer* framebuffer, | 3570 Framebuffer* framebuffer, |
3627 GLuint back_buffer_service_id) { | 3571 GLuint back_buffer_service_id) { |
3628 GLuint framebuffer_id = framebuffer ? framebuffer->service_id() : 0; | 3572 GLuint framebuffer_id = framebuffer ? framebuffer->service_id() : 0; |
3629 | 3573 |
3630 if (framebuffer_id == 0) { | 3574 if (framebuffer_id == 0) { |
3631 framebuffer_id = back_buffer_service_id; | 3575 framebuffer_id = back_buffer_service_id; |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3895 void GLES2DecoderImpl::SetShaderCacheCallback( | 3839 void GLES2DecoderImpl::SetShaderCacheCallback( |
3896 const ShaderCacheCallback& callback) { | 3840 const ShaderCacheCallback& callback) { |
3897 shader_cache_callback_ = callback; | 3841 shader_cache_callback_ = callback; |
3898 } | 3842 } |
3899 | 3843 |
3900 void GLES2DecoderImpl::SetWaitSyncPointCallback( | 3844 void GLES2DecoderImpl::SetWaitSyncPointCallback( |
3901 const WaitSyncPointCallback& callback) { | 3845 const WaitSyncPointCallback& callback) { |
3902 wait_sync_point_callback_ = callback; | 3846 wait_sync_point_callback_ = callback; |
3903 } | 3847 } |
3904 | 3848 |
3905 AsyncPixelTransferManager* | |
3906 GLES2DecoderImpl::GetAsyncPixelTransferManager() { | |
3907 return async_pixel_transfer_manager_.get(); | |
3908 } | |
3909 | |
3910 void GLES2DecoderImpl::ResetAsyncPixelTransferManagerForTest() { | |
3911 async_pixel_transfer_manager_.reset(); | |
3912 } | |
3913 | |
3914 void GLES2DecoderImpl::SetAsyncPixelTransferManagerForTest( | |
3915 AsyncPixelTransferManager* manager) { | |
3916 async_pixel_transfer_manager_ = make_scoped_ptr(manager); | |
3917 } | |
3918 | |
3919 bool GLES2DecoderImpl::GetServiceTextureId(uint32 client_texture_id, | 3849 bool GLES2DecoderImpl::GetServiceTextureId(uint32 client_texture_id, |
3920 uint32* service_texture_id) { | 3850 uint32* service_texture_id) { |
3921 TextureRef* texture_ref = texture_manager()->GetTexture(client_texture_id); | 3851 TextureRef* texture_ref = texture_manager()->GetTexture(client_texture_id); |
3922 if (texture_ref) { | 3852 if (texture_ref) { |
3923 *service_texture_id = texture_ref->service_id(); | 3853 *service_texture_id = texture_ref->service_id(); |
3924 return true; | 3854 return true; |
3925 } | 3855 } |
3926 return false; | 3856 return false; |
3927 } | 3857 } |
3928 | 3858 |
3929 uint32 GLES2DecoderImpl::GetTextureUploadCount() { | 3859 uint32 GLES2DecoderImpl::GetTextureUploadCount() { |
3930 return texture_state_.texture_upload_count + | 3860 return texture_state_.texture_upload_count; |
3931 async_pixel_transfer_manager_->GetTextureUploadCount(); | |
3932 } | 3861 } |
3933 | 3862 |
3934 base::TimeDelta GLES2DecoderImpl::GetTotalTextureUploadTime() { | 3863 base::TimeDelta GLES2DecoderImpl::GetTotalTextureUploadTime() { |
3935 return texture_state_.total_texture_upload_time + | 3864 return texture_state_.total_texture_upload_time; |
3936 async_pixel_transfer_manager_->GetTotalTextureUploadTime(); | |
3937 } | 3865 } |
3938 | 3866 |
3939 base::TimeDelta GLES2DecoderImpl::GetTotalProcessingCommandsTime() { | 3867 base::TimeDelta GLES2DecoderImpl::GetTotalProcessingCommandsTime() { |
3940 return total_processing_commands_time_; | 3868 return total_processing_commands_time_; |
3941 } | 3869 } |
3942 | 3870 |
3943 void GLES2DecoderImpl::AddProcessingCommandsTime(base::TimeDelta time) { | 3871 void GLES2DecoderImpl::AddProcessingCommandsTime(base::TimeDelta time) { |
3944 total_processing_commands_time_ += time; | 3872 total_processing_commands_time_ += time; |
3945 } | 3873 } |
3946 | 3874 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4071 offscreen_saved_frame_buffer_.reset(); | 3999 offscreen_saved_frame_buffer_.reset(); |
4072 offscreen_saved_color_texture_.reset(); | 4000 offscreen_saved_color_texture_.reset(); |
4073 offscreen_resolved_frame_buffer_.reset(); | 4001 offscreen_resolved_frame_buffer_.reset(); |
4074 offscreen_resolved_color_texture_.reset(); | 4002 offscreen_resolved_color_texture_.reset(); |
4075 | 4003 |
4076 // Need to release these before releasing |group_| which may own the | 4004 // Need to release these before releasing |group_| which may own the |
4077 // ShaderTranslatorCache. | 4005 // ShaderTranslatorCache. |
4078 fragment_translator_ = NULL; | 4006 fragment_translator_ = NULL; |
4079 vertex_translator_ = NULL; | 4007 vertex_translator_ = NULL; |
4080 | 4008 |
4081 // Should destroy the transfer manager before the texture manager held | |
4082 // by the context group. | |
4083 async_pixel_transfer_manager_.reset(); | |
4084 | |
4085 // Destroy the GPU Tracer which may own some in process GPU Timings. | 4009 // Destroy the GPU Tracer which may own some in process GPU Timings. |
4086 if (gpu_tracer_) { | 4010 if (gpu_tracer_) { |
4087 gpu_tracer_->Destroy(have_context); | 4011 gpu_tracer_->Destroy(have_context); |
4088 gpu_tracer_.reset(); | 4012 gpu_tracer_.reset(); |
4089 } | 4013 } |
4090 | 4014 |
4091 if (group_.get()) { | 4015 if (group_.get()) { |
4092 framebuffer_manager()->RemoveObserver(this); | 4016 framebuffer_manager()->RemoveObserver(this); |
4093 group_->Destroy(this, have_context); | 4017 group_->Destroy(this, have_context); |
4094 group_ = NULL; | 4018 group_ = NULL; |
(...skipping 6200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10295 Texture* texture = texture_ref->texture(); | 10219 Texture* texture = texture_ref->texture(); |
10296 GLenum type = 0; | 10220 GLenum type = 0; |
10297 GLenum format = 0; | 10221 GLenum format = 0; |
10298 if (!texture->GetLevelType(target, level, &type, &format) || | 10222 if (!texture->GetLevelType(target, level, &type, &format) || |
10299 !texture->ValidForTexture( | 10223 !texture->ValidForTexture( |
10300 target, level, xoffset, yoffset, 0, width, height, 1, type)) { | 10224 target, level, xoffset, yoffset, 0, width, height, 1, type)) { |
10301 LOCAL_SET_GL_ERROR( | 10225 LOCAL_SET_GL_ERROR( |
10302 GL_INVALID_VALUE, "glCopyTexSubImage2D", "bad dimensions."); | 10226 GL_INVALID_VALUE, "glCopyTexSubImage2D", "bad dimensions."); |
10303 return; | 10227 return; |
10304 } | 10228 } |
10305 if (async_pixel_transfer_manager_->AsyncTransferIsInProgress(texture_ref)) { | |
10306 LOCAL_SET_GL_ERROR( | |
10307 GL_INVALID_OPERATION, | |
10308 "glCopyTexSubImage2D", "async upload pending for texture"); | |
10309 return; | |
10310 } | |
10311 | 10229 |
10312 // Check we have compatible formats. | 10230 // Check we have compatible formats. |
10313 GLenum read_format = GetBoundReadFrameBufferInternalFormat(); | 10231 GLenum read_format = GetBoundReadFrameBufferInternalFormat(); |
10314 uint32 channels_exist = GLES2Util::GetChannelsForFormat(read_format); | 10232 uint32 channels_exist = GLES2Util::GetChannelsForFormat(read_format); |
10315 uint32 channels_needed = GLES2Util::GetChannelsForFormat(format); | 10233 uint32 channels_needed = GLES2Util::GetChannelsForFormat(format); |
10316 | 10234 |
10317 if (!channels_needed || | 10235 if (!channels_needed || |
10318 (channels_needed & channels_exist) != channels_needed) { | 10236 (channels_needed & channels_exist) != channels_needed) { |
10319 LOCAL_SET_GL_ERROR( | 10237 LOCAL_SET_GL_ERROR( |
10320 GL_INVALID_OPERATION, "glCopyTexSubImage2D", "incompatible format"); | 10238 GL_INVALID_OPERATION, "glCopyTexSubImage2D", "incompatible format"); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10457 if (!texture_manager()->ValidateTextureParameters(state_.GetErrorState(), | 10375 if (!texture_manager()->ValidateTextureParameters(state_.GetErrorState(), |
10458 function_name, format, type, internal_format, level)) { | 10376 function_name, format, type, internal_format, level)) { |
10459 return false; | 10377 return false; |
10460 } | 10378 } |
10461 if (type != current_type) { | 10379 if (type != current_type) { |
10462 LOCAL_SET_GL_ERROR( | 10380 LOCAL_SET_GL_ERROR( |
10463 GL_INVALID_OPERATION, | 10381 GL_INVALID_OPERATION, |
10464 function_name, "type does not match type of texture."); | 10382 function_name, "type does not match type of texture."); |
10465 return false; | 10383 return false; |
10466 } | 10384 } |
10467 if (async_pixel_transfer_manager_->AsyncTransferIsInProgress(texture_ref)) { | |
10468 LOCAL_SET_GL_ERROR( | |
10469 GL_INVALID_OPERATION, | |
10470 function_name, "async upload pending for texture"); | |
10471 return false; | |
10472 } | |
10473 if (!texture->ValidForTexture( | 10385 if (!texture->ValidForTexture( |
10474 target, level, xoffset, yoffset, 0, width, height, 1, type)) { | 10386 target, level, xoffset, yoffset, 0, width, height, 1, type)) { |
10475 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "bad dimensions."); | 10387 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "bad dimensions."); |
10476 return false; | 10388 return false; |
10477 } | 10389 } |
10478 if ((GLES2Util::GetChannelsForFormat(format) & | 10390 if ((GLES2Util::GetChannelsForFormat(format) & |
10479 (GLES2Util::kDepth | GLES2Util::kStencil)) != 0 | 10391 (GLES2Util::kDepth | GLES2Util::kStencil)) != 0 |
10480 && !feature_info_->IsES3Enabled()) { | 10392 && !feature_info_->IsES3Enabled()) { |
10481 LOCAL_SET_GL_ERROR( | 10393 LOCAL_SET_GL_ERROR( |
10482 GL_INVALID_OPERATION, | 10394 GL_INVALID_OPERATION, |
(...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11727 std::vector<base::Closure> callbacks = | 11639 std::vector<base::Closure> callbacks = |
11728 pending_readpixel_fences_.front()->callbacks; | 11640 pending_readpixel_fences_.front()->callbacks; |
11729 pending_readpixel_fences_.pop(); | 11641 pending_readpixel_fences_.pop(); |
11730 for (size_t i = 0; i < callbacks.size(); i++) { | 11642 for (size_t i = 0; i < callbacks.size(); i++) { |
11731 callbacks[i].Run(); | 11643 callbacks[i].Run(); |
11732 } | 11644 } |
11733 } | 11645 } |
11734 } | 11646 } |
11735 | 11647 |
11736 bool GLES2DecoderImpl::HasMoreIdleWork() { | 11648 bool GLES2DecoderImpl::HasMoreIdleWork() { |
11737 return !pending_readpixel_fences_.empty() || | 11649 return !pending_readpixel_fences_.empty(); |
11738 async_pixel_transfer_manager_->NeedsProcessMorePendingTransfers(); | |
11739 } | 11650 } |
11740 | 11651 |
11741 void GLES2DecoderImpl::PerformIdleWork() { | 11652 void GLES2DecoderImpl::PerformIdleWork() { |
11742 ProcessPendingReadPixels(false); | 11653 ProcessPendingReadPixels(false); |
11743 if (!async_pixel_transfer_manager_->NeedsProcessMorePendingTransfers()) | |
11744 return; | |
11745 async_pixel_transfer_manager_->ProcessMorePendingTransfers(); | |
11746 ProcessFinishedAsyncTransfers(); | |
11747 } | 11654 } |
11748 | 11655 |
11749 error::Error GLES2DecoderImpl::HandleBeginQueryEXT(uint32 immediate_data_size, | 11656 error::Error GLES2DecoderImpl::HandleBeginQueryEXT(uint32 immediate_data_size, |
11750 const void* cmd_data) { | 11657 const void* cmd_data) { |
11751 const gles2::cmds::BeginQueryEXT& c = | 11658 const gles2::cmds::BeginQueryEXT& c = |
11752 *static_cast<const gles2::cmds::BeginQueryEXT*>(cmd_data); | 11659 *static_cast<const gles2::cmds::BeginQueryEXT*>(cmd_data); |
11753 GLenum target = static_cast<GLenum>(c.target); | 11660 GLenum target = static_cast<GLenum>(c.target); |
11754 GLuint client_id = static_cast<GLuint>(c.id); | 11661 GLuint client_id = static_cast<GLuint>(c.id); |
11755 int32 sync_shm_id = static_cast<int32>(c.sync_data_shm_id); | 11662 int32 sync_shm_id = static_cast<int32>(c.sync_data_shm_id); |
11756 uint32 sync_shm_offset = static_cast<uint32>(c.sync_data_shm_offset); | 11663 uint32 sync_shm_offset = static_cast<uint32>(c.sync_data_shm_offset); |
11757 | 11664 |
11758 switch (target) { | 11665 switch (target) { |
11759 case GL_COMMANDS_ISSUED_CHROMIUM: | 11666 case GL_COMMANDS_ISSUED_CHROMIUM: |
11760 case GL_LATENCY_QUERY_CHROMIUM: | 11667 case GL_LATENCY_QUERY_CHROMIUM: |
11761 case GL_ASYNC_PIXEL_UNPACK_COMPLETED_CHROMIUM: | |
11762 case GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM: | |
no sievers
2015/08/26 18:37:26
You want to leave GL_ASYNC_PIXEL_PACK_COMPLETED_CH
reveman
2015/08/26 22:34:25
Done. Nice catch, thanks!
| |
11763 case GL_GET_ERROR_QUERY_CHROMIUM: | 11668 case GL_GET_ERROR_QUERY_CHROMIUM: |
11764 break; | 11669 break; |
11765 case GL_COMMANDS_COMPLETED_CHROMIUM: | 11670 case GL_COMMANDS_COMPLETED_CHROMIUM: |
11766 if (!features().chromium_sync_query) { | 11671 if (!features().chromium_sync_query) { |
11767 LOCAL_SET_GL_ERROR( | 11672 LOCAL_SET_GL_ERROR( |
11768 GL_INVALID_OPERATION, "glBeginQueryEXT", | 11673 GL_INVALID_OPERATION, "glBeginQueryEXT", |
11769 "not enabled for commands completed queries"); | 11674 "not enabled for commands completed queries"); |
11770 return error::kNoError; | 11675 return error::kNoError; |
11771 } | 11676 } |
11772 break; | 11677 break; |
(...skipping 1988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13761 | 13666 |
13762 GLfloat* target_matrix = matrix_mode == GL_PATH_PROJECTION_CHROMIUM | 13667 GLfloat* target_matrix = matrix_mode == GL_PATH_PROJECTION_CHROMIUM |
13763 ? state_.projection_matrix | 13668 ? state_.projection_matrix |
13764 : state_.modelview_matrix; | 13669 : state_.modelview_matrix; |
13765 memcpy(target_matrix, kIdentityMatrix, sizeof(kIdentityMatrix)); | 13670 memcpy(target_matrix, kIdentityMatrix, sizeof(kIdentityMatrix)); |
13766 // The matrix_mode is either GL_PATH_MODELVIEW_NV or GL_PATH_PROJECTION_NV | 13671 // The matrix_mode is either GL_PATH_MODELVIEW_NV or GL_PATH_PROJECTION_NV |
13767 // since the values of the _NV and _CHROMIUM tokens match. | 13672 // since the values of the _NV and _CHROMIUM tokens match. |
13768 glMatrixLoadIdentityEXT(matrix_mode); | 13673 glMatrixLoadIdentityEXT(matrix_mode); |
13769 } | 13674 } |
13770 | 13675 |
13771 bool GLES2DecoderImpl::ValidateAsyncTransfer( | |
13772 const char* function_name, | |
13773 TextureRef* texture_ref, | |
13774 GLenum target, | |
13775 GLint level, | |
13776 const void * data) { | |
13777 // We only support async uploads to 2D textures for now. | |
13778 if (GL_TEXTURE_2D != target) { | |
13779 LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, target, "target"); | |
13780 return false; | |
13781 } | |
13782 // We only support uploads to level zero for now. | |
13783 if (level != 0) { | |
13784 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "level != 0"); | |
13785 return false; | |
13786 } | |
13787 // A transfer buffer must be bound, even for asyncTexImage2D. | |
13788 if (data == NULL) { | |
13789 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, "buffer == 0"); | |
13790 return false; | |
13791 } | |
13792 // We only support one async transfer in progress. | |
13793 if (!texture_ref || | |
13794 async_pixel_transfer_manager_->AsyncTransferIsInProgress(texture_ref)) { | |
13795 LOCAL_SET_GL_ERROR( | |
13796 GL_INVALID_OPERATION, | |
13797 function_name, "transfer already in progress"); | |
13798 return false; | |
13799 } | |
13800 return true; | |
13801 } | |
13802 | |
13803 base::Closure GLES2DecoderImpl::AsyncUploadTokenCompletionClosure( | |
13804 uint32 async_upload_token, | |
13805 uint32 sync_data_shm_id, | |
13806 uint32 sync_data_shm_offset) { | |
13807 scoped_refptr<gpu::Buffer> buffer = GetSharedMemoryBuffer(sync_data_shm_id); | |
13808 if (!buffer.get() || | |
13809 !buffer->GetDataAddress(sync_data_shm_offset, sizeof(AsyncUploadSync))) | |
13810 return base::Closure(); | |
13811 | |
13812 AsyncMemoryParams mem_params(buffer, | |
13813 sync_data_shm_offset, | |
13814 sizeof(AsyncUploadSync)); | |
13815 | |
13816 scoped_refptr<AsyncUploadTokenCompletionObserver> observer( | |
13817 new AsyncUploadTokenCompletionObserver(async_upload_token)); | |
13818 | |
13819 return base::Bind( | |
13820 &AsyncPixelTransferManager::AsyncNotifyCompletion, | |
13821 base::Unretained(GetAsyncPixelTransferManager()), | |
13822 mem_params, | |
13823 observer); | |
13824 } | |
13825 | |
13826 error::Error GLES2DecoderImpl::HandleAsyncTexImage2DCHROMIUM( | |
13827 uint32 immediate_data_size, | |
13828 const void* cmd_data) { | |
13829 const gles2::cmds::AsyncTexImage2DCHROMIUM& c = | |
13830 *static_cast<const gles2::cmds::AsyncTexImage2DCHROMIUM*>(cmd_data); | |
13831 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleAsyncTexImage2DCHROMIUM"); | |
13832 GLenum target = static_cast<GLenum>(c.target); | |
13833 GLint level = static_cast<GLint>(c.level); | |
13834 GLenum internal_format = static_cast<GLenum>(c.internalformat); | |
13835 GLsizei width = static_cast<GLsizei>(c.width); | |
13836 GLsizei height = static_cast<GLsizei>(c.height); | |
13837 GLint border = static_cast<GLint>(c.border); | |
13838 GLenum format = static_cast<GLenum>(c.format); | |
13839 GLenum type = static_cast<GLenum>(c.type); | |
13840 uint32 pixels_shm_id = static_cast<uint32>(c.pixels_shm_id); | |
13841 uint32 pixels_shm_offset = static_cast<uint32>(c.pixels_shm_offset); | |
13842 uint32 pixels_size; | |
13843 uint32 async_upload_token = static_cast<uint32>(c.async_upload_token); | |
13844 uint32 sync_data_shm_id = static_cast<uint32>(c.sync_data_shm_id); | |
13845 uint32 sync_data_shm_offset = static_cast<uint32>(c.sync_data_shm_offset); | |
13846 | |
13847 base::ScopedClosureRunner scoped_completion_callback; | |
13848 if (async_upload_token) { | |
13849 base::Closure completion_closure = | |
13850 AsyncUploadTokenCompletionClosure(async_upload_token, | |
13851 sync_data_shm_id, | |
13852 sync_data_shm_offset); | |
13853 if (completion_closure.is_null()) | |
13854 return error::kInvalidArguments; | |
13855 | |
13856 scoped_completion_callback.Reset(completion_closure); | |
13857 } | |
13858 | |
13859 // TODO(epenner): Move this and copies of this memory validation | |
13860 // into ValidateTexImage2D step. | |
13861 if (!GLES2Util::ComputeImageDataSizes( | |
13862 width, height, 1, format, type, state_.unpack_alignment, &pixels_size, | |
13863 NULL, NULL)) { | |
13864 return error::kOutOfBounds; | |
13865 } | |
13866 const void* pixels = NULL; | |
13867 if (pixels_shm_id != 0 || pixels_shm_offset != 0) { | |
13868 pixels = GetSharedMemoryAs<const void*>( | |
13869 pixels_shm_id, pixels_shm_offset, pixels_size); | |
13870 if (!pixels) { | |
13871 return error::kOutOfBounds; | |
13872 } | |
13873 } | |
13874 | |
13875 TextureManager::DoTexImageArguments args = { | |
13876 target, level, internal_format, width, height, 1, border, format, type, | |
13877 pixels, pixels_size, TextureManager::DoTexImageArguments::kTexImage2D }; | |
13878 TextureRef* texture_ref; | |
13879 // All the normal glTexSubImage2D validation. | |
13880 if (!texture_manager()->ValidateTexImage( | |
13881 &state_, "glAsyncTexImage2DCHROMIUM", args, &texture_ref)) { | |
13882 return error::kNoError; | |
13883 } | |
13884 | |
13885 // Extra async validation. | |
13886 Texture* texture = texture_ref->texture(); | |
13887 if (!ValidateAsyncTransfer( | |
13888 "glAsyncTexImage2DCHROMIUM", texture_ref, target, level, pixels)) | |
13889 return error::kNoError; | |
13890 | |
13891 // Don't allow async redefinition of a textures. | |
13892 if (texture->IsDefined()) { | |
13893 LOCAL_SET_GL_ERROR( | |
13894 GL_INVALID_OPERATION, | |
13895 "glAsyncTexImage2DCHROMIUM", "already defined"); | |
13896 return error::kNoError; | |
13897 } | |
13898 | |
13899 if (!EnsureGPUMemoryAvailable(pixels_size)) { | |
13900 LOCAL_SET_GL_ERROR( | |
13901 GL_OUT_OF_MEMORY, "glAsyncTexImage2DCHROMIUM", "out of memory"); | |
13902 return error::kNoError; | |
13903 } | |
13904 | |
13905 // Setup the parameters. | |
13906 AsyncTexImage2DParams tex_params = { | |
13907 target, level, static_cast<GLenum>(internal_format), | |
13908 width, height, border, format, type}; | |
13909 AsyncMemoryParams mem_params( | |
13910 GetSharedMemoryBuffer(c.pixels_shm_id), c.pixels_shm_offset, pixels_size); | |
13911 | |
13912 // Set up the async state if needed, and make the texture | |
13913 // immutable so the async state stays valid. The level info | |
13914 // is set up lazily when the transfer completes. | |
13915 AsyncPixelTransferDelegate* delegate = | |
13916 async_pixel_transfer_manager_->CreatePixelTransferDelegate(texture_ref, | |
13917 tex_params); | |
13918 texture->SetImmutable(true); | |
13919 | |
13920 delegate->AsyncTexImage2D( | |
13921 tex_params, | |
13922 mem_params, | |
13923 base::Bind(&TextureManager::SetLevelInfoFromParams, | |
13924 // The callback is only invoked if the transfer delegate still | |
13925 // exists, which implies through manager->texture_ref->state | |
13926 // ownership that both of these pointers are valid. | |
13927 base::Unretained(texture_manager()), | |
13928 base::Unretained(texture_ref), | |
13929 tex_params)); | |
13930 return error::kNoError; | |
13931 } | |
13932 | |
13933 error::Error GLES2DecoderImpl::HandleAsyncTexSubImage2DCHROMIUM( | |
13934 uint32 immediate_data_size, | |
13935 const void* cmd_data) { | |
13936 const gles2::cmds::AsyncTexSubImage2DCHROMIUM& c = | |
13937 *static_cast<const gles2::cmds::AsyncTexSubImage2DCHROMIUM*>(cmd_data); | |
13938 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleAsyncTexSubImage2DCHROMIUM"); | |
13939 GLenum target = static_cast<GLenum>(c.target); | |
13940 GLint level = static_cast<GLint>(c.level); | |
13941 GLint xoffset = static_cast<GLint>(c.xoffset); | |
13942 GLint yoffset = static_cast<GLint>(c.yoffset); | |
13943 GLsizei width = static_cast<GLsizei>(c.width); | |
13944 GLsizei height = static_cast<GLsizei>(c.height); | |
13945 GLenum format = static_cast<GLenum>(c.format); | |
13946 GLenum type = static_cast<GLenum>(c.type); | |
13947 uint32 async_upload_token = static_cast<uint32>(c.async_upload_token); | |
13948 uint32 sync_data_shm_id = static_cast<uint32>(c.sync_data_shm_id); | |
13949 uint32 sync_data_shm_offset = static_cast<uint32>(c.sync_data_shm_offset); | |
13950 | |
13951 base::ScopedClosureRunner scoped_completion_callback; | |
13952 if (async_upload_token) { | |
13953 base::Closure completion_closure = | |
13954 AsyncUploadTokenCompletionClosure(async_upload_token, | |
13955 sync_data_shm_id, | |
13956 sync_data_shm_offset); | |
13957 if (completion_closure.is_null()) | |
13958 return error::kInvalidArguments; | |
13959 | |
13960 scoped_completion_callback.Reset(completion_closure); | |
13961 } | |
13962 | |
13963 // TODO(epenner): Move this and copies of this memory validation | |
13964 // into ValidateTexSubImage2D step. | |
13965 uint32 data_size; | |
13966 if (!GLES2Util::ComputeImageDataSizes( | |
13967 width, height, 1, format, type, state_.unpack_alignment, &data_size, | |
13968 NULL, NULL)) { | |
13969 return error::kOutOfBounds; | |
13970 } | |
13971 const void* pixels = GetSharedMemoryAs<const void*>( | |
13972 c.data_shm_id, c.data_shm_offset, data_size); | |
13973 | |
13974 // All the normal glTexSubImage2D validation. | |
13975 error::Error error = error::kNoError; | |
13976 if (!ValidateTexSubImage2D(&error, "glAsyncTexSubImage2DCHROMIUM", | |
13977 target, level, xoffset, yoffset, width, height, format, type, pixels)) { | |
13978 return error; | |
13979 } | |
13980 | |
13981 // Extra async validation. | |
13982 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( | |
13983 &state_, target); | |
13984 Texture* texture = texture_ref->texture(); | |
13985 if (!ValidateAsyncTransfer( | |
13986 "glAsyncTexSubImage2DCHROMIUM", texture_ref, target, level, pixels)) | |
13987 return error::kNoError; | |
13988 | |
13989 // Guarantee async textures are always 'cleared' as follows: | |
13990 // - AsyncTexImage2D can not redefine an existing texture | |
13991 // - AsyncTexImage2D must initialize the entire image via non-null buffer. | |
13992 // - AsyncTexSubImage2D clears synchronously if not already cleared. | |
13993 // - Textures become immutable after an async call. | |
13994 // This way we know in all cases that an async texture is always clear. | |
13995 if (!texture->SafeToRenderFrom()) { | |
13996 if (!texture_manager()->ClearTextureLevel(this, texture_ref, | |
13997 target, level)) { | |
13998 LOCAL_SET_GL_ERROR( | |
13999 GL_OUT_OF_MEMORY, | |
14000 "glAsyncTexSubImage2DCHROMIUM", "dimensions too big"); | |
14001 return error::kNoError; | |
14002 } | |
14003 } | |
14004 | |
14005 // Setup the parameters. | |
14006 AsyncTexSubImage2DParams tex_params = {target, level, xoffset, yoffset, | |
14007 width, height, format, type}; | |
14008 AsyncMemoryParams mem_params( | |
14009 GetSharedMemoryBuffer(c.data_shm_id), c.data_shm_offset, data_size); | |
14010 AsyncPixelTransferDelegate* delegate = | |
14011 async_pixel_transfer_manager_->GetPixelTransferDelegate(texture_ref); | |
14012 if (!delegate) { | |
14013 // TODO(epenner): We may want to enforce exclusive use | |
14014 // of async APIs in which case this should become an error, | |
14015 // (the texture should have been async defined). | |
14016 AsyncTexImage2DParams define_params = {target, level, | |
14017 0, 0, 0, 0, 0, 0}; | |
14018 texture->GetLevelSize( | |
14019 target, level, &define_params.width, &define_params.height, nullptr); | |
14020 texture->GetLevelType( | |
14021 target, level, &define_params.type, &define_params.internal_format); | |
14022 // Set up the async state if needed, and make the texture | |
14023 // immutable so the async state stays valid. | |
14024 delegate = async_pixel_transfer_manager_->CreatePixelTransferDelegate( | |
14025 texture_ref, define_params); | |
14026 texture->SetImmutable(true); | |
14027 } | |
14028 | |
14029 delegate->AsyncTexSubImage2D(tex_params, mem_params); | |
14030 return error::kNoError; | |
14031 } | |
14032 | |
14033 error::Error GLES2DecoderImpl::HandleWaitAsyncTexImage2DCHROMIUM( | |
14034 uint32 immediate_data_size, | |
14035 const void* cmd_data) { | |
14036 const gles2::cmds::WaitAsyncTexImage2DCHROMIUM& c = | |
14037 *static_cast<const gles2::cmds::WaitAsyncTexImage2DCHROMIUM*>(cmd_data); | |
14038 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleWaitAsyncTexImage2DCHROMIUM"); | |
14039 GLenum target = static_cast<GLenum>(c.target); | |
14040 | |
14041 if (GL_TEXTURE_2D != target) { | |
14042 LOCAL_SET_GL_ERROR( | |
14043 GL_INVALID_ENUM, "glWaitAsyncTexImage2DCHROMIUM", "target"); | |
14044 return error::kNoError; | |
14045 } | |
14046 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( | |
14047 &state_, target); | |
14048 if (!texture_ref) { | |
14049 LOCAL_SET_GL_ERROR( | |
14050 GL_INVALID_OPERATION, | |
14051 "glWaitAsyncTexImage2DCHROMIUM", "unknown texture"); | |
14052 return error::kNoError; | |
14053 } | |
14054 AsyncPixelTransferDelegate* delegate = | |
14055 async_pixel_transfer_manager_->GetPixelTransferDelegate(texture_ref); | |
14056 if (!delegate) { | |
14057 LOCAL_SET_GL_ERROR( | |
14058 GL_INVALID_OPERATION, | |
14059 "glWaitAsyncTexImage2DCHROMIUM", "No async transfer started"); | |
14060 return error::kNoError; | |
14061 } | |
14062 delegate->WaitForTransferCompletion(); | |
14063 ProcessFinishedAsyncTransfers(); | |
14064 return error::kNoError; | |
14065 } | |
14066 | |
14067 error::Error GLES2DecoderImpl::HandleWaitAllAsyncTexImage2DCHROMIUM( | |
14068 uint32 immediate_data_size, | |
14069 const void* data) { | |
14070 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleWaitAsyncTexImage2DCHROMIUM"); | |
14071 | |
14072 GetAsyncPixelTransferManager()->WaitAllAsyncTexImage2D(); | |
14073 ProcessFinishedAsyncTransfers(); | |
14074 return error::kNoError; | |
14075 } | |
14076 | |
14077 error::Error GLES2DecoderImpl::HandleUniformBlockBinding( | 13676 error::Error GLES2DecoderImpl::HandleUniformBlockBinding( |
14078 uint32_t immediate_data_size, const void* cmd_data) { | 13677 uint32_t immediate_data_size, const void* cmd_data) { |
14079 if (!unsafe_es3_apis_enabled()) | 13678 if (!unsafe_es3_apis_enabled()) |
14080 return error::kUnknownCommand; | 13679 return error::kUnknownCommand; |
14081 const gles2::cmds::UniformBlockBinding& c = | 13680 const gles2::cmds::UniformBlockBinding& c = |
14082 *static_cast<const gles2::cmds::UniformBlockBinding*>(cmd_data); | 13681 *static_cast<const gles2::cmds::UniformBlockBinding*>(cmd_data); |
14083 GLuint client_id = c.program; | 13682 GLuint client_id = c.program; |
14084 GLuint index = static_cast<GLuint>(c.index); | 13683 GLuint index = static_cast<GLuint>(c.index); |
14085 GLuint binding = static_cast<GLuint>(c.binding); | 13684 GLuint binding = static_cast<GLuint>(c.binding); |
14086 Program* program = GetProgramInfoNotShader( | 13685 Program* program = GetProgramInfoNotShader( |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
14783 return error::kNoError; | 14382 return error::kNoError; |
14784 } | 14383 } |
14785 | 14384 |
14786 // Include the auto-generated part of this file. We split this because it means | 14385 // Include the auto-generated part of this file. We split this because it means |
14787 // we can easily edit the non-auto generated parts right here in this file | 14386 // we can easily edit the non-auto generated parts right here in this file |
14788 // instead of having to edit some template or the code generator. | 14387 // instead of having to edit some template or the code generator. |
14789 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 14388 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
14790 | 14389 |
14791 } // namespace gles2 | 14390 } // namespace gles2 |
14792 } // namespace gpu | 14391 } // namespace gpu |
OLD | NEW |