Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: gpu/command_buffer/client/gles2_implementation.h

Issue 23130004: Enforce a memory limit on MappedMemoryManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix another namespace error Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "gles2_impl_export.h" 17 #include "gles2_impl_export.h"
18 #include "gpu/command_buffer/client/buffer_tracker.h" 18 #include "gpu/command_buffer/client/buffer_tracker.h"
19 #include "gpu/command_buffer/client/client_context_state.h" 19 #include "gpu/command_buffer/client/client_context_state.h"
20 #include "gpu/command_buffer/client/gles2_cmd_helper.h" 20 #include "gpu/command_buffer/client/gles2_cmd_helper.h"
21 #include "gpu/command_buffer/client/gles2_interface.h" 21 #include "gpu/command_buffer/client/gles2_interface.h"
22 #include "gpu/command_buffer/client/gpu_memory_buffer_tracker.h" 22 #include "gpu/command_buffer/client/gpu_memory_buffer_tracker.h"
23 #include "gpu/command_buffer/client/mapped_memory.h"
23 #include "gpu/command_buffer/client/query_tracker.h" 24 #include "gpu/command_buffer/client/query_tracker.h"
24 #include "gpu/command_buffer/client/ref_counted.h" 25 #include "gpu/command_buffer/client/ref_counted.h"
25 #include "gpu/command_buffer/client/ring_buffer.h" 26 #include "gpu/command_buffer/client/ring_buffer.h"
26 #include "gpu/command_buffer/client/share_group.h" 27 #include "gpu/command_buffer/client/share_group.h"
27 #include "gpu/command_buffer/common/compiler_specific.h" 28 #include "gpu/command_buffer/common/compiler_specific.h"
28 #include "gpu/command_buffer/common/debug_marker_manager.h" 29 #include "gpu/command_buffer/common/debug_marker_manager.h"
29 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 30 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
30 31
31 #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
32 #if defined(GLES2_INLINE_OPTIMIZATION) 33 #if defined(GLES2_INLINE_OPTIMIZATION)
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 92
92 #define GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(type, ptr) \ 93 #define GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(type, ptr) \
93 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION_ASSERT(!ptr || \ 94 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION_ASSERT(!ptr || \
94 (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)));
95 96
96 struct GLUniformDefinitionCHROMIUM; 97 struct GLUniformDefinitionCHROMIUM;
97 98
98 namespace gpu { 99 namespace gpu {
99 100
100 class GpuControl; 101 class GpuControl;
101 class MappedMemoryManager;
102 class ScopedTransferBufferPtr; 102 class ScopedTransferBufferPtr;
103 class TransferBufferInterface; 103 class TransferBufferInterface;
104 104
105 namespace gles2 { 105 namespace gles2 {
106 106
107 class ImageFactory; 107 class ImageFactory;
108 class VertexArrayObjectManager; 108 class VertexArrayObjectManager;
109 109
110 // This class emulates GLES2 over command buffers. It can be used by a client 110 // This class emulates GLES2 over command buffers. It can be used by a client
111 // program so that the program does not need deal with shared memory and command 111 // program so that the program does not need deal with shared memory and command
112 // buffer management. See gl2_lib.h. Note that there is a performance gain to 112 // buffer management. See gl2_lib.h. Note that there is a performance gain to
113 // be had by changing your code to use command buffers directly by using the 113 // be had by changing your code to use command buffers directly by using the
114 // GLES2CmdHelper but that entails changing your code to use and deal with 114 // GLES2CmdHelper but that entails changing your code to use and deal with
115 // shared memory and synchronization issues. 115 // shared memory and synchronization issues.
116 class GLES2_IMPL_EXPORT GLES2Implementation : public GLES2Interface { 116 class GLES2_IMPL_EXPORT GLES2Implementation : public GLES2Interface {
117 public: 117 public:
118 enum MappedMemoryLimit {
119 kNoLimit = MappedMemoryManager::kNoLimit,
120 };
118 class ErrorMessageCallback { 121 class ErrorMessageCallback {
119 public: 122 public:
120 virtual ~ErrorMessageCallback() { } 123 virtual ~ErrorMessageCallback() { }
121 virtual void OnErrorMessage(const char* msg, int id) = 0; 124 virtual void OnErrorMessage(const char* msg, int id) = 0;
122 }; 125 };
123 126
124 // Stores GL state that never changes. 127 // Stores GL state that never changes.
125 struct GLES2_IMPL_EXPORT GLStaticState { 128 struct GLES2_IMPL_EXPORT GLStaticState {
126 GLStaticState(); 129 GLStaticState();
127 ~GLStaticState(); 130 ~GLStaticState();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 ShareGroup* share_group, 180 ShareGroup* share_group,
178 TransferBufferInterface* transfer_buffer, 181 TransferBufferInterface* transfer_buffer,
179 bool bind_generates_resource, 182 bool bind_generates_resource,
180 GpuControl* gpu_control); 183 GpuControl* gpu_control);
181 184
182 virtual ~GLES2Implementation(); 185 virtual ~GLES2Implementation();
183 186
184 bool Initialize( 187 bool Initialize(
185 unsigned int starting_transfer_buffer_size, 188 unsigned int starting_transfer_buffer_size,
186 unsigned int min_transfer_buffer_size, 189 unsigned int min_transfer_buffer_size,
187 unsigned int max_transfer_buffer_size); 190 unsigned int max_transfer_buffer_size,
191 unsigned int mapped_memory_limit);
188 192
189 // The GLES2CmdHelper being used by this GLES2Implementation. You can use 193 // The GLES2CmdHelper being used by this GLES2Implementation. You can use
190 // this to issue cmds at a lower level for certain kinds of optimization. 194 // this to issue cmds at a lower level for certain kinds of optimization.
191 GLES2CmdHelper* helper() const; 195 GLES2CmdHelper* helper() const;
192 196
193 // Gets client side generated errors. 197 // Gets client side generated errors.
194 GLenum GetClientSideGLError(); 198 GLenum GetClientSideGLError();
195 199
196 // Include the auto-generated part of this class. We split this because 200 // Include the auto-generated part of this class. We split this because
197 // it means we can easily edit the non-auto generated parts right here in 201 // it means we can easily edit the non-auto generated parts right here in
(...skipping 10 matching lines...) Expand all
208 void GetProgramInfoCHROMIUMHelper(GLuint program, std::vector<int8>* result); 212 void GetProgramInfoCHROMIUMHelper(GLuint program, std::vector<int8>* result);
209 GLint GetAttribLocationHelper(GLuint program, const char* name); 213 GLint GetAttribLocationHelper(GLuint program, const char* name);
210 GLint GetUniformLocationHelper(GLuint program, const char* name); 214 GLint GetUniformLocationHelper(GLuint program, const char* name);
211 bool GetActiveAttribHelper( 215 bool GetActiveAttribHelper(
212 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, 216 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length,
213 GLint* size, GLenum* type, char* name); 217 GLint* size, GLenum* type, char* name);
214 bool GetActiveUniformHelper( 218 bool GetActiveUniformHelper(
215 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, 219 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length,
216 GLint* size, GLenum* type, char* name); 220 GLint* size, GLenum* type, char* name);
217 221
218 void SetSharedMemoryChunkSizeMultiple(unsigned int multiple);
219 222
220 void FreeUnusedSharedMemory(); 223 void FreeUnusedSharedMemory();
221 void FreeEverything(); 224 void FreeEverything();
222 225
223 void SetErrorMessageCallback(ErrorMessageCallback* callback) { 226 void SetErrorMessageCallback(ErrorMessageCallback* callback) {
224 error_message_callback_ = callback; 227 error_message_callback_ = callback;
225 } 228 }
226 229
227 ShareGroup* share_group() const { 230 ShareGroup* share_group() const {
228 return share_group_.get(); 231 return share_group_.get();
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 706
704 inline bool GLES2Implementation::GetTexParameterivHelper( 707 inline bool GLES2Implementation::GetTexParameterivHelper(
705 GLenum /* target */, GLenum /* pname */, GLint* /* params */) { 708 GLenum /* target */, GLenum /* pname */, GLint* /* params */) {
706 return false; 709 return false;
707 } 710 }
708 711
709 } // namespace gles2 712 } // namespace gles2
710 } // namespace gpu 713 } // namespace gpu
711 714
712 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_ 715 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gl_in_process_context.cc ('k') | gpu/command_buffer/client/gles2_implementation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698