Skip to content

Commit

Permalink
Updated ComputeRenderTargetFormatsHash to return 0 hash for no render…
Browse files Browse the repository at this point in the history
… targets and DSV
  • Loading branch information
TheMostDiligent committed Feb 2, 2025
1 parent 45692c0 commit 01f8699
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Graphics/GraphicsAccessories/src/GraphicsAccessories.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3004,6 +3004,9 @@ std::vector<Uint32> ResolveInputLayoutAutoOffsetsAndStrides(LayoutElement* pLayo

size_t ComputeRenderTargetFormatsHash(Uint32 NumRenderTargets, const TEXTURE_FORMAT RTVFormats[], TEXTURE_FORMAT DSVFormat)
{
if (NumRenderTargets == 0 && DSVFormat == TEX_FORMAT_UNKNOWN)
return 0;

size_t Hash = ComputeHash(NumRenderTargets);
for (Uint32 rt = 0; rt < NumRenderTargets; ++rt)
HashCombine(Hash, RTVFormats[rt]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1537,7 +1537,14 @@ TEST(GraphicsAccessories_GraphicsAccessories, ComputeRenderTargetFormatsHash)

auto Test = [&Hashes](Uint32 NumRenderTargets, const TEXTURE_FORMAT RTVFormats[], TEXTURE_FORMAT DepthFormat) {
size_t Hash = ComputeRenderTargetFormatsHash(NumRenderTargets, RTVFormats, DepthFormat);
EXPECT_NE(Hash, size_t{0});
if (NumRenderTargets == 0 && DepthFormat == TEX_FORMAT_UNKNOWN)
{
EXPECT_EQ(Hash, size_t{0});
}
else
{
EXPECT_NE(Hash, size_t{0});
}
EXPECT_TRUE(Hashes.insert(Hash).second);
};

Expand Down

0 comments on commit 01f8699

Please sign in to comment.