Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,16 @@ void DoCommonSettingsGUI(ref Rect rect)
{
EditorGUI.PropertyField(rect, m_TargetDepthBuffer, Styles.targetDepthBuffer);
rect.y += Styles.defaultLineSpace;

CustomPass.TargetBuffer requestedDepth = m_TargetDepthBuffer.GetEnumValue<CustomPass.TargetBuffer>();
if (m_CustomPass.getConstrainedDepthBuffer() != requestedDepth)
{
Rect helpBoxRect = rect;
float helpBoxHeight = EditorGUIUtility.singleLineHeight * 2;
helpBoxRect.height = helpBoxHeight;
EditorGUI.HelpBox(helpBoxRect, "Camera depth isn't supported when dynamic scaling is on. We will automatically fall back to not doing depth-testing for this pass.", MessageType.Warning);
rect.y += helpBoxHeight;
}
}

if ((commonPassUIFlags & PassUIFlag.ClearFlags) != 0)
Expand Down Expand Up @@ -259,6 +269,13 @@ internal float GetPropertyHeight(SerializedProperty property, GUIContent label)
}

height += Styles.defaultLineSpace * lines;

// Add height for the help box if it will be shown
if ((commonPassUIFlags & PassUIFlag.TargetDepthBuffer) != 0 &&
m_CustomPass.getConstrainedDepthBuffer() != m_TargetDepthBuffer.GetEnumValue<CustomPass.TargetBuffer>())
{
height += EditorGUIUtility.singleLineHeight * 2; // Help box height
}
}

return height + GetPassHeight(property);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,24 @@ internal ProfilingSampler profilingSampler
/// </summary>
public TargetBuffer targetDepthBuffer;

// The actual depth buffer has to follow some constraints, and thus may not be the same result as the target
// depth buffer that the user has requested. Apply these constraints and return a result.
internal TargetBuffer getConstrainedDepthBuffer()
{
TargetBuffer depth = targetDepthBuffer;
if (depth == TargetBuffer.Camera &&
HDRenderPipeline.currentAsset.currentPlatformRenderPipelineSettings.dynamicResolutionSettings.enabled &&
currentHDCamera.allowDynamicResolution &&
injectionPoint == CustomPassInjectionPoint.AfterPostProcess)
{
// This custom pass is injected after postprocessing, and Dynamic Resolution Scaling is enabled, which
// means an upscaler is active. In this case, the camera color buffer is the full display resolution,
// but the camera depth buffer is a lower, pre-upscale resolution. So we cannot do depth testing here.
depth = TargetBuffer.None;
}
return depth;
}

/// <summary>
/// What clear to apply when the color and depth buffer are bound
/// </summary>
Expand Down Expand Up @@ -270,7 +288,7 @@ internal void ExecuteInternal(RenderGraph renderGraph, HDCamera hdCamera, Cullin
customPass.isExecuting = false;

// Set back the camera color buffer if we were using a custom buffer as target
if (customPass.targetDepthBuffer != TargetBuffer.Camera)
if (customPass.getConstrainedDepthBuffer() != TargetBuffer.Camera)
CoreUtils.SetRenderTarget(ctx.cmd, outputColorBuffer);
});
}
Expand Down Expand Up @@ -307,16 +325,17 @@ bool IsMSAAEnabled(HDCamera hdCamera)
// This function must be only called from the ExecuteInternal method (requires current render target and current RT manager)
void SetCustomPassTarget(CommandBuffer cmd)
{
TargetBuffer depth = getConstrainedDepthBuffer();
// In case all the buffer are set to none, we can't bind anything
if (targetColorBuffer == TargetBuffer.None && targetDepthBuffer == TargetBuffer.None)
if (targetColorBuffer == TargetBuffer.None && depth == TargetBuffer.None)
return;

RTHandle colorBuffer = (targetColorBuffer == TargetBuffer.Custom) ? currentRenderTarget.customColorBuffer.Value : currentRenderTarget.colorBufferRG;
RTHandle depthBuffer = (targetDepthBuffer == TargetBuffer.Custom) ? currentRenderTarget.customDepthBuffer.Value : currentRenderTarget.depthBufferRG;
RTHandle depthBuffer = (depth == TargetBuffer.Custom) ? currentRenderTarget.customDepthBuffer.Value : currentRenderTarget.depthBufferRG;

if (targetColorBuffer == TargetBuffer.None && targetDepthBuffer != TargetBuffer.None)
if (targetColorBuffer == TargetBuffer.None && depth != TargetBuffer.None)
CoreUtils.SetRenderTarget(cmd, depthBuffer, clearFlags);
else if (targetColorBuffer != TargetBuffer.None && targetDepthBuffer == TargetBuffer.None)
else if (targetColorBuffer != TargetBuffer.None && depth == TargetBuffer.None)
CoreUtils.SetRenderTarget(cmd, colorBuffer, clearFlags);
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ internal static void Place(GameObject go, GameObject parent)

static Light2D CreateLight(MenuCommand menuCommand, Light2D.LightType type, Vector3[] shapePath = null)
{
GameObject go = ObjectFactory.CreateGameObject("Light 2D", typeof(Light2D));
var lightName = type != Light2D.LightType.Point ? type.ToString() : "Spot";
GameObject go = ObjectFactory.CreateGameObject(lightName + " Light 2D", typeof(Light2D));
Light2D light2D = go.GetComponent<Light2D>();
light2D.lightType = type;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,23 @@ MonoBehaviour:
XrSdk:
StereoModes: 0
Reason: 'Unstable on PS4: https://jira.unity3d.com/browse/UUM-113462 '
- FilteredScene: {fileID: 0}
FilteredScenes:
- {fileID: 102900000, guid: 32f9dd5fabc57284bb43468761c84f36, type: 3}
ColorSpace: 1
BuildPlatform: 31
GraphicsDevice: 4
Architecture: 0
XrSdk:
StereoModes: 0
Reason: 'Unstable on PS4: https://jira.unity3d.com/browse/UUM-113462 '
- FilteredScene: {fileID: 0}
FilteredScenes:
- {fileID: 102900000, guid: 500813a390ad4074cba926bf26eef57a, type: 3}
ColorSpace: 1
BuildPlatform: 31
GraphicsDevice: 4
Architecture: 0
XrSdk:
StereoModes: 0
Reason: 'Unstable on PS4: https://jira.unity3d.com/browse/UUM-113462 '