Skip to content

Commit 1667bea

Browse files
giulia-u3dEvergreen
authored andcommitted
[content automatically redacted] touching PlatformDependent folder
1 parent fcf5c68 commit 1667bea

7 files changed

Lines changed: 41 additions & 1 deletion

File tree

Packages/com.unity.render-pipelines.universal/Runtime/Data/UniversalRenderPipelineAsset.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,12 @@ public partial class UniversalRenderPipelineAsset : RenderPipelineAsset<Universa
518518

519519
// Additional lights settings
520520
[SerializeField] LightRenderingMode m_AdditionalLightsRenderingMode = LightRenderingMode.PerPixel;
521+
522+
#if UNITY_META_QUEST
523+
#if UNITY_EDITOR // multi_compile _ META_QUEST_LIGHTUNROLL (only on meta platforms)
524+
[ShaderKeywordFilter.RemoveIfNot(1, keywordNames: ShaderKeywordStrings.META_QUEST_LIGHTUNROLL)]
525+
#endif
526+
#endif
521527
[SerializeField] int m_AdditionalLightsPerObjectLimit = 4;
522528
[SerializeField] bool m_AdditionalLightShadowsSupported = false;
523529
[SerializeField] ShadowResolution m_AdditionalLightsShadowmapResolution = ShadowResolution._2048;

Packages/com.unity.render-pipelines.universal/Runtime/ForwardLights.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,10 @@ internal void SetupLights(UnsafeCommandBuffer cmd, UniversalRenderingData render
523523
cmd.SetKeyword(ShaderGlobalKeywords.ReflectionProbeAtlas, lightData.reflectionProbeAtlas && m_UseForwardPlus && lightData.reflectionProbeBlending); // Needs to match shader stripping
524524

525525
var asset = UniversalRenderPipeline.asset;
526-
526+
#if UNITY_META_QUEST
527+
if (asset != null)
528+
cmd.SetKeyword(ShaderGlobalKeywords.META_QUEST_LIGHTUNROLL, asset.maxAdditionalLightsCount == 1 && asset.additionalLightsRenderingMode != LightRenderingMode.Disabled);
529+
#endif
527530
bool apvIsEnabled = asset != null && asset.lightProbeSystem == LightProbeSystem.ProbeVolumes;
528531
#if UNITY_WEBGL && !UNITY_EDITOR
529532
apvIsEnabled &= SystemInfo.graphicsDeviceType == GraphicsDeviceType.WebGPU; // APV not supported on WebGL, don't try to enable it. WebGPU is fine, though.

Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipelineCore.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -977,6 +977,11 @@ internal static class ShaderGlobalKeywords
977977
public static GlobalKeyword LinearToSRGBConversion;
978978
public static GlobalKeyword _ENABLE_ALPHA_OUTPUT;
979979
public static GlobalKeyword ForwardPlus; // Backward compatibility. Deprecated in 6.1.
980+
981+
#if UNITY_META_QUEST
982+
public static GlobalKeyword META_QUEST_LIGHTUNROLL;
983+
#endif
984+
980985
// TODO: Move following keywords to Local keywords?
981986
// https://docs.unity3d.com/ScriptReference/Rendering.LocalKeyword.html
982987
//public static GlobalKeyword TonemapACES;
@@ -1090,6 +1095,10 @@ public static void InitializeShaderGlobalKeywords()
10901095
ShaderGlobalKeywords.LinearToSRGBConversion = GlobalKeyword.Create(ShaderKeywordStrings.LinearToSRGBConversion);
10911096
ShaderGlobalKeywords._ENABLE_ALPHA_OUTPUT = GlobalKeyword.Create(ShaderKeywordStrings._ENABLE_ALPHA_OUTPUT);
10921097
ShaderGlobalKeywords.ForwardPlus = GlobalKeyword.Create(ShaderKeywordStrings.ForwardPlus); // Backward compatibility. Deprecated in 6.1.
1098+
#if UNITY_META_QUEST
1099+
ShaderGlobalKeywords.META_QUEST_LIGHTUNROLL = GlobalKeyword.Create(ShaderKeywordStrings.META_QUEST_LIGHTUNROLL);
1100+
#endif
1101+
10931102
}
10941103
}
10951104

@@ -1422,6 +1431,11 @@ public static class ShaderKeywordStrings
14221431
/// <summary> Deprecated keyword. Use ClusterLightLoop instead. </summary>
14231432
internal const string ForwardPlus = "_FORWARD_PLUS"; // Backward compatibility. Deprecated in 6.1.
14241433

1434+
#if UNITY_META_QUEST
1435+
/// <summary> Unroll light loop if there is only one additional light on Meta Quest device . </summary>
1436+
internal const string META_QUEST_LIGHTUNROLL = "META_QUEST_LIGHTUNROLL";
1437+
#endif
1438+
14251439
/// <summary> Keyword used for Multi Sampling Anti-Aliasing (MSAA) with 2 per pixel sample count. </summary>
14261440
public const string Msaa2 = "_MSAA_2";
14271441

Packages/com.unity.render-pipelines.universal/ShaderLibrary/RealtimeLights.hlsl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ struct Light
2424
#define CLUSTER_LIGHT_LOOP_SUBTRACTIVE_LIGHT_CHECK
2525
#endif
2626

27+
28+
#if defined(UNITY_PLATFORM_META_QUEST) && META_QUEST_LIGHTUNROLL
29+
#define UNROLL_ONELIGHT [unroll(1)]
30+
#else
31+
#define UNROLL_ONELIGHT
32+
#endif
33+
2734
#if USE_CLUSTER_LIGHT_LOOP
2835
#define LIGHT_LOOP_BEGIN(lightCount) { \
2936
uint lightIndex; \
@@ -34,6 +41,7 @@ struct Light
3441
#define LIGHT_LOOP_END } }
3542
#else
3643
#define LIGHT_LOOP_BEGIN(lightCount) \
44+
UNROLL_ONELIGHT \
3745
for (uint lightIndex = 0u; lightIndex < lightCount; ++lightIndex) {
3846
#define LIGHT_LOOP_END }
3947
#endif

Packages/com.unity.render-pipelines.universal/Shaders/ComplexLit.shader

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ Shader "Universal Render Pipeline/Complex Lit"
135135

136136
// -------------------------------------
137137
// Universal Pipeline keywords
138+
#if defined(UNITY_PLATFORM_META_QUEST)
139+
#pragma multi_compile _ META_QUEST_LIGHTUNROLL
140+
#endif
138141
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
139142
#pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
140143
#pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX

Packages/com.unity.render-pipelines.universal/Shaders/Lit.shader

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ Shader "Universal Render Pipeline/Lit"
135135

136136
// -------------------------------------
137137
// Universal Pipeline keywords
138+
#if defined(UNITY_PLATFORM_META_QUEST)
139+
#pragma multi_compile _ META_QUEST_LIGHTUNROLL
140+
#endif
138141
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
139142
#pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
140143
#pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX

Packages/com.unity.render-pipelines.universal/Shaders/SimpleLit.shader

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ Shader "Universal Render Pipeline/Simple Lit"
100100

101101
// -------------------------------------
102102
// Universal Pipeline keywords
103+
#if defined(UNITY_PLATFORM_META_QUEST)
104+
#pragma multi_compile _ META_QUEST_LIGHTUNROLL
105+
#endif
103106
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
104107
#pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
105108
#pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX

0 commit comments

Comments
 (0)