using System;
using UnityEngine.Scripting;
using System.Collections.Generic;
using UnityEngine.SubsystemsImplementation;
[assembly: AlwaysLinkAssembly]
namespace UnityEngine.AdaptivePerformance.Provider
{
[Preserve]
internal static class AdaptivePerformanceSubsystemRegistry
{
///
/// Only for internal use.
///
///
///
public static AdaptivePerformanceSubsystemDescriptor RegisterDescriptor(AdaptivePerformanceSubsystemDescriptor.Cinfo cinfo)
{
var desc = new AdaptivePerformanceSubsystemDescriptor(cinfo);
SubsystemDescriptorStore.RegisterDescriptor(desc);
return desc;
}
///
/// Only for internal use.
///
///
public static List GetRegisteredDescriptors()
{
var perfDescriptors = new List();
SubsystemManager.GetSubsystemDescriptors(perfDescriptors);
return perfDescriptors;
}
}
///
/// The Adaptive Performance Subsystem Descriptor is used for describing the subsystem so it can be picked up by the subsystem management system.
///
[Preserve]
public sealed class AdaptivePerformanceSubsystemDescriptor : SubsystemDescriptorWithProvider
{
///
/// Cinfo stores the ID and subsystem implementation type which is used to identify the subsystem during subsystem initialization.
///
public struct Cinfo
{
///
/// The ID stores the name of the subsystem used to identify it in the subsystem registry.
///
public string id { get; set; }
///
/// Specifies the provider implementation type to use for instantiation.
///
///
/// The provider implementation type to use for instantiation.
///
public Type providerType { get; set; }
///
/// Specifies the AdaptivePerformanceSubsystem-derived type that forwards casted calls to its provider.
///
///
/// The type of the subsystem to use for instantiation. If null, Subsystem will be instantiated.
///
public Type subsystemTypeOverride { get; set; }
///
/// The subsystem implementation type stores the the type used for initialization in the subsystem registry.
///
[Obsolete("AdaptivePerformanceSubsystem no longer supports the deprecated set of base classes for subsystems as of Unity 2023.1. Use providerType and, optionally, subsystemTypeOverride instead.", true)]
public Type subsystemImplementationType { get; set; }
}
///
/// Constructor to fill the subsystem descriptor with all information to register the subsystem successfully.
///
/// Pass in the information about the subsystem.
public AdaptivePerformanceSubsystemDescriptor(Cinfo cinfo)
{
id = cinfo.id;
providerType = cinfo.providerType;
subsystemTypeOverride = cinfo.subsystemTypeOverride;
}
///
/// Register the subsystem with the subsystem registry and make it available to use during runtime.
///
/// Pass in the information about the subsystem.
/// Returns an active subsystem descriptor.
public static AdaptivePerformanceSubsystemDescriptor RegisterDescriptor(Cinfo cinfo)
{
return AdaptivePerformanceSubsystemRegistry.RegisterDescriptor(cinfo);
}
}
}