Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
32f7e25
[Port] [6000.0] [docg-9065] Fix one minus keyboard shortcut in shader…
svc-reach-platform-support Sep 10, 2026
e1c035e
[Port] [6000.0] ScriptableRenderFeture - Fix Null reference exception
svc-reach-platform-support Sep 10, 2026
fb57b2c
[Port] [6000.0] [Particles] Don't use _FADING_ON keyword if camera fa…
svc-reach-platform-support Sep 12, 2026
70ec77e
[6000.0][UUM-151674] Add buffer bounds checks to `GenSdfRayMap.compute`
april-roszkowski Sep 16, 2026
4559141
[Port] [6000.0] [DOCG-9101] Add links to example nodes on Shader Grap…
marta-malberti Sep 18, 2026
d44474b
[6000.0] Fix shadergraph compilation failure on uv4 input semantic di…
eh-unity Sep 22, 2026
8bea48a
[Port] [6000.0] Fix seams with box projection in URP on platforms sup…
svc-reach-platform-support Sep 24, 2026
b1db0c0
[Port] [6000.0] Set HideAndDontSave on blit meshes so they survive sc…
svc-reach-platform-support Sep 26, 2026
493ccf5
[Port] [6000.0] [7000.0][UUM-150232] [2D] Respect Disable Depth and S…
svc-reach-platform-support Oct 3, 2026
6b26b7a
[Port] [6000.0] Fix RenderTexture.Create failure on certain Android V…
svc-reach-platform-support Oct 4, 2026
d5d28c4
[Port] [6000.0] [UUM-151723][7000.0] Fix camera sorting layer texture…
svc-reach-platform-support Oct 6, 2026
eacce6e
[Port] [6000.0] [URP] [2D] [UUM-145892][7000.0] Fix intermediate text…
svc-reach-platform-support Oct 6, 2026
a6102da
[Port] [6000.0] [UUM-147747][UUM-148111][7000.0] Fix LineRenderer sha…
svc-reach-platform-support Oct 6, 2026
cf04cb6
[6000.0] [UUM-117369] [URP] Revert DX11-only copy of _CameraDepthAtta…
SamuelSiltanenUnity Oct 9, 2026
446c01f
[Port] [6000.0] [UUM-144935][7000.0] Rename Resources folder to Resou…
svc-reach-platform-support Oct 12, 2026
3f8ad0b
[Port] [6000.0] [HDRP] Fix dark outline on geometry with MSAA and clo…
svc-reach-platform-support Oct 14, 2026
6cdaf94
[Port] [6000.0] Fix speckles/white spots with APV
svc-reach-platform-support Oct 17, 2026
8575cbf
[Port] [6000.0] [DOCG-9120] Add Shader Graph project settings referen…
marta-malberti Oct 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,8 @@ bool LoadCellIndexMetaData(uint cellFlatIdx, out uint chunkIndex, out int stepSi
return metaData.x != 0xFFFFFFFF;
}

uint GetIndexData(APVResources apvRes, float3 posWS)
uint GetIndexData(APVResources apvRes, float3 entryPos, float3 residualPosWS)
{
float3 entryPos = floor(posWS * _APVRcpIndirectionEntryDim);
float3 topLeftEntryWS = entryPos * _APVIndirectionEntryDim;

bool isALoadedCell = all(entryPos >= _APVMinLoadedCellInEntries) && all(entryPos <= _APVMaxLoadedCellInEntries);

// Make sure we start from 0
Expand All @@ -300,7 +297,6 @@ uint GetIndexData(APVResources apvRes, float3 posWS)
uint chunkIdx;
if (LoadCellIndexMetaData(flatIdx, chunkIdx, stepSize, minRelativeIdx, sizeOfValid))
{
float3 residualPosWS = posWS - topLeftEntryWS;
uint3 localBrickIndex = floor(residualPosWS / (_APVMinBrickSize * stepSize));
localBrickIndex = min(localBrickIndex, (uint3)(3 * 3 * 3 - 1)); // due to floating point issue, we may query an invalid brick
localBrickIndex -= minRelativeIdx; // Relative to valid region
Expand Down Expand Up @@ -349,8 +345,10 @@ APVResources FillAPVResources()

bool TryToGetPoolUVWAndSubdiv(APVResources apvRes, float3 posWSForSample, out float3 uvw, out uint subdiv)
{
// resolve the index
uint packed_pool_idx = GetIndexData(apvRes, posWSForSample.xyz);
float3 posInEntries = posWSForSample.xyz * _APVRcpIndirectionEntryDim;
float3 entryPos = floor(posInEntries); // integer coord of indirection entry
float3 residualPosWS = min(posInEntries - entryPos, 0.999999) * _APVIndirectionEntryDim; // WS position relative to indirection entry
uint packed_pool_idx = GetIndexData(apvRes, entryPos, residualPosWS);

// unpack pool idx
// size is encoded in the upper 4 bits
Expand All @@ -364,8 +362,21 @@ bool TryToGetPoolUVWAndSubdiv(APVResources apvRes, float3 posWSForSample, out fl
pool_idx.x = floor(flattened_pool_idx - (pool_idx.y * _APVPoolDim.x));

// calculate uv offset and scale
float brickSizeWS = pow(3.0, subdiv) * _APVMinBrickSize;
float3 offset = frac(posWSForSample.xyz / brickSizeWS); // [0;1] in brick space
float brickSizeWS = round(pow(3.0, subdiv)) * _APVMinBrickSize;
float3 offset = frac(residualPosWS / brickSizeWS); // [0;1] in brick space

// special case when bricks are large enough to span multiple indirection entries
if (brickSizeWS > _APVIndirectionEntryDim)
{
float entriesPerBrick = round(brickSizeWS * _APVRcpIndirectionEntryDim);
float3 entryOffsetInBrick = entryPos - entriesPerBrick * floor(entryPos / entriesPerBrick); // entryPos mod entriesPerBrick
#if defined(SHADER_API_GAMECORE)
entryOffsetInBrick = select(entryOffsetInBrick >= entriesPerBrick, entryOffsetInBrick - entriesPerBrick, entryOffsetInBrick);
#else
entryOffsetInBrick = (entryOffsetInBrick >= entriesPerBrick) ? (entryOffsetInBrick - entriesPerBrick) : entryOffsetInBrick;
#endif
offset = min((entryOffsetInBrick * _APVIndirectionEntryDim + residualPosWS) / brickSizeWS, 0.9999);
}
//offset = clamp( offset, 0.25, 0.75 ); // [0.25;0.75] in brick space (is this actually necessary?)

uvw = (pool_idx + 0.5 + (3.0 * offset)) * _APVRcpPoolDim; // add offset with brick footprint converted to text footprint in pool texel space
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,30 +103,47 @@ private LensFlareCommonSRP()
{
}

private static readonly bool s_SupportsLensFlare16bitsFormat = SystemInfo.IsFormatSupported(GraphicsFormat.R16_SFloat, GraphicsFormatUsage.Render);
private static readonly bool s_SupportsLensFlare32bitsFormat = SystemInfo.IsFormatSupported(GraphicsFormat.R32_SFloat, GraphicsFormatUsage.Render);
static readonly bool s_SupportsLensFlare16bitsFormat = SystemInfo.IsFormatSupported(GraphicsFormat.R16_SFloat, GraphicsFormatUsage.Render);
static readonly bool s_SupportsLensFlare32bitsFormat = SystemInfo.IsFormatSupported(GraphicsFormat.R32_SFloat, GraphicsFormatUsage.Render);
static readonly bool s_SupportsLensFlare16bitsFormatWithLoadStore = SystemInfo.IsFormatSupported(GraphicsFormat.R16_SFloat, GraphicsFormatUsage.LoadStore);
static readonly bool s_SupportsLensFlare32bitsFormatWithLoadStore = SystemInfo.IsFormatSupported(GraphicsFormat.R32_SFloat, GraphicsFormatUsage.LoadStore);

/// <summary>
/// Check if we can use an OcclusionRT
/// </summary>
/// <returns>return true if we can have the OcclusionRT</returns>
static public bool IsOcclusionRTCompatible()
// UUM-91313: Some Android Vulkan devices (Adreno 540) don't support R16_SFloat with GraphicsFormatUsage.LoadStore,
// which is required when creating a render texture with enableRandomWrite flag. Random writes are only needed by
// the merge step (compute shader using the texture as UAV), so we enable the flag only if merging is enabled.
static bool requireOcclusionRTRandomWrite => mergeNeeded > 0;

static bool CheckOcclusionBasedOnDeviceType()
{
#if UNITY_SERVER
return false;
#else
return SystemInfo.graphicsDeviceType != GraphicsDeviceType.OpenGLES3 &&
SystemInfo.graphicsDeviceType != GraphicsDeviceType.OpenGLCore &&
SystemInfo.graphicsDeviceType != GraphicsDeviceType.Null &&
SystemInfo.graphicsDeviceType != GraphicsDeviceType.WebGPU &&
(s_SupportsLensFlare16bitsFormat || s_SupportsLensFlare32bitsFormat); //Caching this, because SupportsRenderTextureFormat allocates memory. Go figure.
return SystemInfo.graphicsDeviceType != GraphicsDeviceType.Null &&
SystemInfo.graphicsDeviceType != GraphicsDeviceType.OpenGLES3 &&
SystemInfo.graphicsDeviceType != GraphicsDeviceType.OpenGLCore &&
SystemInfo.graphicsDeviceType != GraphicsDeviceType.WebGPU;
#endif
}

/// <summary>
/// Check if we can create OcclusionRT texture to be used as render target
/// </summary>
/// <returns>Returns true if a supported format is found</returns>
public static bool IsOcclusionRTCompatible()
{
if (requireOcclusionRTRandomWrite)
{
return CheckOcclusionBasedOnDeviceType() &&
(s_SupportsLensFlare16bitsFormatWithLoadStore || s_SupportsLensFlare32bitsFormatWithLoadStore);
}
return CheckOcclusionBasedOnDeviceType() &&
(s_SupportsLensFlare16bitsFormat || s_SupportsLensFlare32bitsFormat);
}

static GraphicsFormat GetOcclusionRTFormat()
{
// SystemInfo.graphicsDeviceType == {GraphicsDeviceType.Direct3D12, GraphicsDeviceType.GameCoreXboxSeries, GraphicsDeviceType.XboxOneD3D12, GraphicsDeviceType.PlayStation5, ...}
if (s_SupportsLensFlare16bitsFormat)
if (requireOcclusionRTRandomWrite ? s_SupportsLensFlare16bitsFormatWithLoadStore : s_SupportsLensFlare16bitsFormat)
return GraphicsFormat.R16_SFloat;
else
// Needed a R32_SFloat for Metal or/and DirectX < 11.3
Expand All @@ -150,8 +167,8 @@ static public void Initialize()
width: maxLensFlareWithOcclusion,
height: Mathf.Max(mergeNeeded * (maxLensFlareWithOcclusionTemporalSample + 1), 1),
format: GetOcclusionRTFormat(),
slices: TextureXR.slices,
enableRandomWrite: true,
slices: TextureXR.slices,
enableRandomWrite: requireOcclusionRTRandomWrite,
dimension: TextureDimension.Tex2DArray);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,15 @@ public static void Initialize(Shader blitPS, Shader blitColorAndDepthPS)
{
if (!s_TriangleMesh)
{
s_TriangleMesh = new Mesh();
s_TriangleMesh = new Mesh { hideFlags = HideFlags.HideAndDontSave };
s_TriangleMesh.vertices = GetFullScreenTriangleVertexPosition(nearClipZ);
s_TriangleMesh.uv = GetFullScreenTriangleTexCoord();
s_TriangleMesh.triangles = new int[3] { 0, 1, 2 };
}
}
if (!s_QuadMesh)
{
s_QuadMesh = new Mesh();
s_QuadMesh = new Mesh { hideFlags = HideFlags.HideAndDontSave };
s_QuadMesh.vertices = GetQuadVertexPosition(nearClipZ);
s_QuadMesh.uv = GetQuadTexCoord();
s_QuadMesh.triangles = new int[6] { 0, 1, 2, 0, 2, 3 };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,7 @@ class CopyXRDepthPassData
public TextureHandle output;
public Vector2 blitScaleBias;
public bool flipY;
public int passIndex;
}

void CopyDepth(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle depthBuffer, TextureHandle output, bool copyForXR)
Expand All @@ -714,6 +715,8 @@ void CopyDepth(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle depthBu
passData.blitScaleBias = copyForXR ? new Vector2(hdCamera.actualWidth / hdCamera.finalViewport.width, hdCamera.actualHeight / hdCamera.finalViewport.height)
: RTHandles.rtHandleProperties.rtHandleScale;
passData.flipY = copyForXR;
passData.passIndex = renderGraph.GetTextureDesc(depthBuffer).msaaSamples != MSAASamples.None ? 1 : 0;
Debug.Assert(!(copyForXR && passData.passIndex != 0), "MSAA depth copies do not support XR scaling and Y-flipping.");

builder.SetRenderFunc(
(CopyXRDepthPassData data, RenderGraphContext ctx) =>
Expand All @@ -724,7 +727,7 @@ void CopyDepth(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle depthBu
mpb.SetVector(HDShaderIDs._BlitScaleBias, data.blitScaleBias);
mpb.SetInt(HDShaderIDs._FlipY, data.flipY ? 1 : 0);

CoreUtils.DrawFullScreen(ctx.cmd, data.copyDepth, mpb);
CoreUtils.DrawFullScreen(ctx.cmd, data.copyDepth, mpb, data.passIndex);
});
}
}
Expand Down Expand Up @@ -1587,7 +1590,7 @@ TransparentPrepassOutput RenderTransparentPrepass(RenderGraph renderGraph, Culli
renderQueueRange: GetTransparentRenderQueueRange(hdCamera, false)));

// Copy depth buffer for refraction
CopyDepth(renderGraph, hdCamera, prepassOutput.resolvedDepthBuffer, output.depthBufferPreRefraction, false);
CopyDepth(renderGraph, hdCamera, prepassOutput.depthBuffer, output.depthBufferPreRefraction, false);

if (hasWater)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,59 @@ Shader "Hidden/HDRP/CopyDepthBuffer"

ENDHLSL
}

Pass
{
Name "Copy Depth MSAA"

Cull Off
ZTest Always
ZWrite On
Blend Off
ColorMask 0

HLSLPROGRAM
#pragma target 4.5
#pragma editor_sync_compilation
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch switch2
#pragma fragment Frag
#pragma vertex Vert

#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"

TEXTURE2D_X_MSAA(float, _InputDepthTexture);

struct Attributes
{
uint vertexID : SV_VertexID;
UNITY_VERTEX_INPUT_INSTANCE_ID
};

struct Varyings
{
float4 positionCS : SV_Position;
UNITY_VERTEX_OUTPUT_STEREO
};

Varyings Vert(Attributes input)
{
Varyings output;
UNITY_SETUP_INSTANCE_ID(input);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
output.positionCS = GetFullScreenTriangleVertexPosition(input.vertexID);
return output;
}

// SV_SampleIndex forces per-sample execution so each sample of the destination gets its own source sample.
float Frag(Varyings input, uint sampleIndex : SV_SampleIndex) : SV_Depth
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
return LOAD_TEXTURE2D_X_MSAA(_InputDepthTexture, int2(input.positionCS.xy), sampleIndex).x;
}

ENDHLSL
}
}
Fallback Off
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using UnityEngine;
using UnityEngine.Rendering.Universal;


namespace UnityEditor.Rendering.Universal
{
[CustomEditor(typeof(Light2D))]
Expand Down Expand Up @@ -53,20 +52,34 @@ private static class Styles
{
public static readonly GUIContent InnerOuterSpotAngle = EditorGUIUtility.TrTextContent("Inner / Outer Spot Angle", "Adjusts the inner / outer angles of this light to change the angle ranges of this Spot Light’s beam.");

public static Texture lightCapTopRight = Resources.Load<Texture>("LightCapTopRight");
public static Texture lightCapTopLeft = Resources.Load<Texture>("LightCapTopLeft");
public static Texture lightCapBottomLeft = Resources.Load<Texture>("LightCapBottomLeft");
public static Texture lightCapBottomRight = Resources.Load<Texture>("LightCapBottomRight");
public static Texture lightCapUp = Resources.Load<Texture>("LightCapUp");
public static Texture lightCapDown = Resources.Load<Texture>("LightCapDown");


public static GUIContent lightTypeFreeform = new GUIContent("Freeform", Resources.Load("InspectorIcons/FreeformLight") as Texture);
public static GUIContent lightTypeSprite = new GUIContent("Sprite", Resources.Load("InspectorIcons/SpriteLight") as Texture);
public static GUIContent lightTypePoint = new GUIContent("Spot", Resources.Load("InspectorIcons/PointLight") as Texture);
public static GUIContent lightTypeGlobal = new GUIContent("Global", Resources.Load("InspectorIcons/GlobalLight") as Texture);
public static GUIContent[] lightTypeOptions = new GUIContent[] { lightTypeFreeform, lightTypeSprite, lightTypePoint, lightTypeGlobal };

static Texture s_LightCapTopRight;
static Texture s_LightCapTopLeft;
static Texture s_LightCapBottomLeft;
static Texture s_LightCapBottomRight;
static Texture s_LightCapUp;
static Texture s_LightCapDown;

public static Texture lightCapTopRight => s_LightCapTopRight ??= LoadIcon("LightCapTopRight.png");
public static Texture lightCapTopLeft => s_LightCapTopLeft ??= LoadIcon("LightCapTopLeft.png");
public static Texture lightCapBottomLeft => s_LightCapBottomLeft ??= LoadIcon("LightCapBottomLeft.png");
public static Texture lightCapBottomRight => s_LightCapBottomRight ??= LoadIcon("LightCapBottomRight.png");
public static Texture lightCapUp => s_LightCapUp ??= LoadIcon("LightCapUp.png");
public static Texture lightCapDown => s_LightCapDown ??= LoadIcon("LightCapDown.png");

static GUIContent s_LightTypeFreeform;
static GUIContent s_LightTypeSprite;
static GUIContent s_LightTypePoint;
static GUIContent s_LightTypeGlobal;
static GUIContent[] s_LightTypeOptions;

public static GUIContent lightTypeFreeform => s_LightTypeFreeform ??= new GUIContent("Freeform", LoadInspectorIcon("FreeformLight.png"));
public static GUIContent lightTypeSprite => s_LightTypeSprite ??= new GUIContent("Sprite", LoadInspectorIcon("SpriteLight.png"));
public static GUIContent lightTypePoint => s_LightTypePoint ??= new GUIContent("Spot", LoadInspectorIcon("PointLight.png"));
public static GUIContent lightTypeGlobal => s_LightTypeGlobal ??= new GUIContent("Global", LoadInspectorIcon("GlobalLight.png"));
public static GUIContent[] lightTypeOptions => s_LightTypeOptions ??= new GUIContent[] { lightTypeFreeform, lightTypeSprite, lightTypePoint, lightTypeGlobal };

static Texture LoadIcon(string fileName) => AssetDatabase.LoadAssetAtPath<Texture>(Light2DEditorUtility.ResourcePath + fileName);
static Texture LoadInspectorIcon(string fileName) => LoadIcon("InspectorIcons/" + fileName);

public static GUIContent blendingSettingsFoldout = EditorGUIUtility.TrTextContent("Blending", "Options used for blending");
public static GUIContent shadowsSettingsFoldout = EditorGUIUtility.TrTextContent("Shadows", "Options used for shadows");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ namespace UnityEditor.Rendering.Universal
{
internal static class Light2DEditorUtility
{
internal static readonly string ResourcePath = "Packages/com.unity.render-pipelines.universal/Editor/2D/ResourceIcons/";

static Material s_TexCapMaterial = CoreUtils.CreateEngineMaterial(Shader.Find("Hidden/Internal-GUITexture"));
static Mesh k_MeshQuad_Cache;
static Mesh k_MeshQuad => k_MeshQuad_Cache == null || k_MeshQuad_Cache.Equals(null) ? (k_MeshQuad_Cache = Resources.GetBuiltinResource<Mesh>("Quad.fbx")) : k_MeshQuad_Cache;
Expand Down

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

This file was deleted.

Loading
Loading