Browse Source
Created an abstract base class for context objects, with a few common helper methods
framework
Created an abstract base class for context objects, with a few common helper methods
framework
4 changed files with 47 additions and 48 deletions
-
34Runtime/Common/FfxContextBase.cs
-
11Runtime/Common/FfxContextBase.cs.meta
-
25Runtime/FSR2/Fsr2Context.cs
-
25Runtime/FSR3/Fsr3UpscalerContext.cs
@ -0,0 +1,34 @@ |
|||||
|
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; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
fileFormatVersion: 2 |
||||
|
guid: f4aeccbeb6e61434eb2e50b7190fda8d |
||||
|
MonoImporter: |
||||
|
externalObjects: {} |
||||
|
serializedVersion: 2 |
||||
|
defaultReferences: [] |
||||
|
executionOrder: 0 |
||||
|
icon: {instanceID: 0} |
||||
|
userData: |
||||
|
assetBundleName: |
||||
|
assetBundleVariant: |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue