Repository navigation
Vulkan: Texture.Format reports the depth-stencil format the device really uses - #3427
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Details
Vulkan does not guarantee any specific depth+stencil format, only that one of
D24_UNORM_S8_UINTorD32_SFLOAT_S8_UINTworks as a depth-stencil attachment. Texture creation already substituted a supported one, but only inNativeFormat.Texture.Formatkept the format that was requested, so the description did not describe the image.Anything reading
Texture.Formatcould 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.AdjustDescriptionForDevicehook, called before the description is stored, soFormat,ViewFormat,RowStride,SizeInBytesand the mipmap descriptions all describe the image that exists. No-op on Direct3D.NativeFormatpatch inInitializeFromImpland the oldTexture.GetFallbackDepthStencilFormat, which was recomputed at every texture and pipeline state creation.This is what
SwapChainGraphicsPresenteralready does for back buffer formats: it writes the surface format it really got back intoDescription.BackBufferFormat.Behaviour change: on a device without
D24_UNORM_S8_UINT(AMD, most mobile), a depth buffer requested asD24_UNorm_S8_UIntnow reportsD32_Float_S8X24_UInt.Types of changes
Checklist
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.