Skip to content

[10.x.x] Merge Hdrp/staging [Skip CI] #1229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Jul 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
dedddbe
Modify scene for better stability (#1120)
remi-chapelain Jul 6, 2020
db99426
Fix area light gizmo not updating engine side light v2 (#1156)
FrancescoC-unity Jul 6, 2020
9af51f9
Updated doc. (#1152)
eturquin Jul 6, 2020
55f0529
Merge branch 'master' into HDRP/staging
sebastienlagarde Jul 6, 2020
f8893e5
Address decal layer documentation feedback (#1157)
sebastienlagarde Jul 7, 2020
7514ba1
Hdrp/docs/upgrading to 2020.2 (#1170)
JordanL8 Jul 7, 2020
fd7ff2e
HDRP - Shutter speed can now be changed by dragging the mouse over th…
pmavridis Jul 7, 2020
d150394
Merge branch 'master' into HDRP/staging
sebastienlagarde Jul 7, 2020
a9a73a4
Fix API breaking change: Add Public quality to Raytracing volume effe…
sebastienlagarde Jul 7, 2020
b0d3cce
ix API breaking change: Add Public quality to Raytracing volume effec…
sebastienlagarde Jul 7, 2020
19cee37
Add 3 tests in HDRP_Test for 1709_DecalLayers for deferred, forward a…
sebastienlagarde Jul 7, 2020
4e5caa5
Added what's new page and relevant images (#1154)
JordanL8 Jul 7, 2020
9cc6c52
update what's new
sebastienlagarde Jul 7, 2020
6c250d7
Fix Material Creation RenderQueue setup + Fix AXF GUI (#1185)
sebastienlagarde Jul 7, 2020
fa607fd
Refactor keyword system in ShaderGraph (#1181)
alelievr Jul 7, 2020
9df292f
Made conversion from render graph handles to actual resource implicit…
JulienIgnace-Unity Jul 8, 2020
17b195b
Fix double sided unlit mode in the UI (#1203)
alelievr Jul 8, 2020
0ed3553
HDRP: Default indirect Lighting controller Layers to Everything to ea…
sebastienlagarde Jul 8, 2020
1f5f2a9
Update cas include paths (#1227)
FrancescoC-unity Jul 9, 2020
c745c93
Hdrp/fix rt odd negative scale (#1180)
eturquin Jul 9, 2020
bc3ee23
Hdrp/fix hierarchicalbox gizmo symetry and homothety mode ensuring fa…
RSlysz Jul 9, 2020
5feb1bf
fix XR single-pass macros in tessellation shaders (#1160)
fabien-unity Jul 9, 2020
9b496b4
Merge branch 'master' into HDRP/staging
sebastienlagarde Jul 9, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions com.unity.render-pipelines.core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed null reference exception in LookDev when setting the SRP to one not implementing LookDev (case 1245086)
- Fix LookDev's undo/redo on EnvironmentLibrary (case 1234725)
- Fix a compil error on OpenGL ES2 in directional lightmap sampling shader code
- Fix hierarchicalbox gizmo outside facing check in symetry or homothety mode no longer move the center

### Changed
- Restored usage of ENABLE_VR to fix compilation errors on some platforms.
Expand Down
99 changes: 88 additions & 11 deletions com.unity.render-pipelines.core/Editor/Gizmo/HierarchicalBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,7 @@ public void DrawHandle()

for (int i = 0, count = m_ControlIDs.Length; i < count; ++i)
m_ControlIDs[i] = GUIUtility.GetControlID("HierarchicalBox".GetHashCode() + i, FocusType.Passive);

EditorGUI.BeginChangeCheck();


var leftPosition = center + size.x * .5f * Vector3.left;
var rightPosition = center + size.x * .5f * Vector3.right;
var topPosition = center + size.y * .5f * Vector3.up;
Expand All @@ -256,6 +254,8 @@ public void DrawHandle()

var theChangedFace = NamedFace.None;

EditorGUI.BeginChangeCheck();

EditorGUI.BeginChangeCheck();
Slider1D(m_ControlIDs[(int)NamedFace.Left], ref leftPosition, Vector3.left, EditorSnapSettings.scale, GetHandleColor(NamedFace.Left));
if (EditorGUI.EndChangeCheck())
Expand Down Expand Up @@ -338,6 +338,27 @@ public void DrawHandle()
case NamedFace.Front: backPosition.z += delta; break;
case NamedFace.Back: frontPosition.z -= delta; break;
}

//ensure that the box face are still facing outside
switch (theChangedFace)
{
case NamedFace.Left:
case NamedFace.Right:
if (rightPosition.x < leftPosition.x)
rightPosition.x = leftPosition.x = center.x;
break;
case NamedFace.Top:
case NamedFace.Bottom:
if (topPosition.y < bottomPosition.y)
topPosition.y = bottomPosition.y = center.y;
break;
case NamedFace.Front:
case NamedFace.Back:
if (frontPosition.z < backPosition.z)
frontPosition.z = backPosition.z = center.z;
break;
}

}

if (useHomothety)
Expand Down Expand Up @@ -367,21 +388,77 @@ public void DrawHandle()
topPosition.y -= halfDelta;
break;
}

//ensure that the box face are still facing outside
switch (theChangedFace)
{
case NamedFace.Left:
if (rightPosition.x < leftPosition.x)
leftPosition.x = rightPosition.x;
if (topPosition.y < bottomPosition.y)
topPosition.y = bottomPosition.y = center.y;
if (frontPosition.z < backPosition.z)
frontPosition.z = backPosition.z = center.z;
break;
case NamedFace.Right:
if (rightPosition.x < leftPosition.x)
rightPosition.x = leftPosition.x;
if (topPosition.y < bottomPosition.y)
topPosition.y = bottomPosition.y = center.y;
if (frontPosition.z < backPosition.z)
frontPosition.z = backPosition.z = center.z;
break;
case NamedFace.Top:
if (topPosition.y < bottomPosition.y)
topPosition.y = bottomPosition.y;
if (rightPosition.x < leftPosition.x)
rightPosition.x = leftPosition.x = center.x;
if (frontPosition.z < backPosition.z)
frontPosition.z = backPosition.z = center.z;
break;
case NamedFace.Bottom:
if (topPosition.y < bottomPosition.y)
bottomPosition.y = topPosition.y;
if (rightPosition.x < leftPosition.x)
rightPosition.x = leftPosition.x = center.x;
if (frontPosition.z < backPosition.z)
frontPosition.z = backPosition.z = center.z;
break;
case NamedFace.Front:
if (frontPosition.z < backPosition.z)
frontPosition.z = backPosition.z;
if (rightPosition.x < leftPosition.x)
rightPosition.x = leftPosition.x = center.x;
if (topPosition.y < bottomPosition.y)
topPosition.y = bottomPosition.y = center.y;
break;
case NamedFace.Back:
if (frontPosition.z < backPosition.z)
backPosition.z = frontPosition.z;
if (rightPosition.x < leftPosition.x)
rightPosition.x = leftPosition.x = center.x;
if (topPosition.y < bottomPosition.y)
topPosition.y = bottomPosition.y = center.y;
break;
}
}

var max = new Vector3(rightPosition.x, topPosition.y, frontPosition.z);
var min = new Vector3(leftPosition.x, bottomPosition.y, backPosition.z);

//ensure that the box face are still facing outside
for (int axis = 0; axis < 3; ++axis)
if (!useSymetry && !useHomothety)
{
if (min[axis] > max[axis])
//ensure that the box face are still facing outside
for (int axis = 0; axis < 3; ++axis)
{
// Control IDs in m_ControlIDs[0-3[ are for positive axes
if (GUIUtility.hotControl == m_ControlIDs[axis])
max[axis] = min[axis];
else
min[axis] = max[axis];
if (min[axis] > max[axis])
{
// Control IDs in m_ControlIDs[0-3[ are for positive axes
if (GUIUtility.hotControl == m_ControlIDs[axis])
max[axis] = min[axis];
else
min[axis] = max[axis];
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public enum DepthAccess
}

/// <summary>
/// This struct specifies the context given to every render pass.
/// This class specifies the context given to every render pass.
/// </summary>
public class RenderGraphContext
{
Expand All @@ -30,8 +30,6 @@ public class RenderGraphContext
public CommandBuffer cmd;
///<summary>Render Graph pooll used for temporary data.</summary>
public RenderGraphObjectPool renderGraphPool;
///<summary>Render Graph Resource Registry used for accessing resources.</summary>
public RenderGraphResourceRegistry resources;
///<summary>Render Graph default resources.</summary>
public RenderGraphDefaultResources defaultResources;
}
Expand Down Expand Up @@ -403,7 +401,7 @@ public void Execute(ScriptableRenderContext renderContext, CommandBuffer cmd, in
{
m_Logger.Initialize();

m_Resources.BeginRender(parameters.renderingWidth, parameters.renderingHeight, parameters.msaaSamples, parameters.currentFrameIndex);
m_Resources.BeginRender(parameters.currentFrameIndex);

LogFrameInformation(parameters.renderingWidth, parameters.renderingHeight);

Expand All @@ -426,6 +424,8 @@ public void Execute(ScriptableRenderContext renderContext, CommandBuffer cmd, in

m_DebugParameters.logFrameInformation = false;
m_DebugParameters.logResources = false;

m_Resources.EndRender();
}
}
#endregion
Expand Down Expand Up @@ -814,7 +814,6 @@ void ExecuteRenderGraph(ScriptableRenderContext renderContext, CommandBuffer cmd
m_RenderGraphContext.cmd = cmd;
m_RenderGraphContext.renderContext = renderContext;
m_RenderGraphContext.renderGraphPool = m_RenderGraphPool;
m_RenderGraphContext.resources = m_Resources;
m_RenderGraphContext.defaultResources = m_DefaultResources;

for (int passIndex = 0; passIndex < m_CompiledPassInfos.size; ++passIndex)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,30 @@

namespace UnityEngine.Experimental.Rendering.RenderGraphModule
{
/// <summary>
/// The RenderGraphResourceRegistry holds all resource allocated during Render Graph execution.
/// </summary>
public class RenderGraphResourceRegistry
class RenderGraphResourceRegistry
{
static readonly ShaderTagId s_EmptyName = new ShaderTagId("");

static RenderGraphResourceRegistry m_CurrentRegistry;
internal static RenderGraphResourceRegistry current
{
get
{
// We assume that it's enough to only check in editor because we don't want to pay the cost at runtime.
#if UNITY_EDITOR
if (m_CurrentRegistry == null)
{
throw new InvalidOperationException("Current Render Graph Resource Registry is not set. You are probably trying to cast a Render Graph handle to a resource outside of a Render Graph Pass.");
}
#endif
return m_CurrentRegistry;
}
set
{
m_CurrentRegistry = value;
}
}

class IRenderGraphResource
{
public bool imported;
Expand Down Expand Up @@ -100,46 +117,29 @@ internal RendererListResource(in RendererListDesc desc)

RTHandle m_CurrentBackbuffer;

#region Public Interface
/// <summary>
/// Returns the RTHandle associated with the provided resource handle.
/// </summary>
/// <param name="handle">Handle to a texture resource.</param>
/// <returns>The RTHandle associated with the provided resource handle or null if the handle is invalid.</returns>
public RTHandle GetTexture(in TextureHandle handle)
internal RTHandle GetTexture(in TextureHandle handle)
{
if (!handle.IsValid())
return null;

return GetTextureResource(handle.handle).resource;
}

/// <summary>
/// Returns the RendererList associated with the provided resource handle.
/// </summary>
/// <param name="handle">Handle to a Renderer List resource.</param>
/// <returns>The Renderer List associated with the provided resource handle or an invalid renderer list if the handle is invalid.</returns>
public RendererList GetRendererList(in RendererListHandle handle)
internal RendererList GetRendererList(in RendererListHandle handle)
{
if (!handle.IsValid() || handle >= m_RendererListResources.size)
return RendererList.nullRendererList;

return m_RendererListResources[handle].rendererList;
}

/// <summary>
/// Returns the Compute Buffer associated with the provided resource handle.
/// </summary>
/// <param name="handle">Handle to a Compute Buffer resource.</param>
/// <returns>The Compute Buffer associated with the provided resource handle or a null reference if the handle is invalid.</returns>
public ComputeBuffer GetComputeBuffer(in ComputeBufferHandle handle)
internal ComputeBuffer GetComputeBuffer(in ComputeBufferHandle handle)
{
if (!handle.IsValid())
return null;

return GetComputeBufferResource(handle.handle).resource;
}
#endregion

#region Internal Interface
private RenderGraphResourceRegistry()
Expand Down Expand Up @@ -172,9 +172,15 @@ ResType GetResource<DescType, ResType>(DynamicArray<IRenderGraphResource> resour
return res.resource;
}

internal void BeginRender(int width, int height, MSAASamples msaaSamples, int currentFrameIndex)
internal void BeginRender(int currentFrameIndex)
{
m_CurrentFrameIndex = currentFrameIndex;
current = this;
}

internal void EndRender()
{
current = null;
}

void CheckHandleValidity(in ResourceHandle res)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal enum RenderGraphResourceType
// Can't have a default constructor with handle = -1 hence the ugly IsValid implementation (where m_IsValid will be false by default).
internal struct ResourceHandle
{
bool m_IsValid;
bool m_IsValid;

public int index { get; private set; }
public RenderGraphResourceType type { get; private set; }
Expand Down Expand Up @@ -53,6 +53,22 @@ public struct TextureHandle

internal TextureHandle(int handle) { this.handle = new ResourceHandle(handle, RenderGraphResourceType.Texture); }

/// <summary>
/// Cast to RTHandle
/// </summary>
/// <param name="texture">Input TextureHandle.</param>
public static implicit operator RTHandle(TextureHandle texture) => texture.IsValid() ? RenderGraphResourceRegistry.current.GetTexture(texture) : null;
/// <summary>
/// Cast to RenderTargetIdentifier
/// </summary>
/// <param name="texture">Input TextureHandle.</param>
public static implicit operator RenderTargetIdentifier(TextureHandle texture) => texture.IsValid() ? RenderGraphResourceRegistry.current.GetTexture(texture) : null;
/// <summary>
/// Cast to RenderTexture
/// </summary>
/// <param name="texture">Input TextureHandle.</param>
public static implicit operator RenderTexture(TextureHandle texture) => texture.IsValid() ? RenderGraphResourceRegistry.current.GetTexture(texture) : null;

/// <summary>
/// Return true if the handle is valid.
/// </summary>
Expand All @@ -70,6 +86,12 @@ public struct ComputeBufferHandle

internal ComputeBufferHandle(int handle) { this.handle = new ResourceHandle(handle, RenderGraphResourceType.ComputeBuffer); }

/// <summary>
/// Cast to ComputeBuffer
/// </summary>
/// <param name="buffer">Input ComputeBufferHandle</param>
public static implicit operator ComputeBuffer(ComputeBufferHandle buffer) => buffer.IsValid() ? RenderGraphResourceRegistry.current.GetComputeBuffer(buffer) : null;

/// <summary>
/// Return true if the handle is valid.
/// </summary>
Expand All @@ -93,6 +115,8 @@ public struct RendererListHandle
/// <returns>The integer representation of the handle.</returns>
public static implicit operator int(RendererListHandle handle) { return handle.handle; }

public static implicit operator RendererList(RendererListHandle rendererList) => rendererList.IsValid() ? RenderGraphResourceRegistry.current.GetRendererList(rendererList) : RendererList.nullRendererList;

/// <summary>
/// Return true if the handle is valid.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ float3 GetCameraRelativePositionWS(float3 positionWS)

real GetOddNegativeScale()
{
return unity_WorldTransformParams.w;
// FIXME: We should be able to just return unity_WorldTransformParams.w, but it is not
// properly set at the moment, when doing ray-tracing; once this has been fixed in cpp,
// we can revert back to the former implementation.
return unity_WorldTransformParams.w >= 0.0 ? 1.0 : -1.0;
}

float3 TransformObjectToWorld(float3 positionOS)
Expand Down
3 changes: 3 additions & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed overused the atlas for Animated/Render Target Cookies (1259930).
- Fixed sky asserts with XR multipass
- Fixed for area light not updating baked light result when modifying with gizmo.
- Fixed robustness issue with GetOddNegativeScale() in ray tracing, which was impacting normal mapping (1261160).
- Fixed regression where moving face of the probe gizmo was not moving its position anymore.
- Fixed XR single-pass macros in tessellation shaders.

### Changed
- Improve MIP selection for decals on Transparents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,23 @@ public static void DrawHandles_EditInfluenceNormal(SerializedInfluenceVolume ser
break;
}
}

static void DrawBoxHandle(SerializedInfluenceVolume serialized, Editor owner, Transform transform, HierarchicalBox box)
{
using (new Handles.DrawingScope(Matrix4x4.TRS(Vector3.zero, transform.rotation, Vector3.one)))
{
box.center = Quaternion.Inverse(transform.rotation)*transform.position;
box.center = Quaternion.Inverse(transform.rotation) * transform.position;
box.size = serialized.boxSize.vector3Value;

EditorGUI.BeginChangeCheck();
box.DrawHull(true);
box.DrawHandle();
if (EditorGUI.EndChangeCheck())
{
var newPosition = transform.rotation * box.center;
Undo.RecordObject(transform, "Moving Influence");
transform.position = newPosition;

// Clamp blend distances
var blendPositive = serialized.boxBlendDistancePositive.vector3Value;
var blendNegative = serialized.boxBlendDistanceNegative.vector3Value;
Expand Down
Loading