@@ -1867,6 +1867,10 @@ struct DeviceFeatures
18671867 /// Not supported by D3D11, D3D12, OpenGL, or Metal backends.
18681868 DEVICE_FEATURE_STATE SpecializationConstants DEFAULT_INITIALIZER (DEVICE_FEATURE_STATE_DISABLED );
18691869
1870+ /// Indicates if the device supports hardware super resolution (upscaling).
1871+ /// MetalFX on Metal, DirectSR on D3D12.
1872+ DEVICE_FEATURE_STATE SuperResolution DEFAULT_INITIALIZER (DEVICE_FEATURE_STATE_DISABLED );
1873+
18701874#if DILIGENT_CPP_INTERFACE
18711875 constexpr DeviceFeatures () noexcept {}
18721876
@@ -1918,11 +1922,12 @@ struct DeviceFeatures
19181922 Handler(NativeMultiDraw) \
19191923 Handler(AsyncShaderCompilation) \
19201924 Handler(FormattedBuffers) \
1921- Handler(SpecializationConstants)
1925+ Handler(SpecializationConstants) \
1926+ Handler(SuperResolution)
19221927
19231928 explicit constexpr DeviceFeatures (DEVICE_FEATURE_STATE State ) noexcept
19241929 {
1925- static_assert (sizeof (* this ) == 48 , "Did you add a new feature to DeviceFeatures? Please add it to ENUMERATE_DEVICE_FEATURES." );
1930+ static_assert (sizeof (* this ) == 49 , "Did you add a new feature to DeviceFeatures? Please add it to ENUMERATE_DEVICE_FEATURES." );
19261931 #define INIT_FEATURE (Feature ) Feature = State;
19271932 ENUMERATE_DEVICE_FEATURES (INIT_FEATURE )
19281933 #undef INIT_FEATURE
@@ -3263,6 +3268,165 @@ struct SparseResourceProperties
32633268typedef struct SparseResourceProperties SparseResourceProperties ;
32643269
32653270
3271+ /// Super resolution upscaler type.
3272+ DILIGENT_TYPED_ENUM (SUPER_RESOLUTION_UPSCALER_TYPE , Uint8 )
3273+ {
3274+ /// Spatial upscaling only (single frame, no motion vectors required).
3275+ SUPER_RESOLUTION_UPSCALER_TYPE_SPATIAL = 0u ,
3276+
3277+ /// Temporal upscaling (uses motion vectors and history accumulation).
3278+ SUPER_RESOLUTION_UPSCALER_TYPE_TEMPORAL
3279+ };
3280+
3281+
3282+ /// Super resolution optimization type.
3283+ /// Defines the quality/performance trade-off for super resolution upscaling.
3284+ DILIGENT_TYPED_ENUM (SUPER_RESOLUTION_OPTIMIZATION_TYPE , Uint8 )
3285+ {
3286+ /// Maximum quality, lowest performance.
3287+ SUPER_RESOLUTION_OPTIMIZATION_TYPE_MAX_QUALITY = 0u ,
3288+
3289+ /// Favor quality over performance.
3290+ SUPER_RESOLUTION_OPTIMIZATION_TYPE_HIGH_QUALITY ,
3291+
3292+ /// Balanced quality/performance trade-off.
3293+ SUPER_RESOLUTION_OPTIMIZATION_TYPE_BALANCED ,
3294+
3295+ /// Favor performance over quality.
3296+ SUPER_RESOLUTION_OPTIMIZATION_TYPE_HIGH_PERFORMANCE ,
3297+
3298+ /// Maximum performance, lowest quality.
3299+ SUPER_RESOLUTION_OPTIMIZATION_TYPE_MAX_PERFORMANCE ,
3300+
3301+ SUPER_RESOLUTION_OPTIMIZATION_TYPE_COUNT
3302+ };
3303+
3304+
3305+ /// Capability flags for spatial super resolution upscaling.
3306+ DILIGENT_TYPED_ENUM (SUPER_RESOLUTION_SPATIAL_CAP_FLAGS , Uint32 )
3307+ {
3308+ SUPER_RESOLUTION_SPATIAL_CAP_FLAG_NONE = 0u ,
3309+
3310+ /// The upscaler is a native hardware-accelerated implementation (e.g. MetalFX, DirectSR)
3311+ /// as opposed to a custom software fallback.
3312+ SUPER_RESOLUTION_SPATIAL_CAP_FLAG_NATIVE = 1u << 0 ,
3313+
3314+ SUPER_RESOLUTION_SPATIAL_CAP_FLAG_LAST = SUPER_RESOLUTION_SPATIAL_CAP_FLAG_NATIVE
3315+ };
3316+ DEFINE_FLAG_ENUM_OPERATORS (SUPER_RESOLUTION_SPATIAL_CAP_FLAGS )
3317+
3318+
3319+ /// Capability flags for temporal super resolution upscaling.
3320+ DILIGENT_TYPED_ENUM (SUPER_RESOLUTION_TEMPORAL_CAP_FLAGS , Uint32 )
3321+ {
3322+ SUPER_RESOLUTION_TEMPORAL_CAP_FLAG_NONE = 0u ,
3323+
3324+ /// The upscaler is a native hardware-accelerated implementation (e.g. MetalFX, DirectSR)
3325+ /// as opposed to a custom software fallback.
3326+ SUPER_RESOLUTION_TEMPORAL_CAP_FLAG_NATIVE = 1u << 0 ,
3327+
3328+ /// The upscaler supports exposure scale texture input.
3329+ SUPER_RESOLUTION_TEMPORAL_CAP_FLAG_EXPOSURE_SCALE_TEXTURE = 1u << 1 ,
3330+
3331+ /// The upscaler supports ignore history mask texture input.
3332+ /// When set, the backend processes the pIgnoreHistoryMaskTextureSRV field
3333+ /// in ExecuteSuperResolutionAttribs.
3334+ SUPER_RESOLUTION_TEMPORAL_CAP_FLAG_IGNORE_HISTORY_MASK = 1u << 2 ,
3335+
3336+ /// The upscaler supports reactive mask texture input.
3337+ /// When set, the backend processes the pReactiveMaskTextureSRV field
3338+ /// in ExecuteSuperResolutionAttribs.
3339+ SUPER_RESOLUTION_TEMPORAL_CAP_FLAG_REACTIVE_MASK = 1u << 3 ,
3340+
3341+ /// The upscaler supports the sharpness control parameter.
3342+ /// When set, the Sharpness field in ExecuteSuperResolutionAttribs is used.
3343+ SUPER_RESOLUTION_TEMPORAL_CAP_FLAG_SHARPNESS = 1u << 4 ,
3344+
3345+ SUPER_RESOLUTION_TEMPORAL_CAP_FLAG_LAST = SUPER_RESOLUTION_TEMPORAL_CAP_FLAG_SHARPNESS
3346+ };
3347+ DEFINE_FLAG_ENUM_OPERATORS (SUPER_RESOLUTION_TEMPORAL_CAP_FLAGS )
3348+
3349+
3350+ /// Information about a supported super resolution upscaler variant
3351+ struct SuperResolutionInfo
3352+ {
3353+ /// Human-readable name of the upscaler variant (e.g. "MetalFX Spatial", "MetalFX Temporal").
3354+ Char Name [128 ] DEFAULT_INITIALIZER ({});
3355+
3356+ /// Unique identifier for this upscaler variant.
3357+ /// Pass this VariantId to SuperResolutionDesc when creating an upscaler.
3358+ INTERFACE_ID VariantId DEFAULT_INITIALIZER ({});
3359+
3360+ /// Upscaler type. Determines which input textures and parameters are required.
3361+ SUPER_RESOLUTION_UPSCALER_TYPE Type DEFAULT_INITIALIZER (SUPER_RESOLUTION_UPSCALER_TYPE_SPATIAL );
3362+
3363+ #if defined(DILIGENT_SHARP_GEN )
3364+ Uint32 CapFlags DEFAULT_INITIALIZER (0 );
3365+ #else
3366+ union
3367+ {
3368+ /// Capability flags for SUPER_RESOLUTION_UPSCALER_TYPE_SPATIAL.
3369+ SUPER_RESOLUTION_SPATIAL_CAP_FLAGS SpatialCapFlags DEFAULT_INITIALIZER (SUPER_RESOLUTION_SPATIAL_CAP_FLAG_NONE );
3370+
3371+ /// Capability flags for SUPER_RESOLUTION_UPSCALER_TYPE_TEMPORAL.
3372+ SUPER_RESOLUTION_TEMPORAL_CAP_FLAGS TemporalCapFlags ;
3373+ };
3374+ #endif
3375+
3376+ #if DILIGENT_CPP_INTERFACE
3377+ constexpr Uint32 SpatialOrTemporalCapFlags () const
3378+ {
3379+ #if defined(DILIGENT_SHARP_GEN )
3380+ return CapFlags ;
3381+ #else
3382+ return SpatialCapFlags ;
3383+ #endif
3384+ }
3385+
3386+ /// Comparison operator tests if two structures are equivalent
3387+
3388+ /// \param [in] RHS - reference to the structure to perform comparison with
3389+ /// \return
3390+ /// - True if all members of the two structures are equal.
3391+ /// - False otherwise.
3392+ bool operator == (const SuperResolutionInfo & RHS ) const noexcept
3393+ {
3394+ return VariantId == RHS .VariantId &&
3395+ Type == RHS .Type &&
3396+ SpatialOrTemporalCapFlags () == RHS .SpatialOrTemporalCapFlags () &&
3397+ memcmp (Name , RHS .Name , sizeof (Name )) == 0 ;
3398+ }
3399+ #endif
3400+ };
3401+ typedef struct SuperResolutionInfo SuperResolutionInfo ;
3402+
3403+
3404+ /// Super resolution properties, reported via GraphicsAdapterInfo
3405+ struct SuperResolutionProperties
3406+ {
3407+ /// Array of supported upscaler variants and their capabilities.
3408+ SuperResolutionInfo Upscalers [DILIGENT_MAX_SUPER_RESOLUTION_UPSCALERS ] DEFAULT_INITIALIZER ({});
3409+
3410+ /// The number of valid elements in the Upscalers array.
3411+ Uint8 NumUpscalers DEFAULT_INITIALIZER (0 );
3412+
3413+ #if DILIGENT_CPP_INTERFACE
3414+ bool operator == (const SuperResolutionProperties & RHS ) const
3415+ {
3416+ if (NumUpscalers != RHS .NumUpscalers )
3417+ return false;
3418+
3419+ for (Uint8 i = 0 ; i < NumUpscalers ; ++ i )
3420+ if (!(Upscalers [i ] == RHS .Upscalers [i ]))
3421+ return false;
3422+
3423+ return true ;
3424+ }
3425+ #endif
3426+ };
3427+ typedef struct SuperResolutionProperties SuperResolutionProperties ;
3428+
3429+
32663430/// Command queue properties
32673431struct CommandQueueInfo
32683432{
@@ -3354,6 +3518,9 @@ struct GraphicsAdapterInfo
33543518 /// Sparse resource properties, see Diligent::SparseResourceProperties.
33553519 SparseResourceProperties SparseResources ;
33563520
3521+ /// Super resolution upscaler properties, see Diligent::SuperResolutionProperties.
3522+ SuperResolutionProperties SuperResolution ;
3523+
33573524 /// Supported device features, see Diligent::DeviceFeatures.
33583525
33593526 /// The feature state indicates:
@@ -3400,6 +3567,7 @@ struct GraphicsAdapterInfo
34003567 ComputeShader == RHS .ComputeShader &&
34013568 DrawCommand == RHS .DrawCommand &&
34023569 SparseResources == RHS .SparseResources &&
3570+ SuperResolution == RHS .SuperResolution &&
34033571 Features == RHS .Features &&
34043572 memcmp (Description , RHS .Description , sizeof (Description )) == 0 ;
34053573 }
0 commit comments