test for viability of compute systems at runtime #1903
Replies: 2 comments 12 replies
-
|
That assert is there to easily catch the exact location where things went wrong in the debugger. After the assert triggers, it should continue and return the error code through the |
Beta Was this translation helpful? Give feedback.
-
|
Thank you for your reply.
That's a perceptive question. I tend to think of asserts as fatal, both in Java and Jolt, but of course they don't have to be. In Java, assertions are implemented using exceptions, which code can catch and ignore, though I consider that poor coding practice. As far as I know, the Java debugger won't modify variables or clear exceptions. (Though now that I think of it, that might be a limitation of the IDE I'm using.) In Jolt, the return value of the Assuming it works, is that the best way to determine whether a suitable DX/Metal/Vulkan driver is present? It looks clumsy because it would affect all assertions for the duration of the call, not just the current thread and not just the assertion at line 38. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm experimenting with the (post-v5.5.0) support for compute shaders in Jolt. My project is a JVM library that runs on various platforms including Linux, macOS, and Windows. Already I build multiple shared libraries for each platform:
I'd like to add support for compute shaders, both CPU-based and GPU-based, without doubling the number of shared libraries. My plan was to build with both
-DJPH_USE_CPU_COMPUTEand (for example)-DJPH_USE_VK, then test at runtime whether the platform supports (in this example) Vulkan, then fall back to CPU compute if it doesn't:However when
JPH_USE_VKis defined, Vulkan is unavailable, and assertions are enabled,CreateComputeSystem()crashes the JVM , due to the following assert in "IncludeVK.h":JoltPhysics/Jolt/Compute/VK/IncludeVK.h
Line 38 in e486f5b
I see the utility of failing quickly when a Vulkan call fails unexpectedly during debugging. However, it would be more convenient for me if failures during
JPH::CreateComputeSystemVK()were reported via the return value (ComputeSystemResult) instead of an assertion. Perhaps the assertion could be bypassed byJPH::CreateComputeSystemVK().Or is there a better way to determine at runtime whether (for example) Vulkan is supported?
Beta Was this translation helpful? Give feedback.
All reactions