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

gpu: Improve SupportsShaderFormat runtime check #12514

Open
flibitijibibo opened this issue Mar 10, 2025 · 1 comment
Open

gpu: Improve SupportsShaderFormat runtime check #12514

flibitijibibo opened this issue Mar 10, 2025 · 1 comment
Assignees
Milestone

Comments

@flibitijibibo
Copy link
Collaborator

At the moment our format check is basically just a static bitflag comparison and the formats are hardcoded into each bootstrap. This is okay but it's not ideal for a few reasons:

  • When Shader Model 7 comes out for D3D12 we can't just assume SPIR-V is available, we have to check the feature level first
  • On macOS Metal is technically always available but the device family may not meet SDL's needs
  • At least one NDA platform only supports a specific shader format when an on-disk shader cache is present

So we need to beef this up a bit and make it a whole bootstrap function, where drivers are given a chance to check for minimum support in addition to checking if the backend recognizes a specific format. For example, we should move this check from CreateDevice to CheckSupport:

https://github.com/libsdl-org/SDL/blob/main/src/gpu/metal/SDL_gpu_metal.m#L4472-L4488

@flibitijibibo
Copy link
Collaborator Author

As a band-aid to the Mac problem we can maybe check for basic hardware support in PrepareDriver, but that's not quite the same as driver format support.

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

No branches or pull requests

3 participants