Create, upload, and read back buffers using generic API in DX12.#1309
Merged
manon-traverse merged 19 commits intoJun 19, 2026
Merged
Conversation
bogner
reviewed
Jun 16, 2026
bogner
left a comment
Contributor
There was a problem hiding this comment.
Looks like the Feature/HLSLLib/PartiallyMappedResources.test test fails with this change, which will need looking into
More WIP. Almost completed refactor in DX12. Implement mapping and unmapping of vulkan textures. Implement copyTextureToBuffer in DX12 and Vulkan. Use llvm::cast instead of static_cast. Lots of progress in making agnostic buffers and textures fully work! Fix resource state issue. Remove incorrect shadowed variable. Use correct strides when uploading textures. Formatting. Store the size in bytes in the Texture and use that for the memory map. Use correct stride for computing the readback buffer size. Counter Buffer WIP. Get basically all tests passing on DX12. Clean up transition barriers. Remove dead code. Use API agnostic code to readback render target. Add missing Texture.cpp file. Add AccelerationStructure entry to isBuffer. Add vulkan image transitions to the render encoder Remove dead code. Add copyBufferToTexture implementation to Metal. Add copyBufferToTexture implementation on Metal. Graceful error on counter buffer feature in metal. Add a not_supported impl for map and unmap on MTLTexture. Mark sparse memory backing as unsupported on buffers in Metal.
877ac53 to
b7b6c72
Compare
Contributor
Author
It seems that test is being skipped on my machine due to my Intel GPU. I have added a code path for sparse textures and buffers. They are fully mapped just like before, but there is now also a generic API present for mapping specific tiles. |
b7b6c72 to
a2ba2d4
Compare
Contributor
Author
|
Looks like there is a bug in the sparse buffer impl. I'll fix that tomorrow. |
bogner
reviewed
Jun 18, 2026
bogner
approved these changes
Jun 18, 2026
bogner
left a comment
Contributor
There was a problem hiding this comment.
LGTM once the redundant friend declarations have been cleaned up
EmilioLaiso
approved these changes
Jun 19, 2026
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.
This is a major step in the generic API that wraps around DX12, Metal and Vulkan.
In the DX12 version of
executeProgramall buffer creation, uploading and reading back is now done using only the generic interface. Only binding of resources to the root signature and setting up descriptor tables/heaps is done using DX12 specific code.This brings the project another step closer to moving
executeProgramoutside of the graphics API wrapper and into the offloader executable.Key changes:
createBufferandcreateTexturecalls, no more raw DX12 callsExtra changes:
Drive by fixes/changes:
CpuToGpuorGpuToCpuMemoryLocation