upleb.uk

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

summaryrefslogtreecommitdiff
path: root/runtime/test/device_proxy_test.cpp
diff options
context:
space:
mode:
authorNiiRoZz <simonin.remi25@gmail.com>2026-11-23 18:14:31 +0100
committerNiiRoZz <simonin.remi25@gmail.com>2026-11-23 18:19:14 +0100
commit4a86034367eacdfca77298d89e37a5bc8545e4e5 (patch)
treee9b244373efb345f22f3ad06b738bb01481274bc /runtime/test/device_proxy_test.cpp
parent77878e31bc28ec970b9f3b30d2eceb3b1baacf80 (diff)
d3d12_xs: a console depth-stencil texture with unordered access is sized and created without it (stand-in)
The console allows ALLOW_DEPTH_STENCIL | ALLOW_UNORDERED_ACCESS on a texture; the PC runtime refuses the pair and slot 25 answered UINT64_MAX for it. pc_resource_flags drops the UAV bit from depth-stencil textures (slot 25 through pc_resource_desc, and slot 76). Their UAV views then write no descriptor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/test/device_proxy_test.cpp')
-rw-r--r--runtime/test/device_proxy_test.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/runtime/test/device_proxy_test.cpp b/runtime/test/device_proxy_test.cpp
index af0afde22..d218f4ded 100644
--- a/runtime/test/device_proxy_test.cpp
+++ b/runtime/test/device_proxy_test.cpp
@@ -227,6 +227,44 @@ int main(int argc, char** argv) {
227 const D3D12_RESOURCE_ALLOCATION_INFO pc_info = device->GetResourceAllocationInfo(0, 1, &desc); 227 const D3D12_RESOURCE_ALLOCATION_INFO pc_info = device->GetResourceAllocationInfo(0, 1, &desc);
228 check(pc_info.SizeInBytes == want.SizeInBytes && pc_info.Alignment == want.Alignment, 228 check(pc_info.SizeInBytes == want.SizeInBytes && pc_info.Alignment == want.Alignment,
229 "slot 25 still answers the PC (C++) form"); 229 "slot 25 still answers the PC (C++) form");
230
231 // A console depth-stencil texture that allows unordered access too, as a title sizes one: a 2D
232 // R32G8X24_TYPELESS texture with ALLOW_DEPTH_STENCIL | ALLOW_UNORDERED_ACCESS and the console layout word. The
233 // PC device refuses the flag pair (negative control); slot 25 sizes it as the depth-stencil texture alone.
234 D3D12_RESOURCE_DESC ds_uav{};
235 ds_uav.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
236 ds_uav.Width = 2560;
237 ds_uav.Height = 1440;
238 ds_uav.DepthOrArraySize = 1;
239 ds_uav.MipLevels = 1;
240 ds_uav.Format = DXGI_FORMAT_R32G8X24_TYPELESS;
241 ds_uav.SampleDesc.Count = 1;
242 ds_uav.Layout = static_cast<D3D12_TEXTURE_LAYOUT>(0x101);
243 ds_uav.Flags = D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL | D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
244 D3D12_RESOURCE_DESC pc_pair = ds_uav;
245 pc_pair.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN;
246 check(real->GetResourceAllocationInfo(0, 1, &pc_pair).SizeInBytes == UINT64_MAX,
247 "the PC device refuses a depth-stencil texture with unordered access (negative control)");
248 D3D12_RESOURCE_DESC ds_only = pc_pair;
249 ds_only.Flags = D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL;
250 const D3D12_RESOURCE_ALLOCATION_INFO ds_want = real->GetResourceAllocationInfo(0, 1, &ds_only);
251 check(ds_want.SizeInBytes != UINT64_MAX, "WARP sizes the depth-stencil texture without unordered access");
252 const D3D12_RESOURCE_DESC ds_clean = rt::d3d12_xs::pc_resource_desc(ds_uav);
253 check(ds_clean.Flags == D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL,
254 "pc_resource_desc drops unordered access from a depth-stencil texture");
255 D3D12_RESOURCE_DESC uav_buffer = buffer_desc();
256 uav_buffer.Flags = D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
257 D3D12_RESOURCE_DESC rt_uav = ds_only;
258 rt_uav.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
259 rt_uav.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET | D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
260 check(rt::d3d12_xs::pc_resource_desc(uav_buffer).Flags == D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS &&
261 rt::d3d12_xs::pc_resource_desc(rt_uav).Flags == rt_uav.Flags,
262 "pc_resource_desc keeps unordered access on buffers and color textures");
263 D3D12_RESOURCE_ALLOCATION_INFO ds_got{~0ull, ~0ull};
264 get_alloc_info(&ds_got, device.Get(), 0, 1, &ds_uav);
265 check(ds_got.SizeInBytes != UINT64_MAX && ds_got.SizeInBytes >= ds_want.SizeInBytes &&
266 (ds_got.SizeInBytes >> 32) == 0,
267 "slot 25 (C ABI) sizes a console depth-stencil texture with unordered access");
230 } 268 }
231 269
232 D3D12_RESOURCE_DESC reserved_desc = buffer_desc(); 270 D3D12_RESOURCE_DESC reserved_desc = buffer_desc();