Luma: Add managed resources#116
Open
garamond13 wants to merge 5 commits into
Open
Conversation
Filoppi
reviewed
May 25, 2026
| // TODO: copy/move. | ||
| // TODO: Move this somewhere else. | ||
| // TODO: Handle views per MIP? | ||
| // TODO: Handle DSV? |
Filoppi
reviewed
May 25, 2026
| // TODO: Move this somewhere else. | ||
| // TODO: Handle views per MIP? | ||
| // TODO: Handle DSV? | ||
| // TODO: Handle multiple views? |
Owner
There was a problem hiding this comment.
Maybe add a custom views array, by index, or by name/hash, that could be added later with extra code (e.g. textureX.AddView()) and let the primary view be constructed within the constructor.
Owner
There was a problem hiding this comment.
All views in DX inherit from the same class, so it could be just 1 array too.
Filoppi
reviewed
May 25, 2026
| // TODO: Handle multiple views? | ||
| // TODO: Handle texture arrays? | ||
| // TODO: Give up on all this? | ||
| class LumaTexture |
Owner
There was a problem hiding this comment.
How about making this a template and then sub "class" it to LumaTexture1D, LumaTexture2D and LumaTexture3D? Instead of having to manually cast them, which sometimes can be annoying.
Filoppi
reviewed
May 25, 2026
|
|
||
| void Create(ID3D11Device* device, const D3D11_TEXTURE2D_DESC* tex_desc, const D3D11_SUBRESOURCE_DATA* initial_data = nullptr, const D3D11_SHADER_RESOURCE_VIEW_DESC* srv_desc = nullptr, const D3D11_RENDER_TARGET_VIEW_DESC* rtv_desc = nullptr, const D3D11_UNORDERED_ACCESS_VIEW_DESC* uav_desc = nullptr) | ||
| { | ||
| ensure(device->CreateTexture2D(tex_desc, initial_data, (ID3D11Texture2D**)&texture), >= 0); |
Owner
There was a problem hiding this comment.
IMO it's nicer to cache the result and check the ensure in a line below
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.
Work in progress.