Add mipmap support to createTextureWithData.#1332
Conversation
248cfd2 to
ee08c94
Compare
ee08c94 to
4eafcd6
Compare
4eafcd6 to
35cadc0
Compare
MarijnS95
left a comment
There was a problem hiding this comment.
LGTM with a few nits inline. Mip math is consistent across backends and the new seam is clean.
| # Unimplemented: Clang + DX: https://github.com/llvm/llvm-project/issues/101558 | ||
| # XFAIL: DirectX || Metal | ||
| # Unimplemented: Metal: https://github.com/llvm/llvm-project/issues/101558 | ||
| # XFAIL: Metal |
There was a problem hiding this comment.
This re-points the same issue (llvm-project#101558) from "Clang + DX" to "Metal". If it's a clang frontend issue it should hit DX and Metal equally, so DX presumably now passes for a different reason (the MipLevels propagation) and the link was mis-attributed. Can you confirm DX CI is green here and fix the comment's rationale rather than re-aiming the same link at Metal?
| const uint32_t MipHeight = std::max(1u, Desc.Height >> I); | ||
| SubresourceFootprint Sub; | ||
| Sub.Offset = Offset; | ||
| Sub.RowSizeInBytes = MipWidth * ElementSize; |
There was a problem hiding this comment.
This assumes uncompressed formats: MipWidth * ElementSize and mips shrinking to 1x1 texel are wrong for block-compressed formats (min 4x4 block). DX is fine via GetCopyableFootprints; VK/Metal would not be. No BC formats in the suite today, so just worth a note:
| Sub.RowSizeInBytes = MipWidth * ElementSize; | |
| // Assumes uncompressed formats; block-compressed formats would need | |
| // block-based row sizing rather than MipWidth * ElementSize. | |
| Sub.RowSizeInBytes = MipWidth * ElementSize; |
|
Is this now a duplicate of #1230, which we can subsequently close as fixed? |
createTextureWithData now also uploads mipmap when creating a texture.
This required introducing a new function to query the texture footprint, as well as adding support for copying mips to the copyBufferToTexture function.
Resolves #1039