Skip to content

Commit 2e02e6a

Browse files
move more headers
1 parent 2ae47ea commit 2e02e6a

File tree

4 files changed

+85
-83
lines changed

4 files changed

+85
-83
lines changed

include/nbl/asset/asset.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@
8181
#include "nbl/asset/metadata/CSTLMetadata.h"
8282

8383
//VT
84-
#include "nbl/asset/utils/IVirtualTexture.h"
84+
#include "nbl/asset/utils/CCPUMeshPackerV1.h"
85+
#include "nbl/asset/utils/CCPUMeshPackerV2.h"
8586
#include "nbl/asset/utils/ICPUVirtualTexture.h"
8687

8788
#endif

include/nbl/asset/CCPUMeshPackerV2.h renamed to include/nbl/asset/utils/CCPUMeshPackerV2.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#define __NBL_ASSET_C_CPU_MESH_PACKER_V2_H_INCLUDED__
77

88
#include <nbl/asset/ICPUMesh.h>
9-
#include <nbl/asset/IMeshPackerV2.h>
9+
#include <nbl/asset/utils/IMeshPackerV2.h>
1010

1111
namespace nbl
1212
{

include/nbl/video/CGPUMeshPackerV2.h

Lines changed: 81 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
#include <nbl/video/IGPUMesh.h>
99
#include <nbl/video/IGPUDescriptorSetLayout.h>
10-
#include <nbl/asset/IMeshPackerV2.h>
11-
#include <nbl/asset/CCPUMeshPackerV2.h>
10+
#include <nbl/asset/utils/IMeshPackerV2.h>
11+
#include <nbl/asset/utils/CCPUMeshPackerV2.h>
1212

1313
using namespace nbl::video;
1414

@@ -18,91 +18,91 @@ namespace asset
1818
{
1919

2020
template <typename MDIStructType = DrawElementsIndirectCommand_t>
21-
class CGPUMeshPackerV2 final : public IMeshPackerV2<video::IGPUBuffer, video::IGPUMeshBuffer, MDIStructType>
21+
class CGPUMeshPackerV2 final : public IMeshPackerV2<video::IGPUBuffer,video::IGPUMeshBuffer,MDIStructType>
2222
{
23-
using base_t = IMeshPackerV2<video::IGPUBuffer, video::IGPUMeshBuffer, MDIStructType>;
24-
using Triangle = typename base_t::Triangle;
25-
using TriangleBatches = typename base_t::TriangleBatches;
26-
27-
public:
28-
using AllocationParams = IMeshPackerBase::AllocationParamsCommon;
29-
using PackerDataStore = typename base_t::PackerDataStore;
30-
using ReservedAllocationMeshBuffers = typename base_t::ReservedAllocationMeshBuffers;
31-
using AttribAllocParams = typename base_t::AttribAllocParams;
32-
33-
public:
34-
CGPUMeshPackerV2(video::IVideoDriver* driver, const AllocationParams& allocParams, uint16_t minTriangleCountPerMDIData = 256u, uint16_t maxTriangleCountPerMDIData = 1024u)
35-
:IMeshPackerV2<video::IGPUBuffer, video::IGPUMeshBuffer, MDIStructType>(allocParams, minTriangleCountPerMDIData, maxTriangleCountPerMDIData),
36-
m_driver(driver)
37-
{}
38-
39-
CGPUMeshPackerV2(video::IVideoDriver* driver, const asset::CCPUMeshPackerV2<MDIStructType>& cpuMP)
40-
:IMeshPackerV2<video::IGPUBuffer, video::IGPUMeshBuffer, MDIStructType>(cpuMP.m_allocParams, cpuMP.m_minTriangleCountPerMDIData, cpuMP.m_maxTriangleCountPerMDIData),
41-
m_driver(driver)
42-
{
43-
m_virtualAttribConfig = cpuMP.m_virtualAttribConfig;
44-
45-
auto& cpuMDIBuff = cpuMP.m_packerDataStore.MDIDataBuffer;
46-
auto& cpuIdxBuff = cpuMP.m_packerDataStore.indexBuffer;
47-
auto& cpuVtxBuff = cpuMP.m_packerDataStore.vertexBuffer;
48-
49-
m_packerDataStore.MDIDataBuffer = driver->createFilledDeviceLocalGPUBufferOnDedMem(cpuMDIBuff->getSize(), cpuMDIBuff->getPointer());
50-
m_packerDataStore.indexBuffer = driver->createFilledDeviceLocalGPUBufferOnDedMem(cpuMDIBuff->getSize(), cpuMDIBuff->getPointer());
51-
m_packerDataStore.vertexBuffer = driver->createFilledDeviceLocalGPUBufferOnDedMem(cpuMDIBuff->getSize(), cpuMDIBuff->getPointer());
52-
}
53-
54-
CGPUMeshPackerV2(video::IVideoDriver* driver, asset::CCPUMeshPackerV2<MDIStructType>&& cpuMP)
55-
:IMeshPackerV2<video::IGPUBuffer, video::IGPUMeshBuffer, MDIStructType>(cpuMP.m_allocParams, cpuMP.m_minTriangleCountPerMDIData, cpuMP.m_maxTriangleCountPerMDIData),
56-
m_driver(driver)
57-
{
58-
m_virtualAttribConfig = std::move(cpuMP.m_virtualAttribConfig);
59-
60-
auto cpuMDIBuff = std::move(cpuMP.m_packerDataStore.MDIDataBuffer);
61-
auto cpuIdxBuff = std::move(cpuMP.m_packerDataStore.indexBuffer);
62-
auto cpuVtxBuff = std::move(cpuMP.m_packerDataStore.vertexBuffer);
63-
64-
m_packerDataStore.MDIDataBuffer = driver->createFilledDeviceLocalGPUBufferOnDedMem(cpuMDIBuff->getSize(), cpuMDIBuff->getPointer());
65-
m_packerDataStore.indexBuffer = driver->createFilledDeviceLocalGPUBufferOnDedMem(cpuIdxBuff->getSize(), cpuIdxBuff->getPointer());
66-
m_packerDataStore.vertexBuffer = driver->createFilledDeviceLocalGPUBufferOnDedMem(cpuVtxBuff->getSize(), cpuVtxBuff->getPointer());
67-
68-
cpuMP.m_vtxBuffAlctr.reset();
69-
cpuMP.m_idxBuffAlctr.reset();
70-
cpuMP.m_MDIDataAlctr.reset();
71-
}
72-
73-
74-
void instantiateDataStorage();
75-
76-
template <typename MeshBufferIterator>
77-
bool commit(IMeshPackerBase::PackedMeshBufferData* pmbdOut, ReservedAllocationMeshBuffers* rambIn, const MeshBufferIterator mbBegin, const MeshBufferIterator mbEnd);
78-
79-
uint32_t getDSlayoutBindingsForUTB(IGPUDescriptorSetLayout::SBinding* outBindings, uint32_t fsamplersBinding = 0u, uint32_t isamplersBinding = 1u, uint32_t usamplersBinding = 2u) const
80-
{
81-
return getDSlayoutBindingsForUTB_internal<IGPUDescriptorSetLayout>(outBindings, fsamplersBinding, isamplersBinding, usamplersBinding);
82-
}
83-
84-
std::pair<uint32_t, uint32_t> getDescriptorSetWritesForUTB(IGPUDescriptorSet::SWriteDescriptorSet* outWrites, IGPUDescriptorSet::SDescriptorInfo* outInfo, IGPUDescriptorSet* dstSet, uint32_t fBuffersBinding = 0u, uint32_t iBuffersBinding = 1u, uint32_t uBuffersBinding = 2u) const
85-
{
86-
auto createBufferView = [&](E_FORMAT format) -> core::smart_refctd_ptr<IGPUBufferView>
23+
using base_t = IMeshPackerV2<video::IGPUBuffer,video::IGPUMeshBuffer,MDIStructType>;
24+
using Triangle = typename base_t::Triangle;
25+
using TriangleBatches = typename base_t::TriangleBatches;
26+
27+
public:
28+
using AllocationParams = IMeshPackerBase::AllocationParamsCommon;
29+
using PackerDataStore = typename base_t::PackerDataStore;
30+
using ReservedAllocationMeshBuffers = typename base_t::ReservedAllocationMeshBuffers;
31+
using AttribAllocParams = typename base_t::AttribAllocParams;
32+
33+
public:
34+
CGPUMeshPackerV2(video::IVideoDriver* driver, const AllocationParams& allocParams, uint16_t minTriangleCountPerMDIData = 256u, uint16_t maxTriangleCountPerMDIData = 1024u)
35+
:IMeshPackerV2<video::IGPUBuffer, video::IGPUMeshBuffer, MDIStructType>(allocParams, minTriangleCountPerMDIData, maxTriangleCountPerMDIData),
36+
m_driver(driver)
37+
{}
38+
39+
CGPUMeshPackerV2(video::IVideoDriver* driver, const asset::CCPUMeshPackerV2<MDIStructType>& cpuMP)
40+
:IMeshPackerV2<video::IGPUBuffer, video::IGPUMeshBuffer, MDIStructType>(cpuMP.m_allocParams, cpuMP.m_minTriangleCountPerMDIData, cpuMP.m_maxTriangleCountPerMDIData),
41+
m_driver(driver)
8742
{
88-
return m_driver->createGPUBufferView(m_packerDataStore.vertexBuffer.get(), format);
89-
};
43+
m_virtualAttribConfig = cpuMP.m_virtualAttribConfig;
9044

91-
return getDescriptorSetWritesForUTB_internal<IGPUDescriptorSet, IGPUBufferView>(outWrites, outInfo, dstSet, createBufferView, fBuffersBinding, iBuffersBinding, uBuffersBinding);
92-
}
45+
auto& cpuMDIBuff = cpuMP.m_packerDataStore.MDIDataBuffer;
46+
auto& cpuIdxBuff = cpuMP.m_packerDataStore.indexBuffer;
47+
auto& cpuVtxBuff = cpuMP.m_packerDataStore.vertexBuffer;
9348

94-
uint32_t getDSlayoutBindingsForSSBO(IGPUDescriptorSetLayout::SBinding* outBindings, uint32_t uintBufferBinding = 0u, uint32_t uvec2BufferBinding = 1u, uint32_t uvec3BufferBinding = 2u, uint32_t uvec4BufferBinding = 3u) const
95-
{
96-
return getDSlayoutBindingsForSSBO_internal<IGPUDescriptorSetLayout>(outBindings, uintBufferBinding, uvec2BufferBinding, uvec3BufferBinding, uvec4BufferBinding);
97-
}
49+
m_packerDataStore.MDIDataBuffer = driver->createFilledDeviceLocalGPUBufferOnDedMem(cpuMDIBuff->getSize(), cpuMDIBuff->getPointer());
50+
m_packerDataStore.indexBuffer = driver->createFilledDeviceLocalGPUBufferOnDedMem(cpuMDIBuff->getSize(), cpuMDIBuff->getPointer());
51+
m_packerDataStore.vertexBuffer = driver->createFilledDeviceLocalGPUBufferOnDedMem(cpuMDIBuff->getSize(), cpuMDIBuff->getPointer());
52+
}
9853

99-
uint32_t getDescriptorSetWritesForSSBO(IGPUDescriptorSet::SWriteDescriptorSet* outWrites, IGPUDescriptorSet::SDescriptorInfo* outInfo, IGPUDescriptorSet* dstSet, uint32_t uintBufferBinding = 0u, uint32_t uvec2BufferBinding = 1u, uint32_t uvec3BufferBinding = 2u, uint32_t uvec4BufferBinding = 3u) const
100-
{
101-
return getDescriptorSetWritesForSSBO_internal<IGPUDescriptorSet>(outWrites, outInfo, dstSet, m_packerDataStore.vertexBuffer, uintBufferBinding, uvec2BufferBinding, uvec3BufferBinding, uvec4BufferBinding);
102-
}
54+
CGPUMeshPackerV2(video::IVideoDriver* driver, asset::CCPUMeshPackerV2<MDIStructType>&& cpuMP)
55+
:IMeshPackerV2<video::IGPUBuffer, video::IGPUMeshBuffer, MDIStructType>(cpuMP.m_allocParams, cpuMP.m_minTriangleCountPerMDIData, cpuMP.m_maxTriangleCountPerMDIData),
56+
m_driver(driver)
57+
{
58+
m_virtualAttribConfig = std::move(cpuMP.m_virtualAttribConfig);
59+
60+
auto cpuMDIBuff = std::move(cpuMP.m_packerDataStore.MDIDataBuffer);
61+
auto cpuIdxBuff = std::move(cpuMP.m_packerDataStore.indexBuffer);
62+
auto cpuVtxBuff = std::move(cpuMP.m_packerDataStore.vertexBuffer);
63+
64+
m_packerDataStore.MDIDataBuffer = driver->createFilledDeviceLocalGPUBufferOnDedMem(cpuMDIBuff->getSize(), cpuMDIBuff->getPointer());
65+
m_packerDataStore.indexBuffer = driver->createFilledDeviceLocalGPUBufferOnDedMem(cpuIdxBuff->getSize(), cpuIdxBuff->getPointer());
66+
m_packerDataStore.vertexBuffer = driver->createFilledDeviceLocalGPUBufferOnDedMem(cpuVtxBuff->getSize(), cpuVtxBuff->getPointer());
67+
68+
cpuMP.m_vtxBuffAlctr.reset();
69+
cpuMP.m_idxBuffAlctr.reset();
70+
cpuMP.m_MDIDataAlctr.reset();
71+
}
72+
73+
74+
void instantiateDataStorage();
75+
76+
template <typename MeshBufferIterator>
77+
bool commit(IMeshPackerBase::PackedMeshBufferData* pmbdOut, ReservedAllocationMeshBuffers* rambIn, const MeshBufferIterator mbBegin, const MeshBufferIterator mbEnd);
78+
79+
uint32_t getDSlayoutBindingsForUTB(IGPUDescriptorSetLayout::SBinding* outBindings, uint32_t fsamplersBinding = 0u, uint32_t isamplersBinding = 1u, uint32_t usamplersBinding = 2u) const
80+
{
81+
return getDSlayoutBindingsForUTB_internal<IGPUDescriptorSetLayout>(outBindings, fsamplersBinding, isamplersBinding, usamplersBinding);
82+
}
83+
84+
std::pair<uint32_t, uint32_t> getDescriptorSetWritesForUTB(IGPUDescriptorSet::SWriteDescriptorSet* outWrites, IGPUDescriptorSet::SDescriptorInfo* outInfo, IGPUDescriptorSet* dstSet, uint32_t fBuffersBinding = 0u, uint32_t iBuffersBinding = 1u, uint32_t uBuffersBinding = 2u) const
85+
{
86+
auto createBufferView = [&](E_FORMAT format) -> core::smart_refctd_ptr<IGPUBufferView>
87+
{
88+
return m_driver->createGPUBufferView(m_packerDataStore.vertexBuffer.get(), format);
89+
};
90+
91+
return getDescriptorSetWritesForUTB_internal<IGPUDescriptorSet, IGPUBufferView>(outWrites, outInfo, dstSet, createBufferView, fBuffersBinding, iBuffersBinding, uBuffersBinding);
92+
}
93+
94+
uint32_t getDSlayoutBindingsForSSBO(IGPUDescriptorSetLayout::SBinding* outBindings, uint32_t uintBufferBinding = 0u, uint32_t uvec2BufferBinding = 1u, uint32_t uvec3BufferBinding = 2u, uint32_t uvec4BufferBinding = 3u) const
95+
{
96+
return getDSlayoutBindingsForSSBO_internal<IGPUDescriptorSetLayout>(outBindings, uintBufferBinding, uvec2BufferBinding, uvec3BufferBinding, uvec4BufferBinding);
97+
}
98+
99+
uint32_t getDescriptorSetWritesForSSBO(IGPUDescriptorSet::SWriteDescriptorSet* outWrites, IGPUDescriptorSet::SDescriptorInfo* outInfo, IGPUDescriptorSet* dstSet, uint32_t uintBufferBinding = 0u, uint32_t uvec2BufferBinding = 1u, uint32_t uvec3BufferBinding = 2u, uint32_t uvec4BufferBinding = 3u) const
100+
{
101+
return getDescriptorSetWritesForSSBO_internal<IGPUDescriptorSet>(outWrites, outInfo, dstSet, m_packerDataStore.vertexBuffer, uintBufferBinding, uvec2BufferBinding, uvec3BufferBinding, uvec4BufferBinding);
102+
}
103103

104-
private:
105-
video::IVideoDriver* m_driver;
104+
private:
105+
video::IVideoDriver* m_driver;
106106

107107
};
108108

include/nbl/video/video.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "nbl/video/IGPUObjectFromAssetConverter.h"
3434

3535
//VT
36+
#include "nbl/video/CGPUMeshPackerV2.h"
3637
#include "nbl/video/IGPUVirtualTexture.h"
3738

3839
#endif

0 commit comments

Comments
 (0)