Skip to content

Commit 2bedeb3

Browse files
committed
Fix clang compile errors to make Nabla compile on android build - there is one TODO to take care of!
1 parent 1892d54 commit 2bedeb3

File tree

6 files changed

+28
-10
lines changed

6 files changed

+28
-10
lines changed

include/nbl/asset/IBuffer.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,20 @@ struct NBL_API SBufferBinding
6262
template<typename BufferType>
6363
struct NBL_API SBufferRange
6464
{
65+
SBufferRange(const size_t& _offset, const size_t _size, core::smart_refctd_ptr<BufferType>&& _buffer)
66+
: offset(_offset), size(_size), buffer(core::smart_refctd_ptr<BufferType>(_buffer)) {}
67+
68+
SBufferRange() : offset(0ull), size(0ull), buffer(nullptr) {}
69+
6570
inline bool isValid() const
6671
{
6772
return buffer && size && (offset+size<=buffer->getSize());
6873
}
6974

70-
size_t offset = 0ull;
71-
size_t size = 0ull;
72-
core::smart_refctd_ptr<BufferType> buffer = nullptr;
75+
size_t offset;
76+
size_t size ;
77+
core::smart_refctd_ptr<BufferType> buffer;
78+
7379
inline bool operator==(const SBufferRange<BufferType>& rhs) const { return buffer==rhs.buffer && offset==rhs.offset && size==rhs.size; }
7480
inline bool operator!=(const SBufferRange<BufferType>& rhs) const { return !operator==(rhs); }
7581
};

include/nbl/asset/ICPUAnimationLibrary.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class NBL_API ICPUAnimationLibrary final : public IAnimationLibrary<ICPUBuffer>,
9999
SBufferBinding<ICPUBuffer> _keyframeStorageBinding = {m_keyframeStorageBinding.offset,_depth>0u ? core::smart_refctd_ptr_static_cast<ICPUBuffer>(m_keyframeStorageBinding.buffer->clone(_depth-1u)):m_keyframeStorageBinding.buffer};
100100
SBufferBinding<ICPUBuffer> _timestampStorageBinding = {m_timestampStorageBinding.offset,_depth>0u ? core::smart_refctd_ptr_static_cast<ICPUBuffer>(m_timestampStorageBinding.buffer->clone(_depth-1u)):m_timestampStorageBinding.buffer};
101101

102-
SBufferRange<ICPUBuffer> _animationStorageRange = {m_animationStorageRange.offset,m_animationStorageRange.size,_depth>0u&&m_animationStorageRange.buffer ? core::smart_refctd_ptr_static_cast<ICPUBuffer>(m_animationStorageRange.buffer->clone(_depth-1u)):m_animationStorageRange.buffer};
102+
SBufferRange<ICPUBuffer> _animationStorageRange = {m_animationStorageRange.offset,m_animationStorageRange.size,_depth>0u&&m_animationStorageRange.buffer ? core::smart_refctd_ptr_static_cast<ICPUBuffer>(m_animationStorageRange.buffer->clone(_depth-1u)):core::smart_refctd_ptr(m_animationStorageRange.buffer)};
103103

104104
auto cp = core::make_smart_refctd_ptr<ICPUAnimationLibrary>(std::move(_keyframeStorageBinding),std::move(_timestampStorageBinding),m_keyframeCount,std::move(_animationStorageRange));
105105
clone_common(cp.get());

include/nbl/ui/CWindowAndroid.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ class CWindowAndroid : public IWindowAndroid
2727
inline const native_handle_t& getNativeHandle() const override { return m_native; }
2828

2929
inline void setCaption(const std::string_view& caption) override {}
30+
virtual IWindowManager* getManager() override
31+
{
32+
/*
33+
TODO: this class should have m_windowManager member...
34+
*/
35+
36+
assert(false);
37+
return nullptr;
38+
}
3039

3140
// WHY THE FUCK ARE THESE PUBLIC?
3241
core::map<uint32_t, core::smart_refctd_ptr<IMouseEventChannel>> m_mouseEventChannels;

include/nbl/video/alloc/CAsyncSingleBufferSubAllocator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ class CAsyncSingleBufferSubAllocator
3535
class DeferredFreeFunctor
3636
{
3737
static constexpr size_t PseudoTupleByteSize = (2u*sizeof(size_type)+sizeof(core::smart_refctd_ptr<core::IReferenceCounted>));
38-
static constexpr size_t AllocatorUnitsPerMetadata = PseudoTupleByteSize/sizeof(HostAllocator::value_type);
39-
static_assert((PseudoTupleByteSize%sizeof(HostAllocator::value_type)) == 0u, "should be divisible by HostAllocator::value_type");
38+
static constexpr size_t AllocatorUnitsPerMetadata = PseudoTupleByteSize/sizeof(typename HostAllocator::value_type);
39+
static_assert((PseudoTupleByteSize%sizeof(typename HostAllocator::value_type)) == 0u, "should be divisible by HostAllocator::value_type");
4040

4141
public:
4242
template<typename T>

include/nbl/video/utilities/IUtilities.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class NBL_API IUtilities : public core::IReferenceCounted
125125
auto mreqs = buffer->getMemoryReqs();
126126
mreqs.memoryTypeBits &= m_device->getPhysicalDevice()->getDeviceLocalMemoryTypeBits();
127127
auto mem = m_device->allocate(mreqs, buffer.get());
128-
updateBufferRangeViaStagingBuffer(queue, asset::SBufferRange<IGPUBuffer>{0u, params.size, buffer}, data);
128+
updateBufferRangeViaStagingBuffer(queue, asset::SBufferRange<IGPUBuffer>{0u, params.size, core::smart_refctd_ptr(buffer)}, data);
129129
return buffer;
130130
}
131131

src/nbl/asset/interchange/CGLTFLoader.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -619,10 +619,13 @@ using namespace nbl::asset;
619619
}
620620
}
621621

622-
//
623622
skins[index].skeleton = skeletons[skeletonNodes[globalRootNode].skeletonID];
624-
skins[index].translationTable = {sizeof(ICPUSkeleton::joint_id_t)*skinJointRefCount,sizeof(ICPUSkeleton::joint_id_t)*jointCount,vertexJointToSkeletonJoint};
625-
skins[index].inverseBindPose = {sizeof(core::matrix3x4SIMD)*skinJointRefCount,sizeof(core::matrix3x4SIMD)*jointCount,inverseBindPose};
623+
skins[index].translationTable.offset = sizeof(ICPUSkeleton::joint_id_t) * skinJointRefCount;
624+
skins[index].translationTable.size = sizeof(ICPUSkeleton::joint_id_t) * jointCount;
625+
skins[index].translationTable.buffer = core::smart_refctd_ptr(vertexJointToSkeletonJoint);
626+
skins[index].inverseBindPose.offset = sizeof(core::matrix3x4SIMD) * skinJointRefCount;
627+
skins[index].inverseBindPose.size = sizeof(core::matrix3x4SIMD) * jointCount;
628+
skins[index].inverseBindPose.buffer = core::smart_refctd_ptr(inverseBindPose);
626629
skins[index].jointCount = jointCount;
627630

628631
auto translationTableIt = reinterpret_cast<ICPUSkeleton::joint_id_t*>(skins[index].translationTable.buffer->getPointer())+skinJointRefCount;

0 commit comments

Comments
 (0)