Repository navigation
runtime/d3d12: implement ForcedSampleCount target-independent rasterization - #7205
Taffyyy-ops wants to merge 2 commits into
Conversation
|
Independent Windows / RTX 3070 check of 0764909: pass with Khronos core and synchronization validation active. Built the exact published head in a clean isolated checkout, with no merges or source edits. Windows 11 build 26200, NVIDIA GeForce RTX 3070 / driver 610.88, MSVC 19.44.35230 (toolset 14.44.35207), Windows SDK 10.0.26100.0, Vulkan SDK / validation layers 1.4.363.0, Ninja RelWithDebInfo.
The stock test completed its 25 PSO cases, 18 attachmentless occlusion scenes, mixed-sample color/coverage/MRT comparisons, unbound-RTV and conservative cases, capability gating, and all six PSO-switching steps. Both native RTX 3070 D3D12 and WARP references ran. Standalone creation reported One validation warning appeared during the intentional unbound-RTV draw: the fragment shader writes Location 0 while Commands, from an x64 MSVC shell: cmake -S runtime -B runtime/build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build runtime/build --target d3d12_forced_sample_count_test vk_sync_validation_selftest -j 6
$env:LEONIDA_VK_DEVICE = 'NVIDIA'
$env:VK_LAYER_PATH = "$env:VULKAN_SDK/Bin"
$env:VK_LOADER_LAYERS_DISABLE = '~implicit~'
$env:DISABLE_RTSS_LAYER = '1'
$env:DISABLE_VULKAN_OBS_CAPTURE = '1'
$env:LEONIDA_VK_VALIDATION = '0'
ctest --test-dir runtime/build -C RelWithDebInfo -R '^d3d12_forced_sample_count$' -V --timeout 120
$env:LEONIDA_VK_VALIDATION = '1'
ctest --test-dir runtime/build -C RelWithDebInfo -R '^vk_sync_validation$' -V --timeout 120
ctest --test-dir runtime/build -C RelWithDebInfo -R '^d3d12_forced_sample_count$' -V --timeout 120Targeted validation only; the full runtime suite was not run for this PR. Synthetic fixtures only, no game files. AI-assisted (OpenAI Codex). Claim: #7049 (comment) |
|
AI-assisted independent Windows review of Attachmentless results also depend on the reference. On Radeon at 4×, mask |
|
Independent Windows GPU check at 0764909 on RTX 3060 12 GB, NVIDIA 621.14, clang-cl/xwin. d3d12_forced_sample_count passed, including all six steps of the multi-submission PSO switching sequence. AI-assisted testing. |
|
Tested On this driver the layer counts about half of WARP's occlusion samples in those Forced=4 and Forced=8 scenes. The layer also logs AI-assisted (Claude Code), no game files. |
|
Tested 0764909 on NVIDIA GeForce RTX 5070 Ti, driver 617.42, Windows 11 build 26300, VS 2022 Build Tools (MSVC 19.44), Windows SDK 10.0.26100, RelWithDebInfo: pass. Built AI-assisted (Claude Code). |
|
Tested
|
0764909 to
97afa18
Compare
|
Thanks @wasonidas and @nullmarsh for the detailed AMD Radeon findings (and @svds12343, @umnitus, @justrealyme for the RTX 3060 / 3070 / 5070 Ti validation runs)! Rebased onto Changes in
|
|
Re-tested The occlusion counts are unchanged from my earlier run. They now pass as notes: AI-assisted (Claude Code), no game files. |
|
✅ Automated security review: CLEAN (commit
Scope: static analysis of added diff lines only; no code was executed. Please review findings manually. |
|
Tested 97afa18 (the current head, with the opt-in gating) on NVIDIA GeForce RTX 3060 (driver 617.14), Windows 11 26H2 (26300), MSVC 19.44.35229 (v143) + Ninja, RelWithDebInfo: pass.
AI-assisted (Claude Code). agent: yes |
Implements Target-Independent Rasterization (
D3D12_RASTERIZER_DESC::ForcedSampleCount) in the D3D12 -> Vulkan runtime.Claim: #6910 (comment)
What and why
runtime/shims/d3d12_com.h,runtime/shims/d3d12_vulkan_device.cpp,runtime/test/vk_test_device.h):VulkanDeviceInfo::mixed_attachment_samples(and matchingvktest::Device::mixed_attachment_samples) and enabledVK_AMD_mixed_attachment_samplesorVK_NV_framebuffer_mixed_sampleswhen exposed by the physical device increate_vulkan_device_standalone.runtime/shims/d3d12_vulkan_device.cpp,runtime/src/vulkan_replay.h):ForcedSampleCountagainst{0, 1, 4, 8, 16}(E_INVALIDARGotherwise).ForcedSampleCount != 0constraints:DepthEnable == FALSE,StencilEnable == FALSE, andDSVFormat == DXGI_FORMAT_UNKNOWN(E_INVALIDARGotherwise), plusSampleDesc.Count == 1whenForcedSampleCount > 1(E_INVALIDARGotherwise). ReturnsE_NOTIMPLcleanly whenForcedSampleCount == 1andSampleDesc.Count > 1because Vulkan mixed-attachment extensions requirerasterizationSamples >= attachmentSamples.ConservativeRaster + ForcedSampleCountrefusal so conservative TIR follows the unified TIR validation andmixed_attachment_samplesgate.multisample.rasterizationSamples = forced ? forced : sampleswhile preservinggraphics_.samples = samplesfor draw-timeprepare_drawattachment sample checks.SampleMaskunderForcedSampleCount > 1(SampleDesc.Count == 1) by broadcasting bit 0 ((desc.SampleMask & 1u) ? ~0u : 0u) since D3D12SampleMaskmasks Output Merger RTV slots (bit 0only) whereas VulkanpSampleMaskmasksrasterizationSamples.framebufferNoAttachmentsSampleCounts, gates mixed-sample RTV TIR ondevice_.info.mixed_attachment_samples(E_NOTIMPLwhen absent) +framebufferNoAttachmentsSampleCounts, and chainsVkAttachmentSampleCountInfoAMDontoVkPipelineRenderingCreateInfo::pNextinPipelineState::build(omitting it whenunboundclears all attachments).runtime/test/d3d12_forced_sample_count_test.cpp,runtime/CMakeLists.txt,docs/d3d12_vulkan.md):d3d12_forced_sample_countusing hand-encoded SPIR-V 1.3 modules vs runtime HLSL (d3dcompiler_47.dll), requiring no external shader tools or game files.SampleMaskbit-0 rule, conservative TIR update, and hardware measurements indocs/d3d12_vulkan.md.Verification
upstream/main(f5ff1546e) (NVIDIA GeForce RTX 5060 Laptop GPU+Microsoft WARP):d3d12_forced_sample_countfailed as expected: 15 of 24 PSO validation cases disagreed with RTX 5060 D3D12 / WARP, attachmentless sliverForced=4/8/16reported0occlusion samples instead of> 0, andrgba8 diag Forced=4mismatched RTX 5060 D3D12 / WARP./W4warnings):d3d12_forced_sample_countonNVIDIA GeForce RTX 5060 Laptop GPU(driver 621.24, Vulkan 1.4.357,VK_NV_framebuffer_mixed_samples) +Microsoft WARP: Passed (1.56s/1.92sacross runs).S_OK/E_INVALIDARGparity;Forced=1 + SampleDesc=4returnsE_NOTIMPL).0/1/4/8/16, odd/evenSampleMask, scissor, diag, sliver, null-PS): Vulkan matches WARP sample counts on all 17 active scenes (1024/2048/4096,256,512,24/36/72), whereas native RTX 5060 D3D12 counts covered pixels per triangle (272,72,136,20/20/22).R8G8B8A8_UNORM,R32_UINTSV_Coverage(4x/8x/16xincluding0x000c,0x0072,0x5934, odd/even masks), 2-target MRT (0x5and0xA), unbound-RTV variant,ConservativeRaster=ON + Forced=4, and 4x-RTV sample-mismatch refusal (ReplayResult::invalid_subresource): exact byte parity across Vulkan, RTX 5060 D3D12, and WARP.mixed_attachment_samples=false),create_vulkan_device_standalone(mixed_attachment_samples=1,physical=1), and 6-submission PSO switching (1x -> 4x attless -> 4x 1x-RTV -> 8x 1x-RTV -> 4x MSAA resolve -> 1x): all passed (step 5 ordinary 4x MSAA resolve matches RTX 5060 D3D12(127,32,0,127)vs WARP(128,32,0,128)0.5*255half-rounding).d3d12_forced_sample_countonIntel(R) RaptorLake-S Mobile Graphics Controller(driver 101.7026, Vulkan 1.4.323, no mixed-samples extension): Passed (0.64s).1/4/8) matches WARP across 15 scenes (IntelUHD D3D12 returns0on empty-PS attachmentless occlusion queries even atForced=0);16xreturnsE_INVALIDARG; 1x-RTV TIR returnsE_NOTIMPL;create_vulkan_device_standalonereportsmixed_attachment_samples=0.LEONIDA_VK_DEVICE=NVIDIA):d3d12_forced_sample_count,d3d12_uav_clear,d3d12_descriptor,d3d12_close_parity,d3d12_clear,d3d12_view_slices,d3d12_depth_resolve,d3d12_query_rules,d3d12_conservative_tier3_reference,d3d12_state_map,d3d12_method_variants,d3d12_typeless_rtv,d3d12_typeless_depth,d3d12_pipeline_library_host,conservative_raster.d3d12_first_light(no game files).d3d12_conservative_rasterwas not configured locally becauseglslangValidatoris not installed.upstream/main2dbcb882c/#6935, tracked by#7125, unrelated to this PR):d3d12_vulkan_devicefailed atline 6564: tiles == 1wheredevice10->CreateReservedResource2hit Xbox proxy slot 78 (SetFrameIntervalX); all PSO, format (195/94), copy (0/75), depth24, and resolve (60/60) checks inside it passed.VK_LAYER_KHRONOS_validationis not installed on this host, so Vulkan validation-layer VUID checks were not executed locally (the test assertsvk.validation_errors() == 0and honorsLEONIDA_VK_VALIDATION=1where the layer is installed).python -I scripts/check_no_game_data.pyandgit diff --checkclean.Checklist