Skip to content

D3D12.X: drop conservative rasterization where the GPU has none (amd-dev port of #2038) - #2589

Closed
philip-roy-jones wants to merge 1 commit into
xcl-dev:amd-devfrom
philip-roy-jones:d3d12x-no-conservative-raster-amd-dev
Closed

philip-roy-jones wants to merge 1 commit into
xcl-dev:amd-devfrom
philip-roy-jones:d3d12x-no-conservative-raster-amd-dev

Conversation

@philip-roy-jones

Copy link
Copy Markdown
Contributor

Port of #2038 to amd-dev.

On a GPU without conservative rasterization, D3D12 refuses every graphics pipeline that asks for it. The Radeon RX 580 (AMD Polaris, feature level 12_0) reports conservative rasterization tier 0. With the debug layer on, each refusal says ID3D12Device::CreateRasterizerState: Device does not support Conservative Rasterization (pRasterizerDesc specifies D3D12_CONSERVATIVE_RASTERIZATION_MODE_ON) (id 647). The shaders do not matter. amd-dev passes ConservativeRaster through unchanged, so the translated pipeline, its stand-in and the dummy fallback are all refused.

On this RX 580, in a retail title run on amd-dev 04e0b95, the first such pipeline came at 79.2 s. It was refused in all three forms, and the process ended with 0xc0000409 about 5 s later. After the translated pipeline is refused, graphics_pso hands the title's own description, console shaders included, to the driver. Windows Error Reporting has many records of this exit for this PC's XCL builds, in amdxc64.dll 31.0.21925.1001 at offset 0x14e8d85. Keeping console bytecode out of the driver on that path is a separate change. This PR removes the refusal itself, so those pipelines are built.

XCL now reads the tier from D3D12_OPTIONS. Where the GPU has none, it turns conservative rasterization off in the graphics descriptions it makes: the translated pipeline, the stand-in and the dummy fallback. The draws of those pipelines then cover the pixels whose centres their triangles cover, not every pixel a triangle touches, so their edges can differ from the console's. Nothing changes on a GPU that reports a tier. Feature level 12_1 requires tier 1, so only feature level 12_0 GPUs such as this one take the new path.

Part of #1833. Related: #2038 (the same change for main), #303.

What is in it

  • crates/xcl/src/hle/d3d12x/real.rs: conservative_raster (the device's tier) and pc_conservative_raster, called next to pc_topology_type for the translated pipeline, the stand-in and the dummy fallback. It counts the pipelines it drops the flag on in xcl.log (the first five and every 1000th), so a run shows how many there were. D3D12.X: drop conservative rasterization where the GPU has none #2038 logs it once.
  • crates/xcl/src/hle/d3d12x/real.rs: conservative_raster_tests. An unknown device keeps the flag, and a pipeline that asks for conservative rasterization builds on the test GPU.
  • README.md: one sentence in the GPU notes.

Tested

  • Radeon RX 580 8 GB (driver 31.0.21925.1001), Ryzen 7 7700X, 32 GB, Windows 11 Pro 26200, Rust 1.100.0 MSVC, Windows SDK DXC 1.8.2502.11. Release builds of main 08db802, amd-dev bf02341 and this head e087311 (cargo build --release --locked -p xcl, each from a clean checkout into its own target directory): all exit 0, no new warnings. cargo test --locked --workspace --no-run on the head: exit 0.
  • Pending (queued on the RX 580): the whole suite on the head, the new GPU test with the drop disabled and on WARP, the paired title runs and a debug-layer run of the head. This PR stays a draft until they are in.

Regression run

  • Pending: main 08db802, amd-dev base bf02341 and this head, 300 s each, back to back.

Not tested

  • How the draws of the pipelines that asked for conservative rasterization look without it. Their output was not compared with the console's.
  • Other GPUs without the tier (other Polaris cards) and other AMD drivers. GPUs that report a tier are unaffected by construction. The focused tests cover that path on WARP.
  • Mesh and two-pass (MS / GS) pipelines: their rasterizer subobjects are passed as they are. They need mesh shaders, which this GPU does not have. A feature level 12_2 GPU has both mesh shaders and conservative rasterization.

AI use

  • Claude Code with Claude Opus 5.5 (claude-opus-5-5, reasoning effort max) wrote this port, its log change and the tests' adaptation to amd-dev, ran the builds, tests and title runs on the RX 580, wrote this description, and opened this PR on Philip's instruction. The original change and its tests (D3D12.X: drop conservative rasterization where the GPU has none #2038) were also written by Claude Code with Claude Opus 5.5. Reviewed on Philip's behalf.

🤖 Generated with Claude Code

Port of xcl-dev#2038 to amd-dev.

The RX 580 (AMD Polaris, feature level 12_0) reports conservative
rasterization tier 0, and D3D12 refuses every pipeline that asks for it,
whatever its shaders (debug layer id 647: "CreateRasterizerState: Device
does not support Conservative Rasterization"). XCL passed
ConservativeRaster through unchanged, so the translated pipeline, its
stand-in and the dummy fallback were all refused. In a retail title run
on amd-dev 04e0b95 the first such pipeline came 79 s in. After its
translated form was refused, graphics_pso handed the title's own
description, console shaders included, to the driver, and the process
ended with 0xc0000409 in amdxc64.dll about 5 s later.

XCL now asks D3D12_OPTIONS for the tier and, where the GPU has none,
turns conservative rasterization off in the descriptions it makes
(translated, stand-in, fallback), counting them in xcl.log. Those draws
then cover the pixels whose centres their triangles cover rather than
every pixel they touch, so their edges can differ from the console's.
Feature level 12_1 requires tier 1, so newer GPUs are not affected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@philip-roy-jones

Copy link
Copy Markdown
Contributor Author

Closing this: #2038 already makes this change on main, and amd-dev takes in main regularly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant