4 changed files with 115 additions and 5 deletions
-
2com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/Upscalers/FSR2WrapperUpscaler.cs
-
107com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/Upscalers/FSR3Upscaler.cs
-
2com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/Upscalers/FSR3Upscaler.cs.meta
-
7com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/Upscalers/UpscalerPlugin.cs
@ -0,0 +1,107 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
|
||||
|
namespace UnityEngine.Rendering.HighDefinition.AMD.FSR3 |
||||
|
{ |
||||
|
public class FSR3Upscaler: UpscalerPlugin |
||||
|
{ |
||||
|
private static FSR3GraphicsDevice sGraphicsDeviceInstance; |
||||
|
|
||||
|
public override bool Load() => true; |
||||
|
|
||||
|
public override bool IsLoaded() => true; |
||||
|
|
||||
|
public override GraphicsDevice CreateGraphicsDevice() |
||||
|
{ |
||||
|
if (sGraphicsDeviceInstance != null) |
||||
|
{ |
||||
|
sGraphicsDeviceInstance.Shutdown(); |
||||
|
sGraphicsDeviceInstance.Initialize(); |
||||
|
return sGraphicsDeviceInstance; |
||||
|
} |
||||
|
|
||||
|
var graphicsDevice = new FSR3GraphicsDevice(); |
||||
|
if (graphicsDevice.Initialize()) |
||||
|
{ |
||||
|
sGraphicsDeviceInstance = graphicsDevice; |
||||
|
return graphicsDevice; |
||||
|
} |
||||
|
|
||||
|
Debug.LogWarning("Failed to initialize FSR3 Graphics Device"); |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
public override GraphicsDevice device => sGraphicsDeviceInstance; |
||||
|
} |
||||
|
|
||||
|
public class FSR3GraphicsDevice : GraphicsDevice |
||||
|
{ |
||||
|
private static readonly Stack<FSR3Context> sContextPool = new(); |
||||
|
|
||||
|
internal bool Initialize() |
||||
|
{ |
||||
|
// TODO
|
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
internal void Shutdown() |
||||
|
{ |
||||
|
// TODO
|
||||
|
} |
||||
|
|
||||
|
public override FSR2Context CreateFeature(CommandBuffer cmd, in FSR2CommandInitializationData initSettings) |
||||
|
{ |
||||
|
var context = sContextPool.Count != 0 ? sContextPool.Pop() : new FSR3Context(); |
||||
|
context.Init(initSettings); // TODO might need some way to distinguish between contexts (see featureSlot)
|
||||
|
return context; |
||||
|
} |
||||
|
|
||||
|
public override void DestroyFeature(CommandBuffer cmd, FSR2Context fsrContext) |
||||
|
{ |
||||
|
var context = (FSR3Context)fsrContext; |
||||
|
context.Reset(); |
||||
|
sContextPool.Push(context); |
||||
|
} |
||||
|
|
||||
|
public override void ExecuteFSR2(CommandBuffer cmd, FSR2Context fsrContext, in FSR2TextureTable textures) |
||||
|
{ |
||||
|
((FSR3Context)fsrContext).Draw(cmd, in textures); |
||||
|
} |
||||
|
|
||||
|
public override bool GetRenderResolutionFromQualityMode(FSR2Quality qualityMode, uint displayWidth, uint displayHeight, out uint renderWidth, out uint renderHeight) |
||||
|
{ |
||||
|
throw new System.NotImplementedException(); |
||||
|
} |
||||
|
|
||||
|
public override float GetUpscaleRatioFromQualityMode(FSR2Quality qualityMode) |
||||
|
{ |
||||
|
throw new System.NotImplementedException(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public class FSR3Context : FSR2Context |
||||
|
{ |
||||
|
private FSR2CommandInitializationData _initData; |
||||
|
public override ref FSR2CommandInitializationData initData => ref _initData; |
||||
|
|
||||
|
private FSR2CommandExecutionData _executeData; |
||||
|
public override ref FSR2CommandExecutionData executeData => ref _executeData; |
||||
|
|
||||
|
internal void Init(in FSR2CommandInitializationData initSettings) |
||||
|
{ |
||||
|
// TODO: create internal context data
|
||||
|
_initData = initSettings; |
||||
|
} |
||||
|
|
||||
|
internal void Reset() |
||||
|
{ |
||||
|
// TODO: destroy internal context data
|
||||
|
_initData = new FSR2CommandInitializationData(); |
||||
|
_executeData = new FSR2CommandExecutionData(); |
||||
|
} |
||||
|
|
||||
|
internal void Draw(CommandBuffer cmd, in FSR2TextureTable textures) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,2 @@ |
|||||
|
fileFormatVersion: 2 |
||||
|
guid: 2bc3842c136ac0b4f8e140ea29ad7761 |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue