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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 #endif | 87 #endif |
86 | 88 |
87 #define GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(type, ptr) \ | 89 #define GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(type, ptr) \ |
88 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION_ASSERT(ptr && \ | 90 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION_ASSERT(ptr && \ |
89 (ptr[0] == static_cast<type>(0) || ptr[0] == static_cast<type>(-1))); | 91 (ptr[0] == static_cast<type>(0) || ptr[0] == static_cast<type>(-1))); |
90 | 92 |
91 #define GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(type, ptr) \ | 93 #define GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(type, ptr) \ |
92 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION_ASSERT(!ptr || \ | 94 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION_ASSERT(!ptr || \ |
93 (ptr[0] == static_cast<type>(0) || ptr[0] == static_cast<type>(-1))); | 95 (ptr[0] == static_cast<type>(0) || ptr[0] == static_cast<type>(-1))); |
94 | 96 |
97 // TODO(kaanb): Ask gman if there's a better header for this. | |
98 #define GL_READ_WRITE 0x88BA | |
no sievers
2013/05/14 21:10:03
Can't you add it to the third party glext header w
kaanb
2013/05/14 23:37:09
I'll defer to gman@ on that
| |
99 | |
95 struct GLUniformDefinitionCHROMIUM; | 100 struct GLUniformDefinitionCHROMIUM; |
96 | 101 |
97 namespace gpu { | 102 namespace gpu { |
98 | 103 |
99 class MappedMemoryManager; | 104 class MappedMemoryManager; |
100 class ScopedTransferBufferPtr; | 105 class ScopedTransferBufferPtr; |
101 class TransferBufferInterface; | 106 class TransferBufferInterface; |
102 | 107 |
103 namespace gles2 { | 108 namespace gles2 { |
104 | 109 |
110 class ImageFactory; | |
105 class VertexArrayObjectManager; | 111 class VertexArrayObjectManager; |
106 | 112 |
107 // This class emulates GLES2 over command buffers. It can be used by a client | 113 // 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 | 114 // 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 | 115 // 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 | 116 // 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 | 117 // GLES2CmdHelper but that entails changing your code to use and deal with |
112 // shared memory and synchronization issues. | 118 // shared memory and synchronization issues. |
113 class GLES2_IMPL_EXPORT GLES2Implementation : public GLES2Interface { | 119 class GLES2_IMPL_EXPORT GLES2Implementation : public GLES2Interface { |
114 public: | 120 public: |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
158 static const GLuint kClientSideElementArrayId = 0xFEDCBA99u; | 164 static const GLuint kClientSideElementArrayId = 0xFEDCBA99u; |
159 | 165 |
160 // Number of swap buffers allowed before waiting. | 166 // Number of swap buffers allowed before waiting. |
161 static const size_t kMaxSwapBuffers = 2; | 167 static const size_t kMaxSwapBuffers = 2; |
162 | 168 |
163 GLES2Implementation( | 169 GLES2Implementation( |
164 GLES2CmdHelper* helper, | 170 GLES2CmdHelper* helper, |
165 ShareGroup* share_group, | 171 ShareGroup* share_group, |
166 TransferBufferInterface* transfer_buffer, | 172 TransferBufferInterface* transfer_buffer, |
167 bool share_resources, | 173 bool share_resources, |
168 bool bind_generates_resource); | 174 bool bind_generates_resource, |
175 ImageFactory* image_factory); | |
169 | 176 |
170 virtual ~GLES2Implementation(); | 177 virtual ~GLES2Implementation(); |
171 | 178 |
172 bool Initialize( | 179 bool Initialize( |
173 unsigned int starting_transfer_buffer_size, | 180 unsigned int starting_transfer_buffer_size, |
174 unsigned int min_transfer_buffer_size, | 181 unsigned int min_transfer_buffer_size, |
175 unsigned int max_transfer_buffer_size); | 182 unsigned int max_transfer_buffer_size); |
176 | 183 |
177 // The GLES2CmdHelper being used by this GLES2Implementation. You can use | 184 // The GLES2CmdHelper being used by this GLES2Implementation. You can use |
178 // this to issue cmds at a lower level for certain kinds of optimization. | 185 // this to issue cmds at a lower level for certain kinds of optimization. |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
428 void DeleteVertexArraysOESStub(GLsizei n, const GLuint* arrays); | 435 void DeleteVertexArraysOESStub(GLsizei n, const GLuint* arrays); |
429 | 436 |
430 void BufferDataHelper( | 437 void BufferDataHelper( |
431 GLenum target, GLsizeiptr size, const void* data, GLenum usage); | 438 GLenum target, GLsizeiptr size, const void* data, GLenum usage); |
432 void BufferSubDataHelper( | 439 void BufferSubDataHelper( |
433 GLenum target, GLintptr offset, GLsizeiptr size, const void* data); | 440 GLenum target, GLintptr offset, GLsizeiptr size, const void* data); |
434 void BufferSubDataHelperImpl( | 441 void BufferSubDataHelperImpl( |
435 GLenum target, GLintptr offset, GLsizeiptr size, const void* data, | 442 GLenum target, GLintptr offset, GLsizeiptr size, const void* data, |
436 ScopedTransferBufferPtr* buffer); | 443 ScopedTransferBufferPtr* buffer); |
437 | 444 |
445 GLuint CreateImageCHROMIUMHelper( | |
446 GLsizei width, GLsizei height, GLenum internalformat); | |
447 void DestroyImageCHROMIUMHelper(GLuint image_id); | |
448 void* MapImageCHROMIUMHelper(GLuint image_id, GLenum access); | |
449 void UnmapImageCHROMIUMHelper(GLuint image_id); | |
450 void GetImageParameterivCHROMIUMHelper( | |
451 GLuint image_id, GLenum pname, GLint* params); | |
452 | |
438 // Helper for GetVertexAttrib | 453 // Helper for GetVertexAttrib |
439 bool GetVertexAttribHelper(GLuint index, GLenum pname, uint32* param); | 454 bool GetVertexAttribHelper(GLuint index, GLenum pname, uint32* param); |
440 | 455 |
441 GLuint GetMaxValueInBufferCHROMIUMHelper( | 456 GLuint GetMaxValueInBufferCHROMIUMHelper( |
442 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset); | 457 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset); |
443 | 458 |
444 void RestoreElementAndArrayBuffers(bool restore); | 459 void RestoreElementAndArrayBuffers(bool restore); |
445 void RestoreArrayBuffer(bool restrore); | 460 void RestoreArrayBuffer(bool restrore); |
446 | 461 |
447 // The pixels pointer should already account for unpack skip rows and skip | 462 // The pixels pointer should already account for unpack skip rows and skip |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
593 ShaderPrecisionCacheMap; | 608 ShaderPrecisionCacheMap; |
594 ShaderPrecisionCacheMap shader_precision_cache_; | 609 ShaderPrecisionCacheMap shader_precision_cache_; |
595 | 610 |
596 scoped_refptr<ShareGroup> share_group_; | 611 scoped_refptr<ShareGroup> share_group_; |
597 | 612 |
598 scoped_ptr<QueryTracker> query_tracker_; | 613 scoped_ptr<QueryTracker> query_tracker_; |
599 QueryTracker::Query* current_query_; | 614 QueryTracker::Query* current_query_; |
600 | 615 |
601 scoped_ptr<BufferTracker> buffer_tracker_; | 616 scoped_ptr<BufferTracker> buffer_tracker_; |
602 | 617 |
618 scoped_ptr<GpuMemoryBufferTracker> gpu_memory_buffer_tracker_; | |
619 | |
603 ErrorMessageCallback* error_message_callback_; | 620 ErrorMessageCallback* error_message_callback_; |
604 | 621 |
605 scoped_ptr<std::string> current_trace_name_; | 622 scoped_ptr<std::string> current_trace_name_; |
606 | 623 |
624 ImageFactory* image_factory_; | |
625 | |
607 DISALLOW_COPY_AND_ASSIGN(GLES2Implementation); | 626 DISALLOW_COPY_AND_ASSIGN(GLES2Implementation); |
608 }; | 627 }; |
609 | 628 |
610 inline bool GLES2Implementation::GetBufferParameterivHelper( | 629 inline bool GLES2Implementation::GetBufferParameterivHelper( |
611 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { | 630 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { |
612 return false; | 631 return false; |
613 } | 632 } |
614 | 633 |
615 inline bool GLES2Implementation::GetFramebufferAttachmentParameterivHelper( | 634 inline bool GLES2Implementation::GetFramebufferAttachmentParameterivHelper( |
616 GLenum /* target */, | 635 GLenum /* target */, |
(...skipping 20 matching lines...) Expand all Loading... | |
637 | 656 |
638 inline bool GLES2Implementation::GetTexParameterivHelper( | 657 inline bool GLES2Implementation::GetTexParameterivHelper( |
639 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { | 658 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { |
640 return false; | 659 return false; |
641 } | 660 } |
642 | 661 |
643 } // namespace gles2 | 662 } // namespace gles2 |
644 } // namespace gpu | 663 } // namespace gpu |
645 | 664 |
646 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ | 665 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ |
OLD | NEW |