Skip to content

[HDRP] Fixed max shadow crash #2760

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

Merged
merged 5 commits into from
Nov 27, 2020
Merged

Conversation

alelievr
Copy link
Member

@alelievr alelievr commented Nov 26, 2020

Purpose of this PR

Fix this issue: https://fogbugz.unity3d.com/f/cases/1290357/
Backport case for 10.3: https://fogbugz.unity3d.com/f/cases/1294583/

Note: To avoid paying the CPU cost of culling for shadows that we won't use, I disabled the ShadowCasters flag on the culling options when shadows are disabled.
We don't allocate the shadow atlases anymore either.


Testing status

Manually tested with the template scene, now setting max shadows on screen does not produce any error.


Comments to reviewers

There might be some side effects on the shader variable side, even if we shouldn't use them when shadows are disabled. But I haven't encountered this case while testing.

@FrancescoC-unity
Copy link
Contributor

This LGTM, but can you check if all is fine when having cached shadows? (Update mode set to OnEnable/OnDemand)

@alelievr
Copy link
Member Author

@FrancescoC-unity I played with those options and nothing unexpected (no shadows).

@alelievr alelievr marked this pull request as ready for review November 26, 2020 14:05
Copy link
Contributor

@TomasKiniulis TomasKiniulis left a comment

Choose a reason for hiding this comment

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

@alelievr I can't get this working. After setting max shadows even with clean template library along the repro steps it still gives me the following:

ArgumentException: ComputeBuffer.SetData() : Accessing 832 bytes at offset 0 for Compute Buffer of size 208 bytes is not possible.
UnityEngine.ComputeBuffer.SetData[T] (System.Collections.Generic.List`1[T] data) (at <da7cdc01e3cf4ce5b78778fcf6bb28ca>:0)
UnityEngine.Rendering.HighDefinition.HDShadowManager.PrepareGPUShadowDatas (UnityEngine.Rendering.CullingResults cullResults, UnityEngine.Rendering.HighDefinition.HDCamera camera) (at C:/Users/Tomas/Documents/Github_Projects/Graphics2/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.cs:706)
UnityEngine.Rendering.HighDefinition.HDRenderPipeline.PrepareLightsForGPU (UnityEngine.Rendering.CommandBuffer cmd, UnityEngine.Rendering.HighDefinition.HDCamera hdCamera, UnityEngine.Rendering.CullingResults cullResults, UnityEngine.Rendering.HighDefinition.HDProbeCullingResults hdProbeCullingResults, UnityEngine.Rendering.HighDefinition.DensityVolumeList densityVolumes, UnityEngine.Rendering.HighDefinition.ProbeVolumeList probeVolumes, UnityEngine.Rendering.HighDefinition.DebugDisplaySettings debugDisplaySettings, UnityEngine.Rendering.HighDefinition.AOVRequestData aovRequest) (at C:/Users/Tomas/Documents/Github_Projects/Graphics2/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs:2753)

i7vUk4rUob

Shadows are not displayed correctly without error spam only after reopening the project, but setting shadows above from zero and back to zero brings the issue back

Copy link
Contributor

@TomasKiniulis TomasKiniulis left a comment

Choose a reason for hiding this comment

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

Tested new changes with multiple quality levels and rendergraph enalbed/disabled. No exceptions occur anymore on my end when Maximum Shadows on Screen are set to 0

@sebastienlagarde sebastienlagarde merged commit 9f0a576 into hd/bugfix Nov 27, 2020
@sebastienlagarde sebastienlagarde deleted the hd/fix/max-shadow-crash branch November 27, 2020 17:11
sebastienlagarde added a commit that referenced this pull request Nov 30, 2020
* Fixed volume component tooltips using the same parameter name (#2754)

* Use the proper history info for Bicubic resampling in TAA (#2759)

* Use proper info for previous buffer info

* changelog

* Fixed lookdev movement (#2757)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* [HDRP] Fix issue with saving some quality settings in volume overrides (#2758)

* Fix issue with saving some quality settings volume overrides

* Fix typo in changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* [HDRP] Fixed NullReferenceException in HDRenderPipeline.UpgradeResourcesIfNeeded (case 1292524) (#2765)

* fix issue with confusing text (#2766)

* Fixed SSGI texture allocation with RG disabled (#2768)

* [HDRP] Fixed max shadow crash (#2760)

* Fixed NullReference Exception when setting Max Shadows On Screen to 0 in the HDRP asset

* Updated changelog

* Fixed nullref again + debug

* Initialize shadow request count

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Formatting

* Update CHANGELOG.md

Co-authored-by: Adrien de Tocqueville <adrien.tocqueville@unity3d.com>
Co-authored-by: FrancescoC-unity <43168857+FrancescoC-unity@users.noreply.github.com>
Co-authored-by: Pavlos Mavridis <pavlos.mavridis@unity3d.com>
Co-authored-by: Antoine Lelievre <antoinel@unity3d.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants