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

Texture format swizzling #71

Merged
merged 3 commits into from
Jul 4, 2024
Merged

Texture format swizzling #71

merged 3 commits into from
Jul 4, 2024

Conversation

TheSpydog
Copy link
Collaborator

Fixes #56.

Replaces:

  • R5G6B5 -> B5G6R5
  • A1R5G5B5 -> B5G5R5A1
  • A2R10G10B10 -> R10G10B10A2

and removes A2B10G10R10 entirely.

The reason for the last change is because I was incorrect in my initial write-up, D3D11/12 have no support for B10G10R10A2. So we'd have to swizzle R10G10B10A2 on the D3D side, which is not ideal. To keep as much swizzling logic as possible in Vulkan, I think we should exclusively offer RGBA order.

However, Vulkan's native surface support for A2R10G10B10 is ~12%. So instead we'll always use A2B10R10G10 (which has a ~62% surface support rate) and then swizzle it into RGBA order.

One remaining issue is with Metal's ABGR4 format. It doesn't support BGRA4 or any other swizzle natively, and D3D/VK don't support A4B4G4R4 natively. I'll need to set up a Metal swizzle for this format specifically.

@flibitijibibo flibitijibibo marked this pull request as ready for review July 4, 2024 21:26
@flibitijibibo
Copy link
Collaborator

One remaining issue is with Metal's ABGR4 format. It doesn't support BGRA4 or any other swizzle natively, and D3D/VK don't support A4B4G4R4 natively. I'll need to set up a Metal swizzle for this format specifically.

Marked this one as ready for now since I believe this is just a quick MTLTextureSwizzle, but if it's a major blocker that can be reverted (otherwise I'll apply this to the weekly update).

@flibitijibibo flibitijibibo merged commit db917ee into gpu_next Jul 4, 2024
78 checks passed
@flibitijibibo flibitijibibo deleted the texture-formats branch July 4, 2024 22:02
bartwe pushed a commit to bartwe/SDL-gpu-dx12 that referenced this pull request Jul 6, 2024
flibitijibibo pushed a commit that referenced this pull request Jul 11, 2024
bartwe pushed a commit to bartwe/SDL-gpu-dx12 that referenced this pull request Jul 12, 2024
bartwe pushed a commit to bartwe/SDL-gpu-dx12 that referenced this pull request Jul 13, 2024
flibitijibibo pushed a commit that referenced this pull request Jul 16, 2024
flibitijibibo pushed a commit that referenced this pull request Jul 19, 2024
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.

None yet

2 participants