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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 scoped_ptr<gfx::GLFence> fence; | 504 scoped_ptr<gfx::GLFence> fence; |
505 }; | 505 }; |
506 | 506 |
507 class AsyncUploadTokenCompletionObserver | 507 class AsyncUploadTokenCompletionObserver |
508 : public AsyncPixelTransferCompletionObserver { | 508 : public AsyncPixelTransferCompletionObserver { |
509 public: | 509 public: |
510 explicit AsyncUploadTokenCompletionObserver(uint32 async_upload_token) | 510 explicit AsyncUploadTokenCompletionObserver(uint32 async_upload_token) |
511 : async_upload_token_(async_upload_token) { | 511 : async_upload_token_(async_upload_token) { |
512 } | 512 } |
513 | 513 |
514 virtual void DidComplete(const AsyncMemoryParams& mem_params) OVERRIDE { | 514 virtual void DidComplete(const AsyncMemoryParams& mem_params) override { |
515 DCHECK(mem_params.buffer().get()); | 515 DCHECK(mem_params.buffer().get()); |
516 void* data = mem_params.GetDataAddress(); | 516 void* data = mem_params.GetDataAddress(); |
517 AsyncUploadSync* sync = static_cast<AsyncUploadSync*>(data); | 517 AsyncUploadSync* sync = static_cast<AsyncUploadSync*>(data); |
518 sync->SetAsyncUploadToken(async_upload_token_); | 518 sync->SetAsyncUploadToken(async_upload_token_); |
519 } | 519 } |
520 | 520 |
521 private: | 521 private: |
522 virtual ~AsyncUploadTokenCompletionObserver() { | 522 virtual ~AsyncUploadTokenCompletionObserver() { |
523 } | 523 } |
524 | 524 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 class GLES2DecoderImpl : public GLES2Decoder, | 556 class GLES2DecoderImpl : public GLES2Decoder, |
557 public FramebufferManager::TextureDetachObserver, | 557 public FramebufferManager::TextureDetachObserver, |
558 public ErrorStateClient { | 558 public ErrorStateClient { |
559 public: | 559 public: |
560 explicit GLES2DecoderImpl(ContextGroup* group); | 560 explicit GLES2DecoderImpl(ContextGroup* group); |
561 virtual ~GLES2DecoderImpl(); | 561 virtual ~GLES2DecoderImpl(); |
562 | 562 |
563 // Overridden from AsyncAPIInterface. | 563 // Overridden from AsyncAPIInterface. |
564 virtual Error DoCommand(unsigned int command, | 564 virtual Error DoCommand(unsigned int command, |
565 unsigned int arg_count, | 565 unsigned int arg_count, |
566 const void* args) OVERRIDE; | 566 const void* args) override; |
567 | 567 |
568 virtual error::Error DoCommands(unsigned int num_commands, | 568 virtual error::Error DoCommands(unsigned int num_commands, |
569 const void* buffer, | 569 const void* buffer, |
570 int num_entries, | 570 int num_entries, |
571 int* entries_processed) OVERRIDE; | 571 int* entries_processed) override; |
572 | 572 |
573 template <bool DebugImpl> | 573 template <bool DebugImpl> |
574 error::Error DoCommandsImpl(unsigned int num_commands, | 574 error::Error DoCommandsImpl(unsigned int num_commands, |
575 const void* buffer, | 575 const void* buffer, |
576 int num_entries, | 576 int num_entries, |
577 int* entries_processed); | 577 int* entries_processed); |
578 | 578 |
579 // Overridden from AsyncAPIInterface. | 579 // Overridden from AsyncAPIInterface. |
580 virtual const char* GetCommandName(unsigned int command_id) const OVERRIDE; | 580 virtual const char* GetCommandName(unsigned int command_id) const override; |
581 | 581 |
582 // Overridden from GLES2Decoder. | 582 // Overridden from GLES2Decoder. |
583 virtual bool Initialize(const scoped_refptr<gfx::GLSurface>& surface, | 583 virtual bool Initialize(const scoped_refptr<gfx::GLSurface>& surface, |
584 const scoped_refptr<gfx::GLContext>& context, | 584 const scoped_refptr<gfx::GLContext>& context, |
585 bool offscreen, | 585 bool offscreen, |
586 const gfx::Size& size, | 586 const gfx::Size& size, |
587 const DisallowedFeatures& disallowed_features, | 587 const DisallowedFeatures& disallowed_features, |
588 const std::vector<int32>& attribs) OVERRIDE; | 588 const std::vector<int32>& attribs) override; |
589 virtual void Destroy(bool have_context) OVERRIDE; | 589 virtual void Destroy(bool have_context) override; |
590 virtual void SetSurface( | 590 virtual void SetSurface( |
591 const scoped_refptr<gfx::GLSurface>& surface) OVERRIDE; | 591 const scoped_refptr<gfx::GLSurface>& surface) override; |
592 virtual void ProduceFrontBuffer(const Mailbox& mailbox) OVERRIDE; | 592 virtual void ProduceFrontBuffer(const Mailbox& mailbox) override; |
593 virtual bool ResizeOffscreenFrameBuffer(const gfx::Size& size) OVERRIDE; | 593 virtual bool ResizeOffscreenFrameBuffer(const gfx::Size& size) override; |
594 void UpdateParentTextureInfo(); | 594 void UpdateParentTextureInfo(); |
595 virtual bool MakeCurrent() OVERRIDE; | 595 virtual bool MakeCurrent() override; |
596 virtual GLES2Util* GetGLES2Util() OVERRIDE { return &util_; } | 596 virtual GLES2Util* GetGLES2Util() override { return &util_; } |
597 virtual gfx::GLContext* GetGLContext() OVERRIDE { return context_.get(); } | 597 virtual gfx::GLContext* GetGLContext() override { return context_.get(); } |
598 virtual ContextGroup* GetContextGroup() OVERRIDE { return group_.get(); } | 598 virtual ContextGroup* GetContextGroup() override { return group_.get(); } |
599 virtual Capabilities GetCapabilities() OVERRIDE; | 599 virtual Capabilities GetCapabilities() override; |
600 virtual void RestoreState(const ContextState* prev_state) OVERRIDE; | 600 virtual void RestoreState(const ContextState* prev_state) override; |
601 | 601 |
602 virtual void RestoreActiveTexture() const OVERRIDE { | 602 virtual void RestoreActiveTexture() const override { |
603 state_.RestoreActiveTexture(); | 603 state_.RestoreActiveTexture(); |
604 } | 604 } |
605 virtual void RestoreAllTextureUnitBindings( | 605 virtual void RestoreAllTextureUnitBindings( |
606 const ContextState* prev_state) const OVERRIDE { | 606 const ContextState* prev_state) const override { |
607 state_.RestoreAllTextureUnitBindings(prev_state); | 607 state_.RestoreAllTextureUnitBindings(prev_state); |
608 } | 608 } |
609 virtual void RestoreActiveTextureUnitBinding( | 609 virtual void RestoreActiveTextureUnitBinding( |
610 unsigned int target) const OVERRIDE { | 610 unsigned int target) const override { |
611 state_.RestoreActiveTextureUnitBinding(target); | 611 state_.RestoreActiveTextureUnitBinding(target); |
612 } | 612 } |
613 virtual void RestoreBufferBindings() const OVERRIDE { | 613 virtual void RestoreBufferBindings() const override { |
614 state_.RestoreBufferBindings(); | 614 state_.RestoreBufferBindings(); |
615 } | 615 } |
616 virtual void RestoreGlobalState() const OVERRIDE { | 616 virtual void RestoreGlobalState() const override { |
617 state_.RestoreGlobalState(NULL); | 617 state_.RestoreGlobalState(NULL); |
618 } | 618 } |
619 virtual void RestoreProgramBindings() const OVERRIDE { | 619 virtual void RestoreProgramBindings() const override { |
620 state_.RestoreProgramBindings(); | 620 state_.RestoreProgramBindings(); |
621 } | 621 } |
622 virtual void RestoreTextureUnitBindings(unsigned unit) const OVERRIDE { | 622 virtual void RestoreTextureUnitBindings(unsigned unit) const override { |
623 state_.RestoreTextureUnitBindings(unit, NULL); | 623 state_.RestoreTextureUnitBindings(unit, NULL); |
624 } | 624 } |
625 virtual void RestoreFramebufferBindings() const OVERRIDE; | 625 virtual void RestoreFramebufferBindings() const override; |
626 virtual void RestoreRenderbufferBindings() OVERRIDE; | 626 virtual void RestoreRenderbufferBindings() override; |
627 virtual void RestoreTextureState(unsigned service_id) const OVERRIDE; | 627 virtual void RestoreTextureState(unsigned service_id) const override; |
628 | 628 |
629 virtual void ClearAllAttributes() const OVERRIDE; | 629 virtual void ClearAllAttributes() const override; |
630 virtual void RestoreAllAttributes() const OVERRIDE; | 630 virtual void RestoreAllAttributes() const override; |
631 | 631 |
632 virtual QueryManager* GetQueryManager() OVERRIDE { | 632 virtual QueryManager* GetQueryManager() override { |
633 return query_manager_.get(); | 633 return query_manager_.get(); |
634 } | 634 } |
635 virtual VertexArrayManager* GetVertexArrayManager() OVERRIDE { | 635 virtual VertexArrayManager* GetVertexArrayManager() override { |
636 return vertex_array_manager_.get(); | 636 return vertex_array_manager_.get(); |
637 } | 637 } |
638 virtual ImageManager* GetImageManager() OVERRIDE { | 638 virtual ImageManager* GetImageManager() override { |
639 return image_manager_.get(); | 639 return image_manager_.get(); |
640 } | 640 } |
641 virtual bool ProcessPendingQueries() OVERRIDE; | 641 virtual bool ProcessPendingQueries() override; |
642 virtual bool HasMoreIdleWork() OVERRIDE; | 642 virtual bool HasMoreIdleWork() override; |
643 virtual void PerformIdleWork() OVERRIDE; | 643 virtual void PerformIdleWork() override; |
644 | 644 |
645 virtual void WaitForReadPixels(base::Closure callback) OVERRIDE; | 645 virtual void WaitForReadPixels(base::Closure callback) override; |
646 | 646 |
647 virtual void SetResizeCallback( | 647 virtual void SetResizeCallback( |
648 const base::Callback<void(gfx::Size, float)>& callback) OVERRIDE; | 648 const base::Callback<void(gfx::Size, float)>& callback) override; |
649 | 649 |
650 virtual Logger* GetLogger() OVERRIDE; | 650 virtual Logger* GetLogger() override; |
651 | 651 |
652 virtual void BeginDecoding() OVERRIDE; | 652 virtual void BeginDecoding() override; |
653 virtual void EndDecoding() OVERRIDE; | 653 virtual void EndDecoding() override; |
654 | 654 |
655 virtual ErrorState* GetErrorState() OVERRIDE; | 655 virtual ErrorState* GetErrorState() override; |
656 virtual const ContextState* GetContextState() OVERRIDE { return &state_; } | 656 virtual const ContextState* GetContextState() override { return &state_; } |
657 | 657 |
658 virtual void SetShaderCacheCallback( | 658 virtual void SetShaderCacheCallback( |
659 const ShaderCacheCallback& callback) OVERRIDE; | 659 const ShaderCacheCallback& callback) override; |
660 virtual void SetWaitSyncPointCallback( | 660 virtual void SetWaitSyncPointCallback( |
661 const WaitSyncPointCallback& callback) OVERRIDE; | 661 const WaitSyncPointCallback& callback) override; |
662 | 662 |
663 virtual AsyncPixelTransferManager* | 663 virtual AsyncPixelTransferManager* |
664 GetAsyncPixelTransferManager() OVERRIDE; | 664 GetAsyncPixelTransferManager() override; |
665 virtual void ResetAsyncPixelTransferManagerForTest() OVERRIDE; | 665 virtual void ResetAsyncPixelTransferManagerForTest() override; |
666 virtual void SetAsyncPixelTransferManagerForTest( | 666 virtual void SetAsyncPixelTransferManagerForTest( |
667 AsyncPixelTransferManager* manager) OVERRIDE; | 667 AsyncPixelTransferManager* manager) override; |
668 virtual void SetIgnoreCachedStateForTest(bool ignore) OVERRIDE; | 668 virtual void SetIgnoreCachedStateForTest(bool ignore) override; |
669 void ProcessFinishedAsyncTransfers(); | 669 void ProcessFinishedAsyncTransfers(); |
670 | 670 |
671 virtual bool GetServiceTextureId(uint32 client_texture_id, | 671 virtual bool GetServiceTextureId(uint32 client_texture_id, |
672 uint32* service_texture_id) OVERRIDE; | 672 uint32* service_texture_id) override; |
673 | 673 |
674 virtual uint32 GetTextureUploadCount() OVERRIDE; | 674 virtual uint32 GetTextureUploadCount() override; |
675 virtual base::TimeDelta GetTotalTextureUploadTime() OVERRIDE; | 675 virtual base::TimeDelta GetTotalTextureUploadTime() override; |
676 virtual base::TimeDelta GetTotalProcessingCommandsTime() OVERRIDE; | 676 virtual base::TimeDelta GetTotalProcessingCommandsTime() override; |
677 virtual void AddProcessingCommandsTime(base::TimeDelta) OVERRIDE; | 677 virtual void AddProcessingCommandsTime(base::TimeDelta) override; |
678 | 678 |
679 // Restores the current state to the user's settings. | 679 // Restores the current state to the user's settings. |
680 void RestoreCurrentFramebufferBindings(); | 680 void RestoreCurrentFramebufferBindings(); |
681 | 681 |
682 // Sets DEPTH_TEST, STENCIL_TEST and color mask for the current framebuffer. | 682 // Sets DEPTH_TEST, STENCIL_TEST and color mask for the current framebuffer. |
683 void ApplyDirtyState(); | 683 void ApplyDirtyState(); |
684 | 684 |
685 // These check the state of the currently bound framebuffer or the | 685 // These check the state of the currently bound framebuffer or the |
686 // backbuffer if no framebuffer is bound. | 686 // backbuffer if no framebuffer is bound. |
687 // If all_draw_buffers is false, only check with COLOR_ATTACHMENT0, otherwise | 687 // If all_draw_buffers is false, only check with COLOR_ATTACHMENT0, otherwise |
688 // check with all attached and enabled color attachments. | 688 // check with all attached and enabled color attachments. |
689 bool BoundFramebufferHasColorAttachmentWithAlpha(bool all_draw_buffers); | 689 bool BoundFramebufferHasColorAttachmentWithAlpha(bool all_draw_buffers); |
690 bool BoundFramebufferHasDepthAttachment(); | 690 bool BoundFramebufferHasDepthAttachment(); |
691 bool BoundFramebufferHasStencilAttachment(); | 691 bool BoundFramebufferHasStencilAttachment(); |
692 | 692 |
693 virtual error::ContextLostReason GetContextLostReason() OVERRIDE; | 693 virtual error::ContextLostReason GetContextLostReason() override; |
694 | 694 |
695 // Overridden from FramebufferManager::TextureDetachObserver: | 695 // Overridden from FramebufferManager::TextureDetachObserver: |
696 virtual void OnTextureRefDetachedFromFramebuffer( | 696 virtual void OnTextureRefDetachedFromFramebuffer( |
697 TextureRef* texture) OVERRIDE; | 697 TextureRef* texture) override; |
698 | 698 |
699 // Overriden from ErrorStateClient. | 699 // Overriden from ErrorStateClient. |
700 virtual void OnOutOfMemoryError() OVERRIDE; | 700 virtual void OnOutOfMemoryError() override; |
701 | 701 |
702 // Ensure Renderbuffer corresponding to last DoBindRenderbuffer() is bound. | 702 // Ensure Renderbuffer corresponding to last DoBindRenderbuffer() is bound. |
703 void EnsureRenderbufferBound(); | 703 void EnsureRenderbufferBound(); |
704 | 704 |
705 // Helpers to facilitate calling into compatible extensions. | 705 // Helpers to facilitate calling into compatible extensions. |
706 static void RenderbufferStorageMultisampleHelper( | 706 static void RenderbufferStorageMultisampleHelper( |
707 const FeatureInfo* feature_info, | 707 const FeatureInfo* feature_info, |
708 GLenum target, | 708 GLenum target, |
709 GLsizei samples, | 709 GLsizei samples, |
710 GLenum internal_format, | 710 GLenum internal_format, |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1157 // overridden from GLES2Decoder | 1157 // overridden from GLES2Decoder |
1158 virtual bool ClearLevel(unsigned service_id, | 1158 virtual bool ClearLevel(unsigned service_id, |
1159 unsigned bind_target, | 1159 unsigned bind_target, |
1160 unsigned target, | 1160 unsigned target, |
1161 int level, | 1161 int level, |
1162 unsigned internal_format, | 1162 unsigned internal_format, |
1163 unsigned format, | 1163 unsigned format, |
1164 unsigned type, | 1164 unsigned type, |
1165 int width, | 1165 int width, |
1166 int height, | 1166 int height, |
1167 bool is_texture_immutable) OVERRIDE; | 1167 bool is_texture_immutable) override; |
1168 | 1168 |
1169 // Restore all GL state that affects clearing. | 1169 // Restore all GL state that affects clearing. |
1170 void RestoreClearState(); | 1170 void RestoreClearState(); |
1171 | 1171 |
1172 // Remembers the state of some capabilities. | 1172 // Remembers the state of some capabilities. |
1173 // Returns: true if glEnable/glDisable should actually be called. | 1173 // Returns: true if glEnable/glDisable should actually be called. |
1174 bool SetCapabilityState(GLenum cap, bool enabled); | 1174 bool SetCapabilityState(GLenum cap, bool enabled); |
1175 | 1175 |
1176 // Check that the currently bound framebuffers are valid. | 1176 // Check that the currently bound framebuffers are valid. |
1177 // Generates GL error if not. | 1177 // Generates GL error if not. |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1560 | 1560 |
1561 // Validates the program and location for a glGetUniform call and returns | 1561 // Validates the program and location for a glGetUniform call and returns |
1562 // a SizeResult setup to receive the result. Returns true if glGetUniform | 1562 // a SizeResult setup to receive the result. Returns true if glGetUniform |
1563 // should be called. | 1563 // should be called. |
1564 bool GetUniformSetup( | 1564 bool GetUniformSetup( |
1565 GLuint program, GLint fake_location, | 1565 GLuint program, GLint fake_location, |
1566 uint32 shm_id, uint32 shm_offset, | 1566 uint32 shm_id, uint32 shm_offset, |
1567 error::Error* error, GLint* real_location, GLuint* service_id, | 1567 error::Error* error, GLint* real_location, GLuint* service_id, |
1568 void** result, GLenum* result_type); | 1568 void** result, GLenum* result_type); |
1569 | 1569 |
1570 virtual bool WasContextLost() OVERRIDE; | 1570 virtual bool WasContextLost() override; |
1571 virtual bool WasContextLostByRobustnessExtension() OVERRIDE; | 1571 virtual bool WasContextLostByRobustnessExtension() override; |
1572 virtual void LoseContext(uint32 reset_status) OVERRIDE; | 1572 virtual void LoseContext(uint32 reset_status) override; |
1573 | 1573 |
1574 #if defined(OS_MACOSX) | 1574 #if defined(OS_MACOSX) |
1575 void ReleaseIOSurfaceForTexture(GLuint texture_id); | 1575 void ReleaseIOSurfaceForTexture(GLuint texture_id); |
1576 #endif | 1576 #endif |
1577 | 1577 |
1578 bool ValidateCompressedTexDimensions( | 1578 bool ValidateCompressedTexDimensions( |
1579 const char* function_name, | 1579 const char* function_name, |
1580 GLint level, GLsizei width, GLsizei height, GLenum format); | 1580 GLint level, GLsizei width, GLsizei height, GLenum format); |
1581 bool ValidateCompressedTexFuncData( | 1581 bool ValidateCompressedTexFuncData( |
1582 const char* function_name, | 1582 const char* function_name, |
(...skipping 9561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11144 } | 11144 } |
11145 } | 11145 } |
11146 | 11146 |
11147 // Include the auto-generated part of this file. We split this because it means | 11147 // Include the auto-generated part of this file. We split this because it means |
11148 // we can easily edit the non-auto generated parts right here in this file | 11148 // we can easily edit the non-auto generated parts right here in this file |
11149 // instead of having to edit some template or the code generator. | 11149 // instead of having to edit some template or the code generator. |
11150 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 11150 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
11151 | 11151 |
11152 } // namespace gles2 | 11152 } // namespace gles2 |
11153 } // namespace gpu | 11153 } // namespace gpu |
OLD | NEW |