diff options
| author | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-24 20:53:43 -0500 |
|---|---|---|
| committer | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-24 20:53:43 -0500 |
| commit | aa23d709c908ec424b5933f305668d75cff23ea4 (patch) | |
| tree | d6aeadde792f1a0c80cdbc6cd102c572ea275cea /runtime | |
| parent | 85caf5815b3d3728f65cc1873117be2ef546bc7f (diff) | |
A sampled view of a placed texture that waits for its memory is remembered, not bound
CreateShaderResourceView asked for the image to tell a texture from a buffer. In the base that accessor binds a deferred placed image, so with prepare_on_bind the memory was bound before write_image_descriptor could remember the view, and #939's first-use path never ran (xbox_staged_texture_views, xbox_visible_texture_views). A texture that still waits for its memory is recognised without asking for the image. xbox_placed_texture_first_use expected a placed sampled texture to wait without prepare_on_bind as well; in the merge it waits only with it (the base backs every other title image when it is made), and the test says so.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Diffstat (limited to 'runtime')
| -rw-r--r-- | runtime/shims/d3d12_vulkan_device.cpp | 4 | ||||
| -rw-r--r-- | runtime/test/d3d12_m2_textured_test.cpp | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/runtime/shims/d3d12_vulkan_device.cpp b/runtime/shims/d3d12_vulkan_device.cpp index bef500d1b..8c8f4c3b4 100644 --- a/runtime/shims/d3d12_vulkan_device.cpp +++ b/runtime/shims/d3d12_vulkan_device.cpp | |||
| @@ -12451,7 +12451,9 @@ public: | |||
| 12451 | log_once("shader-resource view denied by resource flags; format", int(r->desc().Format)); | 12451 | log_once("shader-resource view denied by resource flags; format", int(r->desc().Format)); |
| 12452 | return; | 12452 | return; |
| 12453 | } | 12453 | } |
| 12454 | if (!r->descriptor_image()) { | 12454 | // A placed texture whose memory waits for its first use is a texture all the same, and asking for its image |
| 12455 | // would bind that memory here, before write_image_descriptor can remember the view (prepare_on_bind). | ||
| 12456 | if (!r->deferrable_sample() && !r->descriptor_image()) { | ||
| 12455 | if (!desc) { | 12457 | if (!desc) { |
| 12456 | log_once("buffer SRV requires a description; width", int(r->desc().Width)); | 12458 | log_once("buffer SRV requires a description; width", int(r->desc().Width)); |
| 12457 | return; | 12459 | return; |
diff --git a/runtime/test/d3d12_m2_textured_test.cpp b/runtime/test/d3d12_m2_textured_test.cpp index cce977fb4..bb8186fe5 100644 --- a/runtime/test/d3d12_m2_textured_test.cpp +++ b/runtime/test/d3d12_m2_textured_test.cpp | |||
| @@ -271,7 +271,9 @@ int main(int argc, char** argv) { | |||
| 271 | for (UINT i=0; i<2; ++i) { | 271 | for (UINT i=0; i<2; ++i) { |
| 272 | if (placed) { | 272 | if (placed) { |
| 273 | EXPECT(SUCCEEDED(at_address(placed_pages[i],texture_desc,D3D12_BARRIER_LAYOUT_COPY_DEST,&textures[i].p))); | 273 | EXPECT(SUCCEEDED(at_address(placed_pages[i],texture_desc,D3D12_BARRIER_LAYOUT_COPY_DEST,&textures[i].p))); |
| 274 | EXPECT(rt::d3d12::vulkan_memory_flags(textures[i].p) == 0); | 274 | // A placed sampled texture waits for its memory only where views are prepared at bind time |
| 275 | // (prepare_on_bind); otherwise it is backed when it is made, like every other title image. | ||
| 276 | EXPECT((rt::d3d12::vulkan_memory_flags(textures[i].p) == 0) == staged_views); | ||
| 275 | } else { | 277 | } else { |
| 276 | EXPECT(SUCCEEDED(device->CreateCommittedResource(&default_heap, D3D12_HEAP_FLAG_NONE, &texture_desc, | 278 | EXPECT(SUCCEEDED(device->CreateCommittedResource(&default_heap, D3D12_HEAP_FLAG_NONE, &texture_desc, |
| 277 | initial_state, nullptr, IID_PPV_ARGS(&textures[i].p)))); | 279 | initial_state, nullptr, IID_PPV_ARGS(&textures[i].p)))); |