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/ShaderBuffer.cpp

Diff revisions: vs.
  @@ -5,41 +5,35 @@
5 5
6 6 namespace Divide {
7 7
8 - ShaderBuffer::ShaderBuffer(GFXDevice& context,
9 - const U32 ringBufferLength,
10 - bool unbound,
11 - bool persistentMapped,
12 - BufferUpdateFrequency frequency)
13 - : GUIDWrapper(),
14 - GraphicsResource(context, getGUID()),
15 - RingBuffer(ringBufferLength),
16 - _sizeFactor(1),
17 - _bufferSize(0),
18 - _primitiveSize(0),
19 - _primitiveCount(0),
20 - _alignmentRequirement(0),
21 - _maxSize(0),
22 - _frequency(frequency),
23 - _unbound(unbound),
24 - _persistentMapped(persistentMapped && !Config::Profile::DISABLE_PERSISTENT_BUFFER)
25 - {
26 - }
27 -
28 - ShaderBuffer::~ShaderBuffer()
29 - {
30 - }
31 -
32 - void ShaderBuffer::create(U32 primitiveCount, ptrdiff_t primitiveSize, U32 sizeFactor) {
33 - _primitiveCount = primitiveCount;
34 - _primitiveSize = primitiveSize;
35 - _bufferSize = primitiveSize * primitiveCount;
36 - _sizeFactor = sizeFactor;
37 - assert(_bufferSize > 0 && "ShaderBuffer::Create error: Invalid buffer size!");
38 - }
39 -
40 - void ShaderBuffer::setData(const bufferPtr data) {
41 - assert(_bufferSize > 0 && "ShaderBuffer::SetData error: Invalid buffer size!");
42 - updateData(0, _primitiveCount, data);
43 - }
8 + size_t ShaderBuffer::_boundAlignmentRequirement = 0;
9 + size_t ShaderBuffer::_unboundAlignmentRequirement = 0;
44 10
11 + ShaderBuffer::ShaderBuffer(GFXDevice& context,
12 + const ShaderBufferParams& params)
13 + : GUIDWrapper(),
14 + GraphicsResource(context, getGUID()),
15 + RingBuffer(params._ringBufferLength),
16 + _primitiveSize(params._primitiveSizeInBytes),
17 + _primitiveCount(params._primitiveCount),
18 + _frequency(params._updateFrequency),
19 + _unbound(params._unbound),
20 + _bufferSize(0),
21 + _maxSize(0)
22 + {
23 + _bufferSize = _primitiveSize * _primitiveCount;
24 + assert(_bufferSize > 0 && "ShaderBuffer::Create error: Invalid buffer size!");
25 + }
26 +
27 + ShaderBuffer::~ShaderBuffer()
28 + {
29 + }
30 +
31 + void ShaderBuffer::setData(const bufferPtr data) {
32 + assert(_bufferSize > 0 && "ShaderBuffer::SetData error: Invalid buffer size!");
33 + updateData(0, _primitiveCount, data);
34 + }
35 +
36 + size_t ShaderBuffer::alignmentRequirement(bool unbound) {
37 + return unbound ? _unboundAlignmentRequirement : _boundAlignmentRequirement;
38 + }
45 39 }; //namespace Divide;