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

Unified Diff: gpu/command_buffer/service/buffer_manager.h

Issue 1001833005: Update from https://crrev.com/320343 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Supress Created 5 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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/buffer_manager.h
diff --git a/gpu/command_buffer/service/buffer_manager.h b/gpu/command_buffer/service/buffer_manager.h
index 22a6e429f4d4720b1f2de8cccd12adc71d912d58..29bfaf4d431cf0809a6e1ecc920ace2df5fdedf4 100644
--- a/gpu/command_buffer/service/buffer_manager.h
+++ b/gpu/command_buffer/service/buffer_manager.h
@@ -11,6 +11,7 @@
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "gpu/command_buffer/common/buffer.h"
#include "gpu/command_buffer/service/gl_utils.h"
#include "gpu/command_buffer/service/memory_tracking.h"
#include "gpu/gpu_export.h"
@@ -27,6 +28,19 @@ class TestHelper;
// Info about Buffers currently in the system.
class GPU_EXPORT Buffer : public base::RefCounted<Buffer> {
public:
+ struct MappedRange {
+ GLintptr offset;
+ GLsizeiptr size;
+ GLenum access;
+ void* pointer; // Pointer returned by driver.
+ scoped_refptr<gpu::Buffer> shm; // Client side mem.
+
+ MappedRange(GLintptr offset, GLsizeiptr size, GLenum access,
+ void* pointer, scoped_refptr<gpu::Buffer> shm);
+ ~MappedRange();
+ void* GetShmPointer() const;
+ };
+
Buffer(BufferManager* manager, GLuint service_id);
GLuint service_id() const {
@@ -67,6 +81,19 @@ class GPU_EXPORT Buffer : public base::RefCounted<Buffer> {
return is_client_side_array_;
}
+ void SetMappedRange(GLintptr offset, GLsizeiptr size, GLenum access,
+ void* pointer, scoped_refptr<gpu::Buffer> shm) {
+ mapped_range_.reset(new MappedRange(offset, size, access, pointer, shm));
+ }
+
+ void RemoveMappedRange() {
+ mapped_range_.reset(nullptr);
+ }
+
+ const MappedRange* GetMappedRange() const {
+ return mapped_range_.get();
+ }
+
private:
friend class BufferManager;
friend class BufferManagerTestBase;
@@ -163,6 +190,9 @@ class GPU_EXPORT Buffer : public base::RefCounted<Buffer> {
// Usage of buffer.
GLenum usage_;
+ // Data cached from last glMapBufferRange call.
+ scoped_ptr<MappedRange> mapped_range_;
+
// A map of ranges to the highest value in that range of a certain type.
typedef std::map<Range, GLuint, Range::Less> RangeToMaxValueMap;
RangeToMaxValueMap range_set_;
@@ -232,15 +262,16 @@ class GPU_EXPORT BufferManager {
// set to a non-zero size.
bool UseNonZeroSizeForClientSideArrayBuffer();
+ Buffer* GetBufferInfoForTarget(ContextState* state, GLenum target) const;
+
private:
friend class Buffer;
friend class TestHelper; // Needs access to DoBufferData.
friend class BufferManagerTestBase; // Needs access to DoBufferSubData.
+
void StartTracking(Buffer* buffer);
void StopTracking(Buffer* buffer);
- Buffer* GetBufferInfoForTarget(ContextState* state, GLenum target);
-
// Does a glBufferSubData and updates the approriate accounting.
// Assumes the values have already been validated.
void DoBufferSubData(
« no previous file with comments | « gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h ('k') | gpu/command_buffer/service/buffer_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698