OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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_SERVICE_INDEXED_BUFFER_BINDING_HOST_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_INDEXED_BUFFER_BINDING_HOST_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_INDEXED_BUFFER_BINDING_HOST_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_INDEXED_BUFFER_BINDING_HOST_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 // This is called on the active host when glBufferData is called and buffer | 36 // This is called on the active host when glBufferData is called and buffer |
37 // size might change. | 37 // size might change. |
38 void OnBufferData(GLenum target, Buffer* buffer); | 38 void OnBufferData(GLenum target, Buffer* buffer); |
39 | 39 |
40 // This is called when the host become active. | 40 // This is called when the host become active. |
41 void OnBindHost(GLenum target); | 41 void OnBindHost(GLenum target); |
42 | 42 |
43 void RemoveBoundBuffer(Buffer* buffer); | 43 void RemoveBoundBuffer(Buffer* buffer); |
44 | 44 |
45 Buffer* GetBufferBinding(GLuint index) const; | 45 Buffer* GetBufferBinding(GLuint index) const; |
| 46 // Returns |size| set by glBindBufferRange; 0 if set by glBindBufferBase. |
46 GLsizeiptr GetBufferSize(GLuint index) const; | 47 GLsizeiptr GetBufferSize(GLuint index) const; |
| 48 // For glBindBufferBase, return the actual buffer size when this function is |
| 49 // called, not when glBindBufferBase is called. |
| 50 // For glBindBufferRange, return the |size| set by glBindBufferRange minus |
| 51 // the range that's beyond the buffer. |
| 52 GLsizeiptr GetEffectiveBufferSize(GLuint index) const; |
47 GLintptr GetBufferStart(GLuint index) const; | 53 GLintptr GetBufferStart(GLuint index) const; |
48 | 54 |
49 // This is used only for UNIFORM_BUFFER bindings in context switching. | 55 // This is used only for UNIFORM_BUFFER bindings in context switching. |
50 void RestoreBindings(IndexedBufferBindingHost* prev); | 56 void RestoreBindings(IndexedBufferBindingHost* prev); |
51 | 57 |
52 protected: | 58 protected: |
53 friend class base::RefCounted<IndexedBufferBindingHost>; | 59 friend class base::RefCounted<IndexedBufferBindingHost>; |
54 | 60 |
55 virtual ~IndexedBufferBindingHost(); | 61 virtual ~IndexedBufferBindingHost(); |
56 | 62 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 bool needs_emulation_; | 102 bool needs_emulation_; |
97 | 103 |
98 // This is used for optimization purpose in context switching. | 104 // This is used for optimization purpose in context switching. |
99 size_t max_non_null_binding_index_plus_one_; | 105 size_t max_non_null_binding_index_plus_one_; |
100 }; | 106 }; |
101 | 107 |
102 } // namespace gles2 | 108 } // namespace gles2 |
103 } // namespace gpu | 109 } // namespace gpu |
104 | 110 |
105 #endif // GPU_COMMAND_BUFFER_SERVICE_INDEXED_BUFFER_BINDING_HOST_H_ | 111 #endif // GPU_COMMAND_BUFFER_SERVICE_INDEXED_BUFFER_BINDING_HOST_H_ |
OLD | NEW |