| 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 #ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ | 5 #ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ |
| 6 #define GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ | 6 #define GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ |
| 7 | 7 |
| 8 #include <GLES2/gl2.h> | 8 #include <GLES2/gl2.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <queue> | 11 #include <queue> |
| 12 #include <set> | 12 #include <set> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "../client/buffer_tracker.h" | 17 #include "../client/buffer_tracker.h" |
| 18 #include "../client/client_context_state.h" | 18 #include "../client/client_context_state.h" |
| 19 #include "../client/gles2_cmd_helper.h" | 19 #include "../client/gles2_cmd_helper.h" |
| 20 #include "../client/gles2_interface.h" | 20 #include "../client/gles2_interface.h" |
| 21 #include "../client/gpu_memory_buffer_tracker.h" |
| 22 #include "../client/image_factory.h" |
| 21 #include "../client/query_tracker.h" | 23 #include "../client/query_tracker.h" |
| 22 #include "../client/ref_counted.h" | 24 #include "../client/ref_counted.h" |
| 23 #include "../client/ring_buffer.h" | 25 #include "../client/ring_buffer.h" |
| 24 #include "../client/share_group.h" | 26 #include "../client/share_group.h" |
| 25 #include "../common/compiler_specific.h" | 27 #include "../common/compiler_specific.h" |
| 26 #include "../common/debug_marker_manager.h" | 28 #include "../common/debug_marker_manager.h" |
| 27 #include "../common/gles2_cmd_utils.h" | 29 #include "../common/gles2_cmd_utils.h" |
| 28 #include "gles2_impl_export.h" | 30 #include "gles2_impl_export.h" |
| 29 | 31 |
| 30 #if !defined(NDEBUG) && !defined(__native_client__) && !defined(GLES2_CONFORMANC
E_TESTS) // NOLINT | 32 #if !defined(NDEBUG) && !defined(__native_client__) && !defined(GLES2_CONFORMANC
E_TESTS) // NOLINT |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 struct GLUniformDefinitionCHROMIUM; | 97 struct GLUniformDefinitionCHROMIUM; |
| 96 | 98 |
| 97 namespace gpu { | 99 namespace gpu { |
| 98 | 100 |
| 99 class MappedMemoryManager; | 101 class MappedMemoryManager; |
| 100 class ScopedTransferBufferPtr; | 102 class ScopedTransferBufferPtr; |
| 101 class TransferBufferInterface; | 103 class TransferBufferInterface; |
| 102 | 104 |
| 103 namespace gles2 { | 105 namespace gles2 { |
| 104 | 106 |
| 107 class ImageFactory; |
| 105 class VertexArrayObjectManager; | 108 class VertexArrayObjectManager; |
| 106 | 109 |
| 107 // This class emulates GLES2 over command buffers. It can be used by a client | 110 // This class emulates GLES2 over command buffers. It can be used by a client |
| 108 // program so that the program does not need deal with shared memory and command | 111 // program so that the program does not need deal with shared memory and command |
| 109 // buffer management. See gl2_lib.h. Note that there is a performance gain to | 112 // buffer management. See gl2_lib.h. Note that there is a performance gain to |
| 110 // be had by changing your code to use command buffers directly by using the | 113 // be had by changing your code to use command buffers directly by using the |
| 111 // GLES2CmdHelper but that entails changing your code to use and deal with | 114 // GLES2CmdHelper but that entails changing your code to use and deal with |
| 112 // shared memory and synchronization issues. | 115 // shared memory and synchronization issues. |
| 113 class GLES2_IMPL_EXPORT GLES2Implementation : public GLES2Interface { | 116 class GLES2_IMPL_EXPORT GLES2Implementation : public GLES2Interface { |
| 114 public: | 117 public: |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 static const GLuint kClientSideElementArrayId = 0xFEDCBA99u; | 170 static const GLuint kClientSideElementArrayId = 0xFEDCBA99u; |
| 168 | 171 |
| 169 // Number of swap buffers allowed before waiting. | 172 // Number of swap buffers allowed before waiting. |
| 170 static const size_t kMaxSwapBuffers = 2; | 173 static const size_t kMaxSwapBuffers = 2; |
| 171 | 174 |
| 172 GLES2Implementation( | 175 GLES2Implementation( |
| 173 GLES2CmdHelper* helper, | 176 GLES2CmdHelper* helper, |
| 174 ShareGroup* share_group, | 177 ShareGroup* share_group, |
| 175 TransferBufferInterface* transfer_buffer, | 178 TransferBufferInterface* transfer_buffer, |
| 176 bool share_resources, | 179 bool share_resources, |
| 177 bool bind_generates_resource); | 180 bool bind_generates_resource, |
| 181 ImageFactory* image_factory); |
| 178 | 182 |
| 179 virtual ~GLES2Implementation(); | 183 virtual ~GLES2Implementation(); |
| 180 | 184 |
| 181 bool Initialize( | 185 bool Initialize( |
| 182 unsigned int starting_transfer_buffer_size, | 186 unsigned int starting_transfer_buffer_size, |
| 183 unsigned int min_transfer_buffer_size, | 187 unsigned int min_transfer_buffer_size, |
| 184 unsigned int max_transfer_buffer_size); | 188 unsigned int max_transfer_buffer_size); |
| 185 | 189 |
| 186 // The GLES2CmdHelper being used by this GLES2Implementation. You can use | 190 // The GLES2CmdHelper being used by this GLES2Implementation. You can use |
| 187 // this to issue cmds at a lower level for certain kinds of optimization. | 191 // this to issue cmds at a lower level for certain kinds of optimization. |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 void DeleteVertexArraysOESStub(GLsizei n, const GLuint* arrays); | 493 void DeleteVertexArraysOESStub(GLsizei n, const GLuint* arrays); |
| 490 | 494 |
| 491 void BufferDataHelper( | 495 void BufferDataHelper( |
| 492 GLenum target, GLsizeiptr size, const void* data, GLenum usage); | 496 GLenum target, GLsizeiptr size, const void* data, GLenum usage); |
| 493 void BufferSubDataHelper( | 497 void BufferSubDataHelper( |
| 494 GLenum target, GLintptr offset, GLsizeiptr size, const void* data); | 498 GLenum target, GLintptr offset, GLsizeiptr size, const void* data); |
| 495 void BufferSubDataHelperImpl( | 499 void BufferSubDataHelperImpl( |
| 496 GLenum target, GLintptr offset, GLsizeiptr size, const void* data, | 500 GLenum target, GLintptr offset, GLsizeiptr size, const void* data, |
| 497 ScopedTransferBufferPtr* buffer); | 501 ScopedTransferBufferPtr* buffer); |
| 498 | 502 |
| 503 GLuint CreateImageCHROMIUMHelper( |
| 504 GLsizei width, GLsizei height, GLenum internalformat); |
| 505 void DestroyImageCHROMIUMHelper(GLuint image_id); |
| 506 void* MapImageCHROMIUMHelper(GLuint image_id, GLenum access); |
| 507 void UnmapImageCHROMIUMHelper(GLuint image_id); |
| 508 void GetImageParameterivCHROMIUMHelper( |
| 509 GLuint image_id, GLenum pname, GLint* params); |
| 510 |
| 499 // Helper for GetVertexAttrib | 511 // Helper for GetVertexAttrib |
| 500 bool GetVertexAttribHelper(GLuint index, GLenum pname, uint32* param); | 512 bool GetVertexAttribHelper(GLuint index, GLenum pname, uint32* param); |
| 501 | 513 |
| 502 GLuint GetMaxValueInBufferCHROMIUMHelper( | 514 GLuint GetMaxValueInBufferCHROMIUMHelper( |
| 503 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset); | 515 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset); |
| 504 | 516 |
| 505 void RestoreElementAndArrayBuffers(bool restore); | 517 void RestoreElementAndArrayBuffers(bool restore); |
| 506 void RestoreArrayBuffer(bool restrore); | 518 void RestoreArrayBuffer(bool restrore); |
| 507 | 519 |
| 508 // The pixels pointer should already account for unpack skip rows and skip | 520 // The pixels pointer should already account for unpack skip rows and skip |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 | 659 |
| 648 scoped_ptr<MappedMemoryManager> mapped_memory_; | 660 scoped_ptr<MappedMemoryManager> mapped_memory_; |
| 649 | 661 |
| 650 scoped_refptr<ShareGroup> share_group_; | 662 scoped_refptr<ShareGroup> share_group_; |
| 651 | 663 |
| 652 scoped_ptr<QueryTracker> query_tracker_; | 664 scoped_ptr<QueryTracker> query_tracker_; |
| 653 QueryTracker::Query* current_query_; | 665 QueryTracker::Query* current_query_; |
| 654 | 666 |
| 655 scoped_ptr<BufferTracker> buffer_tracker_; | 667 scoped_ptr<BufferTracker> buffer_tracker_; |
| 656 | 668 |
| 669 scoped_ptr<GpuMemoryBufferTracker> gpu_memory_buffer_tracker_; |
| 670 |
| 657 ErrorMessageCallback* error_message_callback_; | 671 ErrorMessageCallback* error_message_callback_; |
| 658 | 672 |
| 659 scoped_ptr<std::string> current_trace_name_; | 673 scoped_ptr<std::string> current_trace_name_; |
| 660 | 674 |
| 675 ImageFactory* image_factory_; |
| 676 |
| 661 DISALLOW_COPY_AND_ASSIGN(GLES2Implementation); | 677 DISALLOW_COPY_AND_ASSIGN(GLES2Implementation); |
| 662 }; | 678 }; |
| 663 | 679 |
| 664 inline bool GLES2Implementation::GetBufferParameterivHelper( | 680 inline bool GLES2Implementation::GetBufferParameterivHelper( |
| 665 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { | 681 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { |
| 666 return false; | 682 return false; |
| 667 } | 683 } |
| 668 | 684 |
| 669 inline bool GLES2Implementation::GetFramebufferAttachmentParameterivHelper( | 685 inline bool GLES2Implementation::GetFramebufferAttachmentParameterivHelper( |
| 670 GLenum /* target */, | 686 GLenum /* target */, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 691 | 707 |
| 692 inline bool GLES2Implementation::GetTexParameterivHelper( | 708 inline bool GLES2Implementation::GetTexParameterivHelper( |
| 693 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { | 709 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { |
| 694 return false; | 710 return false; |
| 695 } | 711 } |
| 696 | 712 |
| 697 } // namespace gles2 | 713 } // namespace gles2 |
| 698 } // namespace gpu | 714 } // namespace gpu |
| 699 | 715 |
| 700 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ | 716 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ |
| OLD | NEW |