Skip to content

Expose Graphics.Vulkan.Marshal.Create.Union? #13

@Rotaerk

Description

@Rotaerk

I'm trying to create some helper functions to eliminate some of the monotony of creating structures, for instance:

applicationInfo ::
  CreateVkStruct VkApplicationInfo
    '[
      "pApplicationName",
      "applicationVersion",
      "pEngineName",
      "engineVersion",
      "apiVersion"
    ] () ->
  VkApplicationInfo
applicationInfo rest =
  createVk $
  set @"sType" VK_STRUCTURE_TYPE_APPLICATION_INFO &*
  set @"pNext" VK_NULL &*
  rest

However, with this implementation, I have to supply the fields in the order specified in the type signature. Is there some way to resolve this? Would exposing the Union type family help?

Also, it seems like it might be more flexible in this context if there were a way to specify "a CreateVkStruct that has all the fields set except these", and then have the type signature list sType and pNext rather than the ones that the caller must provide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions