From 2913c076c38d28a232f54fd567e620a600dcbb7e Mon Sep 17 00:00:00 2001 From: Kelbo Date: Sun, 29 Nov 2026 17:12:11 -0500 Subject: [PATCH] pixel uav: size the view record against its own width, not the desktop struct resolve_pixel_uavs() ordered its 'described' test by sizeof(D3D12_UNORDERED_ACCESS_VIEW_DESC). The guest record is ViewRecord::uav_desc_bytes wide, so with the Agility SDK 1.620.2 header, where that struct is 48 bytes, every described pixel UAV view read as truncated and every pixel UAV draw was refused: the texture kept its previous contents and the refusals the fixture expects were never logged. --- src/startup_stubs/d3d12_draw.inl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/startup_stubs/d3d12_draw.inl b/src/startup_stubs/d3d12_draw.inl index f6e88d4e4f..cb95dbec0e 100644 --- a/src/startup_stubs/d3d12_draw.inl +++ b/src/startup_stubs/d3d12_draw.inl @@ -2839,10 +2839,15 @@ bool resolve_pixel_uavs(const Translation& tr, const Pass& pass, PixelUavBinding if (resource->own().tiled_address_srv) return refuse(i, "resource is a texture by title address", record.resource); auto* texture = static_cast(resource->own().real); D3D12_UNORDERED_ACCESS_VIEW_DESC title_view{}; - const bool described = record.desc_bytes >= sizeof(title_view); + // The guest record is ViewRecord::uav_desc_bytes wide whatever the desktop struct is. Ordering this + // by sizeof(title_view) refuses every described view when the Agility header makes that struct 48 + // bytes, because the record still carries 40 and the view reads as truncated. + constexpr std::size_t record_bytes = ViewRecord::uav_desc_bytes; + static_assert(sizeof(title_view) >= record_bytes); + const bool described = record.desc_bytes >= record_bytes; if (record.desc_bytes && !described) return refuse(i, "truncated view description", record.desc_bytes); if (described) { - std::memcpy(&title_view, record.desc, sizeof(title_view)); + std::memcpy(&title_view, record.desc, record_bytes); title_view.Format = desktop_format(title_view.Format); } const D3D12_RESOURCE_DESC desc = texture->GetDesc();