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" |
11 #include "gpu/command_buffer/service/gl_utils.h" | 11 #include "gpu/command_buffer/service/gl_utils.h" |
12 #include "gpu/gpu_export.h" | 12 #include "gpu/gpu_export.h" |
13 | 13 |
14 namespace gpu { | 14 namespace gpu { |
15 namespace gles2 { | 15 namespace gles2 { |
16 | 16 |
17 class Buffer; | 17 class Buffer; |
18 | 18 |
19 // This is a base class for indexed buffer bindings tracking. | 19 // This is a base class for indexed buffer bindings tracking. |
20 // TransformFeedback and Program should inherit from this base class, | 20 // TransformFeedback and Program should inherit from this base class, |
21 // for tracking indexed TRANSFORM_FEEDBACK_BUFFER / UNIFORM_BUFFER bindings. | 21 // for tracking indexed TRANSFORM_FEEDBACK_BUFFER / UNIFORM_BUFFER bindings. |
22 class GPU_EXPORT IndexedBufferBindingHost : | 22 class GPU_EXPORT IndexedBufferBindingHost : |
23 public base::RefCounted<IndexedBufferBindingHost> { | 23 public base::RefCounted<IndexedBufferBindingHost> { |
24 public: | 24 public: |
25 // |needs_emulation| is set to true on Desktop GL 4.1 or lower. | 25 // In theory |needs_emulation| needs to be true on Desktop GL 4.1 or lower. |
| 26 // However, we set it to true everywhere, not to trust drivers to handle |
| 27 // out-of-bounds buffer access. |
26 IndexedBufferBindingHost(uint32_t max_bindings, bool needs_emulation); | 28 IndexedBufferBindingHost(uint32_t max_bindings, bool needs_emulation); |
27 | 29 |
28 // The following two functions do state update and call the underlying GL | 30 // The following two functions do state update and call the underlying GL |
29 // function. All validations have been done already and the GL function is | 31 // function. All validations have been done already and the GL function is |
30 // guaranteed to succeed. | 32 // guaranteed to succeed. |
31 void DoBindBufferBase(GLenum target, GLuint index, Buffer* buffer); | 33 void DoBindBufferBase(GLenum target, GLuint index, Buffer* buffer); |
32 void DoBindBufferRange( | 34 void DoBindBufferRange( |
33 GLenum target, GLuint index, Buffer* buffer, GLintptr offset, | 35 GLenum target, GLuint index, Buffer* buffer, GLintptr offset, |
34 GLsizeiptr size); | 36 GLsizeiptr size); |
35 | 37 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 bool needs_emulation_; | 104 bool needs_emulation_; |
103 | 105 |
104 // This is used for optimization purpose in context switching. | 106 // This is used for optimization purpose in context switching. |
105 size_t max_non_null_binding_index_plus_one_; | 107 size_t max_non_null_binding_index_plus_one_; |
106 }; | 108 }; |
107 | 109 |
108 } // namespace gles2 | 110 } // namespace gles2 |
109 } // namespace gpu | 111 } // namespace gpu |
110 | 112 |
111 #endif // GPU_COMMAND_BUFFER_SERVICE_INDEXED_BUFFER_BINDING_HOST_H_ | 113 #endif // GPU_COMMAND_BUFFER_SERVICE_INDEXED_BUFFER_BINDING_HOST_H_ |
OLD | NEW |