Skip to content

Commit ba94180

Browse files
devshkeptsecret
authored andcommitted
submit BLAS builds right away if there are TLAS builds
Also handle BLAS->TLAS failures slightly differently with more granularity and correct mark-as-failure behaviour
1 parent 7a0d080 commit ba94180

File tree

2 files changed

+322
-288
lines changed

2 files changed

+322
-288
lines changed

include/nbl/video/utilities/CAssetConverter.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,6 @@ class CAssetConverter : public core::IReferenceCounted
899899
{
900900
// By default the last to queue to touch a GPU object will own it after any transfer or compute operations are complete.
901901
// If you want to record a pipeline barrier that will release ownership to another family, override this.
902-
// The overload for the IGPUBuffer may be called with a hash belonging to a Acceleration Structure, this means that its the storage buffer backing the AS
903902
virtual inline uint32_t getFinalOwnerQueueFamily(const IGPUBuffer* buffer, const core::blake3_hash_t& createdFrom)
904903
{
905904
return IQueue::FamilyIgnored;
@@ -908,6 +907,11 @@ class CAssetConverter : public core::IReferenceCounted
908907
{
909908
return IQueue::FamilyIgnored;
910909
}
910+
// This overload only gets called on the uncompacted Acceleration Structure, this means that it also controls the ownership of the resulting compacted AS
911+
virtual inline uint32_t getFinalOwnerQueueFamily(const IGPUAccelerationStructure* image, const core::blake3_hash_t& createdFrom)
912+
{
913+
return IQueue::FamilyIgnored;
914+
}
911915
// You can choose what layout the images get transitioned to at the end of an upload
912916
// (the images that don't get uploaded to can be transitioned from UNDEFINED without needing any work here)
913917
virtual inline IGPUImage::LAYOUT getFinalLayout(const IGPUImage* image, const core::blake3_hash_t& createdFrom, const uint8_t mipLevel)
@@ -922,6 +926,11 @@ class CAssetConverter : public core::IReferenceCounted
922926
// best guess
923927
return layout_t::GENERAL;
924928
}
929+
// by default only care about 10% gains in storage
930+
virtual inline bool confirmCompact(const uint64_t newSize, const IGPUAccelerationStructure* original)
931+
{
932+
return double(newSize)/double(original->getCreationParams().bufferRange.size)<0.9;
933+
}
925934
// By default we always insert into the cache
926935
virtual inline bool writeCache(const CCacheBase::key_t& createdFrom)
927936
{
@@ -1098,8 +1107,9 @@ class CAssetConverter : public core::IReferenceCounted
10981107
{
10991108
// This is the BLAS meant to be used for the instance, note that compaction of a BLAS overwrites the initial values at the end of `reserve`
11001109
core::smart_refctd_ptr<const IGPUBottomLevelAccelerationStructure> gpuBLAS;
1110+
uint64_t buildDuringConvertCall : 1 = false;
11011111
// internal micro-refcount which lets us know when we should remove the entry from the map below
1102-
uint32_t remainingUsages = 0;
1112+
uint64_t remainingUsages : 63 = 0;
11031113
};
11041114
using cpu_to_gpu_blas_map_t = core::unordered_map<const asset::ICPUBottomLevelAccelerationStructure*,BLASUsedInTLASBuild>;
11051115
cpu_to_gpu_blas_map_t m_blasBuildMap;

0 commit comments

Comments
 (0)