|
|
|
@ -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) |
|
|
|
{ |
|
|
|
|