From 1b539d8907af3cc77e52e8cf4edf029964e0423a Mon Sep 17 00:00:00 2001 From: Jay Kwak <82421531+jkwak-work@users.noreply.github.com> Date: Fri, 2 May 2025 20:08:49 +0000 Subject: Fix intermittent failure of slang-unit-test-tool/ReplayRecord (#6981) * Fix intermittent failure of slang-unit-test-tool/ReplayRecord Three problems are addressed: 1. the graphics driver sometimes returns nullptr from GetShaderIdentifier 2. `findRecordFileName()` may not find any records at all. 3. the return value from cleanupRecordFiles() overwrote the error value in `res` and it returned SLANG_OK even when there were errors. * Fix compiler warnings on Windows --- tools/gfx/d3d12/d3d12-shader-table.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tools/gfx') diff --git a/tools/gfx/d3d12/d3d12-shader-table.cpp b/tools/gfx/d3d12/d3d12-shader-table.cpp index be537c737..66d63bed1 100644 --- a/tools/gfx/d3d12/d3d12-shader-table.cpp +++ b/tools/gfx/d3d12/d3d12-shader-table.cpp @@ -61,6 +61,8 @@ RefPtr ShaderTableImpl::createDeviceBuffer( if (name.getLength()) { void* shaderId = stateObjectProperties->GetShaderIdentifier(name.toWString().begin()); + if (nullptr == shaderId) + throw Exception(String("Failed to get shader identifier for '") + name + "'"); memcpy(dest, shaderId, D3D12_SHADER_IDENTIFIER_SIZE_IN_BYTES); } if (overwrite.size) -- cgit v1.2.3