-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sparse texture support #26
Comments
So, as an addition to #24 thread, I'll add that D3D11 also supports sparse (or tiled) textures, and all of the D3D12/Vulkan GPUs already support them (more info). So, maybe we don't need an extension for this? |
Despite that all GAPIs expose tiled textures, I would prefer to start with a separate extension. IMO, it would be easier to discuss and progress. There is a big chance that it will have gone into core by the time of the release. IMO, tiled resources are tricky:
While I'm learning specs, I would be happy to see a draft proposal in any form :) |
I thought a little longer and looked into the API for working with tiles, and what can I say:
Thus, I concluded that this is probably not worth implementing because it requires overcomplicating the API for virtual mapping. |
Giving up? :) As I said, I will look at the specs and discuss with colleagues. Finding a common denominator (even omitting or limiting D3D11 support) will be a nice achievement. |
Just saying that it would be hard to implement this without breaking the whole resource API. So if you are okay with it - I can try to think how it can be implemented.
In D3D12 and Vulkan, it works as a separate resource type (i.e. "reserved" for D3D12), so it can be generalised. Also, it looks like in D3D11 API trying to match D3D12 Reserved Resource but with separate pools to manage memory allocations, so they can easily be combined. The sad news is that I haven't found any official example for the D3D11 tiled resource, only for the reserved D3D12 resource (but I will refer to D3D12 as the most complete solution for managing resources). |
I find it funny though... D3D11: void UpdateTileMappings(
[in] ID3D12Resource *pResource,
UINT NumResourceRegions,
[in, optional] const D3D12_TILED_RESOURCE_COORDINATE *pResourceRegionStartCoordinates,
[in, optional] const D3D12_TILE_REGION_SIZE *pResourceRegionSizes,
[in, optional] ID3D12Heap *pHeap,
UINT NumRanges,
[in, optional] const D3D12_TILE_RANGE_FLAGS *pRangeFlags,
[in, optional] const UINT *pHeapRangeStartOffsets,
[in, optional] const UINT *pRangeTileCounts,
D3D12_TILE_MAPPING_FLAGS Flags
); D3D12 HRESULT UpdateTileMappings(
[in] ID3D11Resource *pTiledResource,
[in] UINT NumTiledResourceRegions,
[in, optional] const D3D11_TILED_RESOURCE_COORDINATE *pTiledResourceRegionStartCoordinates,
[in, optional] const D3D11_TILE_REGION_SIZE *pTiledResourceRegionSizes,
[in, optional] ID3D11Buffer *pTilePool,
[in] UINT NumRanges,
[in, optional] const UINT *pRangeFlags,
[in, optional] const UINT *pTilePoolStartOffsets,
[in, optional] const UINT *pRangeTileCounts,
[in] UINT Flags
); No difference at all! I think that we maybe can implement heap emulation for D3D11 via resources, what do you think? |
Heaps are already emulated in D3D11. It's not a real emulation, of course, heaps are dummy objects. So, yes, it's doable. |
Yes, please. Let's stay in touch on this topic. |
Can you update NRIFramework and NRISamples to the latest version? Or can I just use their current version? |
I'm starting to update NRI and NRIFramework to the latest (including ReBAR support). ETA is 3-5 h. |
Updated. |
While working on implementing sparse textures, I got to thinking about memory management for resources. I don't like the fact that you have to first bind a texture to allocate memory, because for sparse textures you have to first create a reserved resource and only then update the regions using the |
In VK only this is possible:
This fact dictates the API. No more comments for now because I'm still out of the topic... |
So, my additional thoughts on sparse (info for PR #28). D3D11 does not support allocating tile memory outside of the tile pool, whereas D3D12 and Vulkan allow it. For this reason, I decided to make a separate structure called I added a draft version of the tiling extension that tries to combine all the ways to handle sparse textures (Vulkan is more low-level than D3D12, so I decided to implicitly define all the necessary information for the bind function and simplify the function call). I can answer your questions on this topic here. References: |
Thank you, Anton. Please, give me more time (I would like to get feedback from colleagues, what will take additional time). |
Thanks for solid baseline. Not looking at implementation details, here are my comments for the interface:
Thanks for docs! I'm still not an expert (VK doc is very long), but I believe this functionality will go into core. Also, currently I'm assuming that this API is implementable for all GAPIs (I trust you). |
From the doc:
I'm OK to ignore such weird functionality. Having a single sparse resource using tiles from several memory heaps looks like a bad engine design. (UPDATE) After consultations I realized that such functionality is very useful. You can have a tiled resource (incredibly large) and just "assign" a new memory chunk to some tiles without a need to recreate everything. |
OK, these changes are fine to me, I'll fix them as soon as possible (currently unavailable due to work) |
No description provided.
The text was updated successfully, but these errors were encountered: