Skip to content

Commit 617401c

Browse files
vkd3d: Add input attachment mapping to pso compat hash.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
1 parent 54761b6 commit 617401c

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

libs/vkd3d/state.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,6 +1754,36 @@ HRESULT d3d12_root_signature_create_empty(struct d3d12_device *device,
17541754
return S_OK;
17551755
}
17561756

1757+
static vkd3d_shader_hash_t d3d12_root_signature_hash_input_attachments(
1758+
vkd3d_shader_hash_t hash, const D3D12_VK_INPUT_ATTACHMENT_MAPPINGS *mappings)
1759+
{
1760+
unsigned int i;
1761+
1762+
hash = hash_fnv1_iterate_u32(hash, mappings->NumRenderTargets);
1763+
hash = hash_fnv1_iterate_u32(hash, mappings->EnableDepth);
1764+
hash = hash_fnv1_iterate_u32(hash, mappings->EnableStencil);
1765+
1766+
for (i = 0; i < mappings->NumRenderTargets; i++)
1767+
{
1768+
hash = hash_fnv1_iterate_u32(hash, mappings->RenderTargets[i].RegisterSpace);
1769+
hash = hash_fnv1_iterate_u32(hash, mappings->RenderTargets[i].ShaderRegister);
1770+
}
1771+
1772+
if (mappings->EnableDepth)
1773+
{
1774+
hash = hash_fnv1_iterate_u32(hash, mappings->Depth.RegisterSpace);
1775+
hash = hash_fnv1_iterate_u32(hash, mappings->Depth.ShaderRegister);
1776+
}
1777+
1778+
if (mappings->EnableStencil)
1779+
{
1780+
hash = hash_fnv1_iterate_u32(hash, mappings->Stencil.RegisterSpace);
1781+
hash = hash_fnv1_iterate_u32(hash, mappings->Stencil.ShaderRegister);
1782+
}
1783+
1784+
return hash;
1785+
}
1786+
17571787
static HRESULT d3d12_root_signature_create_from_blob(struct d3d12_device *device,
17581788
const void *bytecode, size_t bytecode_length,
17591789
const D3D12_VK_INPUT_ATTACHMENT_MAPPINGS *mappings,
@@ -1803,6 +1833,12 @@ static HRESULT d3d12_root_signature_create_from_blob(struct d3d12_device *device
18031833
object->layout_compatibility_hash = vkd3d_root_signature_v_1_2_compute_layout_compat_hash(
18041834
&root_signature_desc.vkd3d.v_1_2);
18051835

1836+
if (mappings)
1837+
{
1838+
object->pso_compatibility_hash = d3d12_root_signature_hash_input_attachments(
1839+
object->pso_compatibility_hash, mappings);
1840+
}
1841+
18061842
/* Inline the root signature blob inside the SPIR-V. */
18071843
if (SUCCEEDED(hr) && !raw_payload &&
18081844
!(root_signature_desc.d3d12.Desc_1_2.Flags & D3D12_ROOT_SIGNATURE_FLAG_LOCAL_ROOT_SIGNATURE) &&

0 commit comments

Comments
 (0)