Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should WGPUSurfaceCapabilities.alphaModes include Auto? #292

Closed
kainino0x opened this issue May 17, 2024 · 3 comments
Closed

Should WGPUSurfaceCapabilities.alphaModes include Auto? #292

kainino0x opened this issue May 17, 2024 · 3 comments
Labels
has resolution Issue is resolved, just needs to be done presentation Presenting images to surfaces like windows and canvases

Comments

@kainino0x
Copy link
Collaborator

WGPUSurfaceCapabilities.alphaModes lists the supported WGPUCompositeAlphaModes, out of:

typedef enum WGPUCompositeAlphaMode {
    WGPUCompositeAlphaMode_Auto = 0x00000000,
    WGPUCompositeAlphaMode_Opaque = 0x00000001,
    WGPUCompositeAlphaMode_Premultiplied = 0x00000002,
    WGPUCompositeAlphaMode_Unpremultiplied = 0x00000003,
    WGPUCompositeAlphaMode_Inherit = 0x00000004,
    WGPUCompositeAlphaMode_Force32 = 0x7FFFFFFF
} WGPUCompositeAlphaMode WGPU_ENUM_ATTRIBUTE;

I believe Auto is always "supported". Should it be listed in alphaModes?

Followup issue to #203. cc @rajveermalviya @Kangz @eliemichel

@kainino0x kainino0x added the presentation Presenting images to surfaces like windows and canvases label May 17, 2024
@kainino0x
Copy link
Collaborator Author

If we don't list it, then I think alphaModes[0] should be the same as whatever Auto would pick (either Opaque or Inherit).

@kainino0x kainino0x added the !discuss Needs discussion (at meeting or online) label May 22, 2024
@kainino0x kainino0x added the needs docs Non-trivial API contract needs to be documented. Orthogonal to open vs closed; remove when doc'd. label Jun 6, 2024
@kainino0x
Copy link
Collaborator Author

Jun 6 meeting:

  • should do the same thing as formats. there is no preferred format, use formats[0]
  • no need to report Auto, it is always supported
  • could also be helpful to know what Auto is going to map to..?
  • CF: You don’t know what the default is on the system.
    • KN: In a native app, you would use Inherit. When you’re targeting web, you use Opaque because Inherit doesn’t exist (or we make it so Inherit means Opaque on web, but probably not). But, in order to use Inherit, you have to know what it is (in native you’ll have set it up somewhere else). If it’s the wrong thing, it’s not going to work.
    • CF: The impression of Inherit I get is that you don’t care. You just want something.
    • KN: Right, if you’re always clearing the alpha channel, all modes do the same thing.
    • CF: which is most applications - you don’t actually care.
    • KN (+ clarifications): So should we [replace Inherit with] a mode that is “assume alpha is 1”? Or is Inherit meant to also be usable with externally-configured transparency modes?
      • discussion: think inherit can be used with transparency
  • AE: For the question of whether to return auto, I guess don’t return it? doesn’t seem useful
  • KN: As long as we’re able to say what Auto maps to for alphaModes[0], then it’s ok.
    • If we put Auto first, then the rest of the list can be unsorted. alphaModes[1] doesn’t have to be anything in particular
  • Don’t return Auto in alphaModes array, alphaModes[0] is always equivalent to Auto

@kainino0x kainino0x added has resolution Issue is resolved, just needs to be done and removed !discuss Needs discussion (at meeting or online) labels Jun 6, 2024
@Kangz
Copy link
Collaborator

Kangz commented Aug 28, 2024

Done in #319.

@Kangz Kangz closed this as completed Aug 28, 2024
@kainino0x kainino0x removed the needs docs Non-trivial API contract needs to be documented. Orthogonal to open vs closed; remove when doc'd. label Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has resolution Issue is resolved, just needs to be done presentation Presenting images to surfaces like windows and canvases
Projects
None yet
Development

No branches or pull requests

2 participants