-
Notifications
You must be signed in to change notification settings - Fork 792
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
[APV] Cell streaming system #5731
Conversation
Updated Probe Reference debug to use it completely
… into hd/apv-cell-streaming
…oaded at the same time.
…ebug." This reverts commit 51eac63.
… into hd/apv-msic-fixes
This reverts commit e128c24.
…ad of constant buffers" This reverts commit d381f78.
… into hd/apv-msic-fixes
… into hd/apv-cell-streaming # Conflicts: # com.unity.render-pipelines.core/Runtime/Utilities/MeshGizmo.cs
…gies/Graphics into hd/apv-cell-streaming
… into hd/apv-cell-streaming # Conflicts: # com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeReferenceVolume.cs
com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.cs
Show resolved
Hide resolved
int m_UpdateMaxIndex = int.MinValue; | ||
|
||
// Static variable required to avoid allocations inside lambda functions | ||
static Cell g_Cell = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yikes, can we use the cell index instead to do the checks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can but I don't think that would make any difference, would it? It's just comparing references.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would we still need to have the global static thing? I guess?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the static is mandatory because we use lambda for finding stuff. So it would capture the variable and generate gcalloc without it.
I guess we can make functors and set the ref in it to avoid this but it's much more verbose for not a lot of gain (I don't expect this to be run multi-threaded)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, you can replace the FindIndex with an old school for loop, it will avoid GC allocs and the static global field.
com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeBrickIndex.cs
Show resolved
Hide resolved
com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeBrickPool.cs
Outdated
Show resolved
Hide resolved
com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeBrickPool.cs
Show resolved
Hide resolved
|
||
// In order not to pre-allocate for the worse case, we update the texture by smaller chunks with a preallocated DataLoc | ||
int chunkIndex = 0; | ||
while (chunkIndex < cellInfo.chunkList.Count) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks correct, but is delicate, have you stress tested this a bit to see if all looks fine?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested as much as I could but it could be interesting to test with bigger/more complex scenes as well. As it is, it's hard to force streaming activity in a relevant way :/
public int flatIdxInCellIndices = -1; | ||
public bool loaded = false; | ||
public ProbeBrickIndex.CellIndexUpdateInfo updateInfo; | ||
public int sourceAssetInstanceID; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason for this change? It was very useful to use a string as a ID to debug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perf reason. I need to check that everytime an asset is streamed in/out to remove existing cells from internal arrays. Comparing strings did not feel good at all.
I might be overthinking this though, for now we don't even have asset streaming so...
com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeReferenceVolume.cs
Outdated
Show resolved
Hide resolved
cells[cell.index] = cell; | ||
// The same cell can exist in more than one asset | ||
// Need to check existence because we don't want to add cells more than once to streaming structures | ||
// TODO: Check perf if relevant? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it? :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kind of the same as above. This is relevant in term of perf when we have asset streaming. Right now it is expected that this happens during loading only so it's probably fine as is.
com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeReferenceVolume.cs
Outdated
Show resolved
Hide resolved
… into hd/apv-cell-streaming-2
… into hd/apv-cell-streaming-2
… into hd/apv-cell-streaming-2 # Conflicts: # com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeReferenceVolume.cs
Testing status: Complete Whats to be tested:
Feature testing
Workflow
No streaming specific issues found but filed a lot for general APV here Showcase 4EHeTZ9blF.mp4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the review
… into hd/apv-cell-streaming-2
… into hd/apv-cell-streaming-2 # Conflicts: # com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeReferenceVolume.Debug.cs
* master: Add missing shader stages in shader keyword copying (#6008) [Yamato] Add all DX11 job for URP (#6075) [HDRP] Add more performance test coverage (#5814) Fix templates ISO date (#6073) Fix division by 0 when AO is 0 (#6078) Fixed grammar errors (#6077) [HDRP][Path Tracing] Improved robustness of the stacklit material (#6066) [APV] Cell streaming system (#5731) Update revision for URP update test project (#6061) [HDRP][Path Tracing] Camera ray misses now return a null value with Minimum Depth > 1 (#6067) Renable missing test (Lens Flare) (#5456) [HDRP][Path Tracing] Added proper support for interleaved tiling (#5953) Fix to render depth or depth/normal of waving grass (#4097) Remove ScreenSpaceShadowResolvePass (#6002) [HDRP][Docs] Update docs with RendererList related option (#6031) Layer drawer used in ray/path tracing now matches 100% with camera's. (#5956) Fix iridescence tooltip (#5950) [HDRP] Change RenderGraph Begin/Execute function pattern to avoid leaks (#5929) [HDRP] Fix errors when switching build targets in editor (#5918) Generate a material as a subasset for ShaderGraphs (#5795)
Purpose of this PR
This PR introduces cell streaming to the APV.
This includes:
Still needs to be done:
What has been tested: