Skip to content

Luma: Add managed resources#116

Open
garamond13 wants to merge 5 commits into
Filoppi:mainfrom
garamond13:main
Open

Luma: Add managed resources#116
garamond13 wants to merge 5 commits into
Filoppi:mainfrom
garamond13:main

Conversation

@garamond13
Copy link
Copy Markdown
Collaborator

Work in progress.

// TODO: copy/move.
// TODO: Move this somewhere else.
// TODO: Handle views per MIP?
// TODO: Handle DSV?
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, add DSV too!

// TODO: Move this somewhere else.
// TODO: Handle views per MIP?
// TODO: Handle DSV?
// TODO: Handle multiple views?
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All views in DX inherit from the same class, so it could be just 1 array too.

// TODO: Handle multiple views?
// TODO: Handle texture arrays?
// TODO: Give up on all this?
class LumaTexture
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.


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);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO it's nicer to cache the result and check the ensure in a line below

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants