[Vulkan][DirectX] Refactor texture handling in anticipation of other texture types - #1465
Open
Icohedron wants to merge 1 commit into
Open
[Vulkan][DirectX] Refactor texture handling in anticipation of other texture types#1465Icohedron wants to merge 1 commit into
Icohedron wants to merge 1 commit into
Conversation
A new TextureDimension enum has been added. Places where a 2D texture-related were expected are now replaced with a helper function and switch over the enum to return the appropriate value. Places that assumed the number of texture subresources was the number of mip levels are now replaced with a call to a helper to obtain the correct subresource count. The number of subresources is equal to the number of mip levels right now, but that will change with array textures which will add array slices. Added backend-agnostic helper functions for texture subresource layout arithmetic, and symmetric functions for copying texture contents between tightly-packed host buffers and GPU-mapped memory regions. Also fixes two latent bugs: DX copyTextureToBuffer only copied subresource 0, never reading back mip beyond the most detailed one (mip 0). VK copyTextureToBuffer passed regionCount = 0, making the copy a no-op. Assisted by: Claude Opus 5
Icohedron
force-pushed
the
users/icohedron/texture-refactor
branch
from
August 21, 2026 02:33
7d63059 to
28f82c4
Compare
bob80905
reviewed
Aug 25, 2026
|
|
||
| // Copy a texture's contents between a tightly-packed host buffer and a | ||
| // (possibly row/subresource padded) GPU-visible mapping described by `Layout`. | ||
| // These are the single place that knows how to bridge the two layouts, so |
bob80905
approved these changes
Aug 25, 2026
bob80905
left a comment
Contributor
There was a problem hiding this comment.
only outstanding thing is grammar inside a comment, LGTM
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.
A new TextureDimension enum has been added. Places where a 2D texture-related were expected are now replaced with a helper function and switch over the enum to return the appropriate value.
Places that assumed the number of texture subresources was the number of mip levels are now replaced with a call to a helper to obtain the correct subresource count. The number of subresources is equal to the number of mip levels right now, but that will change with array textures which will add array slices.
Added backend-agnostic helper functions for texture subresource layout arithmetic, and symmetric functions for copying texture contents between tightly-packed host buffers and GPU-mapped memory regions.
Also fixes two latent bugs:
DX copyTextureToBuffer only copied subresource 0, never reading back mip beyond the most detailed one (mip 0).
VK copyTextureToBuffer passed regionCount = 0, making the copy a no-op.
Assisted by: Claude Opus 5
Stack created with GitHub Stacks CLI • Give Feedback 💬