Version: Unity 6.7 Beta (6000.7)
LanguageEnglish
  • C#

AMDUnityPlugin

class in UnityEngine.AMD

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Provides methods to manage loading and unloading AMD module plugins.

AMDUnityPlugin contains the implementations for AMD's temporal upscaling technologies:

To access this API, follow these steps:

  1. Open the Package Manager window
  2. Go to Built-in packages.
  3. Enable the AMD package.

Once enabled, the plugin is automatically loaded by Unity and becomes available for both built-in and custom FSR integration workflows.

Note: You don't need to use this API to enable FSR in a Unity project. For more information, refer to Upscaling Framework or HDRP Dynamic Resolution.

AMDUnityPlugin enables advanced users to access and integrate AMD's FSR functionality directly in custom rendering workflows. It's primarily intended for users who want to bypass Upscaler Framework or the built-in engine integration available in the High Definition Render Pipeline (HDRP), to implement their own FSR logic, such as through a CustomPass or other Scriptable Render Pipeline (SRP) extensions.

When using this API manually, it's good practice to verify that the plugin is available using AMDUnityPlugin.IsLoaded. In case the plugin fails to load automatically (for example, the end user isn't using the native AMD package), you can load it manually using AMDUnityPlugin.Load.

Additional resources: FSR2Context, GraphicsDevice, CommandBuffer, ScriptableRenderContext

using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.AMD;

// Example HDRP custom pass public class CustomFSRPass : CustomPass { public static bool EnsureAMDPluginLoaded() { if (!AMDUnityPlugin.IsLoaded()) { Debug.Log("AMDUnityPlugin is not loaded!"); if (!AMDUnityPlugin.Load()) { Debug.LogError("Unable to load AMDUnityPlugin"); return false; } }

Debug.Log("AMDUnityPlugin is successfully loaded!"); return true; }

void InitializeAMDDevice() { if (!EnsureAMDPluginLoaded()) return;

// device initialization code }

protected override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd) { if (amdDevice == null) { InitializeAMDDevice(); } // other pass setup code }

protected override void Execute(CustomPassContext ctx) { // pass execution code }

protected override void Cleanup() { // pass cleanup code }

private GraphicsDevice amdDevice = null; // other member variables }

Static Methods

Method Description
IsLoadedChecks whether the AMDUnityPlugin in the AMD native module has been loaded or not.
LoadAttempts to dynamically load the AMDUnityPlugin.