Skip to content

Vulkan: Texture.Format reports the depth-stencil format the device really uses - #3427

Merged
xen2 merged 1 commit into
stride3d:masterfrom
xen2:feature/vulkan-real-depth-format
Sep 12, 2026
Merged

xen2 merged 1 commit into
stride3d:masterfrom
xen2:feature/vulkan-real-depth-format

Conversation

@xen2

@xen2 xen2 commented Sep 12, 2026

Copy link
Copy Markdown
Member

PR Details

Vulkan does not guarantee any specific depth+stencil format, only that one of D24_UNORM_S8_UINT or D32_SFLOAT_S8_UINT works as a depth-stencil attachment. Texture creation already substituted a supported one, but only in NativeFormat. Texture.Format kept the format that was requested, so the description did not describe the image.

Anything reading Texture.Format could then disagree with the device. The multisample feature table was one case, fixed separately in #3382.

Changes

  • GraphicsDevice.GetSupportedDepthStencilFormat: resolves the format once per device and caches it. It only depends on the physical device.
  • New AdjustDescriptionForDevice hook, called before the description is stored, so Format, ViewFormat, RowStride, SizeInBytes and the mipmap descriptions all describe the image that exists. No-op on Direct3D.
  • Removed the late NativeFormat patch in InitializeFromImpl and the old Texture.GetFallbackDepthStencilFormat, which was recomputed at every texture and pipeline state creation.

This is what SwapChainGraphicsPresenter already does for back buffer formats: it writes the surface format it really got back into Description.BackBufferFormat.

Behaviour change: on a device without D24_UNORM_S8_UINT (AMD, most mobile), a depth buffer requested as D24_UNorm_S8_UInt now reports D32_Float_S8X24_UInt.

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have built and run the editor to try this change out.

Builds clean on Direct3D11, Direct3D12 and Vulkan. Not run on a device lacking D24_UNORM_S8_UINT, so the substitution path itself is untested: on hardware that supports the format, nothing changes.

@xen2 xen2 added ci-enduser Run the end-user sample screenshot + packaging suite on this PR ci-editor Run the GameStudio editor screenshot suite on this PR ci-ios Run the iOS game test suite on this PR ci-android Run the Android game test suite on this PR labels Sep 12, 2026
@xen2
xen2 merged commit a5080af into stride3d:master Sep 12, 2026
51 of 55 checks passed
@xen2
xen2 deleted the feature/vulkan-real-depth-format branch September 12, 2026 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-android Run the Android game test suite on this PR ci-editor Run the GameStudio editor screenshot suite on this PR ci-enduser Run the end-user sample screenshot + packaging suite on this PR ci-ios Run the iOS game test suite on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant