Browse Source

Set up first skeleton for optical flow data structures and dispatching

fsr3framegen
Nico de Poel 2 years ago
parent
commit
07a7571935
  1. 55
      Runtime/OpticalFlow/OpticalFlow.cs
  2. 11
      Runtime/OpticalFlow/OpticalFlow.cs.meta
  3. 4
      Runtime/OpticalFlow/OpticalFlowAssets.cs
  4. 17
      Runtime/OpticalFlow/OpticalFlowContext.cs
  5. 11
      Runtime/OpticalFlow/OpticalFlowContext.cs.meta

55
Runtime/OpticalFlow/OpticalFlow.cs

@ -0,0 +1,55 @@
using System;
using System.Runtime.InteropServices;
using UnityEngine;
namespace FidelityFX.OpticalFlow
{
public static class OpticalFlow
{
public static OpticalFlowContext CreateContext(in ContextDescription contextDescription)
{
throw new NotImplementedException();
}
public struct ContextDescription
{
public Vector2Int resolution;
}
public struct DispatchDescription
{
public ResourceView color;
public ResourceView opticalFlowVector;
public ResourceView opticalFlowSCD;
public bool reset;
public int backbufferTransferFunction;
public Vector2 minMaxLuminance;
}
[Serializable, StructLayout(LayoutKind.Sequential)]
internal struct OpticalFlowConstants
{
public Vector2Int inputLumaResolution;
public uint opticalFlowPyramidLevel;
public uint opticalFlowPyramidLevelCount;
public int frameIndex;
public uint backbufferTransferFunction;
public Vector2 minMaxLuminance;
}
[Serializable, StructLayout(LayoutKind.Sequential)]
internal struct SpdConstants
{
public uint mips;
public uint numWorkGroups;
public uint workGroupOffsetX;
public uint workGroupOffsetY;
public uint numWorkGroupsOpticalFlowInputPyramid;
public uint pad0_;
public uint pad1_;
public uint pad2_;
}
}
}

11
Runtime/OpticalFlow/OpticalFlow.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cb98adb74c696524e900d3b0b965e1dc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

4
Runtime/OpticalFlow/OpticalFlowAssets.cs

@ -75,12 +75,12 @@ namespace FidelityFX.OpticalFlow
public ComputeShader prepareLuma;
/// <summary>
/// The compute shader used by the generate SCD histogram pass.
/// The compute shader used by the generate scene change detection histogram pass.
/// </summary>
public ComputeShader generateScdHistogram;
/// <summary>
/// The compute shader used by the compute SCD divergence pass.
/// The compute shader used by the compute scene change detection divergence pass.
/// </summary>
public ComputeShader computeScdDivergence;

17
Runtime/OpticalFlow/OpticalFlowContext.cs

@ -0,0 +1,17 @@
using System;
using UnityEngine;
using UnityEngine.Rendering;
namespace FidelityFX.OpticalFlow
{
public class OpticalFlowContext
{
private bool _firstExecution = true;
private uint _resourceFrameIndex;
public void Dispatch(CommandBuffer commandBuffer, in OpticalFlow.DispatchDescription dispatchDescription)
{
throw new NotImplementedException();
}
}
}

11
Runtime/OpticalFlow/OpticalFlowContext.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: baebcaebda3cbd344a546d7f3c47ae0d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Loading…
Cancel
Save