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/Buffers/ShaderBuffer/Headers/ShaderBuffer.h

Diff revisions: vs.
  @@ -37,23 +37,35 @@
37 37
38 38 namespace Divide {
39 39
40 + struct ShaderBufferParams {
41 + ShaderBufferParams()
42 + : _ringBufferLength(1),
43 + _primitiveCount(0),
44 + _primitiveSizeInBytes(0),
45 + _unbound(false),
46 + _initialData(nullptr),
47 + _updateFrequency(BufferUpdateFrequency::ONCE)
48 + {
49 + }
50 +
51 + U32 _ringBufferLength;
52 + U32 _primitiveCount;
53 + size_t _primitiveSizeInBytes;
54 + bool _unbound;
55 + BufferUpdateFrequency _updateFrequency;
56 + bufferPtr _initialData;
57 + };
58 +
40 59 class ShaderProgram;
41 60 class NOINITVTABLE ShaderBuffer : public GraphicsResource,
42 61 public RingBuffer,
43 62 public GUIDWrapper {
44 63 USE_CUSTOM_ALLOCATOR
45 64 public:
46 - explicit ShaderBuffer(GFXDevice& context,
47 - const U32 ringBufferLength,
48 - bool unbound,
49 - bool persistentMapped,
50 - BufferUpdateFrequency frequency);
65 + explicit ShaderBuffer(GFXDevice& context, const ShaderBufferParams& params);
51 66
52 67 virtual ~ShaderBuffer();
53 68
54 - /// Create a new buffer to hold our shader data
55 - virtual void create(U32 primitiveCount, ptrdiff_t primitiveSize, U32 sizeFactor = 1);
56 -
57 69 virtual void updateData(ptrdiff_t offsetElementCount,
58 70 ptrdiff_t rangeElementCount,
59 71 const bufferPtr data) = 0;
  @@ -85,25 +97,27 @@
85 97
86 98 inline size_t getPrimitiveSize() const { return _primitiveSize; }
87 99 inline U32 getPrimitiveCount() const { return _primitiveCount; }
88 - inline size_t getAlignmentRequirement() const { return _alignmentRequirement; }
89 100
90 101 virtual void addAtomicCounter(U32 sizeFactor = 1) = 0;
91 102 virtual U32 getAtomicCounter(U32 counterIndex = 0) = 0;
92 103 virtual void bindAtomicCounter(U32 counterIndex = 0, U32 bindIndex = 0) = 0;
93 104 virtual void resetAtomicCounter(U32 counterIndex = 0) = 0;
94 105
106 + static size_t alignmentRequirement(bool unbound);
107 +
95 108 protected:
96 109 size_t _bufferSize;
97 110 size_t _primitiveSize;
98 - size_t _alignmentRequirement;
99 111 size_t _maxSize;
100 112 U32 _primitiveCount;
101 - U32 _sizeFactor;
113 +
114 + static size_t _boundAlignmentRequirement;
115 + static size_t _unboundAlignmentRequirement;
102 116
103 117 const bool _unbound;
104 - const bool _persistentMapped;
105 118 const BufferUpdateFrequency _frequency;
106 119 };
107 120
121 +
108 122 }; // namespace Divide
109 123 #endif //_SHADER_BUFFER_H_