|
|
@ -29,7 +29,7 @@ namespace ArmASR |
|
|
|
|
|
|
|
|
private CustomSampler _sampler; |
|
|
private CustomSampler _sampler; |
|
|
|
|
|
|
|
|
protected AsrPass(Asr.ContextDescription contextDescription, AsrResources resources, ComputeBuffer constants) |
|
|
|
|
|
|
|
|
protected AsrPass(in Asr.ContextDescription contextDescription, AsrResources resources, ComputeBuffer constants) |
|
|
{ |
|
|
{ |
|
|
ContextDescription = contextDescription; |
|
|
ContextDescription = contextDescription; |
|
|
Resources = resources; |
|
|
Resources = resources; |
|
|
@ -45,14 +45,14 @@ namespace ArmASR |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void ScheduleDispatch(CommandBuffer commandBuffer, Asr.DispatchDescription dispatchParams, int frameIndex, int dispatchX = 0, int dispatchY = 0) |
|
|
|
|
|
|
|
|
public void ScheduleDispatch(CommandBuffer commandBuffer, in Asr.DispatchDescription dispatchParams, int frameIndex, int dispatchX = 0, int dispatchY = 0) |
|
|
{ |
|
|
{ |
|
|
BeginSample(commandBuffer); |
|
|
BeginSample(commandBuffer); |
|
|
DoScheduleDispatch(commandBuffer, dispatchParams, frameIndex, dispatchX, dispatchY); |
|
|
DoScheduleDispatch(commandBuffer, dispatchParams, frameIndex, dispatchX, dispatchY); |
|
|
EndSample(commandBuffer); |
|
|
EndSample(commandBuffer); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
protected abstract void DoScheduleDispatch(CommandBuffer commandBuffer, Asr.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY); |
|
|
|
|
|
|
|
|
protected abstract void DoScheduleDispatch(CommandBuffer commandBuffer, in Asr.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY); |
|
|
|
|
|
|
|
|
protected void InitComputeShader(string passName, ComputeShader shader) |
|
|
protected void InitComputeShader(string passName, ComputeShader shader) |
|
|
{ |
|
|
{ |
|
|
@ -116,7 +116,7 @@ namespace ArmASR |
|
|
{ |
|
|
{ |
|
|
private readonly ComputeBuffer _spdConstants; |
|
|
private readonly ComputeBuffer _spdConstants; |
|
|
|
|
|
|
|
|
public AsrComputeLuminancePyramidPass(Asr.ContextDescription contextDescription, AsrResources resources, ComputeBuffer constants, ComputeBuffer spdConstants) |
|
|
|
|
|
|
|
|
public AsrComputeLuminancePyramidPass(in Asr.ContextDescription contextDescription, AsrResources resources, ComputeBuffer constants, ComputeBuffer spdConstants) |
|
|
: base(contextDescription, resources, constants) |
|
|
: base(contextDescription, resources, constants) |
|
|
{ |
|
|
{ |
|
|
_spdConstants = spdConstants; |
|
|
_spdConstants = spdConstants; |
|
|
@ -124,7 +124,7 @@ namespace ArmASR |
|
|
InitComputeShader("Compute Luminance Pyramid", contextDescription.Shaders.computeLuminancePyramidPass); |
|
|
InitComputeShader("Compute Luminance Pyramid", contextDescription.Shaders.computeLuminancePyramidPass); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
protected override void DoScheduleDispatch(CommandBuffer commandBuffer, Asr.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) |
|
|
|
|
|
|
|
|
protected override void DoScheduleDispatch(CommandBuffer commandBuffer, in Asr.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) |
|
|
{ |
|
|
{ |
|
|
commandBuffer.SetComputeResourceParam(ComputeShader, KernelIndex, AsrShaderIDs.SrvInputColor, dispatchParams.Color); |
|
|
commandBuffer.SetComputeResourceParam(ComputeShader, KernelIndex, AsrShaderIDs.SrvInputColor, dispatchParams.Color); |
|
|
commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, AsrShaderIDs.SrvAutoExposure, Resources.AutoExposure[frameIndex ^ 1]); |
|
|
commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, AsrShaderIDs.SrvAutoExposure, Resources.AutoExposure[frameIndex ^ 1]); |
|
|
@ -145,13 +145,13 @@ namespace ArmASR |
|
|
{ |
|
|
{ |
|
|
private readonly RenderTargetIdentifier[] _mrt = new RenderTargetIdentifier[3]; |
|
|
private readonly RenderTargetIdentifier[] _mrt = new RenderTargetIdentifier[3]; |
|
|
|
|
|
|
|
|
public AsrReconstructPreviousDepthPass(Asr.ContextDescription contextDescription, AsrResources resources, ComputeBuffer constants) |
|
|
|
|
|
|
|
|
public AsrReconstructPreviousDepthPass(in Asr.ContextDescription contextDescription, AsrResources resources, ComputeBuffer constants) |
|
|
: base(contextDescription, resources, constants) |
|
|
: base(contextDescription, resources, constants) |
|
|
{ |
|
|
{ |
|
|
InitFragmentShader("Reconstruct & Dilate", contextDescription.Shaders.fragmentShader, 1); |
|
|
InitFragmentShader("Reconstruct & Dilate", contextDescription.Shaders.fragmentShader, 1); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
protected override void DoScheduleDispatch(CommandBuffer commandBuffer, Asr.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) |
|
|
|
|
|
|
|
|
protected override void DoScheduleDispatch(CommandBuffer commandBuffer, in Asr.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) |
|
|
{ |
|
|
{ |
|
|
commandBuffer.SetGlobalResource(AsrShaderIDs.SrvInputColor, dispatchParams.Color); |
|
|
commandBuffer.SetGlobalResource(AsrShaderIDs.SrvInputColor, dispatchParams.Color); |
|
|
commandBuffer.SetGlobalResource(AsrShaderIDs.SrvInputDepth, dispatchParams.Depth); |
|
|
commandBuffer.SetGlobalResource(AsrShaderIDs.SrvInputDepth, dispatchParams.Depth); |
|
|
@ -175,13 +175,13 @@ namespace ArmASR |
|
|
{ |
|
|
{ |
|
|
private readonly RenderTargetIdentifier[] _mrt = new RenderTargetIdentifier[2]; |
|
|
private readonly RenderTargetIdentifier[] _mrt = new RenderTargetIdentifier[2]; |
|
|
|
|
|
|
|
|
public AsrDepthClipPass(Asr.ContextDescription contextDescription, AsrResources resources, ComputeBuffer constants) |
|
|
|
|
|
|
|
|
public AsrDepthClipPass(in Asr.ContextDescription contextDescription, AsrResources resources, ComputeBuffer constants) |
|
|
: base(contextDescription, resources, constants) |
|
|
: base(contextDescription, resources, constants) |
|
|
{ |
|
|
{ |
|
|
InitFragmentShader("Depth Clip", contextDescription.Shaders.fragmentShader, 2); |
|
|
InitFragmentShader("Depth Clip", contextDescription.Shaders.fragmentShader, 2); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
protected override void DoScheduleDispatch(CommandBuffer commandBuffer, Asr.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) |
|
|
|
|
|
|
|
|
protected override void DoScheduleDispatch(CommandBuffer commandBuffer, in Asr.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) |
|
|
{ |
|
|
{ |
|
|
commandBuffer.SetGlobalResource(AsrShaderIDs.SrvInputColor, dispatchParams.Color); |
|
|
commandBuffer.SetGlobalResource(AsrShaderIDs.SrvInputColor, dispatchParams.Color); |
|
|
commandBuffer.SetGlobalResource(AsrShaderIDs.SrvInputDepth, dispatchParams.Depth); |
|
|
commandBuffer.SetGlobalResource(AsrShaderIDs.SrvInputDepth, dispatchParams.Depth); |
|
|
@ -205,13 +205,13 @@ namespace ArmASR |
|
|
|
|
|
|
|
|
internal class AsrLockPass : AsrPass |
|
|
internal class AsrLockPass : AsrPass |
|
|
{ |
|
|
{ |
|
|
public AsrLockPass(Asr.ContextDescription contextDescription, AsrResources resources, ComputeBuffer constants) |
|
|
|
|
|
|
|
|
public AsrLockPass(in Asr.ContextDescription contextDescription, AsrResources resources, ComputeBuffer constants) |
|
|
: base(contextDescription, resources, constants) |
|
|
: base(contextDescription, resources, constants) |
|
|
{ |
|
|
{ |
|
|
InitComputeShader("Create Locks", contextDescription.Shaders.lockPass); |
|
|
InitComputeShader("Create Locks", contextDescription.Shaders.lockPass); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
protected override void DoScheduleDispatch(CommandBuffer commandBuffer, Asr.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) |
|
|
|
|
|
|
|
|
protected override void DoScheduleDispatch(CommandBuffer commandBuffer, in Asr.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) |
|
|
{ |
|
|
{ |
|
|
commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, AsrShaderIDs.SrvLockInputLuma, AsrShaderIDs.UavLockInputLuma); |
|
|
commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, AsrShaderIDs.SrvLockInputLuma, AsrShaderIDs.UavLockInputLuma); |
|
|
|
|
|
|
|
|
@ -228,13 +228,13 @@ namespace ArmASR |
|
|
{ |
|
|
{ |
|
|
private readonly RenderTargetIdentifier[] _mrt = new RenderTargetIdentifier[4]; |
|
|
private readonly RenderTargetIdentifier[] _mrt = new RenderTargetIdentifier[4]; |
|
|
|
|
|
|
|
|
public AsrAccumulatePass(Asr.ContextDescription contextDescription, AsrResources resources, ComputeBuffer constants) |
|
|
|
|
|
|
|
|
public AsrAccumulatePass(in Asr.ContextDescription contextDescription, AsrResources resources, ComputeBuffer constants) |
|
|
: base(contextDescription, resources, constants) |
|
|
: base(contextDescription, resources, constants) |
|
|
{ |
|
|
{ |
|
|
InitFragmentShader("Reproject & Accumulate", contextDescription.Shaders.fragmentShader, 3); |
|
|
InitFragmentShader("Reproject & Accumulate", contextDescription.Shaders.fragmentShader, 3); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
protected override void DoScheduleDispatch(CommandBuffer commandBuffer, Asr.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) |
|
|
|
|
|
|
|
|
protected override void DoScheduleDispatch(CommandBuffer commandBuffer, in Asr.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) |
|
|
{ |
|
|
{ |
|
|
if ((ContextDescription.Flags & Asr.InitializationFlags.EnableDisplayResolutionMotionVectors) == 0) |
|
|
if ((ContextDescription.Flags & Asr.InitializationFlags.EnableDisplayResolutionMotionVectors) == 0) |
|
|
{ |
|
|
{ |
|
|
@ -286,7 +286,7 @@ namespace ArmASR |
|
|
{ |
|
|
{ |
|
|
private readonly ComputeBuffer _rcasConstants; |
|
|
private readonly ComputeBuffer _rcasConstants; |
|
|
|
|
|
|
|
|
public AsrSharpenPass(Asr.ContextDescription contextDescription, AsrResources resources, ComputeBuffer constants, ComputeBuffer rcasConstants) |
|
|
|
|
|
|
|
|
public AsrSharpenPass(in Asr.ContextDescription contextDescription, AsrResources resources, ComputeBuffer constants, ComputeBuffer rcasConstants) |
|
|
: base(contextDescription, resources, constants) |
|
|
: base(contextDescription, resources, constants) |
|
|
{ |
|
|
{ |
|
|
_rcasConstants = rcasConstants; |
|
|
_rcasConstants = rcasConstants; |
|
|
@ -294,7 +294,7 @@ namespace ArmASR |
|
|
InitFragmentShader("RCAS Sharpening", contextDescription.Shaders.fragmentShader, 4); |
|
|
InitFragmentShader("RCAS Sharpening", contextDescription.Shaders.fragmentShader, 4); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
protected override void DoScheduleDispatch(CommandBuffer commandBuffer, Asr.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) |
|
|
|
|
|
|
|
|
protected override void DoScheduleDispatch(CommandBuffer commandBuffer, in Asr.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) |
|
|
{ |
|
|
{ |
|
|
commandBuffer.SetGlobalResource(AsrShaderIDs.SrvInputExposure, dispatchParams.Exposure); |
|
|
commandBuffer.SetGlobalResource(AsrShaderIDs.SrvInputExposure, dispatchParams.Exposure); |
|
|
commandBuffer.SetGlobalTexture(AsrShaderIDs.SrvRcasInput, Resources.InternalUpscaled[frameIndex]); |
|
|
commandBuffer.SetGlobalTexture(AsrShaderIDs.SrvRcasInput, Resources.InternalUpscaled[frameIndex]); |
|
|
@ -309,7 +309,7 @@ namespace ArmASR |
|
|
{ |
|
|
{ |
|
|
private readonly ComputeBuffer _generateReactiveConstants; |
|
|
private readonly ComputeBuffer _generateReactiveConstants; |
|
|
|
|
|
|
|
|
public AsrGenerateReactivePass(Asr.ContextDescription contextDescription, AsrResources resources, ComputeBuffer constants, ComputeBuffer generateReactiveConstants) |
|
|
|
|
|
|
|
|
public AsrGenerateReactivePass(in Asr.ContextDescription contextDescription, AsrResources resources, ComputeBuffer constants, ComputeBuffer generateReactiveConstants) |
|
|
: base(contextDescription, resources, constants) |
|
|
: base(contextDescription, resources, constants) |
|
|
{ |
|
|
{ |
|
|
_generateReactiveConstants = generateReactiveConstants; |
|
|
_generateReactiveConstants = generateReactiveConstants; |
|
|
@ -317,7 +317,7 @@ namespace ArmASR |
|
|
InitFragmentShader("Auto-Generate Reactive Mask", contextDescription.Shaders.fragmentShader, 0); |
|
|
InitFragmentShader("Auto-Generate Reactive Mask", contextDescription.Shaders.fragmentShader, 0); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
protected override void DoScheduleDispatch(CommandBuffer commandBuffer, Asr.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) |
|
|
|
|
|
|
|
|
protected override void DoScheduleDispatch(CommandBuffer commandBuffer, in Asr.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) |
|
|
{ |
|
|
{ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|