这是indexloc提供的服务,不要输入任何密码
Skip to content

Adding invertY and preMultiplyAlpha options to copyExternalImageToTexture #2324

@Popov72

Description

@Popov72

It would be very nice to add these options to copyEITT, much in the same way we have them in ImageBitmap.

I have read #2110.

From @kenrussell:

The only other reason control over the vertical flip would be needed is for ImageBitmaps, and it doesn't seem necessary to me to support that; the web app should just not flip its ImageBitmaps when it intends to import them to WebGPU

In Babylon.js we do need to invertY the texture in some cases so that our code works both in WebGL and WebGPU. When we need it (actually it's most of the time), we must do an additional pass to invertY the texture (requiring also a temporary texture), whereas it seems it would be very easy to add the options to the copyEITT function (there's already a render pass internally to perform the copy - at least in Dawn) and would be better for perf because the Y inversion would be done at copy time, so would be essentially free.

In Babylon.js we do see a difference in perf between WebGL and WebGPU when using a GUI which is updated each frame (so the source of copyEITT is a canvas) because of this additional render pass.

There's the same case to be made for preMultiplyAlpha, but even if only invertY can get in we would already be very happy!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions