Repository navigation
PrepareUploadEx for Direct3D 12 planar depth/stencil formats - #753
Closed
João Vilaça (jpggvilaca) wants to merge 2 commits into
Closed
João Vilaça (jpggvilaca) wants to merge 2 commits into
João Vilaça (jpggvilaca) wants to merge 2 commits into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Collaborator
|
Please explain why you are closing the PR. |
Author
Apologies for all this confusion. I thought I could work on this but it might not be allowed by my company (Intel), so, in case of doubt, I decided to close just to avoid any issues. I apologize for wasting your time and appreciate the opportunity to contribute/learn. |
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.
Related to microsoft/DirectXTK12#283. As suggested there, this adds the depth/stencil support to DirectXTex first; DDSTextureLoader12 and DirectXTK12 will follow.
Problem
PrepareUploadreturnsHRESULT_E_NOT_SUPPORTEDfor the D24 and D32 depth/stencil families, because Direct3D 12 treats them as two planes, while DDS files (like Direct3D 11) store depth and stencil interleaved per pixel.Change
Adds a new function:
D24_UNORM_S8_UINT,R24G8_TYPELESS,R24_UNORM_X8_TYPELESS,X24_TYPELESS_G8_UINT) and the D32 family (D32_FLOAT_S8X24_UINT,R32G8X24_TYPELESS,R32_FLOAT_X8X24_TYPELESS,X32_TYPELESS_G8X24_UINT), the data is rearranged byte by byte intoplanarData: plane 0 holds 4 bytes per pixel (depth, with the X8 bits zeroed as the planar depth/stencil spec requires) and plane 1 holds 1 byte per pixel (stencil).subresourcespoints intoplanarData, so it must outliveUpdateSubresources.PrepareUpload, andplanarDatais left empty.PrepareUploaditself is unchanged.XBOX_DXGI_FORMAT_D16_UNORM_S8_UINT(which DirectXTex already stores planar) still returnHRESULT_E_NOT_SUPPORTED.rowPitchis smaller thanwidth * bytesPerPixelare rejected, and the buffer size is computed in 64 bits with an overflow check.The scanline helpers follow the style of
CopyScanline24bppinDirectXTexDDS.cpp.Testing
xtd3d12from directxtextest, withdepthimageD16.dds,depthimageD24.ddsanddepthimageD32.ddsadded (test PR to follow): all tests pass with the D3D12 debug layer enabled; the only debug-layer error is the existing invalid-dimension check in the CreateTexture test.depthimageD24.ddsis created, prepared, uploaded and rendered; D16/D32 are skipped only in the render test, since those formats can't be used for shader resource views.Documentation
Suggested wiki text for the CreateTexture page, next to
PrepareUpload:Note: I developed this with help from Claude. I've built, tested and reviewed every change myself.