upleb.uk

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

summaryrefslogtreecommitdiff
path: root/runtime/test/command_list_test.cpp
diff options
context:
space:
mode:
authorJan Trencansky <jan.trencansky@protonmail.com>2026-11-21 16:18:56 -0500
committerJan Trencansky <jan.trencansky@protonmail.com>2026-11-21 16:34:22 -0500
commitd27e4c57650ac5db8914d1cdb3cdb1ef943095d8 (patch)
treea452da9418c8548a94f744f5da9fc88e94eeb2de /runtime/test/command_list_test.cpp
parent4e390e0871d7265e629b51aca8ff99a15a6a6845 (diff)
Runtime: ResolveSubresource and multisampled textures on Vulkan
There was no resolve, and a multisampled committed texture was refused. - IR: ResolveSubresource (two different resources). - Replay: ResolveSubresource is vkCmdResolveImage in the layouts copies use: a multisampled colour subresource into a single-sampled 2D one of the same size and format. Depth-stencil resolves and resolves between two formats of a typeless family stay unsupported. ResourceBinding gains samples: a multisampled texture copies only to its own sample count and has no footprint. - Device: committed multisampled 2D textures (single-mip render targets or depth-stencils, when the GPU has the sample count for the format; the other shapes are E_INVALIDARG as in D3D12), and TEXTURE2DMS render-target and depth-stencil views. - COM: ID3D12GraphicsCommandList::ResolveSubresource. Tests: command_list_test (recording rules, and a copy with a z range); vk_command_replay_test part C (a 4x resolve and the refused resolves and multisampled copies; it also runs the volume copies that are already on main at the Vulkan level, on Linux too: a 4x4x4 volume uploaded, copied as a block and whole, read back, and the z ranges that must be refused); d3d12_vulkan_device_test (a resolve through the Xbox-ABI proxy and the refused shapes). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Diffstat (limited to 'runtime/test/command_list_test.cpp')
-rw-r--r--runtime/test/command_list_test.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/runtime/test/command_list_test.cpp b/runtime/test/command_list_test.cpp
index d4dbe855d..797ba03d5 100644
--- a/runtime/test/command_list_test.cpp
+++ b/runtime/test/command_list_test.cpp
@@ -119,12 +119,25 @@ int main() {
119 CHECK(!list.copy_texture({texture, 0, 0, 0, texture, true, {2, 2, 0, 2, 6, 1}})); // empty box 119 CHECK(!list.copy_texture({texture, 0, 0, 0, texture, true, {2, 2, 0, 2, 6, 1}})); // empty box
120 CHECK(list.copy_resource({5, 6})); 120 CHECK(list.copy_resource({5, 6}));
121 CHECK(!list.copy_resource({5, 5})); 121 CHECK(!list.copy_resource({5, 5}));
122 // A volume's box has a z range, and its footprint a depth; a resolve needs two different resources.
123 CHECK(list.copy_texture({texture, 0, 0, 2, {4, true, 0, 512, 4, 4, 4, 256}, true, {0, 0, 1, 4, 4, 3}}));
124 CHECK(!list.copy_texture({texture, 0, 0, 0, {4, true, 0, 512, 4, 4, 0, 256}, false, {}})); // no slices
125 CHECK(!list.copy_texture({texture, 0, 0, 0, texture, true, {0, 0, 2, 4, 4, 2}})); // empty in z
126 CHECK(list.resolve_subresource({7, 1, 8, 0}));
127 CHECK(!list.resolve_subresource({7, 0, 7, 0}));
128 CHECK(!list.resolve_subresource({0, 0, 8, 0}));
129 CHECK(!list.resolve_subresource({7, 0, 0, 0}));
122 CHECK(list.close()); 130 CHECK(list.close());
123 CHECK(list.commands().size() == 4); 131 CHECK(!list.resolve_subresource({7, 1, 8, 0}));
132 CHECK(list.commands().size() == 6);
124 CHECK(std::get<CopyBuffer>(list.commands()[0]).src_offset == 16); 133 CHECK(std::get<CopyBuffer>(list.commands()[0]).src_offset == 16);
125 CHECK(std::get<CopyTexture>(list.commands()[1]).src.footprint && !std::get<CopyTexture>(list.commands()[1]).has_box); 134 CHECK(std::get<CopyTexture>(list.commands()[1]).src.footprint && !std::get<CopyTexture>(list.commands()[1]).has_box);
126 CHECK(std::get<CopyTexture>(list.commands()[2]).box.right == 6); 135 CHECK(std::get<CopyTexture>(list.commands()[2]).box.right == 6);
127 CHECK(std::get<CopyResource>(list.commands()[3]).src == 6); 136 CHECK(std::get<CopyResource>(list.commands()[3]).src == 6);
137 const auto& slices = std::get<CopyTexture>(list.commands()[4]);
138 CHECK(slices.z == 2 && slices.src.depth == 4 && slices.box.front == 1 && slices.box.back == 3);
139 const auto& resolved = std::get<ResolveSubresource>(list.commands()[5]);
140 CHECK(resolved.dst == 7 && resolved.dst_subresource == 1 && resolved.src == 8 && resolved.src_subresource == 0);
128 141
129 CHECK(list.reset()); 142 CHECK(list.reset());
130 CHECK(!list.closed() && list.commands().empty()); 143 CHECK(!list.closed() && list.commands().empty());