You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
861 B
34 lines
861 B
using System;
|
|
using System.Runtime.InteropServices;
|
|
using UnityEngine;
|
|
|
|
namespace FidelityFX
|
|
{
|
|
public abstract class FfxContextBase
|
|
{
|
|
protected static ComputeBuffer CreateConstantBuffer<TBuf>()
|
|
where TBuf: struct
|
|
{
|
|
return new ComputeBuffer(1, Marshal.SizeOf<TBuf>(), ComputeBufferType.Constant);
|
|
}
|
|
|
|
protected static void DestroyConstantBuffer(ref ComputeBuffer bufferRef)
|
|
{
|
|
if (bufferRef == null)
|
|
return;
|
|
|
|
bufferRef.Release();
|
|
bufferRef = null;
|
|
}
|
|
|
|
protected static void DestroyPass<TPass>(ref TPass pass)
|
|
where TPass: class, IDisposable
|
|
{
|
|
if (pass == null)
|
|
return;
|
|
|
|
pass.Dispose();
|
|
pass = null;
|
|
}
|
|
}
|
|
}
|