Skip to content

Conversation

lukaschod
Copy link
Contributor

@lukaschod lukaschod commented Sep 7, 2021

Purpose of this PR

This is follow up of #5060.

Stripping disabled variants if feature is enabled:

  • Main light shadows.
  • Additional light.
  • Additional light shadows.

Testing status

  • Local GFX foundation passing.
  • Tested empty project, urp template.

Empty project with most features enabled lit shader:
Before: 93
After 48

Foundation:
Before: 44k (10k lit)
After: 24k (5k lit)


Comments to reviewers

Notes for the reviewers you have assigned.

@github-actions
Copy link

github-actions bot commented Sep 7, 2021

Hi! This comment will help you figure out which jobs to run before merging your PR. The suggestions are dynamic based on what files you have changed.
Link to Yamato: https://yamato.cds.internal.unity3d.com/jobs/902-Graphics
Search for your PR branch using the sidebar on the left, then add the following segment(s) to the end of the URL (you may need multiple tabs depending on how many packages you change)

URP
/.yamato%252Fall-urp.yml%2523PR_URP_trunk

Depending on the scope of your PR, you may need to run more jobs than what has been suggested. Please speak to your lead or a Graphics SDET (#devs-graphics-automation) if you are unsure.

@lukaschod lukaschod marked this pull request as ready for review September 28, 2021 09:51
@lukaschod lukaschod requested review from a team as code owners September 28, 2021 09:51
@lukaschod lukaschod changed the title (Experimental) Adding strip off variants for additional lights and ma… [2022.1] Add Shadow and Additional light variant stripping Sep 28, 2021
Copy link
Contributor

@ellioman ellioman left a comment

Choose a reason for hiding this comment

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

Added a few comments that I want you to take a look at before approving.

…universal/strip-off-shadows-addlights

# Conflicts:
#	com.unity.render-pipelines.universal/CHANGELOG.md
@lukaschod lukaschod requested a review from phi-lira September 30, 2021 09:54
Copy link
Contributor

@phi-lira phi-lira left a comment

Choose a reason for hiding this comment

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

Approving with some comments.

Comment on lines 125 to 130
internal void SetupForEmptyRendering()
{
m_MainLightShadowmapTexture = ShadowUtils.GetTemporaryShadowTexture(1, 1, k_ShadowmapBufferBits);
m_CreateEmptyShadowmap = true;
useNativeRenderPass = false;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor: When reviewing it felt confusing to you have two initialization steps in setup and execute and the initialization fields differ between main and additional light shadow pass. So it seems arbitrary at first.

F.ex in the additional shadow pass you create and initialize the texture in the setup, in the main pass you create the texture in setup but initialize it in execute.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we actually need to have the separate setup initalization, this adds more code to tests and renderer setup.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed


SetupShaderLightConstants(cmd, ref renderingData);

bool lightCountCheck = (m_AdditionalLightsAlwaysEnabled && renderingData.lightData.maxPerObjectAdditionalLightsCount > 0) || additionalLightsCount > 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

can additionalLightsCount be changed at runtime and you get into a situation that the keyword and stripped and at runtime you try to enable it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

add additional check to prevent this

Copy link

@aleksandrasdzikia aleksandrasdzikia left a comment

Choose a reason for hiding this comment

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

Looks good. Tested URP template and Viking Village. Visual correctness looks good, no performance regression. Played around with different settings, didn't find any issues.

@lukaschod
Copy link
Contributor Author

URP_Foundation on Android_OpenGLES3_Standalone_il2cpp_Linear on version trunk
https://unity-ci.cds.internal.unity3d.com/job/9183640
URP_Foundation on Android_Vulkan_Standalone_il2cpp_Linear on version trunk
https://unity-ci.cds.internal.unity3d.com/job/9167131
URP_Lighting on Android_OpenGLES3_Standalone_il2cpp_Linear on version trunk
https://unity-ci.cds.internal.unity3d.com/job/9167152
URP_Lighting on Android_Vulkan_Standalone_il2cpp_Linear on version trunk
Connection Failure on master

URP_PostPro on Android_Vulkan_Standalone_il2cpp_Linear on version trunk
https://unity-ci.cds.internal.unity3d.com/job/9156314
URP_PostPro on Linux_Vulkan_Standalone_mono_Linear on version trunk
https://unity-ci.cds.internal.unity3d.com/job/9156313
URP_PostPro on Win_Vulkan_Standalone_mono_Linear on version trunk
failing tests on master
UniversalGraphicsTests.145_SoftParticlesStackWithPP
UniversalGraphicsTests.145_SoftParticlesStackWithPP_deferred

URP_PostPro on OSX_Metal_playmode_mono_Linear on version trunk
https://unity-ci.cds.internal.unity3d.com/job/9173533
Some random failure on master

URP_PostPro on Win_DX11_playmode_XR_mono_Linear on version trunk
https://unity-ci.cds.internal.unity3d.com/job/9149555
Same issue on master
One or more child steps have failed.
Editor exited with non-zero exit code: -1073741819

URP_Terrain on Android_OpenGLES3_Standalone_il2cpp_Linear on version trunk
https://unity-ci.cds.internal.unity3d.com/job/9159438
URP_Terrain on Android_Vulkan_Standalone_il2cpp_Linear on version trunk
https://unity-ci.cds.internal.unity3d.com/job/9167173
URP_Terrain on OSX_Metal_playmode_mono_Linear on version trunk
Same issue on master

Universal_Stereo on Win__Standalone_mono_Linear on version trunk
https://unity-ci.cds.internal.unity3d.com/job/9183646
master failing LWGraphicsTests.126_SampleDepth

Copy link
Contributor

@phi-lira phi-lira left a comment

Choose a reason for hiding this comment

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

LGTM.

@phi-lira phi-lira changed the base branch from master to universal/staging October 6, 2021 14:46
@phi-lira phi-lira merged commit 6b9b612 into universal/staging Oct 6, 2021
@phi-lira phi-lira deleted the universal/strip-off-shadows-addlights branch October 6, 2021 14:47
@phi-lira phi-lira mentioned this pull request Oct 6, 2021
lukaschod added a commit that referenced this pull request Oct 14, 2021
lukaschod added a commit that referenced this pull request Oct 21, 2021
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.

6 participants