JSType and Marshalling needs more type support #97268
-
Hi, I'd like to discuss a feature 'need'. I want to transfer arrays of float and bytes to javascript from Blazor to support using the WebGl or WebGpu capabilities without any double handling of the data. Ie it would seem to me to be useful to be able to send TypedArrays directly to the GPU. I am not experienced enough in the lower-level operation of the .net to WASM boundary to appreciate if there are any benefits to be had or what the engineering 'cost' is. I would assume the 'api' would involve adding TypedArray to JSType, and using ReadonlySpan as the passed in (to javascript) argument type, where T is: [s]byte, [U]Int[16|32|64], float or double. Like the current Span support, I would expect that the data is only valid for the lifetime of the call. Is this even possible? As a side note: why does the current capability support the ArraySegment but not a Memory object? Why would anyone even use an ArraySegment today? Regards, Scott PS: I have subsequently noticed that when a Span is turned into a memory array there is a Float64Array typed array hiding under it. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
cc @pavelsavara |
Beta Was this translation helpful? Give feedback.
-
I created #97380 for it.
I created #97381 for that. |
Beta Was this translation helpful? Give feedback.
I created #97380 for it.
I created #97381 for that.