get readable error from wait_check (#6965)

Co-authored-by: Mesozoic Egg <mesozoic.egg@proton.me>
This commit is contained in:
mesozoic-egg
2024-10-09 22:28:58 +08:00
committed by GitHub
parent 20d3c2d113
commit 0e8bcda07e

View File

@@ -48,7 +48,7 @@ def to_struct(*t: int, _type: type = ctypes.c_ulong):
def wait_check(cbuf: Any):
msg(cbuf, "waitUntilCompleted")
if (error := cast(int, msg(cbuf, "error", restype=ctypes.c_ulong))) != 0: raise RuntimeError(error)
error_check(msg(cbuf, "error", restype=objc_instance))
def elapsed_time(cbuf: objc_id):
return cast(float, msg(cbuf, "GPUEndTime", restype=ctypes.c_double)) - cast(float, msg(cbuf, "GPUStartTime", restype=ctypes.c_double))