@@ -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,142 @@ 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+ /// Capability flags for spatial super resolution upscaling.
3271+ DILIGENT_TYPED_ENUM (SUPER_RESOLUTION_SPATIAL_CAP_FLAGS , Uint32 )
3272+ {
3273+ SUPER_RESOLUTION_SPATIAL_CAP_FLAG_NONE = 0u ,
3274+
3275+ /// The upscaler is a native hardware-accelerated implementation (e.g. MetalFX, DirectSR)
3276+ /// as opposed to a custom software fallback.
3277+ SUPER_RESOLUTION_SPATIAL_CAP_FLAG_NATIVE = 1u << 0 ,
3278+
3279+ SUPER_RESOLUTION_SPATIAL_CAP_FLAG_LAST = SUPER_RESOLUTION_SPATIAL_CAP_FLAG_NATIVE
3280+ };
3281+ DEFINE_FLAG_ENUM_OPERATORS (SUPER_RESOLUTION_SPATIAL_CAP_FLAGS )
3282+
3283+
3284+ /// Capability flags for temporal super resolution upscaling.
3285+ DILIGENT_TYPED_ENUM (SUPER_RESOLUTION_TEMPORAL_CAP_FLAGS , Uint32 )
3286+ {
3287+ SUPER_RESOLUTION_TEMPORAL_CAP_FLAG_NONE = 0u ,
3288+
3289+ /// The upscaler is a native hardware-accelerated implementation (e.g. MetalFX, DirectSR)
3290+ /// as opposed to a custom software fallback.
3291+ SUPER_RESOLUTION_TEMPORAL_CAP_FLAG_NATIVE = 1u << 0 ,
3292+
3293+ /// The upscaler supports exposure scale texture input.
3294+ SUPER_RESOLUTION_TEMPORAL_CAP_FLAG_EXPOSURE_SCALE_TEXTURE = 1u << 1 ,
3295+
3296+ /// The upscaler supports ignore history mask texture input.
3297+ /// When set, the backend processes the pIgnoreHistoryMaskTextureSRV field
3298+ /// in ExecuteSuperResolutionAttribs.
3299+ SUPER_RESOLUTION_TEMPORAL_CAP_FLAG_IGNORE_HISTORY_MASK = 1u << 2 ,
3300+
3301+ /// The upscaler supports reactive mask texture input.
3302+ /// When set, the backend processes the pReactiveMaskTextureSRV field
3303+ /// in ExecuteSuperResolutionAttribs.
3304+ SUPER_RESOLUTION_TEMPORAL_CAP_FLAG_REACTIVE_MASK = 1u << 3 ,
3305+
3306+ /// The upscaler supports the sharpness control parameter.
3307+ /// When set, the Sharpness field in ExecuteSuperResolutionAttribs is used.
3308+ SUPER_RESOLUTION_TEMPORAL_CAP_FLAG_SHARPNESS = 1u << 4 ,
3309+
3310+ SUPER_RESOLUTION_TEMPORAL_CAP_FLAG_LAST = SUPER_RESOLUTION_TEMPORAL_CAP_FLAG_SHARPNESS
3311+ };
3312+ DEFINE_FLAG_ENUM_OPERATORS (SUPER_RESOLUTION_TEMPORAL_CAP_FLAGS )
3313+
3314+
3315+ /// Information about a supported super resolution upscaler variant
3316+ struct SuperResolutionUpscalerInfo
3317+ {
3318+ /// Human-readable name of the upscaler variant (e.g. "MetalFX Spatial", "MetalFX Temporal").
3319+ Char Name [128 ] DEFAULT_INITIALIZER ({});
3320+
3321+ /// Unique identifier for this upscaler variant.
3322+ /// Pass this VariantId to SuperResolutionUpscalerDesc when creating an upscaler.
3323+ INTERFACE_ID VariantId DEFAULT_INITIALIZER ({});
3324+
3325+ /// Upscaler type. Determines which input textures and parameters are required.
3326+ SUPER_RESOLUTION_UPSCALER_TYPE Type DEFAULT_INITIALIZER (SUPER_RESOLUTION_UPSCALER_TYPE_SPATIAL );
3327+
3328+ #if defined(DILIGENT_SHARP_GEN )
3329+ Uint32 CapFlags DEFAULT_INITIALIZER (0 );
3330+ #else
3331+ union
3332+ {
3333+ /// Capability flags for SUPER_RESOLUTION_UPSCALER_TYPE_SPATIAL.
3334+ SUPER_RESOLUTION_SPATIAL_CAP_FLAGS SpatialCapFlags DEFAULT_INITIALIZER (SUPER_RESOLUTION_SPATIAL_CAP_FLAG_NONE );
3335+
3336+ /// Capability flags for SUPER_RESOLUTION_UPSCALER_TYPE_TEMPORAL.
3337+ SUPER_RESOLUTION_TEMPORAL_CAP_FLAGS TemporalCapFlags ;
3338+ };
3339+ #endif
3340+
3341+ #if DILIGENT_CPP_INTERFACE
3342+ constexpr Uint32 SpatialOrTemporalCapFlags () const
3343+ {
3344+ #if defined(DILIGENT_SHARP_GEN )
3345+ return CapFlags ;
3346+ #else
3347+ return SpatialCapFlags ;
3348+ #endif
3349+ }
3350+
3351+ /// Comparison operator tests if two structures are equivalent
3352+
3353+ /// \param [in] RHS - reference to the structure to perform comparison with
3354+ /// \return
3355+ /// - True if all members of the two structures are equal.
3356+ /// - False otherwise.
3357+ bool operator == (const SuperResolutionUpscalerInfo & RHS ) const noexcept
3358+ {
3359+ return VariantId == RHS .VariantId &&
3360+ Type == RHS .Type &&
3361+ SpatialOrTemporalCapFlags () == RHS .SpatialOrTemporalCapFlags () &&
3362+ memcmp (Name , RHS .Name , sizeof (Name )) == 0 ;
3363+ }
3364+ #endif
3365+ };
3366+ typedef struct SuperResolutionUpscalerInfo SuperResolutionUpscalerInfo ;
3367+
3368+
3369+ /// Super resolution properties, reported via GraphicsAdapterInfo
3370+ struct SuperResolutionProperties
3371+ {
3372+ /// Array of supported upscaler variants and their capabilities.
3373+ SuperResolutionUpscalerInfo Upscalers [DILIGENT_MAX_SUPER_RESOLUTION_UPSCALERS ] DEFAULT_INITIALIZER ({});
3374+
3375+ /// The number of valid elements in the Upscalers array.
3376+ Uint8 NumUpscalers DEFAULT_INITIALIZER (0 );
3377+
3378+ #if DILIGENT_CPP_INTERFACE
3379+ bool operator == (const SuperResolutionProperties & RHS ) const
3380+ {
3381+ if (NumUpscalers != RHS .NumUpscalers )
3382+ return false;
3383+
3384+ for (Uint8 i = 0 ; i < NumUpscalers ; ++ i )
3385+ if (!(Upscalers [i ] == RHS .Upscalers [i ]))
3386+ return false;
3387+
3388+ return true ;
3389+ }
3390+ #endif
3391+ };
3392+ typedef struct SuperResolutionProperties SuperResolutionProperties ;
3393+
3394+
32543395/// Command queue properties
32553396struct CommandQueueInfo
32563397{
@@ -3342,6 +3483,9 @@ struct GraphicsAdapterInfo
33423483 /// Sparse resource properties, see Diligent::SparseResourceProperties.
33433484 SparseResourceProperties SparseResources ;
33443485
3486+ /// Super resolution upscaler properties, see Diligent::SuperResolutionProperties.
3487+ SuperResolutionProperties SuperResolution ;
3488+
33453489 /// Supported device features, see Diligent::DeviceFeatures.
33463490
33473491 /// The feature state indicates:
@@ -3388,6 +3532,7 @@ struct GraphicsAdapterInfo
33883532 ComputeShader == RHS .ComputeShader &&
33893533 DrawCommand == RHS .DrawCommand &&
33903534 SparseResources == RHS .SparseResources &&
3535+ SuperResolution == RHS .SuperResolution &&
33913536 Features == RHS .Features &&
33923537 memcmp (Description , RHS .Description , sizeof (Description )) == 0 ;
33933538 }
0 commit comments