| 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> |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 // This class emulates GLES2 over command buffers. It can be used by a client | 103 // This class emulates GLES2 over command buffers. It can be used by a client |
| 104 // program so that the program does not need deal with shared memory and command | 104 // program so that the program does not need deal with shared memory and command |
| 105 // buffer management. See gl2_lib.h. Note that there is a performance gain to | 105 // buffer management. See gl2_lib.h. Note that there is a performance gain to |
| 106 // be had by changing your code to use command buffers directly by using the | 106 // be had by changing your code to use command buffers directly by using the |
| 107 // GLES2CmdHelper but that entails changing your code to use and deal with | 107 // GLES2CmdHelper but that entails changing your code to use and deal with |
| 108 // shared memory and synchronization issues. | 108 // shared memory and synchronization issues. |
| 109 class GLES2_IMPL_EXPORT GLES2Implementation { | 109 class GLES2_IMPL_EXPORT GLES2Implementation { |
| 110 public: | 110 public: |
| 111 class ErrorMessageCallback { |
| 112 public: |
| 113 virtual ~ErrorMessageCallback() { } |
| 114 virtual void OnErrorMessage(const char* msg, int id) = 0; |
| 115 }; |
| 116 |
| 111 // Stores client side cached GL state. | 117 // Stores client side cached GL state. |
| 112 struct GLState { | 118 struct GLState { |
| 113 GLState() | 119 GLState() |
| 114 : max_combined_texture_image_units(0), | 120 : max_combined_texture_image_units(0), |
| 115 max_cube_map_texture_size(0), | 121 max_cube_map_texture_size(0), |
| 116 max_fragment_uniform_vectors(0), | 122 max_fragment_uniform_vectors(0), |
| 117 max_renderbuffer_size(0), | 123 max_renderbuffer_size(0), |
| 118 max_texture_image_units(0), | 124 max_texture_image_units(0), |
| 119 max_texture_size(0), | 125 max_texture_size(0), |
| 120 max_varying_vectors(0), | 126 max_varying_vectors(0), |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 | 214 |
| 209 void FreeTextureId(GLuint id) { | 215 void FreeTextureId(GLuint id) { |
| 210 id_handlers_[id_namespaces::kTextures]->FreeIds(1, &id); | 216 id_handlers_[id_namespaces::kTextures]->FreeIds(1, &id); |
| 211 } | 217 } |
| 212 | 218 |
| 213 void SetSharedMemoryChunkSizeMultiple(unsigned int multiple); | 219 void SetSharedMemoryChunkSizeMultiple(unsigned int multiple); |
| 214 | 220 |
| 215 void FreeUnusedSharedMemory(); | 221 void FreeUnusedSharedMemory(); |
| 216 void FreeEverything(); | 222 void FreeEverything(); |
| 217 | 223 |
| 224 void SetErrorMessageCallback(ErrorMessageCallback* callback) { |
| 225 error_message_callback_ = callback; |
| 226 } |
| 227 |
| 218 private: | 228 private: |
| 219 friend class ClientSideBufferHelper; | 229 friend class ClientSideBufferHelper; |
| 220 friend class GLES2ImplementationTest; | 230 friend class GLES2ImplementationTest; |
| 221 | 231 |
| 222 // Used to track whether an extension is available | 232 // Used to track whether an extension is available |
| 223 enum ExtensionStatus { | 233 enum ExtensionStatus { |
| 224 kAvailableExtensionStatus, | 234 kAvailableExtensionStatus, |
| 225 kUnavailableExtensionStatus, | 235 kUnavailableExtensionStatus, |
| 226 kUnknownExtensionStatus | 236 kUnknownExtensionStatus |
| 227 }; | 237 }; |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 typedef std::map<const void*, MappedTexture> MappedTextureMap; | 525 typedef std::map<const void*, MappedTexture> MappedTextureMap; |
| 516 MappedTextureMap mapped_textures_; | 526 MappedTextureMap mapped_textures_; |
| 517 | 527 |
| 518 scoped_ptr<MappedMemoryManager> mapped_memory_; | 528 scoped_ptr<MappedMemoryManager> mapped_memory_; |
| 519 | 529 |
| 520 scoped_ptr<ProgramInfoManager> program_info_manager_; | 530 scoped_ptr<ProgramInfoManager> program_info_manager_; |
| 521 | 531 |
| 522 scoped_ptr<QueryTracker> query_tracker_; | 532 scoped_ptr<QueryTracker> query_tracker_; |
| 523 QueryTracker::Query* current_query_; | 533 QueryTracker::Query* current_query_; |
| 524 | 534 |
| 535 ErrorMessageCallback* error_message_callback_; |
| 536 |
| 525 DISALLOW_COPY_AND_ASSIGN(GLES2Implementation); | 537 DISALLOW_COPY_AND_ASSIGN(GLES2Implementation); |
| 526 }; | 538 }; |
| 527 | 539 |
| 528 inline bool GLES2Implementation::GetBufferParameterivHelper( | 540 inline bool GLES2Implementation::GetBufferParameterivHelper( |
| 529 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { | 541 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { |
| 530 return false; | 542 return false; |
| 531 } | 543 } |
| 532 | 544 |
| 533 inline bool GLES2Implementation::GetFramebufferAttachmentParameterivHelper( | 545 inline bool GLES2Implementation::GetFramebufferAttachmentParameterivHelper( |
| 534 GLenum /* target */, | 546 GLenum /* target */, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 555 | 567 |
| 556 inline bool GLES2Implementation::GetTexParameterivHelper( | 568 inline bool GLES2Implementation::GetTexParameterivHelper( |
| 557 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { | 569 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { |
| 558 return false; | 570 return false; |
| 559 } | 571 } |
| 560 | 572 |
| 561 } // namespace gles2 | 573 } // namespace gles2 |
| 562 } // namespace gpu | 574 } // namespace gpu |
| 563 | 575 |
| 564 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ | 576 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ |
| OLD | NEW |