#jira UE-109349
Add mip map bias for virtual texture sampling.
Respects the existing r.MiipMapLodBias CVar.
Also add residency tracking for each virtual texture physical pool.
If the pool has been created from a config with the bEnableResidencyMipMapBias flag set then a mip map lod bias is applied to bring the pool back within budget.
The residency mip map lod bias is applied globally (combined with the global mip map lod bias).
In future it could be good to apply the mip map lod bias per physical pool, but this will require tracking all physical pool combinations for each page table.
Physical pool residency tracking can be shown on screen with r.vt.residency.show CVar.
#rb ben.ingram
#ROBOMERGE-SOURCE: CL 16724483 via CL 16724487
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v835-16672529)
[CL 16724488 by jeremy moore in ue5-release-engine-test branch]
- This should be much faster than previous code which attempted to map all mip levels
- Need to ensure at least lowest resolution mip is mapped, in order to avoid rendering frames with garbage data mapped
- Add warning for AllocatedVTs that never manage to complete this mappings
#rb none
#jira none
#ROBOMERGE-SOURCE: CL 16308484 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v800-16297934)
[CL 16308810 by ben ingram in ue5-release-engine-test branch]
- Instead, keep VT cached for a few frames after they are deleted, this way they can be re-used if they're deleted/recreated due to state changes
- This should solve the problem of material changes causing pages to become unmapped for a few frames
#rb none
#jira none
[CL 16209506 by Ben Ingram in ue5-main branch]
With lots of VTs per material, pages may not be 'touched' by the CPU every frame they're used, this threshold will help prevent these pages from being re-used too early
Effectively this will make the 'VT oversubscription' message more likely to appear, but this should more accurately reflect the actual load on the system
#rb none
#jira none
[CL 16208261 by Ben Ingram in ue5-main branch]
- Need to include LocalMipBias, otherwise may not be any data at AllocatedVT's MaxLevel for sparse UDIMs
- Check for overflow when adding lock requests, keep overflow requests around to try again next frame
#rb none
#jira none
[CL 16194638 by Ben Ingram in ue5-main branch]
- It's not possible to make wrapping work correctly for lower mip levels, depending on the sizes of the VTs in the stack
- Now UDIMs that are smaller than stack dimensions will just map the lowest resolution mip to out-of-bounds addresses
- Entire stack will continue to wrap, based on the stack dimensions
- End result is UDIM wrapping should no longer by relied on
#rb none
#jira none
[CL 16184868 by Ben Ingram in ue5-main branch]
- Fix how local mip bias is applied
- Fix a few inconsistencies with how various vLevels are computed
- Rename some values to try to be more consistent between vLevel, Local_vLevel, Mapping_vLevel, vLogSize, etc
#rb none
#jira none
[CL 15947986 by Ben Ingram in ue5-main branch]
Integrate virutal texture allocator improvements from main.
[FYI] ben.ingram
#lockdown kevin.ortegren
#ROBOMERGE-SOURCE: CL 15922154 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v786-15839533)
[CL 15922638 by jeremy moore in ue5-main branch]
- Account for VT requests now encoding vLevel+1
- Fix sampling in shader when explicit mip level is not given
#rb none
#jira none
[CL 15905062 by Ben Ingram in ue5-main branch]
- Now try to map both wrapped/unwrapped address when processing a wrapped address
- Previously there was nothing to map tiles to the original vAddress
#rb none
#jira FROST-1581
[CL 15857083 by Ben Ingram in ue5-main branch]
- Check partially allocated block for fit, don't need to start with a completely free block for allocations
- Try to use the lowest possible vAddress for new allocations, this reduces the texture area covered by allocations
- Page table is no longer required to be square power-2 texture, instead allow it to grow organically as allocated area increases
- Allocator starts with maximum-sized block and tracks allocated area, no longer needs special logic to 'grow'
- Rectangular allocated VTs now mip based on min-size rather than max-size, relaxes alignment requirements and allows better packing
#rb jeremy.moore
#jira none
[CL 15825578 by Ben Ingram in ue5-main branch]
- Rework hashing of FAllocatedVTDescription to be more explicit about hashing each individual member, don't hash the debug name
#rb none
#jira none
[CL 15732300 by Ben Ingram in ue5-main branch]