Skip to content

Commit bf0eb58

Browse files
committed
Rename GetUBName to GetUBOrSBName.
1 parent 2231e07 commit bf0eb58

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

Graphics/ShaderTools/src/SPIRVShaderResources.cpp

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ spv::ExecutionModel ShaderTypeToSpvExecutionModel(SHADER_TYPE ShaderType)
224224
}
225225
}
226226

227-
const std::string& GetUBName(diligent_spirv_cross::Compiler& Compiler,
227+
const std::string& GetUBOrSBName(diligent_spirv_cross::Compiler& Compiler,
228228
const diligent_spirv_cross::Resource& UB,
229229
const diligent_spirv_cross::ParsedIR::Source& IRSource)
230230
{
@@ -262,19 +262,6 @@ const std::string& GetUBName(diligent_spirv_cross::Compiler& Compi
262262
return ((IRSource.hlsl || IRSource.lang == spv::SourceLanguageSlang) && !instance_name.empty()) ? instance_name : UB.name;
263263
}
264264

265-
const std::string& GetSSBName(diligent_spirv_cross::Compiler& Compiler,
266-
const diligent_spirv_cross::Resource& SSB,
267-
const diligent_spirv_cross::ParsedIR::Source& IRSource)
268-
{
269-
//layout(std430, binding = 3) readonly buffer StructuredBuffer_world_material_t_std430_t_0 // <-- type name
270-
//{
271-
// world_material_t_std430_0 _data[];
272-
//} WorldMaterialSSBO; // <-- instance name
273-
274-
const std::string& instance_name = Compiler.get_name(SSB.id);
275-
return ((IRSource.hlsl || IRSource.lang == spv::SourceLanguageSlang) && !instance_name.empty()) ? instance_name : SSB.name;
276-
}
277-
278265
static SHADER_CODE_BASIC_TYPE SpirvBaseTypeToShaderCodeBasicType(diligent_spirv_cross::SPIRType::BaseType SpvBaseType)
279266
{
280267
switch (SpvBaseType)
@@ -433,9 +420,9 @@ SPIRVShaderResources::SPIRVShaderResources(IMemoryAllocator& Allocator,
433420

434421
size_t ResourceNamesPoolSize = 0;
435422
for (const diligent_spirv_cross::Resource& ub : resources.uniform_buffers)
436-
ResourceNamesPoolSize += GetUBName(Compiler, ub, ParsedIRSource).length() + 1;
423+
ResourceNamesPoolSize += GetUBOrSBName(Compiler, ub, ParsedIRSource).length() + 1;
437424
for (const diligent_spirv_cross::Resource& sb : resources.storage_buffers)
438-
ResourceNamesPoolSize += GetSSBName(Compiler, sb, ParsedIRSource).length() + 1;
425+
ResourceNamesPoolSize += GetUBOrSBName(Compiler, sb, ParsedIRSource).length() + 1;
439426
static_assert(Uint32{SPIRVShaderResourceAttribs::ResourceType::NumResourceTypes} == 12, "Please account for the new resource type below");
440427
for (auto* pResType :
441428
{
@@ -528,7 +515,7 @@ SPIRVShaderResources::SPIRVShaderResources(IMemoryAllocator& Allocator,
528515
Uint32 CurrUB = 0;
529516
for (const diligent_spirv_cross::Resource& UB : resources.uniform_buffers)
530517
{
531-
const std::string& name = GetUBName(Compiler, UB, ParsedIRSource);
518+
const std::string& name = GetUBOrSBName(Compiler, UB, ParsedIRSource);
532519
const diligent_spirv_cross::SPIRType& Type = Compiler.get_type(UB.type_id);
533520
const size_t Size = Compiler.get_declared_struct_size(Type);
534521
new (&GetUB(CurrUB++)) SPIRVShaderResourceAttribs //
@@ -552,7 +539,7 @@ SPIRVShaderResources::SPIRVShaderResources(IMemoryAllocator& Allocator,
552539
Uint32 CurrSB = 0;
553540
for (const diligent_spirv_cross::Resource& SB : resources.storage_buffers)
554541
{
555-
const std::string& name = GetSSBName(Compiler, SB, ParsedIRSource);
542+
const std::string& name = GetUBOrSBName(Compiler, SB, ParsedIRSource);
556543
diligent_spirv_cross::Bitset BufferFlags = Compiler.get_buffer_block_flags(SB.id);
557544
bool IsReadOnly = BufferFlags.get(spv::DecorationNonWritable);
558545

0 commit comments

Comments
 (0)