diff options
Diffstat (limited to 'runtime/shims/d3d12_com.cpp')
| -rw-r--r-- | runtime/shims/d3d12_com.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/runtime/shims/d3d12_com.cpp b/runtime/shims/d3d12_com.cpp index d9b1a009c..e81788d05 100644 --- a/runtime/shims/d3d12_com.cpp +++ b/runtime/shims/d3d12_com.cpp | |||
| @@ -917,6 +917,19 @@ private: | |||
| 917 | state.layout = layout; | 917 | state.layout = layout; |
| 918 | state.data = {}; | 918 | state.data = {}; |
| 919 | if (signature && !state.layout) stub("ID3D12GraphicsCommandList::Set*RootSignature(foreign root signature)"); | 919 | if (signature && !state.layout) stub("ID3D12GraphicsCommandList::Set*RootSignature(foreign root signature)"); |
| 920 | // CreateRootSignature accepted it for the other bind point only (its log line says why). | ||
| 921 | if (layout && !(is_compute(state) ? layout->compute_ok : layout->graphics_ok)) { | ||
| 922 | stub(is_compute(state) ? "SetComputeRootSignature(signature that does not fit the compute layout)" | ||
| 923 | : "SetGraphicsRootSignature(signature that does not fit the graphics layout)"); | ||
| 924 | check(false); | ||
| 925 | } | ||
| 926 | } | ||
| 927 | |||
| 928 | bool is_compute(const RootState& state) const { return &state == &compute_; } | ||
| 929 | |||
| 930 | // The parameter's first user-data dword at this bind point (RootArgumentLayout). | ||
| 931 | std::uint32_t first_dword(const RootState& state, const RootArgumentLayout::Parameter& p) const { | ||
| 932 | return is_compute(state) ? p.compute_offset : p.user_offset; | ||
| 920 | } | 933 | } |
| 921 | 934 | ||
| 922 | // The parameter, if it exists and has the expected type; null after recording an invalid call. | 935 | // The parameter, if it exists and has the expected type; null after recording an invalid call. |
| @@ -958,7 +971,8 @@ private: | |||
| 958 | if (!p) return; | 971 | if (!p) return; |
| 959 | if (!data || std::uint64_t(offset) + count > p->constant_count) return check(false); | 972 | if (!data || std::uint64_t(offset) + count > p->constant_count) return check(false); |
| 960 | const auto* values = static_cast<const std::uint32_t*>(data); | 973 | const auto* values = static_cast<const std::uint32_t*>(data); |
| 961 | for (UINT i = 0; i < count; ++i) write(state, p->user_offset + offset + i, values[i]); | 974 | const std::uint32_t first = first_dword(state, *p); |
| 975 | for (UINT i = 0; i < count; ++i) write(state, first + offset + i, values[i]); | ||
| 962 | } | 976 | } |
| 963 | 977 | ||
| 964 | void address(RootState& state, UINT index, std::uint64_t va, rt::rootsig::ParamType type) { | 978 | void address(RootState& state, UINT index, std::uint64_t va, rt::rootsig::ParamType type) { |
| @@ -968,8 +982,11 @@ private: | |||
| 968 | return; | 982 | return; |
| 969 | const RootArgumentLayout::Parameter* p = parameter(state, index, type); | 983 | const RootArgumentLayout::Parameter* p = parameter(state, index, type); |
| 970 | if (!p) return; | 984 | if (!p) return; |
| 971 | write(state, p->user_offset, std::uint32_t(va)); | 985 | const std::uint32_t first = first_dword(state, *p); |
| 972 | write(state, p->user_offset + 1, std::uint32_t(va >> 32)); | 986 | write(state, first, std::uint32_t(va)); |
| 987 | // In the compute layout a descriptor table is one dword, the 32-bit VA of its first descriptor (the heaps | ||
| 988 | // live below 4 GiB); a root view keeps both halves. The graphics layout gives every address two dwords. | ||
| 989 | if (!(is_compute(state) && type == rt::rootsig::ParamType::Table)) write(state, first + 1, std::uint32_t(va >> 32)); | ||
| 973 | } | 990 | } |
| 974 | 991 | ||
| 975 | D3D12_COMMAND_LIST_TYPE type_; | 992 | D3D12_COMMAND_LIST_TYPE type_; |