Skip to content

Commit 1309681

Browse files
authored
Merge pull request #8252 from Unity-Technologies/internal/6000.4/staging
Mirror Internal/6000.4/staging
2 parents cf70de3 + 359e9b8 commit 1309681

File tree

64 files changed

+2990
-364
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2990
-364
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ public class InternalRenderGraphContext
118118
internal RenderGraphPass executingPass;
119119
internal NativeRenderPassCompiler.CompilerContextData compilerContext;
120120
internal bool contextlessTesting;
121+
internal bool forceResourceCreation;
121122
}
122123

123124
// InternalRenderGraphContext is public (but all members are internal)
@@ -1621,6 +1622,15 @@ public void BeginRecording(in RenderGraphParameters parameters)
16211622
m_RenderGraphContext.renderGraphPool = m_RenderGraphPool;
16221623
m_RenderGraphContext.defaultResources = m_DefaultResources;
16231624

1625+
// With the actual implementation of the Frame Debugger, we cannot re-use resources during the same frame
1626+
// or it breaks the rendering of the pass preview, since the FD copies the texture after the execution of the RG.
1627+
m_RenderGraphContext.forceResourceCreation =
1628+
#if UNITY_EDITOR || DEVELOPMENT_BUILD
1629+
FrameDebugger.enabled;
1630+
#else
1631+
false;
1632+
#endif
1633+
16241634
if (m_DebugParameters.immediateMode)
16251635
{
16261636
UpdateCurrentCompiledGraph(graphHash: -1, forceNoCaching: true);

Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResourceRegistry.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,7 @@ internal bool CreatePooledResource(InternalRenderGraphContext rgContext, int typ
10171017
var resource = m_RenderGraphResources[type].resourceArray[index];
10181018
if (!resource.imported)
10191019
{
1020-
resource.CreatePooledGraphicsResource();
1020+
resource.CreatePooledGraphicsResource(rgContext.forceResourceCreation);
10211021

10221022
if (m_RenderGraphDebug.enableLogging)
10231023
resource.LogCreation(m_FrameInformationLogger);

Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResources.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public virtual bool NeedsFallBack()
183183
return requestFallBack && writeCount == 0;
184184
}
185185

186-
public virtual void CreatePooledGraphicsResource() { }
186+
public virtual void CreatePooledGraphicsResource(bool forceResourceCreation) { }
187187
public virtual void CreateGraphicsResource() { }
188188
public virtual void UpdateGraphicsResource() { }
189189
public virtual void ReleasePooledGraphicsResource(int frameIndex) { }
@@ -231,7 +231,7 @@ public override void ReleaseGraphicsResource()
231231
graphicsResource = null;
232232
}
233233

234-
public override void CreatePooledGraphicsResource()
234+
public override void CreatePooledGraphicsResource(bool forceResourceCreation)
235235
{
236236
Debug.Assert(m_Pool != null, "RenderGraphResource: CreatePooledGraphicsResource should only be called for regular pooled resources");
237237

@@ -242,7 +242,7 @@ public override void CreatePooledGraphicsResource()
242242

243243
// If the pool doesn't have any available resource that we can use, we will create one
244244
// In any case, we will update the graphicsResource name based on the RenderGraph resource name
245-
if (!m_Pool.TryGetResource(hashCode, out graphicsResource))
245+
if (forceResourceCreation || !m_Pool.TryGetResource(hashCode, out graphicsResource))
246246
{
247247
CreateGraphicsResource();
248248
}

Packages/com.unity.render-pipelines.core/Runtime/Vrs/VrsRenderPipelineRuntimeResources.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace UnityEngine.Rendering
77
/// </summary>
88
[Serializable]
99
[SupportedOnRenderPipeline]
10-
[Categorization.CategoryInfo(Name = "R: VRS - Runtime Resources", Order = 1000)]
10+
[Categorization.CategoryInfo(Name = "VRS - Runtime Resources", Order = 1000)]
1111
public sealed class VrsRenderPipelineRuntimeResources : IRenderPipelineResources
1212
{
1313
/// <summary>
@@ -18,6 +18,7 @@ public sealed class VrsRenderPipelineRuntimeResources : IRenderPipelineResources
1818
bool IRenderPipelineGraphicsSettings.isAvailableInPlayerBuild => true;
1919

2020
[SerializeField]
21+
[Tooltip("Compute shader used for converting textures to shading rate values")]
2122
[ResourcePath("Runtime/Vrs/Shaders/VrsTexture.compute")]
2223
ComputeShader m_TextureComputeShader;
2324

@@ -31,6 +32,7 @@ public ComputeShader textureComputeShader
3132
}
3233

3334
[SerializeField]
35+
[Tooltip("Shader used when visualizing shading rate values as a color image")]
3436
[ResourcePath("Runtime/Vrs/Shaders/VrsVisualization.shader")]
3537
Shader m_VisualizationShader;
3638

Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ float3 AcesTonemap(float3 aces)
651651

652652
// --- Red modifier --- //
653653
half hue = rgb_2_hue(half3(aces));
654-
half centeredHue = center_hue(hue, RRT_RED_HUE);
654+
float centeredHue = center_hue(hue, RRT_RED_HUE); // UUM-125596 Must be float for subsequent calculations
655655
float hueWeight;
656656
{
657657
//hueWeight = cubic_basis_shaper(centeredHue, RRT_RED_WIDTH);

Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityDOTSInstancing.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ void SetupDOTSInstanceSelectMasks() {}
294294

295295
#ifdef UNITY_DOTS_INSTANCING_UNIFORM_BUFFER
296296
CBUFFER_START(unity_DOTSInstancing_IndirectInstanceVisibility)
297-
float4 unity_DOTSInstancing_IndirectInstanceVisibilityRaw[4096];
297+
float4 unity_DOTSInstancing_IndirectInstanceVisibilityRaw[1024];
298298
CBUFFER_END
299299
#else
300300
ByteAddressBuffer unity_DOTSInstancing_IndirectInstanceVisibility;

Packages/com.unity.render-pipelines.core/Tests/Editor/UnifiedRayTracing/TraceTransparentRays.urtshader

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ int _AnyHitDecision;
1717

1818
uint AnyHitExecute(UnifiedRT::HitContext hitContext, inout RayPayload payload)
1919
{
20-
payload.anyHits |= (1 << hitContext.InstanceID());
20+
payload.anyHits |= (1u << hitContext.InstanceID());
2121

2222
return _AnyHitDecision;
2323
}

Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Water/Water.hlsl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,9 +415,6 @@ PreLightData GetPreLightData(float3 V, PositionInputs posInput, inout BSDFData b
415415
// Grab the water profile of this surface
416416
WaterSurfaceProfile profile = _WaterSurfaceProfiles[bsdfData.surfaceIndex];
417417

418-
// Make sure to apply the smoothness fade
419-
EvaluateSmoothnessFade(posInput.positionWS, profile, bsdfData);
420-
421418
// Profile data
422419
preLightData.tipScatteringHeight = profile.tipScatteringHeight;
423420
preLightData.bodyScatteringHeight = profile.bodyScatteringHeight;

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4142,6 +4142,7 @@ TextureHandle LensFlareScreenSpacePass(RenderGraph renderGraph, HDCamera hdCamer
41424142

41434143
int ratio = (int)m_LensFlareScreenSpace.resolution.value;
41444144
Color tintColor = m_LensFlareScreenSpace.tintColor.value;
4145+
int bloomMip = m_LensFlareScreenSpace.bloomMip.value;
41454146

41464147
using (var builder = renderGraph.AddUnsafePass<LensFlareScreenSpaceData>("Lens Flare Screen Space", out var passData, ProfilingSampler.Get(HDProfileId.LensFlareScreenSpace)))
41474148
{
@@ -4151,7 +4152,10 @@ TextureHandle LensFlareScreenSpacePass(RenderGraph renderGraph, HDCamera hdCamer
41514152
passData.viewport = postProcessViewportSize;
41524153
passData.hdCamera = hdCamera;
41534154
passData.screenSpaceLensFlareBloomMipTexture = screenSpaceLensFlareBloomMipTexture;
4154-
builder.UseTexture(passData.screenSpaceLensFlareBloomMipTexture, AccessFlags.ReadWrite);
4155+
// NOTE: SSLF mip texture is usually the bloom.mip[N] and the BloomTexture is bloom.mip[0]. Sometimes N == 0 which causes double UseTexture error.
4156+
// Check if we are trying to use the same texture twice in the RG.
4157+
if(bloomMip != 0)
4158+
builder.UseTexture(passData.screenSpaceLensFlareBloomMipTexture, AccessFlags.ReadWrite);
41554159
passData.originalBloomTexture = originalBloomTexture;
41564160
builder.UseTexture(passData.originalBloomTexture, AccessFlags.ReadWrite);
41574161

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1606,7 +1606,7 @@ void DownsampleDepthForLowResTransparency(RenderGraph renderGraph, HDCamera hdCa
16061606
scaleBias.w = data.loadOffset.y;
16071607
}
16081608
natCmd.SetGlobalVector(HDShaderIDs._ScaleBias, scaleBias);
1609-
1609+
natCmd.SetGlobalTexture(HDShaderIDs._CameraDepthTexture, data.depthTexture);
16101610
natCmd.SetViewport(data.viewport);
16111611
natCmd.DrawProcedural(Matrix4x4.identity, data.downsampleDepthMaterial, 0, MeshTopology.Triangles, 3, 1, null);
16121612
});

0 commit comments

Comments
 (0)