Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[SRP] Graphics SRP Devs 0006
Aggreate SRP PRs, those PRs have already been review by release management ahead.

[Graphics STG] Workflows fixes (#15398) 
Fix HDRP Upgrade's reference images not found issue (#15504) 
Fallback when not baked (#13292)
Refactor to allow for URP implementation (#14725)
Adding BRG gfxtest scene in HDRP (#15551)
Disable obsolete job (Create Ono PR) (#15972) 
Implement proper interctions between the water and the cloud system. (#14618)
[HDRP][Path tracing] Fix sky in interleaved tiled rendering (#15393) 
Fix menu missing after VolumeComponentMenu refacto (#15899)
Fix missing brick label in APV debug view when doing realtime subdivision (#15236)
Various improvements to HDRP's water system (#13525) 
[HDRP] Add test in HDRP_DXR_Tests for Pathtracing Tiled Rendering (#14718)
Fix an implementation problem related to the environment lights and ray tracing. (#15265)
[Water] Fix underwater test (#16424)
[HDRP] Update Material of the various test projects to be up to date (#16456)
Graphics/hdrp/bursted shadow requests (#12377) 
Disable APV during preview rendering. (#15848)
[APV] Fix baking set migration (#15431) 
Error for VT node on decal subtargets (#16274)
[HDRP] Implement a third level of noise for the volumetric clouds (#15405)
[RPW] Replaced all CEForRenderPipeline and VCMForRenderPipeline to separate attributes for HDRP (#15982)
[VFX][Tests] Fix VFX tests in HDRP_DXR on DX12 #16003
  • Loading branch information
sebastienlagarde authored and Evergreen committed Oct 22, 2022
1 parent 1d059b3 commit 6cfdd08
Show file tree
Hide file tree
Showing 2,297 changed files with 51,212 additions and 15,894 deletions.
Expand Up @@ -100,7 +100,7 @@ static string DumpValues(this IList list)
continue;

var valueCurrent = current != null ? field.GetValue(current) : null;

if (t == typeof(string))
{
var stringCurrent = (string)valueCurrent;
Expand Down
Expand Up @@ -365,7 +365,7 @@ public static void FindWorldBounds()
ProbeReferenceVolume.instance.globalBounds = globalBounds;
}

static void SetBakingContext(List<ProbeVolumePerSceneData> perSceneData)
static bool SetBakingContext(List<ProbeVolumePerSceneData> perSceneData)
{
// We need to make sure all scenes we are baking have the same profile. The same should be done for the baking settings, but we check only profile.
// TODO: This should be ensured by the controlling panel, until we have that we need to assert.
Expand All @@ -376,7 +376,12 @@ static void SetBakingContext(List<ProbeVolumePerSceneData> perSceneData)
var data = perSceneData[i];
var scene = data.gameObject.scene;
var profile = ProbeReferenceVolume.instance.sceneData.GetBakingSetForScene(scene);
Debug.Assert(profile != null, "Trying to bake a scene without a profile properly set.");

if (profile == null)
{
Debug.LogError($"Scene '{scene.name}' does not belong to any Baking Set. Please add it to a Baking Set in the Probe Volumes tab of the Lighting Window.");
return false;
}

// In case a scene is duplicated, we need to clear references to original asset
if (data.sceneGUID != data.gameObject.scene.GetGUID())
Expand All @@ -391,11 +396,11 @@ static void SetBakingContext(List<ProbeVolumePerSceneData> perSceneData)
m_BakingProfile = profile;
m_BakingSettings = profile.settings;
}
else
{
Debug.Assert(m_BakingProfile.IsEquivalent(profile));
}
else if (!m_BakingProfile.IsEquivalent(profile))
return false;
}

return true;
}

static void EnsurePerSceneDataInOpenScenes()
Expand Down Expand Up @@ -488,7 +493,8 @@ static void OnBakeStarted()

currentBakingState = BakingStage.Started;

SetBakingContext(sceneDataList);
if (!SetBakingContext(sceneDataList))
return;

if (isFreezingPlacement)
{
Expand Down
Expand Up @@ -318,7 +318,7 @@ void InitializeScenarioList()
middle.yMin += 2;
middle.width = 19;
EditorGUI.BeginChangeCheck();
bool toggled = EditorGUI.Toggle(middle, (ProbeReferenceVolume.instance.lightingScenario == scenarioName) && profile.sceneGUIDs.Count != 0, EditorStyles.radioButton);
bool toggled = EditorGUI.Toggle(middle, ProbeReferenceVolume.instance.lightingScenario == scenarioName, EditorStyles.radioButton);
if (EditorGUI.EndChangeCheck() && toggled)
SetActiveScenario(scenarioName);
Expand Down Expand Up @@ -378,6 +378,13 @@ void InitializeScenarioList()
}
};

m_Scenarios.onSelectCallback = (ReorderableList list) =>
{
SetActiveScenario(profile.lightingScenarios[list.index]);
SceneView.RepaintAll();
Repaint();
};

m_Scenarios.onAddCallback = (list) =>
{
serializedObject.ApplyModifiedProperties();
Expand Down
Expand Up @@ -8,16 +8,6 @@
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/EntityLighting.hlsl"

#include "Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.Dilate.cs.hlsl"

#ifndef __BUILTINGIUTILITIES_HLSL__
// We don't need this.
real3 EvaluateAmbientProbe(real3 normalWS)
{
return 0;
}
#endif


#include "Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolume.hlsl"

CBUFFER_START(APVDilation)
Expand Down
Expand Up @@ -98,6 +98,8 @@ static ProbeVolumeBakingSet defaultSet

public static ProbeVolumeLightingTab instance;

public static bool singleSceneMode => instance?.m_SingleSceneMode ?? true;


Vector2 m_ScrollPosition = Vector2.zero;
bool m_SingleSceneMode = true;
Expand Down Expand Up @@ -159,19 +161,17 @@ public override void OnEnable()
titleContent = new GUIContent("Probe Volumes");
priority = 1;

k_Foldouts = new(k_ExpandableDefault, "APV");

RefreshSceneAssets();
}

void Initialize()
{
if (!ProbeReferenceVolume.instance.isInitialized || !ProbeReferenceVolume.instance.enabledBySRP)
{
string apvDisabledErrorMsg = "The Probe Volume is not enabled.";
string apvDisabledErrorMsg = "Probe Volumes are not enabled.";
var renderPipelineAsset = GraphicsSettings.renderPipelineAsset;
if (renderPipelineAsset != null && renderPipelineAsset.GetType().Name == "HDRenderPipelineAsset")
apvDisabledErrorMsg += " Make sure it is enabled in the HDRP asset in use.";
apvDisabledErrorMsg += " Make sure Light Probe System is set to Probe Volumes in the HDRP asset in use.";

EditorGUILayout.HelpBox(apvDisabledErrorMsg, MessageType.Error);
EditorGUILayout.Space();
Expand Down Expand Up @@ -227,7 +227,7 @@ public override void OnGUI()
UseTemporaryBakingSet(activeScene.GetGUID(), activeSet ? activeSet.Clone() : null);
}

using (new EditorGUI.DisabledScope(!m_Initialized))
using (new EditorGUI.DisabledScope(!ProbeReferenceVolume.instance.isInitialized || !ProbeReferenceVolume.instance.enabledBySRP))
{
m_ScrollPosition = EditorGUILayout.BeginScrollView(m_ScrollPosition);

Expand Down Expand Up @@ -295,6 +295,14 @@ void BakeButtonCallback(object data)

if (ButtonWithDropdownList(Styles.generateLighting, Styles.bakeOptionsText, BakeButtonCallback, GUILayout.Width(Styles.lightingButtonWidth)))
{
// Make sure APV is enabled
var sceneData = ProbeReferenceVolume.instance.sceneData;
if (!ProbeReferenceVolume.instance.isInitialized || !ProbeReferenceVolume.instance.enabledBySRP || sceneData == null)
{
Lightmapping.BakeAsync();
return;
}

bool createPV = m_SingleSceneMode ? !ActiveSceneHasProbeVolume() : NoSceneHasProbeVolume();
if (createPV && EditorUtility.DisplayDialog("No Probe Volume in Scene", "Probe Volumes are enabled for this Project, but none exist in the Scene.\n\n" +
"Do you whish to add a Probe Volume to the Active Scene?", "Yes", "No"))
Expand All @@ -315,7 +323,6 @@ void BakeButtonCallback(object data)
SaveTempBakingSetIfNeeded();

// Exclude scenes unchecked from the UI and scenes from other baking sets
var sceneData = ProbeReferenceVolume.instance.sceneData;
ProbeGIBaking.partialBakeSceneList = new();
for (int i = 0; i < SceneManager.sceneCount; i++)
{
Expand All @@ -330,7 +337,7 @@ void BakeButtonCallback(object data)
ProbeGIBaking.partialBakeSceneList = null;

if (ProbeReferenceVolume.instance.supportLightingScenarios && !activeSet.lightingScenarios.Contains(sceneData.lightingScenario))
sceneData.SetActiveScenario(activeSet.lightingScenarios[0]);
sceneData.SetActiveScenario(activeSet.lightingScenarios[0], false);

Lightmapping.BakeAsync();
}
Expand Down Expand Up @@ -548,6 +555,7 @@ ProbeVolumeBakingSet CreateBakingSet()
var newSet = ScriptableObject.CreateInstance<ProbeVolumeBakingSet>();
newSet.name = "New Baking Set";
newSet.singleSceneMode = false;
newSet.settings.SetDefaults();
ProjectWindowUtil.CreateAsset(newSet, System.IO.Path.Combine(path, "New Baking Set.asset").Replace('\\', '/'));
return newSet;
}
Expand Down Expand Up @@ -690,7 +698,7 @@ void InitializeSceneList()
rect.yMax--;
SplitRectInThree(rect, out var sceneRect, out var statusRect, out var bakeRect);
var scene = FindSceneData(activeSet.sceneGUIDs[index]);
var scene = index < activeSet.sceneGUIDs.Count ? FindSceneData(activeSet.sceneGUIDs[index]) : default;
Scene scene2 = SceneManager.GetSceneByPath(scene.GetPath());
bool isLoaded = scene2.isLoaded;
bool isActive = SceneManager.GetActiveScene() == scene2;
Expand All @@ -709,7 +717,7 @@ void InitializeSceneList()
bakeRect.width = 21;
bool bake = true;
if (sceneData.SceneHasProbeVolumes(scene.guid))
if (scene.guid != null && sceneData.SceneHasProbeVolumes(scene.guid))
{
EditorGUI.BeginChangeCheck();
EditorGUI.LabelField(bakeRect, Styles.bakeBox); // Show a tooltip on the checkbox
Expand All @@ -730,7 +738,7 @@ void InitializeSceneList()
content = Styles.iconEnableAll;
scenesToEnable.Add(scene);
}
if (!isLoaded)
if (!isLoaded && scene.guid != null)
{
content = Styles.iconLoadForBake;
scenesForBake.Add(scene);
Expand Down Expand Up @@ -831,7 +839,7 @@ internal void OnSceneOpened(Scene scene, OpenSceneMode mode)

// If we load a new scene that doesn't have the current scenario, change it
if (!set.lightingScenarios.Contains(ProbeReferenceVolume.instance.lightingScenario))
ProbeReferenceVolume.instance.lightingScenario = set.lightingScenarios[0];
ProbeReferenceVolume.instance.sceneData.SetActiveScenario(set.lightingScenarios[0], false);
}
}

Expand Down Expand Up @@ -938,6 +946,9 @@ internal static bool Foldout(GUIContent label, Expandable expandable, bool title
contextMenuCallback(contextMenuRect);
}

if (k_Foldouts == null)
k_Foldouts = new(k_ExpandableDefault, "APV");

bool foldout = title ?
(bool)k_FoldoutTitlebar.Invoke(null, new object[] { labelRect, label, k_Foldouts[expandable], true }) :
EditorGUI.Foldout(labelRect, k_Foldouts[expandable], label, true);
Expand Down Expand Up @@ -1120,7 +1131,7 @@ class ProbeVolumeOverlay : Overlay, ITransientOverlay
{
var profile = ProbeReferenceVolume.instance.sceneData.GetBakingSetForScene(probeVolume.gameObject.scene);
if (profile != null)
return (profile.maxSubdivision - 1, profile.minDistanceBetweenProbes);
return (profile.maxSubdivision, profile.minDistanceBetweenProbes);
}
}

Expand Down
@@ -1,7 +1,6 @@
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.Rendering;

namespace UnityEditor.Rendering.HighDefinition
namespace UnityEditor.Rendering
{
[CustomEditor(typeof(ProbeVolumesOptions))]
sealed class ProbeVolumesOptionsEditor : VolumeComponentEditor
Expand Down
Expand Up @@ -4,6 +4,7 @@
using UnityEngine;
using UnityEngine.Rendering;
using System.Runtime.CompilerServices;
using Unity.Mathematics;

namespace UnityEditor.Rendering
{
Expand Down Expand Up @@ -1267,6 +1268,35 @@ public bool Generate()
EmitPrimitiveType(PrimitiveType.UInt, 4, arraySize, field.Name, "", preprocessor, m_ShaderFields);
else if (fieldType == typeof(Matrix4x4))
EmitMatrixType(floatPrecision, 4, 4, arraySize, field.Name, "", preprocessor, m_ShaderFields);

// Mathematics floating
else if (fieldType == typeof(float2))
EmitPrimitiveType(floatPrecision, 2, arraySize, field.Name, "", preprocessor, m_ShaderFields);
else if (fieldType == typeof(float3))
EmitPrimitiveType(floatPrecision, 4, arraySize, field.Name, "", preprocessor, m_ShaderFields);
else if (fieldType == typeof(float4))
EmitPrimitiveType(floatPrecision, 4, arraySize, field.Name, "", preprocessor, m_ShaderFields);

// Mathematics Signed integer
else if (fieldType == typeof(int2))
EmitPrimitiveType(PrimitiveType.Int, 2, arraySize, field.Name, "", preprocessor, m_ShaderFields);
else if (fieldType == typeof(int3))
EmitPrimitiveType(PrimitiveType.Int, 4, arraySize, field.Name, "", preprocessor, m_ShaderFields);
else if (fieldType == typeof(int4))
EmitPrimitiveType(PrimitiveType.Int, 4, arraySize, field.Name, "", preprocessor, m_ShaderFields);

// Mathematics Unsigned integer
else if (fieldType == typeof(uint2))
EmitPrimitiveType(PrimitiveType.UInt, 2, arraySize, field.Name, "", preprocessor, m_ShaderFields);
else if (fieldType == typeof(uint3))
EmitPrimitiveType(PrimitiveType.UInt, 4, arraySize, field.Name, "", preprocessor, m_ShaderFields);
else if (fieldType == typeof(uint4))
EmitPrimitiveType(PrimitiveType.UInt, 4, arraySize, field.Name, "", preprocessor, m_ShaderFields);

// Mathematics Matrix
else if (fieldType == typeof(float4x4))
EmitMatrixType(floatPrecision, 4, 4, arraySize, field.Name, "", preprocessor, m_ShaderFields);

else if (!ExtractComplex(field, preprocessor, m_ShaderFields))
{
// Error reporting done in ExtractComplex()
Expand Down
Expand Up @@ -3,7 +3,8 @@
"rootNamespace": "",
"references": [
"GUID:df380645f10b7bc4b97d4f5eb6303d95",
"GUID:2665a8d13d1b3f18800f46e256720795"
"GUID:2665a8d13d1b3f18800f46e256720795",
"GUID:d8b63aba1907145bea998dd612889d6b"
],
"includePlatforms": [
"Editor"
Expand Down
8 changes: 8 additions & 0 deletions Packages/com.unity.render-pipelines.core/Runtime/Debug.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -1,11 +1,7 @@
#ifndef PROBEVOLUMEDEBUG_HLSL
#define PROBEVOLUMEDEBUG_HLSL

#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/EntityLighting.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonLighting.hlsl"
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinGIUtilities.hlsl"
#ifndef PROBEVOLUMEDEBUG_BASE_HLSL
#define PROBEVOLUMEDEBUG_BASE_HLSL

// Requires includes in the .shader file
#include "Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/DecodeSH.hlsl"
#include "Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolume.hlsl"
#include "Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeReferenceVolume.Debug.cs.hlsl"
Expand Down Expand Up @@ -118,4 +114,4 @@ float3 CalculateDiffuseLighting(v2f i)
return bakeDiffuseLighting;
}

#endif //PROBEVOLUMEDEBUG_HLSL
#endif //PROBEVOLUMEDEBUG_BASE_HLSL

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6cfdd08

Please sign in to comment.