8000 GPU: D3D12 fails to create multisample texture by gyxos-logan · Pull Request #13084 · libsdl-org/SDL · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

GPU: D3D12 fails to create multisample texture #13084

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

< 8000 /div>
Merged
merged 1 commit into from
May 20, 2025

Conversation

gyxos-logan
Copy link
Contributor

Description

Creating a multisample texture on an Intel iGPU D3D12 feature set 11_1 fails with an error for incorrect alignment setting.

This is update sets the alignment of multisample textures to D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT. According to Microsoft documentation the alignment could also be set to 0 and it would automatically get detected.

https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ns-d3d12-d3d12_resource_desc#alignment

If Alignment is set to 0, the runtime will use 4MB for MSAA textures and 64KB for everything else. The application may choose smaller alignments than these defaults for a couple of texture types when the texture is small. Textures with UNKNOWN layout and MSAA may be created with 64KB alignment (if they pass the small size restriction detailed below).

I notice that it talks about small size restriction which would allow using the current 64kb alignment. Looking at the error this doesn't appear that useful as 1200x800 sample count 2 needed 494 tiles whereas 16 tiles is the maximum for the small size restriction.

Tested and working on NVidia RTX 30 series GPU and Intel iGPU.

Error

D3D12 WARNING: ID3D12Device::CreateCommittedResource: D3D12_RESOURCE_DESC::Alignment cannot be 64KB, since D3D12_RESOURCE_DESC::Width, D3D12_RESOURCE_DESC::Height, and/ or D3D12_RESOURCE_DESC::DepthOrArraySize are too large. 64KB alignment requires the most detailed mip level be theoretically 4MB or smaller. A 64KB tile shape for D3D12_RESOURCE_DIMENSION_TEXTURE2D and D32_FLOAT is 32 texels wide, 64 texels high, and 1 texels deep. When Width = 1200, Height = 800, and Depth = 1, the number of tiles needed is 494, while 16 tiles is the maximum. D3D12_RESOURCE_DESC::Alignment must be 0 or 4MB (aka D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT).

Copy link
Collaborator
@flibitijibibo flibitijibibo left a comment

Choose a reason for hiding this comment

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

Might be worth adding parens or breaking up the line altogether but that's a nitpick at best, just need another +1 in case I'm wrong!

@slouken slouken added this to the 3.2.16 milestone May 20, 2025
@slouken slouken merged commit f4942b3 into libsdl-org:main May 20, 2025
40 checks passed
@slouken
Copy link
Collaborator
slouken commented May 20, 2025

Merged, thanks!

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
0