Unity 6.3
0 онлайн 56 гостей 3 в системе
Вход

FSR2Quality

перечисление

Описание

Параметры для FSR2 режимов производительности.

Каждый режим производительности соответствует коэффициенту масштабирования по измерению входной текстуры:

  1. Качество: 1.5x
  2. Сбалансированный: 1.7x
  3. Производительность: 2.0x
  4. Ультра производительность: 3.0x

Более подробную информацию см. в разделе Режимы масштабирования в документации FSR2.

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

// Example HDRP custom pass public class CustomFSRPass : CustomPass { void InitializeAMDDevice() { // device initialization code } bool HasOutputResolutionChanged(CustomPassContext ctx) { return m_QualityBefore != m_Quality; } bool HasInputResolutionChanged(CustomPassContext ctx) { // detect resolution change }

protected override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd) { if (amdDevice == null) { InitializeAMDDevice(); }

float scalingRatio = fsr2Context == null ? 1.0f : amdDevice.GetUpscaleRatioFromQualityMode(m_Quality); fsr2OutputColorBuffer = RTHandles.Alloc( new Vector2(scalingRatio, scalingRatio), slices: 1, dimension: TextureDimension.Tex2D, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, name: "fsr2OutputColorBuffer", enableRandomWrite: true ); }

protected override void Execute(CustomPassContext ctx) { bool initializeFsr2Context = fsr2Context == null || HasInputResolutionChanged(ctx) || HasOutputResolutionChanged(ctx); if (initializeFsr2Context) { // fsr2Context initialization code }

fsr2Context.executeData.enableSharpening = m_EnableSharpening ? 1 : 0; // populate rest of the fsr2Context.executeData

FSR2TextureTable fsr2TextureTable = new FSR2TextureTable() { // set texture table };

amdDevice.ExecuteFSR2(ctx.cmd, fsr2Context, fsr2TextureTable); }

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

private GraphicsDevice amdDevice = null; private FSR2Context fsr2Context = null; private RTHandle fsr2OutputColorBuffer;

[SerializeField] public float m_Sharpness = 0.92f; [SerializeField] public bool m_EnableSharpening = true; [SerializeField] public FSR2Quality m_Quality = FSR2Quality.Quality; FSR2Quality m_QualityBefore = FSR2Quality.Quality; Vector2Int m_InputTextureSize = new Vector2Int(0,0); }

Свойства

Свойство Описание
QualityВысокое качество, низкая производительность.
BalancedБалансирует производительность с качеством.
PerformanceБыстрая работа, низкое качество.
UltraPerformanceБыстрая производительность, низкое качество.