upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/shims/d3d12_com.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/shims/d3d12_com.cpp')
-rw-r--r--runtime/shims/d3d12_com.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/runtime/shims/d3d12_com.cpp b/runtime/shims/d3d12_com.cpp
index f919cc1eb..de448ddc4 100644
--- a/runtime/shims/d3d12_com.cpp
+++ b/runtime/shims/d3d12_com.cpp
@@ -1679,10 +1679,26 @@ private:
1679 return !(v && std::string_view(v) == "0"); 1679 return !(v && std::string_view(v) == "0");
1680 } 1680 }
1681 1681
1682 // Direct and indirect dispatches. Putting the resource heap first and the sampler heap next is a hypothesis
1683 // with partial evidence (docs/d3d12_vulkan.md section 3.4, tools/compute_heap_layout_census.py). A heap with no
1684 // inline user-data dword left is reported once per heap kind and the explicit arguments are kept.
1682 std::array<std::uint32_t, rt::rootsig::kMaxUserSgprs> compute_user_data() const { 1685 std::array<std::uint32_t, rt::rootsig::kMaxUserSgprs> compute_user_data() const {
1686 note_direct_heap_indexing(compute_.layout);
1683 static const bool enabled = direct_heaps_enabled("LEONIDA_COMPUTE_DIRECT_HEAPS"); 1687 static const bool enabled = direct_heaps_enabled("LEONIDA_COMPUTE_DIRECT_HEAPS");
1684 if (!enabled) return compute_.data; 1688 if (!enabled) return compute_.data;
1685 return with_direct_heaps(compute_, compute_.layout->compute_arguments_end); 1689 const RootArgumentLayout& layout = *compute_.layout;
1690 const bool resource = layout.flags & D3D12_ROOT_SIGNATURE_FLAG_CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED;
1691 const bool sampler = layout.flags & D3D12_ROOT_SIGNATURE_FLAG_SAMPLER_HEAP_DIRECTLY_INDEXED;
1692 const std::uint32_t end = layout.compute_arguments_end;
1693 if ((resource || sampler) && end == rt::rootsig::kNoSgpr) {
1694 note_once("compute direct heaps: not supplied, the root arguments spill (no measured slot)");
1695 } else {
1696 if (resource && end >= rt::rootsig::kMaxUserSgprs)
1697 note_once("compute root arguments leave no inline SGPR for the resource heap");
1698 if (sampler && end + (resource ? 1u : 0u) >= rt::rootsig::kMaxUserSgprs)
1699 note_once("compute root arguments leave no inline SGPR for the sampler heap");
1700 }
1701 return with_direct_heaps(compute_, end);
1686 } 1702 }
1687 1703
1688 // Graphics: vertex, pixel and geometry shaders share one user-data block and the s8 layout, so the heaps after 1704 // Graphics: vertex, pixel and geometry shaders share one user-data block and the s8 layout, so the heaps after
@@ -1749,7 +1765,6 @@ private:
1749 std::fputc('\n', stderr); 1765 std::fputc('\n', stderr);
1750 } 1766 }
1751 } 1767 }
1752 note_direct_heap_indexing(compute_.layout);
1753 check(list_.dispatch({compute_pipeline_, compute_user_data(), x, y, z})); 1768 check(list_.dispatch({compute_pipeline_, compute_user_data(), x, y, z}));
1754 } 1769 }
1755 1770