Skip to content

Should more functions take extensible structs? #216

@kainino0x

Description

@kainino0x

Struct chains provide extensibility to methods that take an extensible struct as an argument, like CreateBuffer. But there are a number of functions which don't. In JavaScript, all functions are extensible because we can add optional arguments to the end, but not in C.

Functions that could make sense to take extensible structs:

  • WriteBuffer
  • WriteTexture (EDIT: this used to take extensible structs but now it doesn't because those were shared with other functions and wouldn't extend cleanly)
  • Submit
  • OnSubmittedWorkDone
  • GetCompilationInfo
  • device Destroy
  • EnumerateFeatures
  • GetMappedRange/GetConstMappedRange
  • MapAsync/Unmap
  • PushErrorScope/PopErrorScope
  • SetUncapturedErrorCallback
  • ProcessEvents
  • GetCurrentTexture (we said this was OK in swapchain & presentation rework #203)
  • Present

These aren't extensible, but I don't think they need it:

  • encoder commands
  • Reference/Release
  • FreeMembers
  • buffer/texture/queryset Destroy
  • SetLabel
  • getters like GetWidth, GetBindGroupLayout, GetQueue
  • Unconfigure

(I think that's the complete list)

Metadata

Metadata

Assignees

No one assigned

    Labels

    extensibilityAdding features without breaking API changes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions