8000 Chain Polymorphism · Issue #1091 · dotnet/Silk.NET · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Chain Polymorphism #1091
Closed
Closed
@Khitiara

Description

@Khitiara

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0