File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -112,12 +112,12 @@ static vulkan_memory_t bmodel_as_device_memory;
112112static VkAccelerationStructureKHR tlas_garbage [TLAS_GARBAGE_FRAME_COUNT ];
113113static int tlas_garbage_index ;
114114
115- #define INITIAL_SCRATCH_BUFFER_SIZE_MB 8
115+ #define MIN_SCRATCH_BUFFER_SIZE_MB 8
116116
117117// Shared scratch buffer for all AS operations (bmodel BLAS build, TLAS build, animated BLAS updates)
118118dynbuffer_t as_scratch_buffer ;
119119static vulkan_memory_t as_scratch_memory ;
120- uint32_t as_scratch_buffer_size = INITIAL_SCRATCH_BUFFER_SIZE_MB * 1024 * 1024 ;
120+ uint32_t as_scratch_buffer_size ;
121121
122122/*
123123===============
@@ -126,14 +126,12 @@ R_EnsureASScratchBufferSize
126126*/
127127void R_EnsureASScratchBufferSize (uint32_t required_size )
128128{
129- if (required_size <= as_scratch_buffer_size && as_scratch_buffer . buffer != VK_NULL_HANDLE )
129+ if (required_size <= as_scratch_buffer_size )
130130 return ;
131131
132132 if (as_scratch_buffer .buffer != VK_NULL_HANDLE )
133- {
134133 R_AddDynamicBufferGarbage (as_scratch_memory , & as_scratch_buffer , 1 , NULL );
135- as_scratch_buffer_size = q_max (as_scratch_buffer_size * 2 , Q_nextPow2 (required_size ));
136- }
134+ as_scratch_buffer_size = Q_nextPow2 (q_max (required_size , MIN_SCRATCH_BUFFER_SIZE_MB * 1024 * 1024 ));
137135
138136 Sys_Printf ("Reallocating dynamic AS scratch buffer (%u KB)\n" , as_scratch_buffer_size / 1024 );
139137
You can’t perform that action at this time.
0 commit comments