Skip to content

Commit a5847ae

Browse files
rework the packer a bit to keep track of UTB formats a bit easier
1 parent 00c670c commit a5847ae

File tree

2 files changed

+186
-221
lines changed

2 files changed

+186
-221
lines changed

include/nbl/asset/utils/CCPUMeshPackerV2.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,20 +142,20 @@ uint32_t CCPUMeshPackerV2<MDIStructType>::commit(IMeshPackerBase::PackedMeshBuff
142142
deinterleaveAndCopyPerInstanceAttribute(*it, location, dstAttrPtr);
143143
}
144144

145-
auto vtxFormatInfo = m_virtualAttribConfig.map.find(attribFormat);
146-
147-
if (vtxFormatInfo == m_virtualAttribConfig.map.end())
145+
auto& utb = m_virtualAttribConfig.utbs[VirtualAttribConfig::getUTBArrayTypeFromFormat(attribFormat)];
146+
auto vtxFormatInfo = utb.find(attribFormat);
147+
if (vtxFormatInfo==utb.end())
148148
return 0u;
149149

150-
uint16_t vaArrayElement = vtxFormatInfo->second.second;
150+
uint16_t vaArrayElement = vtxFormatInfo->second;
151151
uint32_t vaOffset;
152152

153153
if (inputRate == EVIR_PER_VERTEX)
154154
vaOffset = ramb.attribAllocParams[location].offset / attribSize + verticesAddedCnt;
155155
if (inputRate == EVIR_PER_INSTANCE)
156156
vaOffset = ramb.attribAllocParams[location].offset / attribSize + instancesAddedCnt;
157157

158-
cdotOut->attribInfo[location] = VirtualAttribute(vaArrayElement, vaOffset);
158+
cdotOut->attribInfo[location] = VirtualAttribute(vaArrayElement,vaOffset);
159159

160160
}
161161

0 commit comments

Comments
 (0)