Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

D3D12 Validation error on mipmap generation #125

Open
st0rmbtw opened this issue Aug 11, 2024 · 1 comment
Open

D3D12 Validation error on mipmap generation #125

st0rmbtw opened this issue Aug 11, 2024 · 1 comment
Labels
D3D Direct3D specific issue known issue Known issues that might not get fixed anytime soon

Comments

@st0rmbtw
Copy link
Contributor

st0rmbtw commented Aug 11, 2024

I get this validation error after the CreateTexture method call when the texture has the GenerateMips flag.

D3D12 ERROR: GPU-BASED VALIDATION: Dispatch, Incompatible resource state: Resource: 0x0000018B9A5CF520:'Unnamed ID3D12Resource Object', Subresource Index: [0], Descriptor heap index to DescriptorTableStart: [0], Descriptor heap index FromTableStart: [0], Binding Type In Descriptor: SRV, Resource State: D3D12_RESOURCE_STATE_UNORDERED_ACCESS(0x8), Index of Descriptor Range: 0, Shader Stage: COMPUTE, Root Parameter Index: [1], Dispatch Index: [0], Shader Code: <debug info not available>, Asm Instruction Range: [0x190-0x1c3], Asm Operand Index: [3], Command List: 0x0000018B997CF880:'Unnamed ID3D12GraphicsCommandList Object', SRV/UAV/CBV Descriptor Heap: 0x0000018B9A782D90:'Unnamed ID3D12DescriptorHeap Object', Sampler Descriptor Heap: <not set>, Pipeline State: 0x0000018B99F73800:'Unnamed ID3D12PipelineState Object',  [ EXECUTION ERROR #942: GPU_BASED_VALIDATION_INCOMPATIBLE_RESOURCE_STATE]

The error occurs after the Dispatch method call here:

commandList->Dispatch(
DivideRoundUp(dstWidth, 64u),
subresource.numArrayLayers,
1u
);

P.S.
Here's the texture descriptor:

LLGL::TextureDescriptor texture_desc;
texture_desc.type = LLGL::TextureType::Texture2DArray;
texture_desc.extent = LLGL::Extent3D(width, height, 1);
texture_desc.arrayLayers = layers;
texture_desc.bindFlags = LLGL::BindFlags::Sampled | LLGL::BindFlags::ColorAttachment;
texture_desc.cpuAccessFlags = 0;
texture_desc.miscFlags = LLGL::MiscFlags::GenerateMips;
@LukasBanana LukasBanana added D3D Direct3D specific issue known issue Known issues that might not get fixed anytime soon labels Aug 12, 2024
@LukasBanana
Copy link
Owner

This is a known issue and needs a larger refactor in the D3D12 backend for resource state transitioning. Unfortunately, this type of resource transitioning for Mip generation is implemented this way even in Microsoft's MiniEngine example:
https://github.com/microsoft/DirectX-Graphics-Samples/blob/master/MiniEngine/Core/ColorBuffer.cpp#L172

What we can do in the short term is to silence this validation notification until the resource state transitioning is more precise, i.e. works on a per-subresource level rather than a per-resource level. I assume that would be D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_INCOMPATIBLE_RESOURCE_STATE which we can add here at D3D12Device.cpp:192.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
D3D Direct3D specific issue known issue Known issues that might not get fixed anytime soon
Projects
None yet
Development

No branches or pull requests

2 participants