Description
Summary of feature
Using the Silk.NET.Vulkan.Chain
class and its subtypes is occasionally unwieldy when dealing with chains that have conditional elements - in my case I have a function that takes in a SwapchainCreateInfoKHR
and returns an ImageCreateInfo
and I'd like to forward a ImageFormatListCreateInfo
chain element if present, and as it stands I have to return Chain
and cast the indexer to get the head value out for passing to vulkan apis. To make this easier, I propose the following APIs:
public interface IChain<T0> : IDisposable ... {
T0 Head { get; }
}
public interface IChain<T0, T1> : IChain<T1> {
T1 Item1 { get; }
}
...
public class Chain<TChain, T1, T2> : ... IChain<TChain, T1, T2> ...
so that I can use a return value in my case of IChain<ImageCreateInfo>
and always have a typed Head
property to access while maintaining the usefulness of the Chain
type.
Note this API would also possibly allows a version of Chain.Load
that is typed without discarding extra chain items, though I am uncertain how to best implement such a method and this is not particularly necessary for my use-case