Skip to content

Commit

Permalink
com.unity.render-pipelines.core@11.0.0 in Unity 2021.1.9f1
Browse files Browse the repository at this point in the history
## [11.0.0] - 2020-10-21

### Added
- Support for the PlayStation 5 platform has been added.
- Support for the XboxSeries platform has been added.
- New API in DynamicResolutionHandler to handle multicamera rendering for hardware mode. Changing cameras and resetting scaling per camera should be safe.
- New API functions with no side effects in DynamicResolutionHandler, to retrieve resolved drs scale and to apply DRS on a size.

### Fixed
- Fixed the default background color for previews to use the original color.
- Fixed a bug in FreeCamera which would only provide a speed boost for the first frame when pressing the Shfit key.
- Fixed spacing between property fields on the Volume Component Editors.
- Fixed ALL/NONE to maintain the state on the Volume Component Editors.
- Fixed the selection of the Additional properties from ALL/NONE when the option "Show additional properties" is disabled
- Fixed ACES tonemaping for Nintendo Switch by forcing some shader color conversion functions to full float precision.
- Fixed missing warning UI about Projector component being unsupported (case 1300327).
- Fixed the display name of a Volume Parameter when is defined the attribute InspectorName
- Fixed ACES tonemaping on mobile platforms by forcing some shader color conversion functions to full float precision.
- Fix crash on VolumeComponentWithQualityEditor when the current Pipeline is not HDRP
- Calculating correct rtHandleScale by considering the possible pixel rounding when DRS is on
- Fixed ACES filter artefact due to half floating point error on some mobile platforms.
  • Loading branch information
Unity Technologies committed May 23, 2021
1 parent 52bf9f1 commit 2e75eb8
Show file tree
Hide file tree
Showing 8 changed files with 140 additions and 44 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed ACES tonemaping on mobile platforms by forcing some shader color conversion functions to full float precision.
- Fix crash on VolumeComponentWithQualityEditor when the current Pipeline is not HDRP
- Calculating correct rtHandleScale by considering the possible pixel rounding when DRS is on
- Fixed ACES filter artefact due to half floating point error on some mobile platforms.

## [10.2.0] - 2020-10-19

Expand Down
1 change: 1 addition & 0 deletions Editor/LookDev/DisplayWindow.uss
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#viewContainer
{
min-width: 50px;
flex-shrink: 0;
}

Expand Down
2 changes: 1 addition & 1 deletion Runtime/Debugging/DebugManager.Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ internal float GetAction(DebugAction action)

void RegisterInputs()
{
#if UNITY_EDITOR
#if UNITY_EDITOR && !USE_INPUT_SYSTEM
var inputEntries = new List<InputManagerEntry>
{
new InputManagerEntry { name = kEnableDebugBtn1, kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "left ctrl", altBtnPositive = "joystick button 8" },
Expand Down
6 changes: 4 additions & 2 deletions Runtime/Debugging/Prefabs/Scripts/DebugUIHandlerBitField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace UnityEngine.Rendering.UI
{
/// <summary>
/// DebugUIHandler for Bitfield widget. Require the enum to have a None field set to 0 in it's values.
/// DebugUIHandler for Bitfield widget. Require the enum to have a None field set to 0 in its values.
/// </summary>
public class DebugUIHandlerBitField : DebugUIHandlerWidget
{
Expand Down Expand Up @@ -45,9 +45,11 @@ internal override void SetWidget(DebugUI.Widget widget)
}
;

// Destroy the remaining toggles outside of the range of the displayed enum.
for (; toggleIndex < toggles.Count; ++toggleIndex)
{
toggles[toggleIndex].transform.SetParent(null);
CoreUtils.Destroy(toggles[toggleIndex].gameObject);
toggles[toggleIndex] = null;
}
}

Expand Down
158 changes: 119 additions & 39 deletions Runtime/Inputs/InputRegistering.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,45 +11,36 @@ public enum Kind { KeyOrButton, Mouse, Axis }
public enum Axis { X, Y, Third, Fourth, Fifth, Sixth, Seventh, Eigth }
public enum Joy { All, First, Second }

public string name = "";
public string desc = "";
public string btnNegative = "";
public string btnPositive = "";
public string altBtnNegative = "";
public string altBtnPositive = "";
public float gravity = 0.0f;
public float deadZone = 0.0f;
public float sensitivity = 0.0f;
public bool snap = false;
public bool invert = false;
public Kind kind = Kind.Axis;
public Axis axis = Axis.X;
public Joy joystick = Joy.All;
public string name = "";
public string desc = "";
public string btnNegative = "";
public string btnPositive = "";
public string altBtnNegative = "";
public string altBtnPositive = "";
public float gravity = 0.0f;
public float deadZone = 0.0f;
public float sensitivity = 0.0f;
public bool snap = false;
public bool invert = false;
public Kind kind = Kind.Axis;
public Axis axis = Axis.X;
public Joy joystick = Joy.All;

internal bool IsEqual((string name, InputManagerEntry.Kind kind) partialEntry)
=> this.name == partialEntry.name && this.kind == partialEntry.kind;

internal bool IsEqual(InputManagerEntry other)
=> this.name == other.name && this.kind == other.kind;
}

public class InputRegistering
public static class InputRegistering
{
static bool InputAlreadyRegistered(string name, InputManagerEntry.Kind kind, SerializedProperty spAxes)
{
for (var i = 0; i < spAxes.arraySize; ++i)
{
var spAxis = spAxes.GetArrayElementAtIndex(i);
var axisName = spAxis.FindPropertyRelative("m_Name").stringValue;
var kindValue = spAxis.FindPropertyRelative("type").intValue;
if (axisName == name && (int)kind == kindValue)
return true;
}
static List<InputManagerEntry> s_PendingInputsToRegister = new List<InputManagerEntry>();

return false;
}
static bool havePendingOperation => s_PendingInputsToRegister.Count > 0;

static void WriteEntry(SerializedProperty spAxes, InputManagerEntry entry)
static void CopyEntry(SerializedProperty spAxis, InputManagerEntry entry)
{
if (InputAlreadyRegistered(entry.name, entry.kind, spAxes))
return;

spAxes.InsertArrayElementAtIndex(spAxes.arraySize);
var spAxis = spAxes.GetArrayElementAtIndex(spAxes.arraySize - 1);
spAxis.FindPropertyRelative("m_Name").stringValue = entry.name;
spAxis.FindPropertyRelative("descriptiveName").stringValue = entry.desc;
spAxis.FindPropertyRelative("negativeButton").stringValue = entry.btnNegative;
Expand All @@ -66,8 +57,76 @@ static void WriteEntry(SerializedProperty spAxes, InputManagerEntry entry)
spAxis.FindPropertyRelative("joyNum").intValue = (int)entry.joystick;
}

public static void RegisterInputs(List<InputManagerEntry> entries)
static void AddEntriesWithoutCheck(SerializedProperty spAxes, List<InputManagerEntry> newEntries)
{
int endOfCurrentInputList = spAxes.arraySize;
spAxes.arraySize = endOfCurrentInputList + newEntries.Count;

SerializedProperty spAxis = spAxes.GetArrayElementAtIndex(endOfCurrentInputList - 1);
spAxis.Next(false);
for (int i = 0; i < newEntries.Count; ++i, spAxis.Next(false))
CopyEntry(spAxis, newEntries[i]);
}

// Get a representation of the already registered inputs
static List<(string name, InputManagerEntry.Kind kind)> GetCachedInputs(SerializedProperty spAxes)
{
int size = spAxes.arraySize;
List<(string name, InputManagerEntry.Kind kind)> result = new List<(string name, InputManagerEntry.Kind kind)>(size);

SerializedProperty spAxis = spAxes.GetArrayElementAtIndex(0);
for (int i = 0; i < size; ++i, spAxis.Next(false))
result.Add((spAxis.FindPropertyRelative("m_Name").stringValue, (InputManagerEntry.Kind)spAxis.FindPropertyRelative("type").intValue));
return result;
}

static void MakeUniquePendingInputsToRegister()
{
for (int pendingIndex = s_PendingInputsToRegister.Count - 1; pendingIndex > 0; --pendingIndex)
{
InputManagerEntry pendingEntry = s_PendingInputsToRegister[pendingIndex];
int checkedIndex = pendingIndex - 1;
for (; checkedIndex > -1 && !pendingEntry.IsEqual(s_PendingInputsToRegister[checkedIndex]); --checkedIndex) ;

if (checkedIndex == -1)
continue;

// There is a duplicate entry in PendingInputesToRegister.
// Debug.LogWarning($"Two entries with same name and kind are tryed to be added at same time. Only first occurence is kept. Name:{pendingEntry.name} Kind:{pendingEntry.kind}");

// Keep only first.
// Counting decreasingly will have no impact on index before pendingIndex. So we can safely remove it.
s_PendingInputsToRegister.RemoveAt(pendingIndex);
}
}

static void RemovePendingInputsToAddThatAreAlreadyRegistered(List<(string name, InputManagerEntry.Kind kind)> cachedEntries, List<InputManagerEntry> newEntries)
{
for (int newIndex = newEntries.Count - 1; newIndex >= 0; --newIndex)
{
var newEntry = newEntries[newIndex];
int checkedIndex = cachedEntries.Count - 1;
for (; checkedIndex > -1 && !newEntry.IsEqual(cachedEntries[checkedIndex]); --checkedIndex) ;

if (checkedIndex == -1)
continue;

// There is a already a cached entry that correspond.
// Debug.LogWarning($"Another entry with same name and kind already exist. Skiping this one. Name:{newEntry.name} Kind:{newEntry.kind}");

// Keep only first.
// Counting decreasingly will have no impact on index before pendingIndex. So we can safely remove it.
s_PendingInputsToRegister.RemoveAt(newIndex);
}
}

static void DelayedRegisterInput()
{
// Exit quickly if nothing more to register
// (case when several different class try to register, only first call will do all)
if (!havePendingOperation)
return;

// Grab reference to input manager
var assets = AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/InputManager.asset");
// Temporary fix. This happens some time with HDRP init when it's called before asset database is initialized (probably related to package load order).
Expand All @@ -76,18 +135,39 @@ public static void RegisterInputs(List<InputManagerEntry> entries)

var inputManager = assets[0];

// Wrap in serialized object
// Wrap in serialized object to access c++ fields
var soInputManager = new SerializedObject(inputManager);
var spAxes = soInputManager.FindProperty("m_Axes");

foreach (InputManagerEntry entry in entries)
{
WriteEntry(spAxes, entry);
}
// At this point, we assume that entries in spAxes are already unique.

// Ensure no double entry are tried to be registered (trim early)
MakeUniquePendingInputsToRegister();

// Cache already existing entries to minimaly use serialization
var cachedEntries = GetCachedInputs(spAxes);
// And trim pending entries regarding already cached ones.
RemovePendingInputsToAddThatAreAlreadyRegistered(cachedEntries, s_PendingInputsToRegister);

// Add now unique entries
AddEntriesWithoutCheck(spAxes, s_PendingInputsToRegister);

// Commit
soInputManager.ApplyModifiedProperties();
}

public static void RegisterInputs(List<InputManagerEntry> entries)
{
#if ENABLE_INPUT_SYSTEM && ENABLE_INPUT_SYSTEM_PACKAGE
Debug.LogWarning("Trying to add entry in the legacy InputManager but using InputSystem package. Skiping.");
return;
#else
s_PendingInputsToRegister.AddRange(entries);

//delay the call in order to do only one pass event if several different class register inputs
EditorApplication.delayCall += DelayedRegisterInput;
#endif
}
}
#endif
}
12 changes: 12 additions & 0 deletions Runtime/Textures/BufferedRTHandleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,18 @@ public void ResetReferenceSize(int width, int height)
m_RTHandleSystem.ResetReferenceSize(width, height);
}

/// <summary>
/// Queries the number of RT handle buffers allocated for a buffer ID.
/// </summary>
/// <param name="bufferId">The buffer ID to query.</param>
public int GetNumFramesAllocated(int bufferId)
{
if (!m_RTHandles.ContainsKey(bufferId))
return 0;

return m_RTHandles[bufferId].Length;
}

void Swap()
{
foreach (var item in m_RTHandles)
Expand Down
2 changes: 1 addition & 1 deletion ShaderLibrary/ACES.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ half3 xyY_2_XYZ(half3 xyY)

static const half DIM_SURROUND_GAMMA = 0.9811;

half3 darkSurround_to_dimSurround(half3 linearCV)
float3 darkSurround_to_dimSurround(float3 linearCV)
{
half3 XYZ = mul(AP1_2_XYZ_MAT, linearCV);

Expand Down
2 changes: 1 addition & 1 deletion ShaderLibrary/VolumeRendering.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ real OpticalDepthHeightFog(real baseExtinction, real baseHeight, real2 heightExp
real H = heightExponents.y;
real rcpH = heightExponents.x;
real Z = cosZenith;
real absZ = max(abs(cosZenith), REAL_EPS);
real absZ = max(abs(cosZenith), 0.001f);
real rcpAbsZ = rcp(absZ);

real endHeight = startHeight + intervalLength * Z;
Expand Down

0 comments on commit 2e75eb8

Please sign in to comment.