use crate::types::Backend;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Host {
AfterEffects,
Premiere,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum RenderKind {
AeLegacyRender,
AeSmartRenderCpu,
AeSmartRenderGpu,
PremiereGpuEffect,
PremiereGpuTransition,
TestCpu,
TestGpu,
}
impl RenderKind {
pub const fn host(self) -> Host {
match self {
RenderKind::AeLegacyRender | RenderKind::AeSmartRenderCpu | RenderKind::AeSmartRenderGpu => Host::AfterEffects,
RenderKind::PremiereGpuEffect | RenderKind::PremiereGpuTransition => Host::Premiere,
RenderKind::TestCpu | RenderKind::TestGpu => Host::AfterEffects,
}
}
pub const fn is_test(self) -> bool {
matches!(self, RenderKind::TestCpu | RenderKind::TestGpu)
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Capability {
FrameExpansion,
DynamicParamVisibility,
SourceOutputMayAlias,
NativePremiereGpuFilter,
SmartRenderGpu,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct HostCapabilities {
host: Host,
backend: Backend,
}
impl HostCapabilities {
pub const fn new(host: Host, backend: Backend) -> Self {
Self { host, backend }
}
pub const fn host(&self) -> Host {
self.host
}
pub const fn backend(&self) -> Backend {
self.backend
}
pub const fn supports(&self, capability: Capability) -> bool {
match capability {
Capability::FrameExpansion => matches!(self.host, Host::AfterEffects),
Capability::DynamicParamVisibility => true,
Capability::SourceOutputMayAlias => matches!(self.host, Host::Premiere) && !matches!(self.backend, Backend::Cpu),
Capability::NativePremiereGpuFilter => matches!(self.host, Host::Premiere) && !matches!(self.backend, Backend::Cpu),
Capability::SmartRenderGpu => matches!(self.host, Host::AfterEffects) && !matches!(self.backend, Backend::Cpu),
}
}
}