Skip to content

Commit 0144b2d

Browse files
author
devsh
committed
add missing file from last commit
1 parent 1b3a341 commit 0144b2d

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

common/include/nbl/examples/geometry/CSimpleDebugRenderer.hpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,8 @@ class CSimpleDebugRenderer final : public core::IReferenceCounted
5858
uint32_t elementCount = 0;
5959
// indices into the descriptor set
6060
constexpr static inline auto MissingView = hlsl::examples::geometry_creator_scene::SPushConstants::DescriptorCount;
61-
uint8_t positionView = MissingView;
62-
uint8_t normalView = MissingView;
63-
uint8_t uvView = MissingView;
61+
uint16_t positionView = MissingView;
62+
uint16_t normalView = MissingView;
6463
asset::E_INDEX_TYPE indexType = asset::EIT_UNKNOWN;
6564
};
6665
//
@@ -73,8 +72,7 @@ class CSimpleDebugRenderer final : public core::IReferenceCounted
7372
return {
7473
.matrices = viewParams.computeForInstance(world),
7574
.positionView = packedGeo->positionView,
76-
.normalView = packedGeo->normalView,
77-
.uvView = packedGeo->uvView
75+
.normalView = packedGeo->normalView
7876
};
7977
}
8078

@@ -247,24 +245,30 @@ class CSimpleDebugRenderer final : public core::IReferenceCounted
247245

248246
core::vector<IGPUDescriptorSet::SWriteDescriptorSet> writes;
249247
core::vector<IGPUDescriptorSet::SDescriptorInfo> infos;
248+
bool anyFailed = false;
250249
auto allocateUTB = [&](const IGeometry<const IGPUBuffer>::SDataView& view)->uint8_t
251250
{
252251
if (!view)
253252
return SPackedGeometry::MissingView;
254253
auto index = SubAllocatedDescriptorSet::invalid_value;
255254
if (m_params.subAllocDS->multi_allocate(VertexAttrubUTBDescBinding,1,&index)!=0)
255+
{
256+
anyFailed = true;
256257
return SPackedGeometry::MissingView;
257-
const auto retval = infos.size();
258+
}
259+
const auto infosOffset = infos.size();
258260
infos.emplace_back().desc = device->createBufferView(view.src,view.composed.format);
259261
writes.emplace_back() = {
260262
.dstSet = m_params.subAllocDS->getDescriptorSet(),
261263
.binding = VertexAttrubUTBDescBinding,
262264
.arrayElement = index,
263265
.count = 1,
264-
.info = reinterpret_cast<const IGPUDescriptorSet::SDescriptorInfo*>(retval)
266+
.info = reinterpret_cast<const IGPUDescriptorSet::SDescriptorInfo*>(infosOffset)
265267
};
266-
return retval;
268+
return index;
267269
};
270+
if (anyFailed)
271+
device->getLogger()->log("Failed to allocate a UTB for some geometries, probably ran out of space in Descriptor Set!",system::ILogger::ELL_ERROR);
268272

269273
auto sizeToSet = m_geoms.size();
270274
auto resetGeoms = core::makeRAIIExiter([&]()->void
@@ -309,9 +313,6 @@ class CSimpleDebugRenderer final : public core::IReferenceCounted
309313
out.elementCount = geom->getVertexReferenceCount();
310314
out.positionView = allocateUTB(geom->getPositionView());
311315
out.normalView = allocateUTB(geom->getNormalView());
312-
// the first view is usually the UV
313-
if (const auto& auxViews = geom->getAuxAttributeViews(); !auxViews.empty())
314-
out.uvView = allocateUTB(auxViews.front());
315316
}
316317

317318
// no geometry
@@ -351,7 +352,6 @@ class CSimpleDebugRenderer final : public core::IReferenceCounted
351352
auto geo = m_geoms.begin() + ix;
352353
deallocate(geo->positionView);
353354
deallocate(geo->normalView);
354-
deallocate(geo->uvView);
355355
m_geoms.erase(geo);
356356

357357
if (deferredFree.empty())

0 commit comments

Comments
 (0)