Repository navigation
Conversation
…D-45) Rebased onto main after ItsNotRexed#525, which added SNORM/SINT render targets for four formats. This keeps ItsNotRexed#525's formats and adds what it leaves out: - Normalised clears round to nearest even like D3D, so 0.5 on an 8-bit channel is 128 (NVIDIA's clears write 127). The layer hands Vulkan the exact fraction; NaN is 0 and out-of-range values clamp. Covers UNORM, SNORM (scale 127 or 32767, -1.0 is -127), the alpha of the sRGB formats, R10G10B10A2_UNORM and D16_UNORM depth. - More formats: R8/R8G8/R16/R16G16/R16G16B16A16 SNORM, R8/R16 SINT, R8/R16 UINT, R16_UNORM and R16G16_UNORM, with their copy sizes; SINT and UINT of every width clamp to the component range and truncate toward zero. - d3d12_clear_formats_test: 178 cases against WARP over UNORM, SNORM, sRGB, FLOAT, UINT, SINT and the four depth formats. typeless_rtv_test now expects the rounded UNORM value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ProjectLeonida#600 mapped R8G8, R16G16 and R32G32 UINT/SINT, R16G16B16A16 UINT/SINT and R10G10B10A2_UINT, but render_target_clear_color still treats them as float formats: a ClearRenderTargetView writes the float's bits (255.0 becomes 0x437f0000). They now clamp to the component range and truncate toward zero like WARP, with per-channel limits for R10G10B10A2_UINT (10, 10, 10 and 2 bits). R8_TYPELESS, the last two-channel/one-channel TYPELESS form still refused, is mapped as R8_UNORM with the mutable-format flag. d3d12_clear_formats_test goes from 178 to 251 cases against WARP, all matching on an RTX 3060 Ti; without this change 54 differ and R8_TYPELESS is not exposed. clear_color_test checks the integer conversions on the CPU. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CreateRenderTargetView only kept the view format for R8G8B8A8_TYPELESS (UNORM, sRGB and UINT views). For every other TYPELESS resource, and for SINT and SNORM views of R8G8B8A8_TYPELESS, the format was dropped or the view was rejected. A clear through a UINT, SINT, SNORM or sRGB view then converted the colour for the class the layer creates the resource as (UNORM or float) and wrote that. Extend main's ColorViewFormat with a vulkan value. The TargetView then carries the view's VkFormat, accepted when the view is in the resource's TYPELESS family. The replay accepts it for any mutable-format resource with the same texel size and the same single-subresource limits as the RGBA8 views. d3d12_clear_formats_test gets 19 class-changing TYPELESS rows: 359 cases match WARP; without the source change 82 differ and 9 fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8bb5777 to
da1ff40
Compare
|
Tested da1ff40 merged onto main c432cdc on NVIDIA GeForce RTX 4060 Ti (Ada), driver 32.0.16.2124 (NVIDIA 621.24), Windows 11 Home 26300, MSVC 2022 / Ninja, Vulkan SDK 1.4.363: pass. Besides ctest, I ran each test program this PR changes directly (several aren't registered with ctest):
ctest: 100% tests passed, 0 tests failed out of 27. AI-assisted. |
|
Tested da1ff40 on RTX 4090 (driver 621.14), Windows 11 26200, MSVC 19.44: pass
No game files used. AI-assisted run (Claude Code). |
|
Code review at |
|
Closing as superseded by #2103 (D3D-275, "typed RTVs of every typeless color family"), now on main as c48a39d and 88215f9. It does what this PR did, for every typeless color family and for mip, array and MSAA views as well. It also covers matheuskshn's review point. Main checks the view's family ( Thanks to troythedecoyx and kotorvr for the GPU runs. AI-assisted (Claude Code). |
Claimed in #374 as: new item (D3D), the RTV's format ignored on typed views of TYPELESS resources.
Depends on #521 and #589. Their two commits (a7b9ea1, 23827fe) come first here; review the third, da1ff40. All three are rebased on main c432cdc (after #600).
What and why
Main's typed-RTV support (fbffbce) covers R8G8B8A8_TYPELESS with UNORM, sRGB and UINT views. Every other case is still wrong:
CreateRenderTargetViewdrops the view's format. A clear through a UINT, SINT, SNORM or sRGB view converts the colour for the class the layer creates the resource as (UNORM or float) and writes that.This builds on main's design instead of replacing it:
ColorViewFormat(command_list.h) gets avulkanvalue.TargetViewgets avulkan_formatfield with the view's VkFormat, and still fits the descriptor slot. The three named RGBA8 values are unchanged.CreateRenderTargetViewaccepts a typed view of a TYPELESS resource when the view's format is in the resource's TYPELESS family (newtypeless_family). It uses the same single-2D-subresource limit and color-attachment check as the RGBA8 views. A view in the resource's own format keepsColorViewFormat::resource, so those clears are unchanged.color_view_format(vulkan_replay.h) accepts avulkanview of any mutable-format resource (newResourceBinding::mutable_format) with the same texel size. From there main's code path takes over: the clear converts for the view's format and clears through a view of it, including whole-view clears.Tested
d3d12_clear_formats_test: 359 cases match WARP, with and withoutLEONIDA_VK_VALIDATION=1, and no validation errors. 19 new rows clear TYPELESS resources through UINT, SINT, SNORM, UNORM and sRGB views.d3d12_typeless_rtv_test: 13 WARP readbacks match, and 12 invalid views are rejected, with and without validation. The SINT and SNORM entries in its rejection list are now supported, so they became views from another family with the same texel size (R16G16_UINT and R32_FLOAT on R8G8B8A8_TYPELESS).typeless_rtv_test(CPU only): 32 scenarios, up from 22:vulkanUINT view of R16G16_SFLOAT and a SINT view of RGBA8, whole and rectangle;vkCmdClearColorImage;d3d12_clear_test59 andd3d12_vulkan_device_testpass.ctest: 27/27.AI-assisted (Claude Code).
Checklist
docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code