From 9194c5300d03c3163779108d8d27c86dce6afd4b Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Fri, 17 Jan 2025 17:42:29 -0800 Subject: [PATCH] address Tex --- tools/clang/unittests/HLSL/ValidationTest.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/clang/unittests/HLSL/ValidationTest.cpp b/tools/clang/unittests/HLSL/ValidationTest.cpp index 6cac08c27a..cb2a5ce282 100644 --- a/tools/clang/unittests/HLSL/ValidationTest.cpp +++ b/tools/clang/unittests/HLSL/ValidationTest.cpp @@ -1186,7 +1186,8 @@ TEST_F(ValidationTest, ValidationFailNoHash) { return; CComPtr pProgram; - // we need any shader that will pass compilation but fail validation + // We need any shader that will pass compilation but fail validation. + // This shader reads from uninitialized 'float a', which works for now. LPCSTR pSource = R"( float main(snorm float b : B) : SV_DEPTH { @@ -1226,11 +1227,11 @@ TEST_F(ValidationTest, ValidationFailNoHash) { pProgram->GetBufferPointer(), pProgram->GetBufferSize()); VERIFY_IS_NOT_NULL(pHeader); - BYTE Result[DxilContainerHashSize] = {0, 0, 0, 0, 0, 0, 0, 0, + BYTE ZeroHash[DxilContainerHashSize] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - // ComputeHashRetail(DataToHash, AmountToHash, Result); - // Should be unequal, this proves the hash isn't written when validation fails - VERIFY_ARE_EQUAL(memcmp(Result, pHeader->Hash.Digest, sizeof(Result)), 0); + + // Should be equal, this proves the hash isn't written when validation fails + VERIFY_ARE_EQUAL(memcmp(ZeroHash, pHeader->Hash.Digest, sizeof(ZeroHash)), 0); } TEST_F(ValidationTest, UpdateCounterFail) { if (m_ver.SkipIRSensitiveTest())