(async_fun, cb_info_type, cb_type, status_enum, res_idx:int|None, msg_idx:int|None, *params)
| 30 | webgpu.wgpuQueueWriteBuffer(webgpu.wgpuDeviceGetQueue(device), buf, offset, (ctypes.c_uint8 * len(src)).from_buffer(src), len(src)) |
| 31 | |
| 32 | def _run(async_fun, cb_info_type, cb_type, status_enum, res_idx:int|None, msg_idx:int|None, *params): |
| 33 | result: List[Any] = [] |
| 34 | |
| 35 | def cb(*params): |
| 36 | result[:] = params |
| 37 | if msg_idx: result[msg_idx] = from_wgpu_str(result[msg_idx]) |
| 38 | |
| 39 | cb_info = cb_info_type(mode=webgpu.WGPUCallbackMode_WaitAnyOnly, callback=cb_type(cb)) |
| 40 | _wait(async_fun(*params, cb_info)) |
| 41 | |
| 42 | if result[0] != 1: raise RuntimeError(f"[{status_enum.get(result[0]) if status_enum else 'ERROR'}]{result[msg_idx] if msg_idx else ''}") |
| 43 | return result[res_idx] if res_idx else None |
| 44 | |
| 45 | def copy_buffer_to_buffer(dev:WGPUDevPtr, src:WGPUBufPtr, src_offset:int, dst:WGPUBufPtr, dst_offset:int, size:int): |
| 46 | encoder = webgpu.wgpuDeviceCreateCommandEncoder(dev, webgpu.WGPUCommandEncoderDescriptor()) |
no test coverage detected
searching dependent graphs…