Skip to content

Add native Tier 3 inner coverage reference probe - #3970

Closed
73N1X wants to merge 2 commits into
ItsNotRexed:mainfrom
73N1X:feat/conservative-rasterization-tier3-reference-pr
Closed

73N1X wants to merge 2 commits into
ItsNotRexed:mainfrom
73N1X:feat/conservative-rasterization-tier3-reference-pr

Conversation

@73N1X

@73N1X 73N1X commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: BUILD-1082

What and why

Adds d3d12_conservative_tier3_reference, a native D3D12 reference probe for SV_InnerCoverage. It reports the selected Vulkan device's fullyCoveredFragmentShaderInputVariable, matches it to the native D3D12 adapter by LUID, then checks the native Tier 3 output against geometric guarantees on four synthetic triangles.

This is deliberately independent of the open Tier 2 PR: it is based on main, adds no Tier 3 support or emulation to the Vulkan layer, and does not change Tier 1/2 behavior. Please run the documented command on any GPU that reports native D3D12 Tier 3. If multiple GPUs are present, pass -Device '<name substring>' to select one; post the GPU driver, Vulkan property, D3D12 tier, and test result in the PR comments. No game files are needed.

Tested

  • .\scripts\run_conservative_tier3_reference.ps1 — passed (CTest 1/1) on AMD Radeon RX 5700 XT, driver 32.0.21045.5002, Windows SDK 10.0.26100.0. Vulkan reported fullyCoveredFragmentShaderInputVariable=false; native D3D12 reported Tier 3. Four scenes, 1,166 conservative fragments, 812 guaranteed interior pixels checked; no false positives.
  • Translator tests: not applicable; no shader-translator rule changed.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table in docs/design.md, with how it was confirmed. (N/A: this PR adds no translator rule.)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@MKmajster

MKmajster commented Nov 22, 2026 •

Copy link
Copy Markdown

Tested fedc442 on a GPU with both native D3D12 Tier 3 and the Vulkan property. The RX 5700 XT in the description has fullyCoveredFragmentShaderInputVariable=false.

  • GPU: NVIDIA GeForce RTX 3070 (Ampere), driver 617.42 (32.0.16.1742), Windows 11 24H2 (26100), Windows SDK 10.0.26100 (d3d12.h 616), MSVC 19.44. Built with Ninja RelWithDebInfo instead of the script's VS generator, then ctest -R d3d12_conservative_tier3_reference -V. The script does only that, so the result should be the same.
  • Result: pass (CTest 1/1).
Vulkan adapter: NVIDIA GeForce RTX 3070; VK_EXT_conservative_rasterization=yes; fullyCoveredFragmentShaderInputVariable=true; subPixelPrecisionBits=8
Native D3D12 adapter: NVIDIA GeForce RTX 3070; ConservativeRasterizationTier=3
SV_InnerCoverage reference: 4 scenes, 1166 conservative fragments, 812 inner pixels, 812 guaranteed interior pixels checked; no false positives

NVIDIA's native SV_InnerCoverage gives 812 inner pixels against 812 guaranteed interior pixels, with no false positives. The fragment count matches the RX 5700 XT's 1,166. This is the device class where a Vulkan Tier 3 path through FullyCoveredEXT could be compared with the native answer later.

No game files. AI-assisted (Claude).

@0xTehuti 0xTehuti left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested commit fedc442 on Turing hardware (NVIDIA GeForce RTX 2070 SUPER).

Hardware & Environment

  • GPU: NVIDIA GeForce RTX 2070 SUPER (TU104, Turing, 8192 MB VRAM)
  • Driver: 595.79 (WDDM 3.2, Vulkan 1.4.304)
  • OS: Windows 11 Pro x64 (Build 26100)
  • Toolchain: MSVC 19.44.35225.0 (Visual Studio Community 2022 17.14), CMake 4.4, Windows SDK 10.0.26100.0

Capability Reports

  • Vulkan:
    • VK_EXT_conservative_rasterization: yes
    • fullyCoveredFragmentShaderInputVariable: true
    • subPixelPrecisionBits: 8
  • Native D3D12:
    • ConservativeRasterizationTier: 3 (D3D12_CONSERVATIVE_RASTERIZATION_TIER_3)

Execution Results

Built and tested via .\scripts\run_conservative_tier3_reference.ps1 -Device "2070":

UpdateCTestConfiguration  from :C:/Users/Geko/orca/workspaces/Leonida/sweeper/runtime/build/tier3-reference/DartConfiguration.tcl
Parse Config file:C:/Users/Geko/orca/workspaces/Leonida/sweeper/runtime/build/tier3-reference/DartConfiguration.tcl
Test project C:/Users/Geko/orca/workspaces/Leonida/sweeper/runtime/build/tier3-reference
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 136
    Start 136: d3d12_conservative_tier3_reference

136: Test command: C:\Users\Geko\orca\workspaces\Leonida\sweeper\runtime\build\tier3-reference\RelWithDebInfo\d3d12_conservative_tier3_reference_test.exe
136: Working Directory: C:/Users/Geko/orca/workspaces/Leonida/sweeper/runtime/build/tier3-reference
136: Test timeout computed to be: 1500
136: device: NVIDIA GeForce RTX 2070 SUPER
136: subgroup sizes: 32..32 (default 32), requirable in stages 0x3fff, subgroupSizeControl on, computeFullSubgroups on
136: Vulkan adapter: NVIDIA GeForce RTX 2070 SUPER; VK_EXT_conservative_rasterization=yes; fullyCoveredFragmentShaderInputVariable=true; subPixelPrecisionBits=8
136: Native D3D12 adapter: NVIDIA GeForce RTX 2070 SUPER; ConservativeRasterizationTier=3
136: SV_InnerCoverage reference: 4 scenes, 1166 conservative fragments, 812 inner pixels, 812 guaranteed interior pixels checked; no false positives
1/1 Test #136: d3d12_conservative_tier3_reference ...   Passed    0.54 sec

The following tests passed:
	d3d12_conservative_tier3_reference

100% tests passed out of 1

Validation note: testing under LEONIDA_VK_VALIDATION=1 correctly halts with LEONIDA_VK_VALIDATION is set but VK_LAYER_KHRONOS_validation is not installed on systems without the LunarG SDK validation layer installed, consistent with vk_test_device.h.

Code Review Findings

  • Clean-room compliance: Verified. Completely procedural synthetic geometry (4 test triangles rendered in a 32x32 viewport) and runtime HLSL compilation via d3dcompiler_47.dll. Zero game assets, carved files, or dumps.
  • Device matching: The Vulkan VkPhysicalDeviceIDProperties.deviceLUID correctly maps to the matching native host D3D12 adapter via copycmp::try_create_host(device, adapter, &luid).
  • Skip behavior: Cleanly returns CTest skip code 77 (SKIP_RETURN_CODE 77) when running under Wine, if LUID matching fails, when native Tier 3 is unsupported, or if d3dcompiler_47.dll is unavailable.
  • Coverage logic: The inner uncertainty calculation (required_margin = 1.0 / 64.0) accurately tests for zero false positives (margin = -1e-10) while verifying guaranteed inner coverage. Fragment counts (1,166) and inner pixels (812) on Turing TU104 are identical to Ampere GA104 results.

LGTM.


No game files were used. AI-assisted verification.

@Mayzkl

Mayzkl commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested on NVIDIA GeForce RTX 5060 (Blackwell, 8 GB), driver 617.14, Windows 11 (26200), VS 2022 Build Tools (MSVC 14.44), Windows SDK 10.0.26100, Vulkan SDK 1.4.363.1: pass, with the same numbers as the Ampere and Turing runs above (fullyCoveredFragmentShaderInputVariable=true, ConservativeRasterizationTier=3, 1166 conservative fragments, 812/812 guaranteed interior pixels, no false positives). What this run adds:

  • With LEONIDA_VK_VALIDATION=1 and the SDK's VK_LAYER_KHRONOS_validation installed (the case @0xTehuti couldn't run): pass, no validation errors.
  • fedc442's change itself: run_conservative_tier3_reference.ps1 with no -Device picks Vulkan's default adapter (the RTX 5060 here) and passes, CTest 1/1. Also passes at f8b4f03 with -Device "RTX 5060". Both used the script's Visual Studio generator on a Build Tools-only install.
  • Full ctest (Ninja, merged onto main aa2988c): 153/154. The one failure, d3d12_present, happened once under -j 4 and passes 5/5 on its own, both with this PR and on main. This PR doesn't touch it.

AI-assisted check (Claude Code). No game files.

@73N1X

73N1X commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor Author

Update: this follow-up is now available as draft PR #4290. Please attach supported-GPU results there so the implementation review and validation stay together.

The explicit Vulkan InnerCoverage follow-up is ready for a supported-device check: https://github.com/73N1X/Leonida/tree/feat/conservative-rasterization-tier3 at a55ba1f. It builds on #3451 and this reference probe; #3970's published head is unchanged.

Could someone with one of the confirmed fullyCoveredFragmentShaderInputVariable=true devices run the focused comparison? The RTX 2070 SUPER / 3070 / 5060 reports above are suitable candidates. Please use an isolated checkout and your usual CMake generator/Vulkan SDK configuration; glslang is required. After configuring:

cmake --build runtime/build --config RelWithDebInfo --target d3d12_conservative_tier3_test
$env:LEONIDA_VK_DEVICE='RTX 3070' # replace with your adapter substring
$env:LEONIDA_VK_VALIDATION='1'
ctest --test-dir runtime/build -C RelWithDebInfo -R '^(inner_coverage_oracle|d3d12_inner_coverage_guards|d3d12_inner_coverage_native|d3d12_conservative_tier3)$' -V

The positive test should print 48 Vulkan/native paired scenarios, not Skipped. It matches the native D3D12 adapter by LUID and independently checks required interior coverage and forbidden inner pixels on both backends, with 1x/4x MSAA, scissor and unbound-target variants. Please share GPU/driver, the property/tier line, whether that positive test ran, its final result and any validation error class/count. No game files or retail shader data are needed.

Local RX 5700 XT: full runtime build succeeded; CTest 142 passed, 9 skipped, 1 disabled, zero failures (152 registered), validation active. The CPU oracle, ABI/unsupported-device guards and all 48 native-only D3D12 scenarios pass. The positive Vulkan test correctly skips because this adapter reports the property false.

Scope remains experimental: this is an explicit caller-owned shader-library contract using synthetic GLSL FullyCoveredEXT (bool mapped to uint 0/1). Standalone devices keep the opt-in off; the Xbox FSSM/VGPR mapping for SV_InnerCoverage is still unconfirmed, and no automatic game-shader translation or complete retail Tier 3 support is claimed. InnerCoverage with conservative rasterization off is undefined in D3D12 and is not used as an oracle. No ForcedSampleCount/TIR changes.

@73N1X

73N1X commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #4290, which now includes this PR's native Tier 3 reference test, its CMake registration and the PowerShell runner. The test source and runner match this PR's head fedc442; the consolidated reference has also passed the local runtime checks.

Closing this PR to keep one active Tier 3 implementation/review thread. No code is being discarded. This discussion and its independent GPU reports remain available as historical, exact-head evidence; #4290 links back here and no longer lists #3970 as a separate merge prerequisite. #4290 still depends on #3451.

@73N1X 73N1X closed this Nov 23, 2026
ItsNotRexed added a commit that referenced this pull request Nov 23, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

4 participants