Skip to content

Commit 71ff6ff

Browse files
authored
Graphics repo works again with vanilla 2020.3 editor and probe volumes disabled in the frame settings. (#75)
* Revert "Remove MIXED_CACHED_SHADOW define to enable Dynamic Cached Shadows in 2020.2." This reverts commit 4d67365. * Probe Volumes: Fix case when ShaderConfig enables them, but they have not yet been enabled in the frame settings. Previously this case would spill errors about unassigned compute parameters like _ProbeVolumeAtlasSH - this comes up when creating standalone HDRP template projects for repro demos
1 parent 6c226ba commit 71ff6ff

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,12 +1046,9 @@ static void DrawShadowMapContent(SerializedHDLight serialized, Editor owner)
10461046

10471047
if(serialized.shadowUpdateMode.intValue > 0 && serialized.type != HDLightType.Directional)
10481048
{
1049-
1050-
// custom-begin:
1051-
// #if MIXED_CACHED_SHADOW
1049+
#if MIXED_CACHED_SHADOW
10521050
EditorGUILayout.PropertyField(serialized.shadowAlwaysDrawDynamic, s_Styles.shadowAlwaysDrawDynamic);
1053-
// #endif
1054-
// custom-end
1051+
#endif
10551052
EditorGUILayout.PropertyField(serialized.shadowUpdateUponTransformChange, s_Styles.shadowUpdateOnLightTransformChange);
10561053

10571054
}

com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDAdditionalLightData.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2070,12 +2070,10 @@ internal bool ShadowIsUpdatedEveryFrame()
20702070
internal ShadowMapUpdateType GetShadowUpdateType(HDLightType lightType)
20712071
{
20722072
if (ShadowIsUpdatedEveryFrame()) return ShadowMapUpdateType.Dynamic;
2073-
// custom-begin:
2074-
// #if MIXED_CACHED_SHADOW
2073+
#if MIXED_CACHED_SHADOW
20752074
// Note: For now directional are not supported as it will require extra memory budget. This will change in a near future.
20762075
if (m_AlwaysDrawDynamicShadows && lightType != HDLightType.Directional) return ShadowMapUpdateType.Mixed;
2077-
// #endif
2078-
// custom-end
2076+
#endif
20792077
return ShadowMapUpdateType.Cached;
20802078
}
20812079

com.unity.render-pipelines.high-definition/Runtime/Lighting/ProbeVolume/ProbeVolumeLighting.cs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,16 +1015,23 @@ ProbeVolumeList PrepareVisibleProbeVolumeList(HDCamera hdCamera, CommandBuffer i
10151015
{
10161016
ProbeVolumeList probeVolumes = new ProbeVolumeList();
10171017

1018-
if (!m_SupportProbeVolume)
1019-
return probeVolumes;
1020-
1021-
if (!hdCamera.frameSettings.IsEnabled(FrameSettingsField.ProbeVolume))
1022-
{
1023-
PushProbeVolumesGlobalParamsDefault(hdCamera, immediateCmd, renderGraph);
1024-
}
1025-
else
1018+
// In the case where ShaderConfig is setup to fully disable probe volumes, all probe volume variables are stripped, so no work is needed here.
1019+
// However, we can be in a state where ShaderConfig has enabled probe volumes, so the variables are defined, but framesettings disables probe volumes,
1020+
// so in this case we still need to push default parameters.
1021+
// In theory we could expose another keyword to strip out these variables when FrameSettings disables probe volumes, however we do not want to add another
1022+
// keyword and bloat compilation times just for this edge case.
1023+
// This edge case should only happen in practice when users are in the process of enabling probe volumes, but have not fully enabled them.
1024+
// Otherwise, they should just update ShaderConfig to disable probe volumes completely.
1025+
if (ShaderConfig.s_ProbeVolumesEvaluationMode != ProbeVolumesEvaluationModes.Disabled)
10261026
{
1027-
PrepareVisibleProbeVolumeListBuffers(hdCamera, immediateCmd, renderGraph, ref probeVolumes);
1027+
if (!m_SupportProbeVolume || !hdCamera.frameSettings.IsEnabled(FrameSettingsField.ProbeVolume))
1028+
{
1029+
PushProbeVolumesGlobalParamsDefault(hdCamera, immediateCmd, renderGraph);
1030+
}
1031+
else
1032+
{
1033+
PrepareVisibleProbeVolumeListBuffers(hdCamera, immediateCmd, renderGraph, ref probeVolumes);
1034+
}
10281035
}
10291036

10301037
return probeVolumes;

com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowAtlas.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,7 @@ static void RenderShadows( in RenderShadowsParameters parameters,
253253
continue;
254254

255255
bool mixedInDynamicAtlas = false;
256-
// custom-begin:
257-
// #if MIXED_CACHED_SHADOW
256+
#if MIXED_CACHED_SHADOW
258257
if (shadowRequest.isMixedCached)
259258
{
260259
mixedInDynamicAtlas = !renderingOnAShadowCache;
@@ -264,8 +263,7 @@ static void RenderShadows( in RenderShadowsParameters parameters,
264263
{
265264
shadowDrawSettings.objectsFilter = ShadowObjectsFilter.AllObjects;
266265
}
267-
// #endif
268-
// custom-end
266+
#endif
269267

270268
cmd.SetGlobalDepthBias(1.0f, shadowRequest.slopeBias);
271269
cmd.SetViewport(renderingOnAShadowCache ? shadowRequest.cachedAtlasViewport : shadowRequest.dynamicAtlasViewport);

0 commit comments

Comments
 (0)