4 changed files with 38 additions and 36 deletions
-
25Runtime/Common/FfxSpd.cs
-
11Runtime/Common/FfxSpd.cs.meta
-
19Runtime/FSR2/Fsr2Context.cs
-
19Runtime/FSR3/Fsr3UpscalerContext.cs
@ -0,0 +1,25 @@ |
|||
using System; |
|||
using UnityEngine; |
|||
|
|||
namespace FidelityFX |
|||
{ |
|||
public static class FfxSpd |
|||
{ |
|||
public static void SpdSetup(RectInt rectInfo, out Vector2Int dispatchThreadGroupCount, out Vector2Int workGroupOffset, out Vector2Int numWorkGroupsAndMips, int mips = -1) |
|||
{ |
|||
workGroupOffset = new Vector2Int(rectInfo.x / 64, rectInfo.y / 64); |
|||
|
|||
int endIndexX = (rectInfo.x + rectInfo.width - 1) / 64; |
|||
int endIndexY = (rectInfo.y + rectInfo.height - 1) / 64; |
|||
|
|||
dispatchThreadGroupCount = new Vector2Int(endIndexX + 1 - workGroupOffset.x, endIndexY + 1 - workGroupOffset.y); |
|||
|
|||
numWorkGroupsAndMips = new Vector2Int(dispatchThreadGroupCount.x * dispatchThreadGroupCount.y, mips); |
|||
if (mips < 0) |
|||
{ |
|||
float resolution = Math.Max(rectInfo.width, rectInfo.height); |
|||
numWorkGroupsAndMips.y = Math.Min(Mathf.FloorToInt(Mathf.Log(resolution, 2.0f)), 12); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: aee0f42dc1676ab4db5c01520b0b925a |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue