Skip to content

Commit a686063

Browse files
committed
(Temporary) Erfan's fixes for ICPUBuffer
1 parent 7966c87 commit a686063

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

include/nbl/asset/ICPUBuffer.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class NBL_API ICPUBuffer : public asset::IBuffer, public asset::IAsset
3333
}
3434

3535
//! Non-allocating constructor for CCustormAllocatorCPUBuffer derivative
36-
ICPUBuffer(size_t sizeInBytes, void* dat) : asset::IBuffer({dat ? sizeInBytes:0,EUF_TRANSFER_DST_BIT}), data(dat) {}
36+
ICPUBuffer(size_t sizeInBytes, void* dat) : asset::IBuffer({ dat ? sizeInBytes : 0,EUF_TRANSFER_DST_BIT }), data(dat) {}
3737
public:
3838
//! Constructor. TODO: remove, alloc can fail, should be a static create method instead!
3939
/** @param sizeInBytes Size in bytes. If `dat` argument is present, it denotes size of data pointed by `dat`, otherwise - size of data to be allocated.
@@ -56,7 +56,7 @@ class NBL_API ICPUBuffer : public asset::IBuffer, public asset::IAsset
5656
return cp;
5757
}
5858

59-
virtual void convertToDummyObject(uint32_t referenceLevelsBelowToConvert=0u) override
59+
virtual void convertToDummyObject(uint32_t referenceLevelsBelowToConvert = 0u) override
6060
{
6161
if (!canBeConvertedToDummy())
6262
return;
@@ -79,7 +79,7 @@ class NBL_API ICPUBuffer : public asset::IBuffer, public asset::IAsset
7979
virtual void* getPointer()
8080
{
8181
assert(!isImmutable_debug());
82-
return data;
82+
return data;
8383
}
8484

8585
bool canBeRestoredFrom(const IAsset* _other) const override
@@ -115,15 +115,15 @@ class NBL_API ICPUBuffer : public asset::IBuffer, public asset::IAsset
115115
if (willBeRestoredFrom(_other))
116116
std::swap(data, other->data);
117117
}
118-
118+
119119
void* data;
120-
};
120+
};
121121

122-
template<
123-
typename Allocator = _NBL_DEFAULT_ALLOCATOR_METATYPE<uint8_t>,
124-
bool = std::is_same<Allocator, core::null_allocator<typename Allocator::value_type> >::value
125-
>
126-
class NBL_API CCustomAllocatorCPUBuffer;
122+
template<
123+
typename Allocator = _NBL_DEFAULT_ALLOCATOR_METATYPE<uint8_t>,
124+
bool = std::is_same<Allocator, core::null_allocator<typename Allocator::value_type> >::value
125+
>
126+
class NBL_API CCustomAllocatorCPUBuffer;
127127

128128
using CDummyCPUBuffer = CCustomAllocatorCPUBuffer<core::null_allocator<uint8_t>, true>;
129129

@@ -133,11 +133,11 @@ using CDummyCPUBuffer = CCustomAllocatorCPUBuffer<core::null_allocator<uint8_t>,
133133
passing an object type for allocation and a pointer to allocated
134134
data for it's storage by ICPUBuffer.
135135
136-
So the need for the class existence is for common following tricks - among others creating an
137-
\bICPUBuffer\b over an already existing \bvoid*\b array without any \imemcpy\i or \itaking over the memory ownership\i.
138-
You can use it with a \bnull_allocator\b that adopts memory (it is a bit counter intuitive because \badopt = take\b ownership,
139-
but a \inull allocator\i doesn't do anything, even free the memory, so you're all good).
140-
*/
136+
So the need for the class existence is for common following tricks - among others creating an
137+
\bICPUBuffer\b over an already existing \bvoid*\b array without any \imemcpy\i or \itaking over the memory ownership\i.
138+
You can use it with a \bnull_allocator\b that adopts memory (it is a bit counter intuitive because \badopt = take\b ownership,
139+
but a \inull allocator\i doesn't do anything, even free the memory, so you're all good).
140+
*/
141141

142142
template<typename Allocator>
143143
class NBL_API CCustomAllocatorCPUBuffer<Allocator, true> : public ICPUBuffer

0 commit comments

Comments
 (0)