Skip to content

Commit 01f8699

Browse files
Updated ComputeRenderTargetFormatsHash to return 0 hash for no render targets and DSV
1 parent 45692c0 commit 01f8699

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Graphics/GraphicsAccessories/src/GraphicsAccessories.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3004,6 +3004,9 @@ std::vector<Uint32> ResolveInputLayoutAutoOffsetsAndStrides(LayoutElement* pLayo
30043004

30053005
size_t ComputeRenderTargetFormatsHash(Uint32 NumRenderTargets, const TEXTURE_FORMAT RTVFormats[], TEXTURE_FORMAT DSVFormat)
30063006
{
3007+
if (NumRenderTargets == 0 && DSVFormat == TEX_FORMAT_UNKNOWN)
3008+
return 0;
3009+
30073010
size_t Hash = ComputeHash(NumRenderTargets);
30083011
for (Uint32 rt = 0; rt < NumRenderTargets; ++rt)
30093012
HashCombine(Hash, RTVFormats[rt]);

Tests/DiligentCoreTest/src/GraphicsAccessories/GraphicsAccessoriesTest.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1537,7 +1537,14 @@ TEST(GraphicsAccessories_GraphicsAccessories, ComputeRenderTargetFormatsHash)
15371537

15381538
auto Test = [&Hashes](Uint32 NumRenderTargets, const TEXTURE_FORMAT RTVFormats[], TEXTURE_FORMAT DepthFormat) {
15391539
size_t Hash = ComputeRenderTargetFormatsHash(NumRenderTargets, RTVFormats, DepthFormat);
1540-
EXPECT_NE(Hash, size_t{0});
1540+
if (NumRenderTargets == 0 && DepthFormat == TEX_FORMAT_UNKNOWN)
1541+
{
1542+
EXPECT_EQ(Hash, size_t{0});
1543+
}
1544+
else
1545+
{
1546+
EXPECT_NE(Hash, size_t{0});
1547+
}
15411548
EXPECT_TRUE(Hashes.insert(Hash).second);
15421549
};
15431550

0 commit comments

Comments
 (0)