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

Side by Side Diff: gpu/command_buffer/service/buffer_manager.h

Issue 2380683003: add range check to service-side MapBufferRange (Closed)
Patch Set: rebase over reformat Created 4 years, 2 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_SERVICE_BUFFER_MANAGER_H_ 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_BUFFER_MANAGER_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_BUFFER_MANAGER_H_ 6 #define GPU_COMMAND_BUFFER_SERVICE_BUFFER_MANAGER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // Gets the maximum value in the buffer for the given range interpreted as 63 // Gets the maximum value in the buffer for the given range interpreted as
64 // the given type. Returns false if offset and count are out of range. 64 // the given type. Returns false if offset and count are out of range.
65 // offset is in bytes. 65 // offset is in bytes.
66 // count is in elements of type. 66 // count is in elements of type.
67 bool GetMaxValueForRange(GLuint offset, GLsizei count, GLenum type, 67 bool GetMaxValueForRange(GLuint offset, GLsizei count, GLenum type,
68 bool primitive_restart_enabled, GLuint* max_value); 68 bool primitive_restart_enabled, GLuint* max_value);
69 69
70 // Returns a pointer to shadowed data. 70 // Returns a pointer to shadowed data.
71 const void* GetRange(GLintptr offset, GLsizeiptr size) const; 71 const void* GetRange(GLintptr offset, GLsizeiptr size) const;
72 72
73 // Check if an offset, size range is valid for the current buffer.
74 bool CheckRange(GLintptr offset, GLsizeiptr size) const;
75
73 bool IsDeleted() const { 76 bool IsDeleted() const {
74 return deleted_; 77 return deleted_;
75 } 78 }
76 79
77 bool IsValid() const { 80 bool IsValid() const {
78 return initial_target() && !IsDeleted(); 81 return initial_target() && !IsDeleted();
79 } 82 }
80 83
81 bool IsClientSideArray() const { 84 bool IsClientSideArray() const {
82 return is_client_side_array_; 85 return is_client_side_array_;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 bool is_client_side_array); 170 bool is_client_side_array);
168 171
169 // Sets a range of data for this buffer. Returns false if the offset or size 172 // Sets a range of data for this buffer. Returns false if the offset or size
170 // is out of range. 173 // is out of range.
171 bool SetRange( 174 bool SetRange(
172 GLintptr offset, GLsizeiptr size, const GLvoid * data); 175 GLintptr offset, GLsizeiptr size, const GLvoid * data);
173 176
174 // Clears any cache of index ranges. 177 // Clears any cache of index ranges.
175 void ClearCache(); 178 void ClearCache();
176 179
177 // Check if an offset, size range is valid for the current buffer.
178 bool CheckRange(GLintptr offset, GLsizeiptr size) const;
179
180 // The manager that owns this Buffer. 180 // The manager that owns this Buffer.
181 BufferManager* manager_; 181 BufferManager* manager_;
182 182
183 // A copy of the data in the buffer. This data is only kept if the conditions 183 // A copy of the data in the buffer. This data is only kept if the conditions
184 // checked in UseShadowBuffer() are true. 184 // checked in UseShadowBuffer() are true.
185 std::vector<uint8_t> shadow_; 185 std::vector<uint8_t> shadow_;
186 186
187 // Size of buffer. 187 // Size of buffer.
188 GLsizeiptr size_; 188 GLsizeiptr size_;
189 189
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 bool lost_context_; 379 bool lost_context_;
380 bool use_client_side_arrays_for_stream_buffers_; 380 bool use_client_side_arrays_for_stream_buffers_;
381 381
382 DISALLOW_COPY_AND_ASSIGN(BufferManager); 382 DISALLOW_COPY_AND_ASSIGN(BufferManager);
383 }; 383 };
384 384
385 } // namespace gles2 385 } // namespace gles2
386 } // namespace gpu 386 } // namespace gpu
387 387
388 #endif // GPU_COMMAND_BUFFER_SERVICE_BUFFER_MANAGER_H_ 388 #endif // GPU_COMMAND_BUFFER_SERVICE_BUFFER_MANAGER_H_
OLDNEW
« no previous file with comments | « content/test/gpu/gpu_tests/webgl2_conformance_expectations.py ('k') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698