WGPUSync.instanceRequestAdapter returns a broken WGPUAdapter
#166
Replies: 1 comment 4 replies
-
|
Hi, I've reproduced the issue.
Do you have any link to relevant posts/questions/answers/issues? If this is true, I'm afraid that this is rather an issue of Java FFM itself: such "FFI-returned" I'll still make a patch from my side. And before the release of next patch version (v0.4.5), you can temporarily live with your own fork of |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
On Windows 11, Temurin 24.0.1+9, the following snippet fails against 0.4.3:
Which is interesting because I didn't encounter the same issue on Linux.
I have discovered that FFM upcalls on Windows use a confined arena for allocating their arguments. When an upcall returns, its arena is closed, and all its
MemorySegmentarguments become invalid. I haven't investigated why it doesn't happen on Linux, though.The workaround is to use the raw address of a segment:
An example patch for
WGPUSync#onRequestDeviceFinished(please note thatWGPUSync#adapterRequestDeviceis affected as well):private static void onRequestDeviceFinished( ... ) { @Nullable WGPUDevice deviceHandle = device == MemorySegment.NULL ? null - : new WGPUDevice(device); + : new WGPUDevice(MemorySegment.ofAddress(device.address())); @Nullable String messageString = WGPUUtil.readStringView(message); saveSlot.value = new RequestDeviceResult(status, deviceHandle, messageString); }Beta Was this translation helpful? Give feedback.
All reactions