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

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy