Repository navigation
Conversation
tupacfan04
left a comment
There was a problem hiding this comment.
The buffer-UAV validation is correct: runtime/shims/d3d12_vulkan_device.cpp:6299-6335 rejects NumElements == 0, flags outside D3D12_BUFFER_UAV_FLAG_RAW, structured+RAW, nonzero StructureByteStride on raw/typed views, and the existing typed+R32_UINT+RAW branch; the bounds check is overflow-safe, the destination is zeroed before write_buffer_uav, and the counter path is unchanged. The new GPU test is racy, though.
runtime/test/d3d12_buffer_uav_validation_test.cpp does:
queue->Signal(fence.p, 1);
fence->SetEventOnCompletion(1, nullptr);
void* mapped = nullptr;
EXPECT(SUCCEEDED(readback->Map(0, nullptr, &mapped)));SetEventOnCompletion with a null event handle is not a wait (at best E_INVALIDARG, and the return is ignored), and Map on a readback buffer does not wait for the GPU. The test can read the copy buffer before the clear/copy executes; on a fast GPU it may pass, but the expected raw/structured/typed values can be stale or zero. Create a real event, call SetEventOnCompletion(1, event), WaitForSingleObject, then Map (as the existing UAV-clear tests do), or wait on the fence directly.
Secondary coverage gap: the header says the invalid cases include “structured with zero stride”, but the body never creates a structured UAV with Format = UNKNOWN, NumElements > 0, StructureByteStride = 0; write_buffer_uav rejects it via !unit, but no test covers that path.
Synthetic/code-read only; no game files. AI-assisted (OpenCode).
|
Tested
|
|
Tested dd251e4 on NVIDIA GeForce RTX 4060 (Ada), driver 32.0.16.1692, Windows 11 (10.0.26300), MSVC 19.44.35230 (VS 2022 Build Tools), Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0, RelWithDebInfo,
Negative control (the new test built against the merge base's The other invalid cases already pass on main: On the fence wait in the review above: in this layer a null event does block. On the coverage gap: I added a local case (not committed), structured with AI-assisted (Claude Code). |
|
Tested dd251e4 on NVIDIA GeForce RTX 4080 SUPER, driver 621.24 (Vulkan 1.4.357), Windows 11 Pro 26300, MSVC 14.44, Ninja RelWithDebInfo, applied on
(AI-assisted check, Claude Code.) |
Claim: #8186 (comment)
Summary
write_buffer_uav(ID3D12Device::CreateUnorderedAccessView) inruntime/shims/d3d12_vulkan_device.cpp, matchingCreateShaderResourceViewand D3D12 rules and leaving the descriptor slot zeroed (null descriptor) on invalid inputs:NumElements == 0and unknownBuffer.Flagsbits (view.Flags & ~D3D12_BUFFER_UAV_FLAG_RAW).Format == DXGI_FORMAT_UNKNOWN) withD3D12_BUFFER_UAV_FLAG_RAW.StructureByteStride.(UINT64(view.FirstElement) + view.NumElements) > rd.Width / unitwith overflow-safe subtractionview.NumElements > rd.Width / unit - view.FirstElement.write_buffer_uav(buffer UAVs only; no texture UAV changes).runtime/test/d3d12_buffer_uav_validation_test.cppregistered inruntime/CMakeLists.txtwithSKIP_RETURN_CODE 77andFAIL_REGULAR_EXPRESSION "Validation Error;VUID-".Verification
CreateUnorderedAccessView+ClearUnorderedAccessViewUintbehavior for valid raw/typed UAVs and invalid descriptors (NumElements == 0).LEONIDA_BUILD_WINDOWS_RUNTIME=ON,LEONIDA_REQUIRE_VULKAN=ON).LEONIDA_VK_VALIDATION=1(0 VUIDs):d3d12_buffer_uav_validation: Passed (0.24s)d3d12_uav_clear: Passed (0.24s)d3d12_descriptor: Passed (0.38s)d3d12_com: Passed (0.28s)AI-assisted (Gemini 4 Neon).