deno icon indicating copy to clipboard operation
deno copied to clipboard

bug: `GPUCanvasContext.configure()` crash with when `alphaMode` or `usage` is set

Open FuriouZz opened this issue 1 year ago • 2 comments

Version: Deno 1.40.5

With the recent annoucement of BYOW, I created an project to run a three.js application with deno_sdl2.

I noticed that GPUCanvasContext.configure() is quite different that the one described on MDN documentation.

width and height

width and height properties are required

alphaMode

alphaMode accepts "opaque" and "premultiplied" but only "opaque" works.

An error occured when "premultiplied" is set:

TypeError: unknown variant 'premultiplied', expected one of 'auto', 'opaque', 'preMultiplied', 'postMultiplied', 'inherit'

And I got another error if I set "preMultiplied":

TypeError: [object Object]: The provided value 'preMultiplied' is not a valid enum value of type GPUCanvasAlphaMode.

I checked wgpu-types and "preMultiplied" is expected.

Maybe a map from "premultiplied" to "preMultiplied" is required?

usage

usage crash when different than GPUTextureUsage.RENDER_ATTACHMENT (threejs use GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.COPY_SRC):

Error: Surface is not configured for presentation

FuriouZz avatar Feb 17 '24 02:02 FuriouZz

The premultipled casing is fixed upstream. https://github.com/gfx-rs/wgpu/pull/4940.

littledivy avatar Feb 17 '24 05:02 littledivy

Error: Surface is not configured for presentation

I'm getting this error also, though it doesn't seem to be related to usage for me. Rather if I use the default adapter (i.e. the intel integrated gpu) then this error happens but using the high-performance adapter (nividia gpu) then this error goes away.

Jamesernator avatar Apr 22 '24 09:04 Jamesernator

This should now be fixed.

lucacasonato avatar Jun 08 '24 17:06 lucacasonato

Did you try using the "preMultiplied" as is, instead of "preMultiplied"?

On Sat, 8 Jun 2024, 18:34 Luca Casonato, @.***> wrote:

Closed #22446 https://github.com/denoland/deno/issues/22446 as completed.

— Reply to this email directly, view it on GitHub https://github.com/denoland/deno/issues/22446#event-13088955286, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN47WY57LGEPAD3SSHHXWBDZGM6DVAVCNFSM6AAAAABDM52NHKVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJTGA4DQOJVGUZDQNQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

okoibraun avatar Jun 08 '24 18:06 okoibraun

~~Oh, actually nope this is still broken. The correct value is preMultiplied. This should be fixed by just updating wgpu (cc @crowlKats). Sorry for the noise.~~

Sorry, wrong again. It does seem to be fixed. The correct value is premultiplied (all lowercase).

lucacasonato avatar Jun 08 '24 19:06 lucacasonato