Skip to content

Commit ffcacce

Browse files
[HDRP] Merge Hd/bugfix #5999
1 parent 6e87583 commit ffcacce

File tree

11 files changed

+57
-14
lines changed

11 files changed

+57
-14
lines changed

com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphDefaultResources.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public class RenderGraphDefaultResources
1212
// We need to keep around a RTHandle version of default regular 2D textures since RenderGraph API is all RTHandle.
1313
RTHandle m_BlackTexture2D;
1414
RTHandle m_WhiteTexture2D;
15+
RTHandle m_ShadowTexture2D;
1516

1617
/// <summary>Default black 2D texture.</summary>
1718
public TextureHandle blackTexture { get; private set; }
@@ -31,23 +32,28 @@ public class RenderGraphDefaultResources
3132
public TextureHandle blackTexture3DXR { get; private set; }
3233
/// <summary>Default white XR 2D texture.</summary>
3334
public TextureHandle whiteTextureXR { get; private set; }
35+
/// <summary>Default 1x1 shadow texture.</summary>
36+
public TextureHandle defaultShadowTexture { get; private set; }
3437

3538
internal RenderGraphDefaultResources()
3639
{
3740
m_BlackTexture2D = RTHandles.Alloc(Texture2D.blackTexture);
3841
m_WhiteTexture2D = RTHandles.Alloc(Texture2D.whiteTexture);
42+
m_ShadowTexture2D = RTHandles.Alloc(1, 1, depthBufferBits: DepthBits.Depth32, isShadowMap: true);
3943
}
4044

4145
internal void Cleanup()
4246
{
4347
m_BlackTexture2D.Release();
4448
m_WhiteTexture2D.Release();
49+
m_ShadowTexture2D.Release();
4550
}
4651

4752
internal void InitializeForRendering(RenderGraph renderGraph)
4853
{
4954
blackTexture = renderGraph.ImportTexture(m_BlackTexture2D);
5055
whiteTexture = renderGraph.ImportTexture(m_WhiteTexture2D);
56+
defaultShadowTexture = renderGraph.ImportTexture(m_ShadowTexture2D);
5157

5258
clearTextureXR = renderGraph.ImportTexture(TextureXR.GetClearTexture());
5359
magentaTextureXR = renderGraph.ImportTexture(TextureXR.GetMagentaTexture());

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1010
- Fixed diffusion profile being reset to default on SpeedTree8 materials with subsurface scattering enabled during import.
1111
- Fixed error in SSGI when disabling decals (case 1365521).
1212
- Fixed silhouette issue with emissive decals
13+
- Fixed range compression factor being clamped. (case 1365707)
14+
- Fixed tooltip not showing on labels in ShaderGraphs (1358483).
15+
- Fix API warnings in Matcap mode on Metal.
16+
- Fix D3D validation layer errors w.r.t shadow textures when an atlas is not used.
1317

1418
## [10.7.0] - 2021-07-02
1519

com.unity.render-pipelines.high-definition/Documentation~/Feature-Comparison.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ The tables that follow provide an overview of the Features that the High Definit
116116
| **Realtime** | Yes | yes |
117117
| **Baked** | Yes | Yes |
118118
| ***Sampling*** | | |
119+
| **Anchor Override** | Yes | Not supported |
119120
| **Simple** | Yes | See [Reflection Hierarchy](Reflection-in-HDRP.md). |
120121
| **Blend Probes** | Yes | See [Reflection Hierarchy](Reflection-in-HDRP.md). |
121122
| **Blend Probes and Skybox** | Yes | See [Reflection Hierarchy](Reflection-in-HDRP.md). |

com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/SerializedHDReflectionProbe.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ internal override void Update()
3939

4040
internal override void Apply()
4141
{
42-
// Force the mode to real time so its influence is properly culled by the camera.
43-
legacyMode.intValue = 1;
44-
4542
serializedLegacyObject.ApplyModifiedProperties();
4643
base.Apply();
4744
}

com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/SubTargetPropertyBlock.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,17 @@ protected void AddProperty<Data>(GUIContent displayName, Func<Data> getter, Acti
4545

4646
switch (getter())
4747
{
48-
case bool b: elem = new Toggle { value = b, tooltip = displayName.tooltip } as BaseField<Data>; break;
49-
case int i: elem = new IntegerField { value = i, tooltip = displayName.tooltip } as BaseField<Data>; break;
50-
case float f: elem = new FloatField { value = f, tooltip = displayName.tooltip } as BaseField<Data>; break;
51-
case Enum e: elemEnum = new EnumField(e) { value = e, tooltip = displayName.tooltip }; break;
48+
case bool b: elem = new Toggle { value = b } as BaseField<Data>; break;
49+
case int i: elem = new IntegerField { value = i, isDelayed = true } as BaseField<Data>; break;
50+
case float f: elem = new FloatField { value = f, isDelayed = true } as BaseField<Data>; break;
51+
case Enum e: elemEnum = new EnumField(e) { value = e }; break;
5252
default: throw new Exception($"Can't create UI field for type {getter().GetType()}, please add it if it's relevant. If you can't consider using TargetPropertyGUIContext.AddProperty instead.");
5353
}
5454

5555
if (elem != null)
5656
{
57-
context.AddProperty<Data>(displayName.text, indentLevel, elem, (evt) => {
57+
context.AddProperty<Data>(displayName.text, displayName.tooltip, indentLevel, elem, (evt) =>
58+
{
5859
if (Equals(getter(), evt.newValue))
5960
return;
6061

@@ -65,7 +66,8 @@ protected void AddProperty<Data>(GUIContent displayName, Func<Data> getter, Acti
6566
}
6667
else
6768
{
68-
context.AddProperty<Enum>(displayName.text, indentLevel, elemEnum, (evt) => {
69+
context.AddProperty<Enum>(displayName.text, displayName.tooltip, indentLevel, elemEnum, (evt) =>
70+
{
6971
if (Equals(getter(), evt.newValue))
7072
return;
7173

com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,15 +152,18 @@ float4 SampleEnv(LightLoopContext lightLoopContext, int index, float3 texCoord,
152152
color.rgb = SAMPLE_TEXTURECUBE_ARRAY_LOD_ABSTRACT(_EnvCubemapTextures, s_trilinear_clamp_sampler, texCoord, _EnvSliceSize * index + sliceIdx, lod).rgb;
153153
}
154154

155+
// Planar and Reflection Probes aren't pre-expose, so best to clamp to max16 here in case of inf
156+
color.rgb = ClampToFloat16Max(color.rgb);
157+
155158
color.rgb *= rangeCompressionFactorCompensation;
156159
}
157160
else // SINGLE_PASS_SAMPLE_SKY
158161
{
159162
color.rgb = SampleSkyTexture(texCoord, lod, sliceIdx).rgb;
163+
// Sky isn't pre-expose, so best to clamp to max16 here in case of inf
164+
color.rgb = ClampToFloat16Max(color.rgb);
160165
}
161166

162-
// Planar, Reflection Probes and Sky aren't pre-expose, so best to clamp to max16 here in case of inf
163-
color.rgb = ClampToFloat16Max(color.rgb);
164167

165168
return color;
166169
}

com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/GTAOCopyHistory.compute

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
#pragma kernel GTAODenoise_CopyHistory
44

5-
RW_TEXTURE2D_X(uint, _OutputTexture);
5+
RW_TEXTURE2D_X(float4, _OutputTexture);
66
TEXTURE2D_X(_InputTexture);
77

88
[numthreads(8, 8, 1)]
99
void GTAODenoise_CopyHistory(uint3 dispatchThreadId : SV_DispatchThreadID)
1010
{
1111
UNITY_XR_ASSIGN_VIEW_INDEX(dispatchThreadId.z);
12-
_OutputTexture[COORD_TEXTURE2D_X(dispatchThreadId.xy)] = _InputTexture[COORD_TEXTURE2D_X(dispatchThreadId.xy)].x;
12+
_OutputTexture[COORD_TEXTURE2D_X(dispatchThreadId.xy)] = _InputTexture[COORD_TEXTURE2D_X(dispatchThreadId.xy)];
1313
}

com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.RenderGraph.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ static void BindAtlasTexture(RenderGraphContext ctx, TextureHandle texture, int
7474
if (texture.IsValid())
7575
ctx.cmd.SetGlobalTexture(shaderId, texture);
7676
else
77-
ctx.cmd.SetGlobalTexture(shaderId, ctx.defaultResources.blackTexture);
77+
ctx.cmd.SetGlobalTexture(shaderId, ctx.defaultResources.defaultShadowTexture);
7878
}
7979

8080
void BindShadowGlobalResources(RenderGraph renderGraph, in ShadowResult shadowResult)
@@ -95,6 +95,23 @@ void BindShadowGlobalResources(RenderGraph renderGraph, in ShadowResult shadowRe
9595
}
9696
}
9797

98+
internal static void BindDefaultShadowGlobalResources(RenderGraph renderGraph)
99+
{
100+
using (var builder = renderGraph.AddRenderPass<BindShadowGlobalResourcesPassData>("BindDefaultShadowGlobalResources", out var passData))
101+
{
102+
builder.AllowPassCulling(false);
103+
builder.SetRenderFunc(
104+
(BindShadowGlobalResourcesPassData data, RenderGraphContext ctx) =>
105+
{
106+
BindAtlasTexture(ctx, ctx.defaultResources.defaultShadowTexture, HDShaderIDs._ShadowmapAtlas);
107+
BindAtlasTexture(ctx, ctx.defaultResources.defaultShadowTexture, HDShaderIDs._ShadowmapCascadeAtlas);
108+
BindAtlasTexture(ctx, ctx.defaultResources.defaultShadowTexture, HDShaderIDs._ShadowmapAreaAtlas);
109+
BindAtlasTexture(ctx, ctx.defaultResources.defaultShadowTexture, HDShaderIDs._CachedShadowmapAtlas);
110+
BindAtlasTexture(ctx, ctx.defaultResources.defaultShadowTexture, HDShaderIDs._CachedAreaLightShadowmapAtlas);
111+
});
112+
}
113+
}
114+
98115
class BlitCachedShadowPassData
99116
{
100117
public TextureHandle sourceCachedAtlas;

com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Debug.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,8 @@ TextureHandle RenderDebugViewMaterial(RenderGraph renderGraph, CullingResults cu
593593
HDUtils.BlitColorAndDepth(context.cmd, data.clearColorTexture, data.clearDepthTexture, new Vector4(1, 1, 0, 0), 0, !data.clearDepth);
594594
}
595595

596+
BindDefaultTexturesLightingBuffers(context.defaultResources, context.cmd);
597+
596598
BindDBufferGlobalData(data.dbuffer, context);
597599
DrawOpaqueRendererList(context, data.frameSettings, data.opaqueRendererList);
598600

com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ static void BindGlobalLightingBuffers(in LightingBuffers buffers, CommandBuffer
4444
cmd.SetGlobalTexture(HDShaderIDs._ScreenSpaceShadowsTexture, buffers.screenspaceShadowBuffer);
4545
}
4646

47+
static void BindDefaultTexturesLightingBuffers(RenderGraphDefaultResources defaultResources, CommandBuffer cmd)
48+
{
49+
cmd.SetGlobalTexture(HDShaderIDs._AmbientOcclusionTexture, defaultResources.blackTextureXR);
50+
cmd.SetGlobalTexture(HDShaderIDs._SsrLightingTexture, defaultResources.blackTextureXR);
51+
cmd.SetGlobalTexture(HDShaderIDs._IndirectDiffuseTexture, defaultResources.blackTextureXR);
52+
cmd.SetGlobalTexture(HDShaderIDs._ContactShadowTexture, defaultResources.blackUIntTextureXR);
53+
cmd.SetGlobalTexture(HDShaderIDs._ScreenSpaceShadowsTexture, defaultResources.blackTextureXR);
54+
}
55+
4756
class BuildGPULightListPassData
4857
{
4958
public BuildGPULightListParameters buildGPULightListParameters;

0 commit comments

Comments
 (0)