Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
0192a5e
feat: record the compute root signature and descriptor tables (slots …
tedin7 Nov 24, 2026
682b0e0
feat: record compute descriptor tables (slot 35) and clear them on a …
tedin7 Nov 25, 2026
bb6b9a1
merge: keep the main-based compute root rework over the first draft
tedin7 Nov 25, 2026
033f40c
startup: record SetComputeRoot32BitConstant(s) (list slots 37, 39)
tedin7 Nov 24, 2026
9c87260
merge: sync with origin/main (keep compute tables and compute root SR…
tedin7 Nov 25, 2026
d8cc1ac
feat: record command-list slot 14 Dispatch on the desktop list
tedin7 Nov 24, 2026
48635dd
startup: refuse Dispatch under a compute root with unforwarded argume…
tedin7 Nov 25, 2026
7307c2f
startup: gate Dispatch on bound compute root SRVs and a pipeline buil…
tedin7 Nov 25, 2026
cffe8ce
startup: record SetComputeRoot32BitConstant(s) (list slots 37, 39)
tedin7 Nov 24, 2026
e0966b9
feat: record command-list slot 14 Dispatch on the desktop list
tedin7 Nov 24, 2026
f3b91dd
startup: refuse Dispatch under a compute root with unforwarded argume…
tedin7 Nov 25, 2026
c18cacb
startup: gate Dispatch on bound compute root SRVs and a pipeline buil…
tedin7 Nov 25, 2026
24c5f55
fix: pass pipeline root out-param in slot86 mesh cached pipeline build
tedin7 Nov 25, 2026
8a4df52
Merge origin/main into x2w-frontier-slot14-dispatch
tedin7 Nov 25, 2026
be1bce6
Merge branch 'pr1803' into startup/compute-dispatch-translated
NiiRoZz Nov 25, 2026
9828b5d
fix: track which compute root constant words were set; drop slot 40 c…
tedin7 Nov 25, 2026
44f0a23
Merge branch 'pr1974' into startup/compute-dispatch-translated
NiiRoZz Nov 25, 2026
2e25282
Merge branch 'pr1975' into startup/compute-dispatch-translated
NiiRoZz Nov 25, 2026
1e567a0
Dispatch translated compute programs with raw table buffers
NiiRoZz Nov 25, 2026
aca6e89
Log untranslated compute dispatches on their own line budget
NiiRoZz Nov 25, 2026
8e14a74
Count compute dispatches per key with their first refusal
NiiRoZz Nov 25, 2026
f2f7bfc
Dispatch translated compute programs that store to 2D textures
NiiRoZz Nov 25, 2026
15e8b7a
Dispatch translated compute programs that read 2D textures
NiiRoZz Nov 25, 2026
509dc53
Check a compute manifest without entry values at Dispatch
NiiRoZz Nov 25, 2026
d3c396c
Document texture views and the census of translated compute Dispatch
NiiRoZz Nov 25, 2026
70b27f2
Check the device on every 64th translated Dispatch and drop a livenes…
NiiRoZz Nov 25, 2026
d0b9e77
Compute dispatch: allow two outputs of one texture, refuse packed out…
NiiRoZz Nov 25, 2026
6e64faa
Merge branch 'main' into startup/compute-dispatch-translated
tedin7 Nov 25, 2026
771b935
Merge origin/main into pr2470
NiiRoZz Nov 25, 2026
15cdaff
Merge pr2470 (origin/main) into pr2490
NiiRoZz Nov 25, 2026
b49c738
Merge remote-tracking branch 'fork/startup/compute-dispatch-translate…
NiiRoZz Nov 25, 2026
f67f80a
Merge branch 'pr2470' into pr2490
NiiRoZz Nov 25, 2026
f5c3c85
startup: compute input named by a resource heap record a root constan…
NiiRoZz Nov 25, 2026
b6bc3c3
startup: drop a heap record control whose branch target was inside an…
NiiRoZz Nov 25, 2026
5bade3c
Merge main into the heap record branch
NiiRoZz Nov 25, 2026
7bbd141
Merge remote-tracking branch 'origin/main' into startup/compute-dispa…
NiiRoZz Nov 25, 2026
fdba779
startup: read the stage kind as the other handlers do in the heap load
NiiRoZz Nov 25, 2026
d17d262
Merge the current slot 14 Dispatch head (8a4df523)
NiiRoZz Nov 25, 2026
a205217
Merge the current root-constant store head (9828b5d8); pin the entry-…
NiiRoZz Nov 25, 2026
c821b4b
startup: avoid calling the compute driver after process termination b…
RavenCurseBurg Nov 25, 2026
67f25a9
Merge the reworked dispatch branch; a compute list transitions a samp…
NiiRoZz Nov 25, 2026
1f5fb5e
Repair a broken line in the dispatch check
NiiRoZz Nov 25, 2026
7728caf
Merge branch 'pr2470' into pr2490
NiiRoZz Nov 25, 2026
76ce41b
Pin four existing texture dispatch refusals: integer view format, man…
NiiRoZz Nov 25, 2026
1efce19
Merge the reworked dispatch and texture branches
NiiRoZz Nov 25, 2026
ba79c8b
startup: bind a compute heap record whose index is a table buffer wor…
NiiRoZz Nov 25, 2026
b306d44
Merge remote-tracking branch 'origin/main' into HEAD
NiiRoZz Nov 25, 2026
5c248dc
docs: a compute heap record whose index is read from a table buffer
NiiRoZz Nov 25, 2026
62b5ccc
docs: state the measured first refusals and the heap-record ceiling e…
NiiRoZz Nov 25, 2026
f5b0303
Drop the repeated compute root reset left by merging two slot 14 snap…
NiiRoZz Nov 25, 2026
190e00a
Merge startup/compute-dispatch-translated (f5b03039) into startup/com…
NiiRoZz Nov 25, 2026
6d64c36
Merge branch 'startup/compute-dispatch-heap-rootconst' into startup/c…
NiiRoZz Nov 25, 2026
5955e40
startup: keep the descriptor load tag when checking the index word's …
NiiRoZz Nov 25, 2026
6c1960c
startup: read the pipe's modified set tolerantly in the heap index wo…
NiiRoZz Nov 25, 2026
a1ba6fc
Merge upstream main into startup/compute-dispatch-entry-values
NiiRoZz Nov 25, 2026
51b88e0
startup: compute entry values from the words of a bound buffer descri…
NiiRoZz Nov 25, 2026
2efebc4
startup: check that compute output strides keep the swizzle bits
NiiRoZz Nov 25, 2026
5e185ab
Merge upstream main; use upstream's process-exit flag and DllMain
NiiRoZz Nov 25, 2026
63875b3
Merge commit '1991fd08a123604ae9c9ffb90de16d201214589a' into startup/…
NiiRoZz Nov 25, 2026
1991fd0
Merge commit '5e185ab7df261b7574e92eca77df063b69bb0ba5' into pr2490-fu
NiiRoZz Nov 25, 2026
356b805
Merge commit '63875b310533d5f872414130a3d4c2e839717d14' into startup/…
NiiRoZz Nov 25, 2026
121d01b
Merge commit '356b805fd38e3cb0120554bfc3612457393fc213' into startup/…
NiiRoZz Nov 25, 2026
8e393e1
Merge upstream main
NiiRoZz Nov 25, 2026
2221bd8
Merge upstream main
NiiRoZz Nov 25, 2026
8c8c579
Merge commit '2221bd8f2f60ac03a9cf09cc9620cef36eeb209a' into startup/…
NiiRoZz Nov 25, 2026
9caf8fd
Merge remote-tracking branch 'origin/main' into startup/compute-dispa…
NiiRoZz Nov 25, 2026
9d74bec
Merge branch 'startup/compute-dispatch-translated' into startup/compu…
NiiRoZz Nov 25, 2026
d756657
Merge remote-tracking branch 'fork/startup/compute-dispatch-textures'…
NiiRoZz Nov 25, 2026
8c242e3
Merge branch 'startup/compute-dispatch-heap-rootconst' into startup/c…
NiiRoZz Nov 25, 2026
cb6cd7f
Merge branch 'startup/compute-dispatch-heap-bufindex' into startup/co…
NiiRoZz Nov 25, 2026
60304f3
Merge upstream main
NiiRoZz Nov 26, 2026
aa11b13
Merge commit '60304f30' into HEAD
NiiRoZz Nov 26, 2026
550bef9
Merge commit 'aa11b13642b5020088a5d8dea3ac2cd319a61db7' into HEAD
NiiRoZz Nov 26, 2026
206749e
Merge upstream main
NiiRoZz Nov 26, 2026
d3fe030
Merge upstream main
NiiRoZz Nov 26, 2026
28c44d5
Merge upstream main
NiiRoZz Nov 26, 2026
c314f36
Merge upstream main
NiiRoZz Nov 26, 2026
b6665da
Merge upstream main
NiiRoZz Nov 26, 2026
a2affa7
merge: main into the compute entry-values branch
Nov 26, 2026
731fb23
Merge remote-tracking branch 'origin/main' into x2w-2596-merge
Nov 26, 2026
70d95a1
merge: main into the compute entry-values branch (keep both doc secti…
Nov 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4489,9 +4489,12 @@ if(EXISTS "${INTAKE_PYTHON}")
add_test(NAME startup_compute_live_retry_${adapter} COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_compute_live_retry_check.py" "$<TARGET_FILE:startup_stream_consumer>"
"${DXC_EXECUTABLE}" ${adapter})
add_test(NAME startup_compute_dispatch_entry_${adapter} COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_compute_dispatch_entry_check.py" "$<TARGET_FILE:startup_stream_consumer>"
"${DXC_EXECUTABLE}" ${adapter})
set_tests_properties(startup_compute_dispatch_${adapter} startup_compute_dispatch_texture_${adapter}
startup_compute_dispatch_heap_${adapter} startup_compute_dispatch_heap_word_${adapter}
startup_compute_live_retry_${adapter}
startup_compute_live_retry_${adapter} startup_compute_dispatch_entry_${adapter}
PROPERTIES TIMEOUT 120 SKIP_RETURN_CODE 77)
endforeach()
add_test(NAME startup_stream_adapter_filter COMMAND "${INTAKE_PYTHON}" -B
Expand Down
14 changes: 13 additions & 1 deletion docs/experiments.md
Original file line number Diff line number Diff line change
Expand Up @@ -16640,7 +16640,7 @@ the field layouts rather than assembled.

## Translated compute Dispatch

With a device slot 67 placeholder bound, command-list slot 14 looks up the translation of the pipeline's published request (`<key>.txt` with `stage cs`, and `<key>.cs.cso`) and records it on the desktop list. It binds, from the compute descriptor tables of slot 35: raw buffers named by 16-byte hardware buffer descriptors, and 2D textures named by the token of a view the caller created (device slot 18 for an input, slot 19 for an output the program stores `float4` to). `smp` manifest lines become static samplers, and entry values come from the compute root constants of slots 37 and 39. A buffer input must resolve to a complete GPU-backed range; a buffer output must be a placed buffer that aliases the caller's memory and allows unordered access; a texture view must be 2D, created on the desktop, and for an output have a float or normalized format that is not packed, on a texture that is not also an input of the call. Any other manifest line (other texture kinds, sampler heaps, comparison samplers, root views, `stride` and `descword3` entry values) leaves the pipeline untranslated, and a Dispatch that cannot be bound completely is refused with one logged reason: no Dispatch is recorded and nothing is bound (the upload of an input texture the caller filled in memory may already be recorded; it only syncs content). No view is ever bound null. The entry values live in the compute root-constant store of #1975: a word no slot 37 or 39 call wrote since the compute root was set (slot 33 with another root, or a list reset) has no value and is refused with `an entry value was not set since the compute root`; setting the same root again keeps the words, and the graphics words of slot 40 are separate.
With a device slot 67 placeholder bound, command-list slot 14 looks up the translation of the pipeline's published request (`<key>.txt` with `stage cs`, and `<key>.cs.cso`) and records it on the desktop list. It binds, from the compute descriptor tables of slot 35: raw buffers named by 16-byte hardware buffer descriptors, and 2D textures named by the token of a view the caller created (device slot 18 for an input, slot 19 for an output the program stores `float4` to). `smp` manifest lines become static samplers, and entry values come from the compute root constants of slots 37 and 39. A buffer input must resolve to a complete GPU-backed range; a buffer output must be a placed buffer that aliases the caller's memory and allows unordered access; a texture view must be 2D, created on the desktop, and for an output have a float or normalized format that is not packed, on a texture that is not also an input of the call. Any other manifest line (other texture kinds, sampler heaps, comparison samplers, root views, entry values that are neither a root constant nor a buffer descriptor word) leaves the pipeline untranslated, and a Dispatch that cannot be bound completely is refused with one logged reason: no Dispatch is recorded and nothing is bound (the upload of an input texture the caller filled in memory may already be recorded; it only syncs content). No view is ever bound null. The entry values live in the compute root-constant store of #1975: a word no slot 37 or 39 call wrote since the compute root was set (slot 33 with another root, or a list reset) has no value and is refused with `an entry value was not set since the compute root`; setting the same root again keeps the words, and the graphics words of slot 40 are separate.

`tests/startup_compute_dispatch_check.py` drives a source-built gfx1013 program through the stand-in's list on WARP and on a physical adapter (exit 77 without one) and reads the 320 output words back from the aliased memory. Controls in the same run: before the offline translation, without a Dispatch, and with the two descriptors exchanged, every output word must keep its sentinel. The two entry values arrive through slot 37 and slot 39, with other values written through slot 40 in between; `dispatch-same-root` must still give the expected words, and five refused modes must log their reason and keep the sentinels: a missing word, another compute root set and the first set again, a list reset, a compute root that is not the pipeline's, and one buffer named as input and output. `tests/startup_compute_dispatch_texture_check.py` does the same for a program that stores to a 32x8 RGBA16_FLOAT texture (1024 halves read back through CopyTextureRegion; controls: before translation, without a Dispatch, a texture without unordered access) and for the raw buffer program with a level-zero sample of a 1x1 texture XORed into each stored word (control: no view at the table entry). The texture output program is also bound under a manifest edited to declare no entry values.

Expand All @@ -16660,6 +16660,18 @@ cmake --build --preset dev --target startup_stream_consumer
ctest --preset dev --no-tests=error -R "^startup_compute_dispatch_" -V
```

### Entry values from a buffer descriptor

A formatted buffer load passes the input's stride and word 3 as entry values (`udsrc <i> stride <srv>`, `udsrc <i> descword3 <srv>`), and a formatted buffer store (`buffer_store_format_d16_x`, and `buffer_store_format_xyzw` of #2530) passes the output's word 3, the upper half of word 1 and the record count (`uav_descword3`, `uav_stride`, `uav_numrecords`). At Dispatch the stand-in takes each from the descriptor words the same call binds the view from: the stride as the draw path takes it (from the hardware descriptor, or from the title's buffer view for a token), word 3 through the draw path's formatted-buffer check (a token's word is built from its view; a FORMAT the program does not decode refuses the dispatch with `a formatted input has no word 3 the program decodes`), and the output words unmasked, since the store helper checks the swizzle bits itself. A descriptor that is not bound refuses the dispatch as before; an entry value naming a texture slot leaves the pipeline untranslated, and so does any other source.

`tests/startup_compute_dispatch_entry_check.py` dispatches two source-built programs on WARP and on a physical adapter (exit 77 without one) and reads the 320 output words back: the formatted load of `startup_gfx2hlsl_compute_check.py` with two word-3 values on one translation, and the `buffer_store_format_d16_x` program of `startup_compute_store_d16_x_check.py` with four output descriptors (two formats, another stride and record count, and SWIZZLE_ENABLE set in word 1, for which the translated program stores nothing). A FORMAT the program does not decode is refused with every output word at its sentinel. Returning a constant output stride and record count in the runtime, or masking the stride to 14 bits as the draw path does, makes a store run fail. The record count cannot be checked apart from the bound range, which is sized from the same word.

Measured on two synthetic programs. In a local set of 29 compute programs whose first refusal was this manifest line (about 1.4 million calls in one run), 27 now pass the manifest (about 1.39 million calls; 17 of them, about 0.6 million calls, use the store of #2530) and 2 stop at a 1D or 3D texture input. Every formatted store in the 27 passes a zero `soffset`: a nonzero one in structured mode can store past `stride * records` bytes, outside the bound range, and is not checked here. Which bind-time reason the 27 meet next has not been measured.

```powershell
ctest --preset dev --no-tests=error -R "^startup_compute_dispatch_entry_" -V
```

### Static samplers with a LOD clamp

The translator writes a constant sampler of `image_sample`, `_l` or `_lz` whose mip filter is not 0 as an `smpl` line (#2482): a static sampler whose MinLOD and MaxLOD come from the descriptor's word 1. The compute Dispatch now reads `smpl` lines as the draw path does, through the same `TranslatedSamplers::read_manifest_line` and `create_translated_root`; the only difference for compute is that the root signature is set with `SetComputeRootSignature`, and static samplers need nothing else. A comparison sampler (`smpc`) and the run-time sampler heap table (`smpheap`) are still refused, as "a comparison sampler" and "a sampler from the sampler heap". Binding the heap table for compute would need the draw path's sampler snapshot (`snapshot_samplers`, `create_sampler_snapshot_heap`) taken from the compute root's sampler heap pointer, the sampler heap set with `SetDescriptorHeaps` and its table set with `SetComputeRootDescriptorTable`.
Expand Down
59 changes: 53 additions & 6 deletions src/startup_stubs/d3d12_compute_dispatch.inl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
// inputs, `uav <i> table <param> <byte>` outputs) named by hardware buffer descriptors, and 2D textures
// (`srv <i> tex2d table <param> <byte>` inputs, `uav <i> tex2d float table <param> <byte> channels 4` outputs) named
// by the token of a view the title created (device slots 18 and 19). `smp` lines become static samplers. Entry
// values come from the compute root constants of slots 37 and 39. Any other manifest line makes the translation
// values come from the compute root constants of slots 37 and 39, or from the descriptor a buffer input or output is
// bound from: its stride and word 3 (`stride`, `descword3`), and word 3, the upper half of word 1 and the record
// count of an output (`uav_descword3`, `uav_stride`, `uav_numrecords`). Any other manifest line makes the translation
// unavailable; a dispatch that cannot be bound completely is refused with one reason and records no Dispatch and
// binds nothing (the upload of an input texture the title filled in memory may already be recorded: it only
// syncs content).
Expand All @@ -13,12 +15,14 @@ struct ComputeTranslation {
// Root parameter and byte offset (views), or parameter and word (entry values). A heap view names the root
// constant (parameter and word) that indexes its 32-byte record in the list's view heap, or, with word_param
// set, the table buffer (word_param, word_byte) whose word at byte at + root constant (a, b) * times (a < 0:
// at alone) is the index.
// at alone) is the index. An entry value that is not a root constant names input or output a by its source.
enum Source { root_constant, input_stride, input_word3, output_word3, output_stride, output_records };
struct Slot {
int a, b;
bool texture, heap;
int word_param = -1, word_byte = 0;
std::uint32_t at = 0, times = 0;
Source source = root_constant;
};
u64 key = 0;
int state = 0; // 0 not loaded, 1 ready, 2 unavailable
Expand Down Expand Up @@ -89,11 +93,22 @@ const char* load_compute_translation(ComputeTranslation& tr)
}
unsigned i = 0, x = 0, y = 0, z = 0, w = 0;
int a = 0, b = 0, c = 0, d = 0, used = 0;
char name[16] = "";
const auto whole = [&] { return used == static_cast<int>(line.size()); };
// The manifest names of the Source values after root_constant, in their order.
const auto source = [&] {
static const char* const names[] = {"stride", "descword3", "uav_descword3", "uav_stride", "uav_numrecords"};
for (int s = 0; s < 5; ++s)
if (!std::strcmp(name, names[s])) return static_cast<ComputeTranslation::Source>(s + 1);
return ComputeTranslation::root_constant;
};
if (line.empty() || (std::sscanf(line.c_str(), "group %u %u %u%n", &x, &y, &z, &used) == 3 && whole())) continue;
if (std::sscanf(line.c_str(), "ud %u%n", &declared_uds, &used) == 1 && whole()) continue;
if (std::sscanf(line.c_str(), "udsrc %u rootconst %d %d%n", &i, &a, &b, &used) == 3 && whole() && i == tr.uds.size())
tr.uds.push_back({a, b});
else if (std::sscanf(line.c_str(), "udsrc %u %15s %d%n", &i, name, &a, &used) == 3 && whole() && i == tr.uds.size() &&
source() != ComputeTranslation::root_constant)
tr.uds.push_back({a, 0, false, false, -1, 0, 0, 0, source()});
else if (std::sscanf(line.c_str(), "srv %u buf table %d %d%n", &i, &a, &b, &used) == 3 && whole() && i == tr.srvs.size())
tr.srvs.push_back({a, b});
else if (std::sscanf(line.c_str(), "srv %u buf heap rootconst %d %d%n", &i, &a, &b, &used) == 3 && whole() &&
Expand Down Expand Up @@ -122,11 +137,17 @@ const char* load_compute_translation(ComputeTranslation& tr)
tr.samplers.read_manifest_line(line.c_str());
else return line.rfind("srv", 0) == 0 ? "a resource that is not a raw table buffer or a 2D texture"
: line.rfind("uav", 0) == 0 ? "an output that is not a raw table buffer or a 2D float texture"
: line.rfind("udsrc", 0) == 0 ? "an entry value that is not a root constant"
: line.rfind("udsrc", 0) == 0 ? "an entry value that is not a root constant or a buffer descriptor word"
: line.rfind("smp", 0) == 0 ? "a sampler that is not a plain static one" : "an unknown manifest line";
}
if (tr.uds.size() != declared_uds || tr.uds.size() > 32 || tr.srvs.size() > 32 || tr.uavs.size() > 8)
return "entry value, input or output count";
for (const ComputeTranslation::Slot& ud : tr.uds) {
const auto& slots = ud.source >= ComputeTranslation::output_word3 ? tr.uavs : tr.srvs;
if (ud.source != ComputeTranslation::root_constant &&
(ud.a < 0 || static_cast<std::size_t>(ud.a) >= slots.size() || slots[ud.a].texture))
return "an entry value names a descriptor that is not a buffer input or output";
}
x2w_startup::ComPtr<ID3DBlob> code;
if (!cache_path(path, L"", tr.key, L".cs.cso") || FAILED(D3DReadFileToBlob(path, &code))) return "no compiled program";
// Parameter 0 keeps one constant for a program without entry values: a constants parameter cannot be empty.
Expand Down Expand Up @@ -160,6 +181,8 @@ bool dispatch_translated(Wrapper* self, UINT x, UINT y, UINT z)
bool transition, texture, described;
unsigned char desc[40]; // a texture view's description, as the title gave it with a desktop format
Wrapper* wrapper;
std::uint32_t words[4]; // a buffer's descriptor words as it was bound from, and its stride
UINT stride;
} views[40]{};
static_assert(sizeof(D3D12_SHADER_RESOURCE_VIEW_DESC) == 40 && sizeof(D3D12_UNORDERED_ACCESS_VIEW_DESC) == 40);
const auto type = list->GetType();
Expand Down Expand Up @@ -187,7 +210,8 @@ bool dispatch_translated(Wrapper* self, UINT x, UINT y, UINT z)
}
// A word no slot 37 or 39 call wrote since the compute root was set has no value to pass (it is not 0).
for (std::size_t i = 0; !reason && i < tr->uds.size(); ++i)
if (!pass.compute_constants.is_bound(tr->uds[i].a, tr->uds[i].b, 1)) reason = "an entry value was not set since the compute root";
if (tr->uds[i].source == ComputeTranslation::root_constant && !pass.compute_constants.is_bound(tr->uds[i].a, tr->uds[i].b, 1))
reason = "an entry value was not set since the compute root";
const std::size_t inputs = reason ? 0 : tr->srvs.size(), count = reason ? 0 : inputs + tr->uavs.size();
for (std::size_t i = 0; i < count && !reason; ++i) {
const bool output = i >= inputs;
Expand Down Expand Up @@ -290,6 +314,8 @@ bool dispatch_translated(Wrapper* self, UINT x, UINT y, UINT z)
const IndirectBufferView view = indirect_table_buffer(self, words);
if (!view.resource || view.offset % D3D12_RAW_UAV_SRV_BYTE_ALIGNMENT) reason = "an input is not a complete GPU-backed buffer range";
views[i] = {view.resource, view.offset, view.bytes, !view.upload};
views[i].stride = view.stride;
std::memcpy(views[i].words, words, sizeof(views[i].words));
continue;
}
// An output is written by the GPU: only a placed buffer that aliases the title's memory shows the result
Expand All @@ -307,6 +333,29 @@ bool dispatch_translated(Wrapper* self, UINT x, UINT y, UINT z)
for (std::size_t input = 0; input < inputs && !reason; ++input)
if (views[input].resource == placed.alias) reason = "an output buffer is also an input";
views[i] = {placed.alias, offset, bytes, true};
std::memcpy(views[i].words, words, sizeof(views[i].words));
}
// An entry value from a descriptor comes from the words its view was bound from in the loop above.
std::uint32_t values[32] = {};
for (std::size_t i = 0; !reason && i < tr->uds.size(); ++i) {
const ComputeTranslation::Slot& ud = tr->uds[i];
const View& view = views[ud.source >= ComputeTranslation::output_word3 ? inputs + ud.a : ud.a];
std::uint32_t format = 0, word[4];
switch (ud.source) {
case ComputeTranslation::root_constant: values[i] = pass.compute_constants.word(ud.a, ud.b); break;
case ComputeTranslation::input_stride: values[i] = view.stride; break;
case ComputeTranslation::input_word3:
std::memcpy(word, view.words, sizeof(word));
if (formatted_buffer_word3(word, format)) {
reason = "a formatted input has no word 3 the program decodes";
std::memcpy(words, view.words, sizeof(view.words));
}
values[i] = word[3];
break;
case ComputeTranslation::output_word3: values[i] = view.words[3]; break;
case ComputeTranslation::output_stride: values[i] = view.words[1] >> 16; break; // unmasked: the program checks the swizzle bits
case ComputeTranslation::output_records: values[i] = view.words[2]; break;
}
}
// A texture the title filled in memory is brought up to date first. An upload recorded before a later one
// fails only syncs content, as a draw sampling that texture would.
Expand Down Expand Up @@ -363,8 +412,6 @@ bool dispatch_translated(Wrapper* self, UINT x, UINT y, UINT z)
desc.Buffer.Flags = D3D12_BUFFER_UAV_FLAG_RAW;
device_of(the_device)->CreateUnorderedAccessView(view.resource, nullptr, &desc, dest);
}
std::uint32_t values[32] = {};
for (std::size_t i = 0; i < tr->uds.size(); ++i) values[i] = pass.compute_constants.word(tr->uds[i].a, tr->uds[i].b);
if (!pass.heap_set) {
x2w_startup::bind_translated_heaps(list, draw_heap, nullptr);
pass.heap_set = true;
Expand Down
Loading
Loading