Browse Source

Merge branch 'ww1dev/hdrp17/svn' into ww1dev/hdrp17/staging

ww1dev/hdrp17/staging
Nico de Poel 1 month ago
parent
commit
4b7a645f40
  1. 9
      Packages/com.unity.render-pipelines.high-definition/Runtime/FidelityFX/HDRenderPipeline.FidelityFX.Cacao.cs
  2. 2
      Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs
  3. 22
      Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/Upscalers/HDRenderPipeline.AlphaUpscale.cs

9
Packages/com.unity.render-pipelines.high-definition/Runtime/FidelityFX/HDRenderPipeline.FidelityFX.Cacao.cs

@ -72,11 +72,12 @@ namespace UnityEngine.Rendering.HighDefinition
hdCamera.cacaoContext.UpdateSettings(parameters.settings);
using (var builder = renderGraph.AddRenderPass<RenderCacaoPassData>("FidelityFX CACAO", out var passData, ProfilingSampler.Get(HDProfileId.AmbientOcclusion)))
using (var builder = renderGraph.AddUnsafePass<RenderCacaoPassData>("FidelityFX CACAO", out var passData, ProfilingSampler.Get(HDProfileId.AmbientOcclusion)))
{
builder.EnableAsyncCompute(parameters.runAsync);
passData.aoOutput = builder.WriteTexture(CreateAmbientOcclusionTexture(renderGraph, true));
passData.aoOutput = CreateAmbientOcclusionTexture(renderGraph, true);
builder.UseTexture(passData.aoOutput, AccessFlags.Write);
passData.cacaoContext = hdCamera.cacaoContext;
passData.depthBuffer = depthBuffer;
@ -85,7 +86,7 @@ namespace UnityEngine.Rendering.HighDefinition
passData.normalsToView = parameters.cameraToWorldMatrix * Cacao.UnityToCacaoViewMatrix;
passData.rtHandleScale = parameters.rtHandleScale;
builder.SetRenderFunc((RenderCacaoPassData data, RenderGraphContext ctx) =>
builder.SetRenderFunc((RenderCacaoPassData data, UnsafeGraphContext ctx) =>
{
var dispatchInfo = new Cacao.DispatchInfo
{
@ -98,7 +99,7 @@ namespace UnityEngine.Rendering.HighDefinition
ctx.cmd.SetGlobalTexture("_NormalBufferTexture", data.normalBuffer);
ctx.cmd.SetGlobalTexture("_OcclusionTexture", data.aoOutput);
data.cacaoContext.Draw(ctx.cmd, dispatchInfo, data.projectionMatrix, data.normalsToView, data.rtHandleScale);
data.cacaoContext.Draw(CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd), dispatchInfo, data.projectionMatrix, data.normalsToView, data.rtHandleScale);
});
return passData.aoOutput;

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

@ -1018,7 +1018,7 @@ namespace UnityEngine.Rendering.HighDefinition
source = DoFSR2Pass(renderGraph, hdCamera, source, depthBuffer, motionVectors, colorBiasMask);
// WW1MOD Added alpha upscaling
if (!upscalerPlugin.supportsAlpha)
if (!upscalerPlugin.supportsAlpha && GraphicsFormatUtility.HasAlphaChannel(alphaSource.GetDescriptor(renderGraph).format))
source = UpscaleAlpha(renderGraph, hdCamera, alphaSource, depthBuffer, motionVectors, source);
SetCurrentResolutionGroup(renderGraph, hdCamera, ResolutionGroup.AfterDynamicResUpscale);

22
Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/Upscalers/HDRenderPipeline.AlphaUpscale.cs

@ -25,7 +25,7 @@ namespace UnityEngine.Rendering.HighDefinition
TextureHandle UpscaleAlpha(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle source, TextureHandle depth, TextureHandle motionVectors, TextureHandle output)
{
using (var builder = renderGraph.AddRenderPass<AlphaUpscalePassData>("Alpha Upscale", out var passData, ProfilingSampler.Get(HDProfileId.AlphaCopy)))
using (var builder = renderGraph.AddUnsafePass<AlphaUpscalePassData>("Alpha Upscale", out var passData, ProfilingSampler.Get(HDProfileId.AlphaCopy)))
{
Vector2Int finalViewport = DynamicResolutionHandler.instance.finalViewport;
@ -34,17 +34,23 @@ namespace UnityEngine.Rendering.HighDefinition
passData.width = finalViewport.x;
passData.height = finalViewport.y;
passData.viewCount = hdCamera.viewCount;
passData.source = builder.ReadTexture(source);
passData.depth = builder.ReadTexture(depth);
passData.motionVectors = builder.ReadTexture(motionVectors);
passData.output = builder.ReadWriteTexture(output);
passData.source = source;
builder.UseTexture(passData.source);
passData.depth = depth;
builder.UseTexture(passData.depth);
passData.motionVectors = motionVectors;
builder.UseTexture(passData.motionVectors);
passData.output = output;
builder.UseTexture(passData.output, AccessFlags.ReadWrite);
bool validHistory = GrabPostProcessHistoryTextures(hdCamera, HDCameraFrameHistoryType.AlphaUpscale, "Alpha History", GraphicsFormat.R8_UNorm, finalViewport, out RTHandle previous, out RTHandle next);
passData.resetHistory = !validHistory;
passData.prevAlpha = validHistory ? builder.ReadTexture(renderGraph.ImportTexture(previous)) : builder.ReadWriteTexture(renderGraph.ImportTexture(previous));
passData.nextAlpha = builder.WriteTexture(renderGraph.ImportTexture(next));
passData.prevAlpha = renderGraph.ImportTexture(previous);
builder.UseTexture(passData.prevAlpha, validHistory ? AccessFlags.Read : AccessFlags.ReadWrite);
passData.nextAlpha = renderGraph.ImportTexture(next);
builder.UseTexture(passData.nextAlpha, AccessFlags.Write);
builder.SetRenderFunc((AlphaUpscalePassData data, RenderGraphContext ctx) =>
builder.SetRenderFunc(static (AlphaUpscalePassData data, UnsafeGraphContext ctx) =>
{
if (data.resetHistory)
{

Loading…
Cancel
Save