Skip to content

Commit 620f000

Browse files
Revert "HDRenderLoop: Enable linearLighting and CCT + rename rebuild to build"
This reverts commit 4842000.
1 parent 4842000 commit 620f000

File tree

5 files changed

+20
-30
lines changed

5 files changed

+20
-30
lines changed

Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,10 @@ public TextureSettings textureSettings
152152
RenderTargetIdentifier m_DistortionBufferRT;
153153

154154
// Detect when windows size is changing
155-
int m_currentWidth;
156-
int m_currentHeight;
155+
int m_WidthOnRecord;
156+
int m_HeightOnRecord;
157157

158-
// Keep these settings safe to recover when leaving the render pipeline
159-
bool previousLightsUseLinearIntensity;
160-
bool previousLightsUseCCT;
161-
162-
// This must be allocate outside of Build() else the option in the class can't be set in the inspector (as it will in this case recreate the class with default value)
158+
// This must be allocate outside of Rebuild() else the option in the class can't be set in the inspector (as it will in this case recreate the class with default value)
163159
BaseLightLoop m_lightLoop = new TilePass.LightLoop();
164160

165161
public BaseLightLoop lightLoop
@@ -168,7 +164,7 @@ public BaseLightLoop lightLoop
168164
}
169165

170166
// TODO: Find a way to automatically create/iterate through deferred material
171-
// TODO TO CHECK: SebL I move allocation from Build() to here, but there was a comment "// Our object can be garbage collected, so need to be allocate here", it is still true ?
167+
// TODO TO CHECK: SebL I move allocation from Rebuild() to here, but there was a comment "// Our object can be garbage collected, so need to be allocate here", it is still true ?
172168
Lit.RenderLoop m_LitRenderLoop = new Lit.RenderLoop();
173169

174170
public override void Build()
@@ -179,10 +175,6 @@ public override void Build()
179175
reflectionProbe = UnityEditor.SupportedRenderingFeatures.ReflectionProbe.Rotation
180176
};
181177
#endif
182-
previousLightsUseLinearIntensity = UnityEngine.Rendering.GraphicsSettings.lightsUseLinearIntensity;
183-
previousLightsUseCCT = UnityEngine.Rendering.GraphicsSettings.lightsUseCCT;
184-
UnityEngine.Rendering.GraphicsSettings.lightsUseLinearIntensity = true;
185-
UnityEngine.Rendering.GraphicsSettings.lightsUseCCT = true;
186178

187179
m_CameraColorBuffer = Shader.PropertyToID("_CameraColorTexture");
188180
m_CameraDepthBuffer = Shader.PropertyToID("_CameraDepthTexture");
@@ -191,7 +183,7 @@ public override void Build()
191183
m_CameraDepthBufferRT = new RenderTargetIdentifier(m_CameraDepthBuffer);
192184

193185
m_SkyRenderer = new SkyRenderer();
194-
m_SkyRenderer.Build();
186+
m_SkyRenderer.Rebuild();
195187

196188
m_FinalPassMaterial = Utilities.CreateEngineMaterial("Hidden/HDRenderLoop/FinalPass");
197189
m_DebugViewMaterialGBuffer = Utilities.CreateEngineMaterial("Hidden/HDRenderLoop/DebugViewMaterialGBuffer");
@@ -223,15 +215,15 @@ public override void Build()
223215
m_DistortionBuffer = Shader.PropertyToID("_DistortionTexture");
224216
m_DistortionBufferRT = new RenderTargetIdentifier(m_DistortionBuffer);
225217

226-
m_LitRenderLoop.Build();
227-
m_lightLoop.Build(m_TextureSettings);
218+
m_LitRenderLoop.Rebuild();
219+
m_lightLoop.Rebuild(m_TextureSettings);
228220
}
229221

230222
public override void Cleanup()
231223
{
232-
m_lightLoop.Cleanup();
233224
m_LitRenderLoop.Cleanup();
234-
225+
m_lightLoop.Cleanup();
226+
235227
Utilities.Destroy(m_FinalPassMaterial);
236228
Utilities.Destroy(m_DebugViewMaterialGBuffer);
237229

@@ -243,8 +235,6 @@ public override void Cleanup()
243235
#if UNITY_EDITOR
244236
UnityEditor.SupportedRenderingFeatures.active = UnityEditor.SupportedRenderingFeatures.Default;
245237
#endif
246-
UnityEngine.Rendering.GraphicsSettings.lightsUseLinearIntensity = previousLightsUseLinearIntensity;
247-
UnityEngine.Rendering.GraphicsSettings.lightsUseCCT = previousLightsUseCCT;
248238
}
249239

250240
void InitAndClearBuffer(Camera camera, RenderLoop renderLoop)
@@ -572,18 +562,18 @@ void Resize(Camera camera)
572562
// For now consider we have only one camera that go to this code, the main one.
573563
m_SkyRenderer.Resize(m_SkyParameters); // TODO: Also a bad naming, here we just want to realloc texture if skyparameters change (usefull for lookdev)
574564

575-
if (camera.pixelWidth != m_currentWidth || camera.pixelHeight != m_currentHeight || m_lightLoop.NeedResize())
565+
if (camera.pixelWidth != m_WidthOnRecord || camera.pixelHeight != m_HeightOnRecord || m_lightLoop.NeedResize())
576566
{
577-
if (m_currentWidth > 0 && m_currentHeight > 0)
567+
if (m_WidthOnRecord > 0 && m_HeightOnRecord > 0)
578568
{
579569
m_lightLoop.ReleaseResolutionDependentBuffers();
580570
}
581571

582572
m_lightLoop.AllocResolutionDependentBuffers(camera.pixelWidth, camera.pixelHeight);
583573

584574
// update recorded window resolution
585-
m_currentWidth = camera.pixelWidth;
586-
m_currentHeight = camera.pixelHeight;
575+
m_WidthOnRecord = camera.pixelWidth;
576+
m_HeightOnRecord = camera.pixelHeight;
587577
}
588578
}
589579

Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/LightLoop.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace UnityEngine.Experimental.ScriptableRenderLoop
88
public class BaseLightLoop
99
{
1010
// TODO: We should rather put the texture settings in LightLoop, but how do we serialize it ?
11-
public virtual void Build(TextureSettings textureSettings) {}
11+
public virtual void Rebuild(TextureSettings textureSettings) {}
1212

1313
public virtual void Cleanup() {}
1414

@@ -22,7 +22,7 @@ public virtual void NewFrame() {}
2222

2323
public virtual void PrepareLightsForGPU(CullResults cullResults, Camera camera, ref ShadowOutput shadowOutput) { }
2424

25-
// TODO: this should not be part of the interface but for now make something working
25+
// TODO: this should not be aprt of the interface but for now make something working
2626
public virtual void BuildGPULightLists(Camera camera, RenderLoop loop, RenderTargetIdentifier cameraDepthBufferRT) { }
2727

2828
public virtual void PushGlobalParams(Camera camera, RenderLoop loop) {}

Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/TilePass/TilePass.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public void Allocate()
166166
public int debugViewTilesFlags = 0;
167167
public bool enableClustered = false;
168168
public bool disableFptlWhenClustered = true; // still useful on opaques. Should be false by default to force tile on opaque.
169-
public bool enableBigTilePrepass = false;
169+
public bool enableBigTilePrepass = true;
170170
const bool k_UseDepthBuffer = true; // only has an impact when EnableClustered is true (requires a depth-prepass)
171171
const bool k_UseAsyncCompute = true; // should not use on mobile
172172

@@ -209,7 +209,7 @@ int GetNumTileY(Camera camera)
209209
return (camera.pixelHeight + (k_TileSize - 1)) / k_TileSize;
210210
}
211211

212-
public override void Build(TextureSettings textureSettings)
212+
public override void Rebuild(TextureSettings textureSettings)
213213
{
214214
m_lightList = new LightList();
215215
m_lightList.Allocate();

Assets/ScriptableRenderLoop/HDRenderLoop/Material/Lit/Lit.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ Texture2D LoadLUT(TextureFormat format, float[] LtcGGXMagnitudeData,
242242
return CreateLUT(k_LtcLUTResolution, k_LtcLUTResolution, format, pixels);
243243
}
244244

245-
public void Build()
245+
public void Rebuild()
246246
{
247247
m_InitPreFGD = CreateEngineMaterial("Hidden/HDRenderLoop/PreIntegratedFGD");
248248
m_PreIntegratedFGD = new RenderTexture(128, 128, 0, RenderTextureFormat.ARGBHalf);
@@ -260,7 +260,7 @@ public void Cleanup()
260260
{
261261
Utilities.Destroy(m_InitPreFGD);
262262

263-
// TODO: how to delete RenderTexture ? or do we need to do it ?
263+
// TODO: how to delete RenderTexture ?
264264
isInit = false;
265265
}
266266

Assets/ScriptableRenderLoop/HDRenderLoop/Sky/SkyRenderer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public void Resize(SkyParameters skyParameters)
140140
RebuildTextures(skyParameters);
141141
}
142142

143-
public void Build()
143+
public void Rebuild()
144144
{
145145
// TODO: We need to have an API to send our sky information to Enlighten. For now use a workaround through skybox/cubemap material...
146146
m_StandardSkyboxMaterial = Utilities.CreateEngineMaterial("Skybox/Cubemap");

0 commit comments

Comments
 (0)