Commit Graph

113 Commits

Author SHA1 Message Date
jeremy moore
7124ab4a00 #jira UE-117953
#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]
2021-06-20 18:47:26 -04:00
ben ingram
4474e52846 Also destroy pending AllocatedVTs when flushing destroyed VT resources
#rb none
#jira none

#ROBOMERGE-SOURCE: CL 16313886 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v804-16311228)

[CL 16313900 by ben ingram in ue5-release-engine-test branch]
2021-05-13 11:53:48 -04:00
ben ingram
990b78cea7 Remove PRAGMA_DISABLE_OPTIMIZATION left in by mistake
#rb none
#jira none

#ROBOMERGE-SOURCE: CL 16308786 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v800-16297934)

[CL 16308863 by ben ingram in ue5-release-engine-test branch]
2021-05-12 22:00:31 -04:00
ben ingram
439afdb8e9 Restore functionality to automatically map newly allocated VTs, but only for lowest resolution mip level
- 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]
2021-05-12 21:59:47 -04:00
Ben Ingram
bf28486030 Try to make it more obvious that allocated memory will be initialized, attempt to satisfy static analysis
#rb none
#jira none

[CL 16249374 by Ben Ingram in ue5-main branch]
2021-05-10 11:38:54 -04:00
Ben Ingram
de367642c7 AllocatedVTs that use private space are deleted immediately, rather than staying cached for some frames
#jira none
#rb jeremy.moore

[CL 16224868 by Ben Ingram in ue5-main branch]
2021-05-06 15:26:23 -04:00
Jeremy Moore
baf9af8803 Fix nullptr dereference.
#jira none
#rb trivial

[CL 16222882 by Jeremy Moore in ue5-main branch]
2021-05-06 12:54:31 -04:00
Ben Ingram
9468976c1d Don't try to map all resident pages to newly allocated VTs. Too slow, especially for large VTs
- 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]
2021-05-05 13:09:24 -04:00
Ben Ingram
fc2da0313a Add cvar to control number of frames VT page must be unused before it's considered 'free'
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]
2021-05-05 11:55:24 -04:00
Ben Ingram
71d9de4675 Display on-screen message when VT pool is oversubscribed
#rb none
#jira none

[CL 16201143 by Ben Ingram in ue5-main branch]
2021-05-04 19:20:32 -04:00
Ben Ingram
8037278b3f Make sure we're always able to map the lowest resolution VT mips, otherwise the system will continue to try (and fail) to do this every frame, costing lots of perf
- 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]
2021-05-04 11:48:09 -04:00
Ben Ingram
916aa06a15 Remove VT UDIM page table wrapping
- 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]
2021-05-03 12:21:08 -04:00
Ben Ingram
43ad5274ff Fixes for VT page unmapping...ensure that we don't get mismatched ancestor pages
#rb none
#jira none

[CL 15962520 by Ben Ingram in ue5-main branch]
2021-04-08 19:55:35 -04:00
Marc Audy
01b7c9f4f5 Merge UE5/RES @ 15958325 to UE5/Main
This represents UE4/Main @ 15913390 and Dev-PerfTest @ 15913304

[CL 15958515 by Marc Audy in ue5-main branch]
2021-04-08 14:32:07 -04:00
Ben Ingram
eea1e7e74e Various VT fixes, mostly related to UDIMs
- 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]
2021-04-07 19:06:31 -04:00
Ben Ingram
e6c2c85df5 Fixes for UDIM VTs in texture editor
UDIMs use transformed UVs, account for these when computing visible regions
#rb none
#jira none

[CL 15926164 by Ben Ingram in ue5-main branch]
2021-04-05 21:56:26 -04:00
Jeremy Moore
81a5b31997 Fix auto merge error
#jira none
#rb trivial

[CL 15922889 by Jeremy Moore in ue5-main branch]
2021-04-05 16:35:53 -04:00
jeremy moore
e164217933 #jira UE-112852
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]
2021-04-05 16:16:29 -04:00
Ben Ingram
ee8539464d Fixes for VT texture viewer
- 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]
2021-04-02 15:46:47 -04:00
Ben Ingram
72b67d6af6 Update logic for dealing with VT wrap
- 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]
2021-03-29 20:23:32 -04:00
Ben Ingram
60478d3652 VT allocator improvements
- 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]
2021-03-25 12:40:35 -04:00
danny couture
9ac59bee66 Add meaningful Insights trace affecting either map loading or PIE
#rb Francis.Hurteau

[CL 15777110 by danny couture in ue5-main branch]
2021-03-23 10:58:12 -04:00
Yuriy ODonnell
da38c78f19 Added TRACE_CPUPROFILER_EVENT_SCOPE-s in various parts of rendering code that can take non-trivial time.
#preflight 60578088c118270001c6367f

[CL 15756286 by Yuriy ODonnell in ue5-main branch]
2021-03-21 13:53:35 -04:00
Ben Ingram
e1a07fc4a8 r.VT.ListPhysicalPools also reports total memory usage
#rb none
#jira none

[CL 15741593 by Ben Ingram in ue5-main branch]
2021-03-18 16:57:33 -04:00
Ben Ingram
d4bba48214 Add name of material to AllocateVT as debug aid
- 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]
2021-03-17 19:47:18 -04:00