| 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 "../common/gles2_cmd_utils.h" | 16 #include "../common/gles2_cmd_utils.h" |
| 17 #include "../common/scoped_ptr.h" | 17 #include "../common/scoped_ptr.h" |
| 18 #include "../client/ref_counted.h" |
| 18 #include "../client/gles2_cmd_helper.h" | 19 #include "../client/gles2_cmd_helper.h" |
| 19 #include "../client/query_tracker.h" | 20 #include "../client/query_tracker.h" |
| 20 #include "../client/ring_buffer.h" | 21 #include "../client/ring_buffer.h" |
| 21 #include "gles2_impl_export.h" | 22 #include "gles2_impl_export.h" |
| 22 | 23 |
| 23 #if !defined(NDEBUG) && !defined(__native_client__) && !defined(GLES2_CONFORMANC
E_TESTS) // NOLINT | 24 #if !defined(NDEBUG) && !defined(__native_client__) && !defined(GLES2_CONFORMANC
E_TESTS) // NOLINT |
| 24 #if defined(GLES2_INLINE_OPTIMIZATION) | 25 #if defined(GLES2_INLINE_OPTIMIZATION) |
| 25 // TODO(gman): Replace with macros that work with inline optmization. | 26 // TODO(gman): Replace with macros that work with inline optmization. |
| 26 #define GPU_CLIENT_SINGLE_THREAD_CHECK() | 27 #define GPU_CLIENT_SINGLE_THREAD_CHECK() |
| 27 #define GPU_CLIENT_LOG(args) | 28 #define GPU_CLIENT_LOG(args) |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 namespace gpu { | 77 namespace gpu { |
| 77 | 78 |
| 78 class MappedMemoryManager; | 79 class MappedMemoryManager; |
| 79 class ScopedTransferBufferPtr; | 80 class ScopedTransferBufferPtr; |
| 80 class TransferBufferInterface; | 81 class TransferBufferInterface; |
| 81 | 82 |
| 82 namespace gles2 { | 83 namespace gles2 { |
| 83 | 84 |
| 84 class ClientSideBufferHelper; | 85 class ClientSideBufferHelper; |
| 85 class ProgramInfoManager; | 86 class ProgramInfoManager; |
| 87 class ShareGroup; |
| 86 | 88 |
| 87 // Base class for IdHandlers | 89 // Base class for IdHandlers |
| 88 class IdHandlerInterface { | 90 class IdHandlerInterface { |
| 89 public: | 91 public: |
| 90 IdHandlerInterface() { } | 92 IdHandlerInterface() { } |
| 91 virtual ~IdHandlerInterface() { } | 93 virtual ~IdHandlerInterface() { } |
| 92 | 94 |
| 93 // Makes some ids at or above id_offset. | 95 // Makes some ids at or above id_offset. |
| 94 virtual void MakeIds(GLuint id_offset, GLsizei n, GLuint* ids) = 0; | 96 virtual void MakeIds(GLuint id_offset, GLsizei n, GLuint* ids) = 0; |
| 95 | 97 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 164 |
| 163 // GL names for the buffers used to emulate client side buffers. | 165 // GL names for the buffers used to emulate client side buffers. |
| 164 static const GLuint kClientSideArrayId = 0xFEDCBA98u; | 166 static const GLuint kClientSideArrayId = 0xFEDCBA98u; |
| 165 static const GLuint kClientSideElementArrayId = 0xFEDCBA99u; | 167 static const GLuint kClientSideElementArrayId = 0xFEDCBA99u; |
| 166 | 168 |
| 167 // Number of swap buffers allowed before waiting. | 169 // Number of swap buffers allowed before waiting. |
| 168 static const size_t kMaxSwapBuffers = 2; | 170 static const size_t kMaxSwapBuffers = 2; |
| 169 | 171 |
| 170 GLES2Implementation( | 172 GLES2Implementation( |
| 171 GLES2CmdHelper* helper, | 173 GLES2CmdHelper* helper, |
| 174 ShareGroup* share_group, |
| 172 TransferBufferInterface* transfer_buffer, | 175 TransferBufferInterface* transfer_buffer, |
| 173 bool share_resources, | 176 bool share_resources, |
| 174 bool bind_generates_resource); | 177 bool bind_generates_resource); |
| 175 | 178 |
| 176 ~GLES2Implementation(); | 179 ~GLES2Implementation(); |
| 177 | 180 |
| 178 bool Initialize( | 181 bool Initialize( |
| 179 unsigned int starting_transfer_buffer_size, | 182 unsigned int starting_transfer_buffer_size, |
| 180 unsigned int min_transfer_buffer_size, | 183 unsigned int min_transfer_buffer_size, |
| 181 unsigned int max_transfer_buffer_size); | 184 unsigned int max_transfer_buffer_size); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 221 |
| 219 void SetSharedMemoryChunkSizeMultiple(unsigned int multiple); | 222 void SetSharedMemoryChunkSizeMultiple(unsigned int multiple); |
| 220 | 223 |
| 221 void FreeUnusedSharedMemory(); | 224 void FreeUnusedSharedMemory(); |
| 222 void FreeEverything(); | 225 void FreeEverything(); |
| 223 | 226 |
| 224 void SetErrorMessageCallback(ErrorMessageCallback* callback) { | 227 void SetErrorMessageCallback(ErrorMessageCallback* callback) { |
| 225 error_message_callback_ = callback; | 228 error_message_callback_ = callback; |
| 226 } | 229 } |
| 227 | 230 |
| 231 ShareGroup* share_group() const { |
| 232 return share_group_.get(); |
| 233 } |
| 234 |
| 228 private: | 235 private: |
| 229 friend class ClientSideBufferHelper; | 236 friend class ClientSideBufferHelper; |
| 230 friend class GLES2ImplementationTest; | 237 friend class GLES2ImplementationTest; |
| 231 | 238 |
| 232 // Used to track whether an extension is available | 239 // Used to track whether an extension is available |
| 233 enum ExtensionStatus { | 240 enum ExtensionStatus { |
| 234 kAvailableExtensionStatus, | 241 kAvailableExtensionStatus, |
| 235 kUnavailableExtensionStatus, | 242 kUnavailableExtensionStatus, |
| 236 kUnknownExtensionStatus | 243 kUnknownExtensionStatus |
| 237 }; | 244 }; |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 typedef std::map<const void*, MappedBuffer> MappedBufferMap; | 529 typedef std::map<const void*, MappedBuffer> MappedBufferMap; |
| 523 MappedBufferMap mapped_buffers_; | 530 MappedBufferMap mapped_buffers_; |
| 524 | 531 |
| 525 typedef std::map<const void*, MappedTexture> MappedTextureMap; | 532 typedef std::map<const void*, MappedTexture> MappedTextureMap; |
| 526 MappedTextureMap mapped_textures_; | 533 MappedTextureMap mapped_textures_; |
| 527 | 534 |
| 528 scoped_ptr<MappedMemoryManager> mapped_memory_; | 535 scoped_ptr<MappedMemoryManager> mapped_memory_; |
| 529 | 536 |
| 530 scoped_ptr<ProgramInfoManager> program_info_manager_; | 537 scoped_ptr<ProgramInfoManager> program_info_manager_; |
| 531 | 538 |
| 539 scoped_refptr<ShareGroup> share_group_; |
| 540 |
| 532 scoped_ptr<QueryTracker> query_tracker_; | 541 scoped_ptr<QueryTracker> query_tracker_; |
| 533 QueryTracker::Query* current_query_; | 542 QueryTracker::Query* current_query_; |
| 534 | 543 |
| 535 ErrorMessageCallback* error_message_callback_; | 544 ErrorMessageCallback* error_message_callback_; |
| 536 | 545 |
| 537 DISALLOW_COPY_AND_ASSIGN(GLES2Implementation); | 546 DISALLOW_COPY_AND_ASSIGN(GLES2Implementation); |
| 538 }; | 547 }; |
| 539 | 548 |
| 540 inline bool GLES2Implementation::GetBufferParameterivHelper( | 549 inline bool GLES2Implementation::GetBufferParameterivHelper( |
| 541 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { | 550 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 567 | 576 |
| 568 inline bool GLES2Implementation::GetTexParameterivHelper( | 577 inline bool GLES2Implementation::GetTexParameterivHelper( |
| 569 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { | 578 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { |
| 570 return false; | 579 return false; |
| 571 } | 580 } |
| 572 | 581 |
| 573 } // namespace gles2 | 582 } // namespace gles2 |
| 574 } // namespace gpu | 583 } // namespace gpu |
| 575 | 584 |
| 576 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ | 585 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ |
| OLD | NEW |