Skip to content

Commit 994fabc

Browse files
Getting blocked by google/shaderc#1205
1 parent faa29e5 commit 994fabc

File tree

4 files changed

+32
-37
lines changed

4 files changed

+32
-37
lines changed

examples_tests/22.RaytracedAO/fillVisBuffer.frag

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// This file is part of the "Nabla Engine".
33
// For conditions of distribution and use, see copyright notice in nabla.h
44
#version 430 core
5+
#extension GL_NV_fragment_shader_barycentric : require
56
#extension GL_EXT_shader_16bit_storage : require
6-
#include <nbl/builtin/glsl/barycentric/extensions.glsl>
77

88

99
#define _NBL_GLSL_EXT_MITSUBA_LOADER_INSTANCE_DATA_BINDING_ 0

include/nbl/asset/utils/CCPUMeshPackerV1.h

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,12 @@ class CCPUMeshPackerV1 final : public IMeshPacker<ICPUMeshBuffer, MDIStructType>
3232
size_t perInstanceVertexBufferMinAllocByteSize = 32ull;
3333
};
3434

35-
struct ReservedAllocationMeshBuffers
35+
struct ReservedAllocationMeshBuffers : ReservedAllocationMeshBuffersBase
3636
{
37-
uint32_t mdiAllocationOffset;
38-
uint32_t mdiAllocationReservedCnt;
3937
uint32_t instanceAllocationOffset;
4038
uint32_t instanceAllocationReservedSize;
41-
uint32_t indexAllocationOffset;
42-
uint32_t indexAllocationReservedCnt;
4339
uint32_t vertexAllocationOffset;
4440
uint32_t vertexAllocationReservedSize;
45-
46-
inline bool isValid() const
47-
{
48-
return this->mdiAllocationOffset != core::GeneralpurposeAddressAllocator<uint32_t>::invalid_address;
49-
}
5041
};
5142

5243
struct PackerDataStore : base_t::template PackerDataStoreCommon<ICPUBuffer>
@@ -78,17 +69,13 @@ class CCPUMeshPackerV1 final : public IMeshPacker<ICPUMeshBuffer, MDIStructType>
7869

7970
void free(const ReservedAllocationMeshBuffers& ramb)
8071
{
81-
if (ramb.indexAllocationOffset != INVALID_ADDRESS)
82-
m_idxBuffAlctr.free_addr(ramb.indexAllocationOffset, ramb.indexAllocationReservedCnt);
83-
84-
if (ramb.mdiAllocationOffset != INVALID_ADDRESS)
85-
m_MDIDataAlctr.free_addr(ramb.mdiAllocationOffset, ramb.mdiAllocationReservedCnt);
86-
8772
if (ramb.vertexAllocationOffset != INVALID_ADDRESS)
8873
m_vtxBuffAlctr.free_addr(ramb.vertexAllocationOffset, ramb.vertexAllocationReservedSize);
8974

9075
if (ramb.instanceAllocationOffset != INVALID_ADDRESS)
9176
m_vtxBuffAlctr.free_addr(ramb.instanceAllocationOffset, ramb.instanceAllocationReservedSize);
77+
78+
base_t::free(ramb);
9279
}
9380

9481
//needs to be called before first `commit`

include/nbl/asset/utils/IMeshPacker.h

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,19 @@ class IMeshPackerBase : public virtual core::IReferenceCounted
1616
{
1717
public:
1818
constexpr static uint32_t MAX_TRIANGLES_IN_BATCH_CNT = 21845u;
19+
20+
struct ReservedAllocationMeshBuffersBase
21+
{
22+
uint32_t mdiAllocationOffset;
23+
uint32_t mdiAllocationReservedCnt;
24+
uint32_t indexAllocationOffset;
25+
uint32_t indexAllocationReservedCnt;
1926

27+
inline bool isValid()
28+
{
29+
return this->mdiAllocationOffset!=core::GeneralpurposeAddressAllocator<uint32_t>::invalid_address;
30+
}
31+
};
2032
struct PackedMeshBufferData
2133
{
2234
uint32_t mdiParameterOffset; // add to `CCPUMeshPacker::getMultiDrawIndirectBuffer()->getPointer() to get `DrawElementsIndirectCommand_t` address
@@ -120,7 +132,18 @@ class IMeshPackerBase : public virtual core::IReferenceCounted
120132
m_vtxBuffAlctr = core::GeneralpurposeAddressAllocator<uint32_t>(alctrBuffSz, vtxAlctr, resSpcTmp);
121133
}
122134

123-
protected:
135+
void free(const ReservedAllocationMeshBuffersBase& rambb)
136+
{
137+
if (rambb.indexAllocationOffset != INVALID_ADDRESS)
138+
m_idxBuffAlctr.free_addr(rambb.indexAllocationOffset,rambb.indexAllocationReservedCnt);
139+
140+
if (rambb.mdiAllocationOffset != INVALID_ADDRESS)
141+
m_MDIDataAlctr.free_addr(rambb.mdiAllocationOffset,rambb.mdiAllocationReservedCnt);
142+
}
143+
144+
//
145+
_NBL_STATIC_INLINE_CONSTEXPR uint32_t INVALID_ADDRESS = core::GeneralpurposeAddressAllocator<uint32_t>::invalid_address;
146+
124147
core::GeneralpurposeAddressAllocator<uint32_t> m_vtxBuffAlctr;
125148
core::GeneralpurposeAddressAllocator<uint32_t> m_idxBuffAlctr;
126149
core::GeneralpurposeAddressAllocator<uint32_t> m_MDIDataAlctr;
@@ -602,8 +625,6 @@ class IMeshPacker : public IMeshPackerBase
602625
}
603626
};
604627

605-
_NBL_STATIC_INLINE_CONSTEXPR uint32_t INVALID_ADDRESS = core::GeneralpurposeAddressAllocator<uint32_t>::invalid_address;
606-
607628
};
608629

609630
}

include/nbl/asset/utils/IMeshPackerV2.h

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -293,18 +293,9 @@ class IMeshPackerV2 : public IMeshPacker<MeshBufferType,MDIStructType>, public I
293293

294294
//TODO: REDESIGN
295295
//mdi allocation offset and index allocation offset should be shared
296-
struct ReservedAllocationMeshBuffers
296+
struct ReservedAllocationMeshBuffers : ReservedAllocationMeshBuffersBase
297297
{
298-
uint32_t mdiAllocationOffset;
299-
uint32_t mdiAllocationReservedCnt;
300-
uint32_t indexAllocationOffset;
301-
uint32_t indexAllocationReservedCnt;
302298
AttribAllocParams attribAllocParams[SVertexInputParams::MAX_VERTEX_ATTRIB_COUNT];
303-
304-
inline bool isValid()
305-
{
306-
return this->mdiAllocationOffset!=core::GeneralpurposeAddressAllocator<uint32_t>::invalid_address;
307-
}
308299
};
309300
struct VirtualAttribute
310301
{
@@ -595,17 +586,13 @@ class IMeshPackerV2 : public IMeshPacker<MeshBufferType,MDIStructType>, public I
595586
{
596587
for (uint32_t i = 0u; i < meshBuffersToFreeCnt; i++)
597588
{
598-
const ReservedAllocationMeshBuffers* const ramb = rambIn + i;
589+
const ReservedAllocationMeshBuffers& ramb = rambIn[i];
599590

600-
if (ramb->indexAllocationOffset != INVALID_ADDRESS)
601-
m_idxBuffAlctr.free_addr(ramb->indexAllocationOffset, ramb->indexAllocationReservedCnt);
602-
603-
if (ramb->mdiAllocationOffset != INVALID_ADDRESS)
604-
m_MDIDataAlctr.free_addr(ramb->mdiAllocationOffset, ramb->mdiAllocationReservedCnt);
591+
base_t::free(ramb);
605592

606593
for (uint32_t j = 0; j < SVertexInputParams::MAX_VERTEX_ATTRIB_COUNT; j++)
607594
{
608-
const AttribAllocParams& attrAllocParams = ramb->attribAllocParams[j];
595+
const AttribAllocParams& attrAllocParams = ramb.attribAllocParams[j];
609596
if (attrAllocParams.offset != INVALID_ADDRESS)
610597
m_vtxBuffAlctr.free_addr(attrAllocParams.offset, attrAllocParams.size);
611598
}

0 commit comments

Comments
 (0)