Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 826 vs 827 for /trunk/Source Code/Platform/Video/OpenGL/Buffers/Headers/glBufferImpl.h

Diff revisions: vs.
  @@ -35,53 +35,45 @@
35 35 #include "Platform/Video/OpenGL/Headers/glResources.h"
36 36 namespace Divide {
37 37
38 + struct BufferImplParams {
39 + BufferImplParams()
40 + : _target(GL_NONE),
41 + _frequency(BufferUpdateFrequency::ONCE),
42 + _dataSizeInBytes(0),
43 + _initialData(NULL),
44 + _name("")
45 + {
46 + }
47 +
48 + GLenum _target;
49 + BufferUpdateFrequency _frequency;
50 + size_t _dataSizeInBytes;
51 + bufferPtr _initialData;
52 + const char* _name;
53 + };
54 +
38 55 class glBufferLockManager;
39 56 class glBufferImpl {
40 57 public:
41 - glBufferImpl(GLenum target);
58 + glBufferImpl(const BufferImplParams& params);
42 59 virtual ~glBufferImpl();
43 60
44 61 GLuint bufferID() const;
45 62
46 - virtual void create(BufferUpdateFrequency frequency, size_t size, const char* name = nullptr);
47 - virtual bool bindRange(GLuint bindIndex, size_t offset, size_t range);
48 - virtual void lockRange(size_t offset, size_t range);
49 - virtual void updateData(size_t offset, size_t range, const bufferPtr data) = 0;
50 - virtual void readData(size_t offset, size_t range, const bufferPtr data) = 0;
63 + bool bindRange(GLuint bindIndex, size_t offset, size_t range);
64 + void lockRange(size_t offset, size_t range);
65 + void waitRange(size_t offset, size_t range, bool blockClient);
66 +
67 + void updateData(size_t offset, size_t range, const bufferPtr data);
68 + void readData(size_t offset, size_t range, const bufferPtr data);
51 69
52 70 protected:
53 71 GLenum _target;
54 72 GLuint _handle;
55 73 size_t _alignedSize;
56 - BufferUpdateFrequency _updateFrequency;
57 - };
58 -
59 - class glRegularBuffer : public glBufferImpl {
60 - public:
61 - glRegularBuffer(GLenum target);
62 - ~glRegularBuffer();
63 -
64 - void create(BufferUpdateFrequency frequency, size_t size, const char* name = nullptr) override;
65 - void updateData(size_t offset, size_t range, const bufferPtr data) override;
66 - void readData(size_t offset, size_t range, const bufferPtr data) override;
67 - private:
68 74 GLenum _usage;
69 - };
70 -
71 - class glPersistentBuffer : public glBufferImpl {
72 - public:
73 - glPersistentBuffer(GLenum target);
74 - ~glPersistentBuffer();
75 -
76 - void create(BufferUpdateFrequency frequency, size_t size, const char* name = nullptr) override;
77 - void updateData(size_t offset, size_t range, const bufferPtr data) override;
78 - void readData(size_t offset, size_t range, const bufferPtr data) override;
79 - bool bindRange(GLuint bindIndex, size_t offset, size_t range) override;
80 - void lockRange(size_t offset, size_t range) override;
81 - void waitRange(size_t offset, size_t range, bool blockClient);
82 -
83 - private:
84 75 bufferPtr _mappedBuffer;
76 + BufferUpdateFrequency _updateFrequency;
85 77 glBufferLockManager* _lockManager;
86 78 };
87 79 }; //namespace Divide