Skip to content

Commit a7a88bc

Browse files
more SPIR-V introspection fixes
1 parent 4a2da73 commit a7a88bc

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/nbl/asset/utils/CSPIRVIntrospector.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ core::smart_refctd_ptr<const CSPIRVIntrospector::CIntrospectionData> CSPIRVIntro
416416
introData->descriptorSetBindings[descSet].emplace_back();
417417

418418
SShaderResourceVariant& res = introData->descriptorSetBindings[descSet].back();
419+
res.name = r.name;
419420
res.type = restype;
420421
res.binding = _comp.get_decoration(r.id, spv::DecorationBinding);
421422

@@ -504,14 +505,12 @@ core::smart_refctd_ptr<const CSPIRVIntrospector::CIntrospectionData> CSPIRVIntro
504505
for (const spirv_cross::Resource& r : resources.uniform_buffers)
505506
{
506507
SShaderResourceVariant& res = addResource_common(r, ESRT_UNIFORM_BUFFER, mapId2SpecConst);
507-
static_cast<impl::SShaderMemoryBlock&>(res.get<ESRT_UNIFORM_BUFFER>()).name = r.name;
508-
shaderMemBlockIntrospection(_comp, static_cast<impl::SShaderMemoryBlock&>(res.get<ESRT_UNIFORM_BUFFER>()), r.base_type_id, r.id, mapId2SpecConst);
508+
shaderMemBlockIntrospection(_comp, res.get<ESRT_UNIFORM_BUFFER>(), r.base_type_id, r.id, mapId2SpecConst);
509509
}
510510
for (const spirv_cross::Resource& r : resources.storage_buffers)
511511
{
512512
SShaderResourceVariant& res = addResource_common(r, ESRT_STORAGE_BUFFER, mapId2SpecConst);
513-
static_cast<impl::SShaderMemoryBlock&>(res.get<ESRT_STORAGE_BUFFER>()).name = r.name;
514-
shaderMemBlockIntrospection(_comp, static_cast<impl::SShaderMemoryBlock&>(res.get<ESRT_STORAGE_BUFFER>()), r.base_type_id, r.id, mapId2SpecConst);
513+
shaderMemBlockIntrospection(_comp, res.get<ESRT_STORAGE_BUFFER>(), r.base_type_id, r.id, mapId2SpecConst);
515514
}
516515
for (const spirv_cross::Resource& r : resources.subpass_inputs)
517516
{
@@ -584,8 +583,8 @@ core::smart_refctd_ptr<const CSPIRVIntrospector::CIntrospectionData> CSPIRVIntro
584583
{
585584
const spirv_cross::Resource& r = resources.push_constant_buffers.front();
586585
introData->pushConstant.present = true;
587-
static_cast<impl::SShaderMemoryBlock&>(introData->pushConstant.info).name = r.name;
588-
shaderMemBlockIntrospection(_comp, static_cast<impl::SShaderMemoryBlock&>(introData->pushConstant.info), r.base_type_id, r.id, mapId2SpecConst);
586+
introData->pushConstant.name = r.name;
587+
shaderMemBlockIntrospection(_comp, introData->pushConstant.info, r.base_type_id, r.id, mapId2SpecConst);
589588
}
590589

591590
return introData;
@@ -765,16 +764,16 @@ static void deinitIntrospectionData(CSPIRVIntrospector::CIntrospectionData* _dat
765764
switch (res.type)
766765
{
767766
case ESRT_STORAGE_BUFFER:
768-
deinitShdrMemBlock(static_cast<impl::SShaderMemoryBlock&>(res.get<ESRT_STORAGE_BUFFER>()));
767+
deinitShdrMemBlock(res.get<ESRT_STORAGE_BUFFER>());
769768
break;
770769
case ESRT_UNIFORM_BUFFER:
771-
deinitShdrMemBlock(static_cast<impl::SShaderMemoryBlock&>(res.get<ESRT_UNIFORM_BUFFER>()));
770+
deinitShdrMemBlock(res.get<ESRT_UNIFORM_BUFFER>());
772771
break;
773772
default: break;
774773
}
775774
}
776775
if (_data->pushConstant.present)
777-
deinitShdrMemBlock(static_cast<impl::SShaderMemoryBlock&>(_data->pushConstant.info));
776+
deinitShdrMemBlock(_data->pushConstant.info);
778777
}
779778

780779
CSPIRVIntrospector::CIntrospectionData::~CIntrospectionData()

0 commit comments

Comments
 (0)