From f4fc7623c0b81dce364dcf3d227114f644f8831d Mon Sep 17 00:00:00 2001 From: TheGeogeo <57634077+TheGeogeo@users.noreply.github.com> Date: Tue, 24 Nov 2026 16:30:00 +0100 Subject: [PATCH] test: compute the indirect RT scratch size without nested std::max (TEST-INDIRECT-RT-ARENA) --- runtime/test/d3d12_indirect_rt_test.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/runtime/test/d3d12_indirect_rt_test.cpp b/runtime/test/d3d12_indirect_rt_test.cpp index 6a921d8207..f7ecfa2f50 100644 --- a/runtime/test/d3d12_indirect_rt_test.cpp +++ b/runtime/test/d3d12_indirect_rt_test.cpp @@ -10,6 +10,7 @@ #include "vulkan_loader.h" #include "../src/vulkan_device_filter.h" +#include #include #include #include @@ -818,9 +819,10 @@ int main() { } const UINT64 compact_blas_bytes = std::max(blas_compact_info.ResultDataMaxSizeInBytes, compact_vk_sizes.accelerationStructureSize); + // Not nested std::max: MSVC 19.52 at /O2 reads the inner call's result from a stack slot it never wrote. const UINT64 compact_scratch_bytes = std::max( - tlas_info.ScratchDataSizeInBytes, - std::max(blas_compact_info.ScratchDataSizeInBytes, compact_vk_sizes.buildScratchSize)); + {tlas_info.ScratchDataSizeInBytes, blas_compact_info.ScratchDataSizeInBytes, + compact_vk_sizes.buildScratchSize}); auto compact_scratch_desc = make_buf_desc(align256(compact_scratch_bytes) + 256u, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS);