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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 struct GLUniformDefinitionCHROMIUM; | 95 struct GLUniformDefinitionCHROMIUM; |
96 | 96 |
97 namespace gpu { | 97 namespace gpu { |
98 | 98 |
99 class MappedMemoryManager; | 99 class MappedMemoryManager; |
100 class ScopedTransferBufferPtr; | 100 class ScopedTransferBufferPtr; |
101 class TransferBufferInterface; | 101 class TransferBufferInterface; |
102 | 102 |
103 namespace gles2 { | 103 namespace gles2 { |
104 | 104 |
105 class GpuMemoryBufferTracker; | |
105 class VertexArrayObjectManager; | 106 class VertexArrayObjectManager; |
106 | 107 |
107 // This class emulates GLES2 over command buffers. It can be used by a client | 108 // 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 | 109 // 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 | 110 // 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 | 111 // 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 | 112 // GLES2CmdHelper but that entails changing your code to use and deal with |
112 // shared memory and synchronization issues. | 113 // shared memory and synchronization issues. |
113 class GLES2_IMPL_EXPORT GLES2Implementation : public GLES2Interface { | 114 class GLES2_IMPL_EXPORT GLES2Implementation : public GLES2Interface { |
114 public: | 115 public: |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
428 void DeleteVertexArraysOESStub(GLsizei n, const GLuint* arrays); | 429 void DeleteVertexArraysOESStub(GLsizei n, const GLuint* arrays); |
429 | 430 |
430 void BufferDataHelper( | 431 void BufferDataHelper( |
431 GLenum target, GLsizeiptr size, const void* data, GLenum usage); | 432 GLenum target, GLsizeiptr size, const void* data, GLenum usage); |
432 void BufferSubDataHelper( | 433 void BufferSubDataHelper( |
433 GLenum target, GLintptr offset, GLsizeiptr size, const void* data); | 434 GLenum target, GLintptr offset, GLsizeiptr size, const void* data); |
434 void BufferSubDataHelperImpl( | 435 void BufferSubDataHelperImpl( |
435 GLenum target, GLintptr offset, GLsizeiptr size, const void* data, | 436 GLenum target, GLintptr offset, GLsizeiptr size, const void* data, |
436 ScopedTransferBufferPtr* buffer); | 437 ScopedTransferBufferPtr* buffer); |
437 | 438 |
439 // Helper for ImageBufferData | |
440 void ImageBufferDataCHROMIUMHelper( | |
441 GLenum target, GLsizei width, GLsizei height); | |
442 | |
438 // Helper for GetVertexAttrib | 443 // Helper for GetVertexAttrib |
439 bool GetVertexAttribHelper(GLuint index, GLenum pname, uint32* param); | 444 bool GetVertexAttribHelper(GLuint index, GLenum pname, uint32* param); |
440 | 445 |
441 GLuint GetMaxValueInBufferCHROMIUMHelper( | 446 GLuint GetMaxValueInBufferCHROMIUMHelper( |
442 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset); | 447 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset); |
443 | 448 |
444 void RestoreElementAndArrayBuffers(bool restore); | 449 void RestoreElementAndArrayBuffers(bool restore); |
445 void RestoreArrayBuffer(bool restrore); | 450 void RestoreArrayBuffer(bool restrore); |
446 | 451 |
447 // The pixels pointer should already account for unpack skip rows and skip | 452 // The pixels pointer should already account for unpack skip rows and skip |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
491 const std::string& GetLogPrefix() const; | 496 const std::string& GetLogPrefix() const; |
492 | 497 |
493 #if defined(GL_CLIENT_FAIL_GL_ERRORS) | 498 #if defined(GL_CLIENT_FAIL_GL_ERRORS) |
494 void CheckGLError(); | 499 void CheckGLError(); |
495 void FailGLError(GLenum error); | 500 void FailGLError(GLenum error); |
496 #else | 501 #else |
497 void CheckGLError() { } | 502 void CheckGLError() { } |
498 void FailGLError(GLenum /* error */) { } | 503 void FailGLError(GLenum /* error */) { } |
499 #endif | 504 #endif |
500 | 505 |
506 bool GetBoundGpuMemoryBuffer(const char* function_name, GLuint* buffer_id); | |
507 void* GetNativeHandleForBoundGpuMemoryBuffer(); | |
508 bool GetPointervCHROMIUMHelper(GLenum pname, GLvoid** pointer); | |
greggman
2013/04/29 19:58:33
confused. Your last comment said you didn't need G
kaanb
2013/04/30 03:40:10
Removed.
| |
509 | |
501 GLES2Util util_; | 510 GLES2Util util_; |
502 GLES2CmdHelper* helper_; | 511 GLES2CmdHelper* helper_; |
503 TransferBufferInterface* transfer_buffer_; | 512 TransferBufferInterface* transfer_buffer_; |
504 std::string last_error_; | 513 std::string last_error_; |
505 DebugMarkerManager debug_marker_manager_; | 514 DebugMarkerManager debug_marker_manager_; |
506 std::string this_in_hex_; | 515 std::string this_in_hex_; |
507 | 516 |
508 std::queue<int32> swap_buffers_tokens_; | 517 std::queue<int32> swap_buffers_tokens_; |
509 std::queue<int32> rate_limit_tokens_; | 518 std::queue<int32> rate_limit_tokens_; |
510 | 519 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
547 // The program in use by glUseProgram | 556 // The program in use by glUseProgram |
548 GLuint current_program_; | 557 GLuint current_program_; |
549 | 558 |
550 // The currently bound array buffer. | 559 // The currently bound array buffer. |
551 GLuint bound_array_buffer_id_; | 560 GLuint bound_array_buffer_id_; |
552 | 561 |
553 // The currently bound pixel transfer buffers. | 562 // The currently bound pixel transfer buffers. |
554 GLuint bound_pixel_pack_transfer_buffer_id_; | 563 GLuint bound_pixel_pack_transfer_buffer_id_; |
555 GLuint bound_pixel_unpack_transfer_buffer_id_; | 564 GLuint bound_pixel_unpack_transfer_buffer_id_; |
556 | 565 |
566 // The currently bound GPU memory buffer | |
567 GLuint bound_gpu_memory_buffer_id_; | |
568 | |
557 // Client side management for vertex array objects. Needed to correctly | 569 // Client side management for vertex array objects. Needed to correctly |
558 // track client side arrays. | 570 // track client side arrays. |
559 scoped_ptr<VertexArrayObjectManager> vertex_array_object_manager_; | 571 scoped_ptr<VertexArrayObjectManager> vertex_array_object_manager_; |
560 | 572 |
561 GLuint reserved_ids_[2]; | 573 GLuint reserved_ids_[2]; |
562 | 574 |
563 // Current GL error bits. | 575 // Current GL error bits. |
564 uint32 error_bits_; | 576 uint32 error_bits_; |
565 | 577 |
566 // Whether or not to print debugging info. | 578 // Whether or not to print debugging info. |
(...skipping 26 matching lines...) Expand all Loading... | |
593 ShaderPrecisionCacheMap; | 605 ShaderPrecisionCacheMap; |
594 ShaderPrecisionCacheMap shader_precision_cache_; | 606 ShaderPrecisionCacheMap shader_precision_cache_; |
595 | 607 |
596 scoped_refptr<ShareGroup> share_group_; | 608 scoped_refptr<ShareGroup> share_group_; |
597 | 609 |
598 scoped_ptr<QueryTracker> query_tracker_; | 610 scoped_ptr<QueryTracker> query_tracker_; |
599 QueryTracker::Query* current_query_; | 611 QueryTracker::Query* current_query_; |
600 | 612 |
601 scoped_ptr<BufferTracker> buffer_tracker_; | 613 scoped_ptr<BufferTracker> buffer_tracker_; |
602 | 614 |
615 scoped_ptr<GpuMemoryBufferTracker> gpu_memory_buffer_tracker_; | |
616 | |
603 ErrorMessageCallback* error_message_callback_; | 617 ErrorMessageCallback* error_message_callback_; |
604 | 618 |
605 scoped_ptr<std::string> current_trace_name_; | 619 scoped_ptr<std::string> current_trace_name_; |
606 | 620 |
607 DISALLOW_COPY_AND_ASSIGN(GLES2Implementation); | 621 DISALLOW_COPY_AND_ASSIGN(GLES2Implementation); |
608 }; | 622 }; |
609 | 623 |
610 inline bool GLES2Implementation::GetBufferParameterivHelper( | 624 inline bool GLES2Implementation::GetBufferParameterivHelper( |
611 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { | 625 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { |
612 return false; | 626 return false; |
(...skipping 24 matching lines...) Expand all Loading... | |
637 | 651 |
638 inline bool GLES2Implementation::GetTexParameterivHelper( | 652 inline bool GLES2Implementation::GetTexParameterivHelper( |
639 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { | 653 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { |
640 return false; | 654 return false; |
641 } | 655 } |
642 | 656 |
643 } // namespace gles2 | 657 } // namespace gles2 |
644 } // namespace gpu | 658 } // namespace gpu |
645 | 659 |
646 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ | 660 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ |
OLD | NEW |