@@ -1856,6 +1856,10 @@ struct DeviceFeatures
18561856 /// Indicates if device supports formatted buffers.
18571857 DEVICE_FEATURE_STATE FormattedBuffers DEFAULT_INITIALIZER (DEVICE_FEATURE_STATE_DISABLED );
18581858
1859+ /// Indicates if the device supports hardware super resolution (upscaling).
1860+ /// MetalFX on Metal, DirectSR on D3D12.
1861+ DEVICE_FEATURE_STATE SuperResolution DEFAULT_INITIALIZER (DEVICE_FEATURE_STATE_DISABLED );
1862+
18591863#if DILIGENT_CPP_INTERFACE
18601864 constexpr DeviceFeatures () noexcept {}
18611865
@@ -1906,11 +1910,12 @@ struct DeviceFeatures
19061910 Handler(TextureSubresourceViews) \
19071911 Handler(NativeMultiDraw) \
19081912 Handler(AsyncShaderCompilation) \
1909- Handler(FormattedBuffers)
1913+ Handler(FormattedBuffers) \
1914+ Handler(SuperResolution)
19101915
19111916 explicit constexpr DeviceFeatures (DEVICE_FEATURE_STATE State ) noexcept
19121917 {
1913- static_assert (sizeof (* this ) == 47 , "Did you add a new feature to DeviceFeatures? Please add it to ENUMERATE_DEVICE_FEATURES." );
1918+ static_assert (sizeof (* this ) == 48 , "Did you add a new feature to DeviceFeatures? Please add it to ENUMERATE_DEVICE_FEATURES." );
19141919 #define INIT_FEATURE (Feature ) Feature = State;
19151920 ENUMERATE_DEVICE_FEATURES (INIT_FEATURE )
19161921 #undef INIT_FEATURE
@@ -3251,6 +3256,165 @@ struct SparseResourceProperties
32513256typedef struct SparseResourceProperties SparseResourceProperties ;
32523257
32533258
3259+ /// Super resolution upscaler type.
3260+ DILIGENT_TYPED_ENUM (SUPER_RESOLUTION_UPSCALER_TYPE , Uint8 )
3261+ {
3262+ /// Spatial upscaling only (single frame, no motion vectors required).
3263+ SUPER_RESOLUTION_UPSCALER_TYPE_SPATIAL = 0u ,
3264+
3265+ /// Temporal upscaling (uses motion vectors and history accumulation).
3266+ SUPER_RESOLUTION_UPSCALER_TYPE_TEMPORAL
3267+ };
3268+
3269+
3270+ /// Super resolution optimization type.
3271+ /// Defines the quality/performance trade-off for super resolution upscaling.
3272+ DILIGENT_TYPED_ENUM (SUPER_RESOLUTION_OPTIMIZATION_TYPE , Uint8 )
3273+ {
3274+ /// Maximum quality, lowest performance.
3275+ SUPER_RESOLUTION_OPTIMIZATION_TYPE_MAX_QUALITY = 0u ,
3276+
3277+ /// Favor quality over performance.
3278+ SUPER_RESOLUTION_OPTIMIZATION_TYPE_HIGH_QUALITY ,
3279+
3280+ /// Balanced quality/performance trade-off.
3281+ SUPER_RESOLUTION_OPTIMIZATION_TYPE_BALANCED ,
3282+
3283+ /// Favor performance over quality.
3284+ SUPER_RESOLUTION_OPTIMIZATION_TYPE_HIGH_PERFORMANCE ,
3285+
3286+ /// Maximum performance, lowest quality.
3287+ SUPER_RESOLUTION_OPTIMIZATION_TYPE_MAX_PERFORMANCE ,
3288+
3289+ SUPER_RESOLUTION_OPTIMIZATION_TYPE_COUNT
3290+ };
3291+
3292+
3293+ /// Capability flags for spatial super resolution upscaling.
3294+ DILIGENT_TYPED_ENUM (SUPER_RESOLUTION_SPATIAL_CAP_FLAGS , Uint32 )
3295+ {
3296+ SUPER_RESOLUTION_SPATIAL_CAP_FLAG_NONE = 0u ,
3297+
3298+ /// The upscaler is a native hardware-accelerated implementation (e.g. MetalFX, DirectSR)
3299+ /// as opposed to a custom software fallback.
3300+ SUPER_RESOLUTION_SPATIAL_CAP_FLAG_NATIVE = 1u << 0 ,
3301+
3302+ SUPER_RESOLUTION_SPATIAL_CAP_FLAG_LAST = SUPER_RESOLUTION_SPATIAL_CAP_FLAG_NATIVE
3303+ };
3304+ DEFINE_FLAG_ENUM_OPERATORS (SUPER_RESOLUTION_SPATIAL_CAP_FLAGS )
3305+
3306+
3307+ /// Capability flags for temporal super resolution upscaling.
3308+ DILIGENT_TYPED_ENUM (SUPER_RESOLUTION_TEMPORAL_CAP_FLAGS , Uint32 )
3309+ {
3310+ SUPER_RESOLUTION_TEMPORAL_CAP_FLAG_NONE = 0u ,
3311+
3312+ /// The upscaler is a native hardware-accelerated implementation (e.g. MetalFX, DirectSR)
3313+ /// as opposed to a custom software fallback.
3314+ SUPER_RESOLUTION_TEMPORAL_CAP_FLAG_NATIVE = 1u << 0 ,
3315+
3316+ /// The upscaler supports exposure scale texture input.
3317+ SUPER_RESOLUTION_TEMPORAL_CAP_FLAG_EXPOSURE_SCALE_TEXTURE = 1u << 1 ,
3318+
3319+ /// The upscaler supports ignore history mask texture input.
3320+ /// When set, the backend processes the pIgnoreHistoryMaskTextureSRV field
3321+ /// in ExecuteSuperResolutionAttribs.
3322+ SUPER_RESOLUTION_TEMPORAL_CAP_FLAG_IGNORE_HISTORY_MASK = 1u << 2 ,
3323+
3324+ /// The upscaler supports reactive mask texture input.
3325+ /// When set, the backend processes the pReactiveMaskTextureSRV field
3326+ /// in ExecuteSuperResolutionAttribs.
3327+ SUPER_RESOLUTION_TEMPORAL_CAP_FLAG_REACTIVE_MASK = 1u << 3 ,
3328+
3329+ /// The upscaler supports the sharpness control parameter.
3330+ /// When set, the Sharpness field in ExecuteSuperResolutionAttribs is used.
3331+ SUPER_RESOLUTION_TEMPORAL_CAP_FLAG_SHARPNESS = 1u << 4 ,
3332+
3333+ SUPER_RESOLUTION_TEMPORAL_CAP_FLAG_LAST = SUPER_RESOLUTION_TEMPORAL_CAP_FLAG_SHARPNESS
3334+ };
3335+ DEFINE_FLAG_ENUM_OPERATORS (SUPER_RESOLUTION_TEMPORAL_CAP_FLAGS )
3336+
3337+
3338+ /// Information about a supported super resolution upscaler variant
3339+ struct SuperResolutionInfo
3340+ {
3341+ /// Human-readable name of the upscaler variant (e.g. "MetalFX Spatial", "MetalFX Temporal").
3342+ Char Name [128 ] DEFAULT_INITIALIZER ({});
3343+
3344+ /// Unique identifier for this upscaler variant.
3345+ /// Pass this VariantId to SuperResolutionDesc when creating an upscaler.
3346+ INTERFACE_ID VariantId DEFAULT_INITIALIZER ({});
3347+
3348+ /// Upscaler type. Determines which input textures and parameters are required.
3349+ SUPER_RESOLUTION_UPSCALER_TYPE Type DEFAULT_INITIALIZER (SUPER_RESOLUTION_UPSCALER_TYPE_SPATIAL );
3350+
3351+ #if defined(DILIGENT_SHARP_GEN )
3352+ Uint32 CapFlags DEFAULT_INITIALIZER (0 );
3353+ #else
3354+ union
3355+ {
3356+ /// Capability flags for SUPER_RESOLUTION_UPSCALER_TYPE_SPATIAL.
3357+ SUPER_RESOLUTION_SPATIAL_CAP_FLAGS SpatialCapFlags DEFAULT_INITIALIZER (SUPER_RESOLUTION_SPATIAL_CAP_FLAG_NONE );
3358+
3359+ /// Capability flags for SUPER_RESOLUTION_UPSCALER_TYPE_TEMPORAL.
3360+ SUPER_RESOLUTION_TEMPORAL_CAP_FLAGS TemporalCapFlags ;
3361+ };
3362+ #endif
3363+
3364+ #if DILIGENT_CPP_INTERFACE
3365+ constexpr Uint32 SpatialOrTemporalCapFlags () const
3366+ {
3367+ #if defined(DILIGENT_SHARP_GEN )
3368+ return CapFlags ;
3369+ #else
3370+ return SpatialCapFlags ;
3371+ #endif
3372+ }
3373+
3374+ /// Comparison operator tests if two structures are equivalent
3375+
3376+ /// \param [in] RHS - reference to the structure to perform comparison with
3377+ /// \return
3378+ /// - True if all members of the two structures are equal.
3379+ /// - False otherwise.
3380+ bool operator == (const SuperResolutionInfo & RHS ) const noexcept
3381+ {
3382+ return VariantId == RHS .VariantId &&
3383+ Type == RHS .Type &&
3384+ SpatialOrTemporalCapFlags () == RHS .SpatialOrTemporalCapFlags () &&
3385+ memcmp (Name , RHS .Name , sizeof (Name )) == 0 ;
3386+ }
3387+ #endif
3388+ };
3389+ typedef struct SuperResolutionInfo SuperResolutionInfo ;
3390+
3391+
3392+ /// Super resolution properties, reported via GraphicsAdapterInfo
3393+ struct SuperResolutionProperties
3394+ {
3395+ /// Array of supported upscaler variants and their capabilities.
3396+ SuperResolutionInfo Upscalers [DILIGENT_MAX_SUPER_RESOLUTION_UPSCALERS ] DEFAULT_INITIALIZER ({});
3397+
3398+ /// The number of valid elements in the Upscalers array.
3399+ Uint8 NumUpscalers DEFAULT_INITIALIZER (0 );
3400+
3401+ #if DILIGENT_CPP_INTERFACE
3402+ bool operator == (const SuperResolutionProperties & RHS ) const
3403+ {
3404+ if (NumUpscalers != RHS .NumUpscalers )
3405+ return false;
3406+
3407+ for (Uint8 i = 0 ; i < NumUpscalers ; ++ i )
3408+ if (!(Upscalers [i ] == RHS .Upscalers [i ]))
3409+ return false;
3410+
3411+ return true ;
3412+ }
3413+ #endif
3414+ };
3415+ typedef struct SuperResolutionProperties SuperResolutionProperties ;
3416+
3417+
32543418/// Command queue properties
32553419struct CommandQueueInfo
32563420{
@@ -3342,6 +3506,9 @@ struct GraphicsAdapterInfo
33423506 /// Sparse resource properties, see Diligent::SparseResourceProperties.
33433507 SparseResourceProperties SparseResources ;
33443508
3509+ /// Super resolution upscaler properties, see Diligent::SuperResolutionProperties.
3510+ SuperResolutionProperties SuperResolution ;
3511+
33453512 /// Supported device features, see Diligent::DeviceFeatures.
33463513
33473514 /// The feature state indicates:
@@ -3388,6 +3555,7 @@ struct GraphicsAdapterInfo
33883555 ComputeShader == RHS .ComputeShader &&
33893556 DrawCommand == RHS .DrawCommand &&
33903557 SparseResources == RHS .SparseResources &&
3558+ SuperResolution == RHS .SuperResolution &&
33913559 Features == RHS .Features &&
33923560 memcmp (Description , RHS .Description , sizeof (Description )) == 0 ;
33933561 }
0 commit comments