diff options
| author | evilclanker9000 <45567075+evilclanker9000@users.noreply.github.com> | 2026-11-23 22:31:56 +0100 |
|---|---|---|
| committer | evilclanker9000 <45567075+evilclanker9000@users.noreply.github.com> | 2026-11-23 22:31:56 +0100 |
| commit | 3ce953ae806909e03aefbcf6c2866e7430df851e (patch) | |
| tree | 64139ed3ddfbb843aecbcefb4a8762443dd712bb /runtime/test/command_list_test.cpp | |
| parent | 5d74c272363f2703265d44e6aaab1a1df8ddfaf3 (diff) | |
d3d12: a depth clear outside [0, 1], NaN, or with no clear flag no longer fails the list
`CommandList::clear_depth_stencil` (`runtime/src/command_list.h`) refused a `ClearDepthStencilView` whose depth was
outside [0, 1] or NaN, and one whose `D3D12_CLEAR_FLAGS` were 0, so `Close` answered `E_INVALIDARG` and the whole
`ExecuteCommandLists` submission was dropped. Windows' D3D12 closes those lists: on WARP a `D32_FLOAT` target keeps
1.5, -0.5 and NaN exactly as given, and a clear that names no plane clears nothing. `d3d12_clear_test` now reads those
back on WARP and on the layer, and `d3d12_close_parity_test` measures the four `Close` verdicts.
A title that clears depth with a computed value (or wraps the clear in a flag mask that can be 0) lost that frame's
depth clear and, with it, the whole submission's work. The call is now recorded with the depth as given (a D16 target
still quantizes at replay) or, with no plane named, recorded as nothing.
d3d12_clear_test adds three read-back comparisons (1.5/-0.5, NaN, flags 0), command_list_test asserts the accepted
calls and the stored values, and the four close-parity rows move from the known-difference table to `match`.
Diffstat (limited to 'runtime/test/command_list_test.cpp')
| -rw-r--r-- | runtime/test/command_list_test.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/runtime/test/command_list_test.cpp b/runtime/test/command_list_test.cpp index 66750dbb3..4367df6ec 100644 --- a/runtime/test/command_list_test.cpp +++ b/runtime/test/command_list_test.cpp | |||
| @@ -33,12 +33,13 @@ int main() { | |||
| 33 | CHECK(list.uav_barrier({0})); | 33 | CHECK(list.uav_barrier({0})); |
| 34 | CHECK(list.aliasing_barrier({0, 24})); | 34 | CHECK(list.aliasing_barrier({0, 24})); |
| 35 | 35 | ||
| 36 | // Depth-stencil clears: at least one flag, no unknown flags, depth in [0, 1]. | 36 | // Depth-stencil clears: no unknown flags. A clear that names no plane records nothing, and a depth outside [0, 1] |
| 37 | // is kept as given (WARP does that on a D32 target: d3d12_clear_test). | ||
| 37 | const TargetView depth{48, 0, 0, 1}; | 38 | const TargetView depth{48, 0, 0, 1}; |
| 38 | CHECK(!list.clear_depth_stencil(depth, 0, 1.0f, 0)); | 39 | CHECK(list.clear_depth_stencil(depth, 0, 1.0f, 0)); |
| 39 | CHECK(!list.clear_depth_stencil(depth, 0x4, 1.0f, 0)); | 40 | CHECK(!list.clear_depth_stencil(depth, 0x4, 1.0f, 0)); |
| 40 | CHECK(!list.clear_depth_stencil(depth, clear_depth, 1.5f, 0)); | 41 | CHECK(list.clear_depth_stencil(depth, clear_depth, 1.5f, 0)); |
| 41 | CHECK(!list.clear_depth_stencil(depth, clear_depth, -0.0001f, 0)); | 42 | CHECK(list.clear_depth_stencil(depth, clear_depth, -0.0001f, 0)); |
| 42 | CHECK(!list.clear_depth_stencil({}, clear_depth, 1.0f, 0)); | 43 | CHECK(!list.clear_depth_stencil({}, clear_depth, 1.0f, 0)); |
| 43 | CHECK(list.clear_depth_stencil(depth, clear_stencil, 7.0f, 0x5a)); // depth is ignored without clear_depth | 44 | CHECK(list.clear_depth_stencil(depth, clear_stencil, 7.0f, 0x5a)); // depth is ignored without clear_depth |
| 44 | CHECK(list.clear_depth_stencil(depth, clear_depth | clear_stencil, 0.25f, 3)); | 45 | CHECK(list.clear_depth_stencil(depth, clear_depth | clear_stencil, 0.25f, 3)); |
| @@ -51,7 +52,7 @@ int main() { | |||
| 51 | CHECK(!list.uav_barrier({0})); | 52 | CHECK(!list.uav_barrier({0})); |
| 52 | 53 | ||
| 53 | const auto commands = list.commands(); | 54 | const auto commands = list.commands(); |
| 54 | CHECK(commands.size() == 7); | 55 | CHECK(commands.size() == 9); |
| 55 | const auto* first = std::get_if<ClearRenderTarget>(&commands[0]); | 56 | const auto* first = std::get_if<ClearRenderTarget>(&commands[0]); |
| 56 | const auto* second = std::get_if<ClearRenderTarget>(&commands[1]); | 57 | const auto* second = std::get_if<ClearRenderTarget>(&commands[1]); |
| 57 | CHECK(first && second); | 58 | CHECK(first && second); |
| @@ -64,9 +65,13 @@ int main() { | |||
| 64 | CHECK(transition->before == s::render_target && transition->after == s::copy_source); | 65 | CHECK(transition->before == s::render_target && transition->after == s::copy_source); |
| 65 | CHECK(std::get_if<UavBarrier>(&commands[3]) && std::get<UavBarrier>(commands[3]).resource == 0); | 66 | CHECK(std::get_if<UavBarrier>(&commands[3]) && std::get<UavBarrier>(commands[3]).resource == 0); |
| 66 | CHECK(std::get_if<AliasingBarrier>(&commands[4]) && std::get<AliasingBarrier>(commands[4]).after == 24); | 67 | CHECK(std::get_if<AliasingBarrier>(&commands[4]) && std::get<AliasingBarrier>(commands[4]).after == 24); |
| 67 | const auto* stencil = std::get_if<ClearDepthStencil>(&commands[5]); | 68 | const auto* oversized = std::get_if<ClearDepthStencil>(&commands[5]); |
| 69 | CHECK(oversized && oversized->depth == 1.5f); | ||
| 70 | const auto* negative = std::get_if<ClearDepthStencil>(&commands[6]); | ||
| 71 | CHECK(negative && negative->depth == -0.0001f); | ||
| 72 | const auto* stencil = std::get_if<ClearDepthStencil>(&commands[7]); | ||
| 68 | CHECK(stencil && stencil->flags == clear_stencil && stencil->stencil == 0x5a); | 73 | CHECK(stencil && stencil->flags == clear_stencil && stencil->stencil == 0x5a); |
| 69 | const auto* both = std::get_if<ClearDepthStencil>(&commands[6]); | 74 | const auto* both = std::get_if<ClearDepthStencil>(&commands[8]); |
| 70 | CHECK(both && both->flags == (clear_depth | clear_stencil) && both->depth == 0.25f && both->stencil == 3); | 75 | CHECK(both && both->flags == (clear_depth | clear_stencil) && both->depth == 0.25f && both->stencil == 3); |
| 71 | 76 | ||
| 72 | // Rectangles are copied while recording. | 77 | // Rectangles are copied while recording. |