@@ -923,8 +923,9 @@ class CAssetConverter : public core::IReferenceCounted
923
923
// optional, last submit (compute, transfer if no compute needed) signals these in addition to the scratch semaphore
924
924
std::span<const IQueue::SSubmitInfo::SSemaphoreInfo> extraSignalSemaphores = {};
925
925
// specific to Acceleration Structure Build, they need to be at least as large as the largest amount of scratch required for an AS build
926
- CAsyncSingleBufferSubAllocatorST<>* scratchForASBuild = nullptr ;
927
- //
926
+ CAsyncSingleBufferSubAllocatorST</* TODO: try uint64_t GP Address Allocator*/ >* scratchForDeviceASBuild = nullptr ;
927
+ std::pmr::memory_resource* scratchForHostASBuild = nullptr ;
928
+ // needs to service allocations without limit, unlike the above where failure will just force a flush and performance of already queued up builds
928
929
IDeviceMemoryAllocator* compactedASAllocator = nullptr ;
929
930
// specific to mip-map recomputation, these are okay defaults for the size of our Descriptor Indexed temporary descriptor set
930
931
uint32_t sampledImageBindingCount = 1 <<10 ;
@@ -950,12 +951,16 @@ class CAssetConverter : public core::IReferenceCounted
950
951
// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdCopyBufferToImage.html#VUID-vkCmdCopyBufferToImage-commandBuffer-07739
951
952
inline core::bitflag<IQueue::FAMILY_FLAGS> getRequiredQueueFlags () const {return m_queueFlags;}
952
953
953
- // just enough memory to build the Acceleration Structures one by one waiting for each build to complete inbetween
954
- inline uint64_t getMinASBuildScratchSize () const {return m_minASBuildScratchSize;}
955
- // enough memory to build and compact the all Acceleration Structures at once, obviously respecting order of BLAS (build->compact) -> TLAS (build->compact)
956
- inline uint64_t getMaxASBuildScratchSize () const {return m_maxASBuildScratchSize;}
957
- // if returns NONE means there are no acceleration structures to build
954
+ // This is just enough memory to build the Acceleration Structures one by one waiting for each Device Build to complete inbetween. If 0 there are no Device AS Builds or Compactions to perform.
955
+ inline uint64_t getMinASBuildScratchSize (const bool forHostOps ) const {return m_minASBuildScratchSize[forHostOps] ;}
956
+ // Enough memory to build and compact all the Acceleration Structures at once, obviously respecting order of BLAS (build->compact) -> TLAS (build->compact)
957
+ inline uint64_t getMaxASBuildScratchSize (const bool forHostOps ) const {return m_maxASBuildScratchSize[forHostOps] ;}
958
+ // What usage flags your scratch buffer must have, if returns NONE means are no Device AS Builds to perform.
958
959
inline auto getASBuildScratchUsages () const {return m_ASBuildScratchUsages;}
960
+ // tells you if you need to provide a valid `SConvertParams::scratchForHostASBuild`
961
+ inline bool willHostASBuild () const {return m_willHostBuildSomeAS;}
962
+ // tells you if you need to provide a valid `SConvertParams::compactedASAllocator`
963
+ inline bool willCompactAS () const {return m_willHostBuildSomeAS;}
959
964
960
965
//
961
966
inline operator bool () const {return bool (m_converter);}
@@ -1028,6 +1033,7 @@ class CAssetConverter : public core::IReferenceCounted
1028
1033
//
1029
1034
struct ASBuildParams
1030
1035
{
1036
+ // TODO: buildFlags
1031
1037
uint8_t host : 1 ;
1032
1038
uint8_t compact : 1 ;
1033
1039
} asBuildParams;
@@ -1044,9 +1050,12 @@ class CAssetConverter : public core::IReferenceCounted
1044
1050
core::tuple_transform_t <conversion_requests_t ,convertible_asset_types> m_conversionRequests;
1045
1051
1046
1052
//
1047
- uint64_t m_minASBuildScratchSize = 0 ;
1048
- uint64_t m_maxASBuildScratchSize = 0 ;
1053
+ uint64_t m_minASBuildScratchSize[ 2 ] = { 0 , 0 } ;
1054
+ uint64_t m_maxASBuildScratchSize[ 2 ] = { 0 , 0 } ;
1049
1055
core::bitflag<IGPUBuffer::E_USAGE_FLAGS> m_ASBuildScratchUsages = IGPUBuffer::E_USAGE_FLAGS::EUF_NONE;
1056
+ uint8_t m_willHostBuildSomeAS : 1 = false ;
1057
+ uint8_t m_willCompactSomeAS : 1 = false ;
1058
+
1050
1059
//
1051
1060
core::bitflag<IQueue::FAMILY_FLAGS> m_queueFlags = IQueue::FAMILY_FLAGS::NONE;
1052
1061
};
0 commit comments