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

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

Issue 1813163003: Fix PRIMITIVE_RESTART_FIXED_INDEX handling in command buffer and WebGL 2.0. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactored and expanded unittests. Created 4 years, 9 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
« no previous file with comments | « no previous file | gpu/command_buffer/service/buffer_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 GLenum usage() const { 57 GLenum usage() const {
58 return usage_; 58 return usage_;
59 } 59 }
60 60
61 // Gets the maximum value in the buffer for the given range interpreted as 61 // Gets the maximum value in the buffer for the given range interpreted as
62 // the given type. Returns false if offset and count are out of range. 62 // the given type. Returns false if offset and count are out of range.
63 // offset is in bytes. 63 // offset is in bytes.
64 // count is in elements of type. 64 // count is in elements of type.
65 bool GetMaxValueForRange(GLuint offset, GLsizei count, GLenum type, 65 bool GetMaxValueForRange(GLuint offset, GLsizei count, GLenum type,
66 GLuint* max_value); 66 bool primitive_restart_enabled, GLuint* max_value);
67 67
68 // Returns a pointer to shadowed data. 68 // Returns a pointer to shadowed data.
69 const void* GetRange(GLintptr offset, GLsizeiptr size) const; 69 const void* GetRange(GLintptr offset, GLsizeiptr size) const;
70 70
71 bool IsDeleted() const { 71 bool IsDeleted() const {
72 return deleted_; 72 return deleted_;
73 } 73 }
74 74
75 bool IsValid() const { 75 bool IsValid() const {
76 return initial_target() && !IsDeleted(); 76 return initial_target() && !IsDeleted();
(...skipping 17 matching lines...) Expand all
94 } 94 }
95 95
96 private: 96 private:
97 friend class BufferManager; 97 friend class BufferManager;
98 friend class BufferManagerTestBase; 98 friend class BufferManagerTestBase;
99 friend class base::RefCounted<Buffer>; 99 friend class base::RefCounted<Buffer>;
100 100
101 // Represents a range in a buffer. 101 // Represents a range in a buffer.
102 class Range { 102 class Range {
103 public: 103 public:
104 Range(GLuint offset, GLsizei count, GLenum type) 104 Range(GLuint offset, GLsizei count, GLenum type,
105 bool primitive_restart_enabled)
105 : offset_(offset), 106 : offset_(offset),
106 count_(count), 107 count_(count),
107 type_(type) { 108 type_(type),
109 primitive_restart_enabled_(primitive_restart_enabled) {
108 } 110 }
109 111
110 // A less functor provided for std::map so it can find ranges. 112 // A less functor provided for std::map so it can find ranges.
111 struct Less { 113 struct Less {
112 bool operator() (const Range& lhs, const Range& rhs) const { 114 bool operator() (const Range& lhs, const Range& rhs) const {
113 if (lhs.offset_ != rhs.offset_) { 115 if (lhs.offset_ != rhs.offset_) {
114 return lhs.offset_ < rhs.offset_; 116 return lhs.offset_ < rhs.offset_;
115 } 117 }
116 if (lhs.count_ != rhs.count_) { 118 if (lhs.count_ != rhs.count_) {
117 return lhs.count_ < rhs.count_; 119 return lhs.count_ < rhs.count_;
118 } 120 }
119 return lhs.type_ < rhs.type_; 121 if (lhs.type_ != rhs.type_) {
122 return lhs.type_ < rhs.type_;
123 }
124 return lhs.primitive_restart_enabled_ < rhs.primitive_restart_enabled_;
120 } 125 }
121 }; 126 };
122 127
123 private: 128 private:
124 GLuint offset_; 129 GLuint offset_;
125 GLsizei count_; 130 GLsizei count_;
126 GLenum type_; 131 GLenum type_;
132 bool primitive_restart_enabled_;
127 }; 133 };
128 134
129 ~Buffer(); 135 ~Buffer();
130 136
131 GLenum initial_target() const { 137 GLenum initial_target() const {
132 return initial_target_; 138 return initial_target_;
133 } 139 }
134 140
135 void set_initial_target(GLenum target) { 141 void set_initial_target(GLenum target) {
136 DCHECK_EQ(0u, initial_target_); 142 DCHECK_EQ(0u, initial_target_);
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 bool have_context_; 335 bool have_context_;
330 bool use_client_side_arrays_for_stream_buffers_; 336 bool use_client_side_arrays_for_stream_buffers_;
331 337
332 DISALLOW_COPY_AND_ASSIGN(BufferManager); 338 DISALLOW_COPY_AND_ASSIGN(BufferManager);
333 }; 339 };
334 340
335 } // namespace gles2 341 } // namespace gles2
336 } // namespace gpu 342 } // namespace gpu
337 343
338 #endif // GPU_COMMAND_BUFFER_SERVICE_BUFFER_MANAGER_H_ 344 #endif // GPU_COMMAND_BUFFER_SERVICE_BUFFER_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/buffer_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698