AMDUnityPlugin
Provides methods to manage loading and unloading AMD module plugins.
Read time 2 minutesLast updated 6 days ago
Definition
- Type: Class
- Namespace: UnityEngine.AMD
- Assembly: UnityEngine.AMDModule
public static class AMDUnityPlugin
Remarks
AMDUnityPluginTo access this API, follow these steps:
- Open the Package Manager window
- Go to Built-in packages.
- Enable the AMD package.
Once enabled, the plugin is automatically loaded by Unity and becomes available for both built-in and custom FSR2 integration workflows.
Note: You don't need to use this API to enable FSR2 in a Unity project. For more information, refer to HDRP Dynamic Resolution.
AMDUnityPluginCustomPassWhen 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.
Examples
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}