Repository navigation
Conversation
…lists (19) as triangles A rectangle list is three corners; the fourth is v2 + v3 - v1 for the position and every interpolant, after the vertex stage. A quad list is four vertices per quad. Vulkan has neither. A PSO with topology type 19 was refused (E_INVALIDARG) and the two list topologies drew as a plain triangle list. Rectangle list: the PSO becomes a triangle-list pipeline with a generated geometry stage (src/rect_list_geometry.h), built from the vertex shader's own SPIR-V outputs, that emits the strip v1 v2 v3 v4. Quad list: one triangle fan per quad (0 1 2, 0 2 3), drawn with the index values 4q..4q+3 so the translated vertex id (VertexIndex - BaseVertex) is right; non-indexed draws read a shared 0, 1, 2, ... buffer reserved in the arena. Facts from xvalkyrie (GPL-3.0, commit 53af7df77c10); no code copied.
…ty Geometry, log cut-off quads (review fixes)
…at inputs use the first quad vertex, and the PSO topology type is read as raw bits Taken from the follow-up patch of @matheuskshn (930e78a2, tested by them on an RTX 4070 Ti: replay_quad_list_test fails the two non-indexed cases on a6b31d5 and passes with it). Re-run here: replay_quad_list_test and d3d12_rect_list_test exit 0 on the pod (Wine, RTX 4090).
…e told apart from float outputs on the vertex side (comment only)
…ngle (the vertex opposite the longest screen edge) instead of assuming the first; tests for the corner at the second and third vertex and for a non-right triangle
…s drawn; geometry notes edges are measured in NDC
|
I tested the indexed quad path at This follow-up to tedin7’s PR extends the triangle pattern credited to matheuskshn to GPU-resident 16- and 32-bit application indices. A single instanced draw keeps the base vertex and first instance. Out-of-view indices read zero. All eight 64 × 64 frames matched the reference after applying the patch. Five failed on this PR head. |
|
Windows test report, since this PR's CI was cancelled: head
The PR's own tests draw non-indexed quads only, so they neither confirm nor rule out the indexed-quad failure reported above. The rectangle-list path (PSO topology type 19, the four PSOs the retail boot refuses per #432) works on this Windows/NVIDIA stack. AI-assisted. |
|
Tested this on the retail boot, merged at
So the four pipelines that failed are created and the title now draws with them. The picture is still black: with AI-assisted. |
|
Check on a second NVIDIA machine (Windows 11, RTX 5070, driver 617.14, AI-assisted: yes (Claude Code, Sonnet 5.5) |
|
Regression check on Windows 10 Pro 22H2 (19045), RTX 5060 Ti (621.01), VS 2022 RelWithDebInfo, |
…xpands on the GPU (OLD-9940) An indexed quad list was one triangle fan per quad over the application's index buffer. That is wrong in two ways, both measured on ProjectLeonida#207 (RTX 4070 Ti there, RTX 4070 SUPER here): - A fan's triangles are (v1 v2 v0) and (v2 v3 v0), and Vulkan takes a flat input from a triangle's first vertex. So a quad showed its second and third vertex, never its first: a quad with a red first vertex came out black and blue, 0 of 4096 pixels red. - One draw per quad runs every instance of quad 0 before quad 1. D3D12 draws instance by instance, so where instances overlap the wrong one ended on top (2048 of 4096 pixels). Neither can be fixed inside that scheme (VK_EXT_provoking_vertex cannot name a fan's hub either), so the indices are rewritten: a compute pass (quad_index_expand.comp) reads the application's index buffer on the GPU and writes (i0 i1 i2) (i0 i2 i3) for each quad as 32-bit indices into copy scratch, and the draw is one indexed triangle list over that scratch with the application's instance count, base vertex and first instance. Both triangles start at the quad's first vertex, like the non-indexed path. - The host never reads the indices: a copy or a shader earlier in the list can have written them. The pass runs before the draw's rendering scope, between a barrier for those writes and one for its own, and between two segments of an active pipeline-statistics query, as the other helper dispatches do (D3D-162). - 16-bit and 32-bit indices, read as whole words, so a 16-bit view at an address of 2 modulo 4 works. Index values are copied as they are: VertexIndex - BaseVertex is still the application's index. - The strip-cut values are ordinary indices, as in every list topology. An index past the view reads 0, as in D3D12, and the pass reads nothing past the view. A draw's last one to three indices are dropped. - It needs bufferDeviceAddress. Without it, or inside a statistics query that cannot be split, the list is refused as unsupported. - vulkan_topology(19) is a triangle list for both paths; nothing draws a fan any more (MoltenVK has no fans). replay_quad_list_test replays indexed draws through prepare() and the real expander on a recording device: one dispatch before the rendering scope and one draw in it, the push constants for both index sizes, the view's end, the split of a draw larger than one dispatch, the refusals, and the order inside a statistics query. AI-assisted (Claude Code; Claude Opus 5.5 and Claude Fable 5.2). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SR1Fv7eQNgZjM6miWPKjHf
…ex, flat inputs, overlapping instances (d3d12_quad_index) d3d12_rect_list draws its quads without an index buffer, so it could not see what ProjectLeonida#207's review measured on indexed ones. d3d12_quad_index_test draws six 64x64 frames through DrawIndexedInstanced with IASetPrimitiveTopology(19) and compares every pixel bit for bit: 0 non-indexed control 1 16-bit indices, a quad whose corners all differ: the first vertex's colour everywhere 2 32-bit indices from StartIndexLocation 3 3 16-bit indices from StartIndexLocation 5 (an address of 2 modulo 4), BaseVertexLocation 3 4 two quads and two instances whose quads overlap: the later instance on top 5 a view that ends inside the second quad: its last two indices read 0 The index buffer is in a DEFAULT heap and filled by a copy in the first list, so only the GPU can read it. Two translated fixtures, like vs_m15 and ps_m15: vs_quad_inst.asm reads the instance id (v3) to move and recolour each later instance, ps_quad_flat.asm reads its colour with v_interp_mov, which makes the input Flat. RTX 4070 SUPER (621.24), Windows 11, LEONIDA_VK_VALIDATION=1: on the six commits of ProjectLeonida#207: frames 1, 2, 3 and 5 match in 0 of 4096 pixels (black and blue, the second and third vertex), frame 4 in 2048, frame 0 in 4096; exit 1 with the expansion: 4096 of 4096 in all six, 0 validation errors run_gpu_tests.py lists the two fixtures as run by this test, and docs/testing.md names the test (and d3d12_rect_list) among those that need llvm-mc and the SPIR-V tools. AI-assisted (Claude Code; Claude Opus 5.5 and Claude Fable 5.2). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SR1Fv7eQNgZjM6miWPKjHf
Original description (mentions and
#Nreferences are disabled; the numbers refer to the old repository):Rebased cleanly on current main; supersedes
#7448closed during org migration.What
The console's rectangle list (
IASetPrimitiveTopology(17), PSO topology type 19) and quad list (IASetPrimitiveTopology(19)) are accepted and drawn as triangles, instead of refusing the PSO (type 19,E_INVALIDARG) or silently drawing a plain triangle list. This is a 3D-rendering and PSO blocker: a PSO of type 19 fails creation today.runtime/src/rect_list_geometry.h) written from the vertex shader's own SPIR-V outputs. It emits (v1 v2 v4) (v1 v4 v3).docs/d3d12_vulkan.md, "Console rectangle and quad lists".Why
The fourth corner is a function of what the vertex stage wrote, and the translated vertex shaders fetch vertices themselves through V# loads, so a CPU or compute expansion of vertex data would be wrong for non-linear shaders. A geometry stage after the vertex stage is exact and needs only the geometryShader feature. Facts credited to the xvalkyrie backlog V8 (GPL-3.0, commit 53af7df77c10); no code copied.
Tested
Run on this base (current main, native g++ on the build host):
replay_quad_list_test(quad list is one triangle-list indexed draw, topology, index buffer, count 64): exit 0; the layer logs "a non-indexed quad list of 3 quads draws only the first 2" as designed.runtime/srcdoes not compile (quad_indices/ quad-list topology do not exist), so it fails on main and passes with the change.rect_list_geometry.hcompiles standalone with g++ -std=c++20.NOT run on this base (be aware):
d3d12_rect_list_test(the GPU test, Windows exe through Wine) and the compile ofshims/d3d12_vulkan_device.cpp. The GPU pods are off and this host has no unpacked Windows SDK; mingw headers are too old to syntax-check the Windows code. The earlier version of this PR (#7448, older base) measured on an RTX 4090 under Wine: rectangle list 4096 of 4096 pixels on the colour plane (worst error 0); quad list 4096 of 4096 bit-exact; it failed at the PSO on main ("primitive topology type not supported: 19"). The cherry-picks onto current main applied with no conflicts and the merge with the latest main is clean, but the GPU result on this base has not been reproduced. Please rund3d12_rect_listin CI/maintainer hardware before merging.