-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LWJGL integration #9
Comments
i was also planning to use drift in pure java by using lwjgl, but since the first use cases required a native API lwjgl had to wait |
Would really like to see a solution like that proposed by @Spasi |
Hey @redrezo, LWJGL now has DriftFX bindings in the Also, there's no extra dependency. The bindings include the DriftFX source3 (both Java and native) and everything is built together. Afaict your license allows this, but please let me know if that's not the case or if you're simply not OK with it. Now, the problem is that performance is not good. It's actually worse than using I enabled verbose logging and it appears that there's lot of texture creation/recreation going on every frame. Is this expected behavior? Btw, I'm testing on Zulu JDK 8, Windows 10, Ryzen 1800X, GeForce GTX 970 with latest drivers. I also tried the 3 different Thanks!
|
Great work! We‘ll come back to you on the points you raised and ways to fix them |
Thats a great news @Spasi! Regarding your performance observations: I'll will have a look at your demo once i find the time |
@Spasi you can give the wip_performance branch a try - it should be way faster |
Hey @redrezo, I tried the Stack: [0x000000002b250000,0x000000002b350000], sp=0x000000002b34e458, free space=1017k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [nvoglv64.dll+0x94e949]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j org.eclipse.fx.drift.internal.GPUSyncUtil.nCreateFence()J+0
j org.eclipse.fx.drift.internal.GPUSyncUtil.access$000()J+0
j org.eclipse.fx.drift.internal.GPUSyncUtil$GLSync.<init>()V+5
j org.eclipse.fx.drift.internal.GPUSyncUtil$GLSync.CreateFence()Lorg/eclipse/fx/drift/internal/GPUSyncUtil$GLSync;+4
j org.eclipse.fx.drift.internal.QuantumRendererHelper.syncExecuteWithFence(Ljava/util/function/Supplier;)Lorg/eclipse/fx/drift/internal/QuantumRendererHelper$WithFence;+5
j org.eclipse.fx.drift.impl.NGDriftFXSurface.createTexture(Lcom/sun/prism/Graphics;Lorg/eclipse/fx/drift/internal/Frame;)Lcom/sun/prism/Texture;+155
j org.eclipse.fx.drift.impl.NGDriftFXSurface.renderFrame(Lcom/sun/prism/Graphics;Lorg/eclipse/fx/drift/internal/Frame;)V+19
j org.eclipse.fx.drift.impl.NGDriftFXSurface.renderContent(Lcom/sun/prism/Graphics;)V+27
j com.sun.javafx.sg.prism.NGNode.doRender(Lcom/sun/prism/Graphics;)V+330
j com.sun.javafx.sg.prism.NGNode.render(Lcom/sun/prism/Graphics;)V+34
j com.sun.javafx.sg.prism.NGGroup.renderContent(Lcom/sun/prism/Graphics;)V+160
j com.sun.javafx.sg.prism.NGRegion.renderContent(Lcom/sun/prism/Graphics;)V+111
j com.sun.javafx.sg.prism.NGNode.doRender(Lcom/sun/prism/Graphics;)V+330
j com.sun.javafx.sg.prism.NGNode.render(Lcom/sun/prism/Graphics;)V+34
j com.sun.javafx.tk.quantum.ViewPainter.doPaint(Lcom/sun/prism/Graphics;Lcom/sun/javafx/sg/prism/NodePath;)V+201
j com.sun.javafx.tk.quantum.ViewPainter.paintImpl(Lcom/sun/prism/Graphics;)V+982
j com.sun.javafx.tk.quantum.PresentingPainter.run()V+326
j java.util.concurrent.Executors$RunnableAdapter.call()Ljava/lang/Object;+4
j java.util.concurrent.FutureTask.runAndReset()Z+47
j com.sun.javafx.tk.RenderJob.run()V+1
j java.util.concurrent.ThreadPoolExecutor.runWorker(Ljava/util/concurrent/ThreadPoolExecutor$Worker;)V+95
j java.util.concurrent.ThreadPoolExecutor$Worker.run()V+5
j com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run()V+8
j java.lang.Thread.run()V+11 The crash happens in the |
Sorry @Spasi , i forgot to push the conditional code for windows that prevents the gl fence calls.. |
Hey @redrezo, the crash is fixed and performance is much better. Will report exact numbers tomorrow, currently testing over a remote desktop solution which skews performance. The lwjgl3 |
One problem with the current API is that there's no way to synchronize the rendering thread with surface presentation. If no throttling is applied, the rendering loop is able to run at 4000+ fps, with no "back-pressure" happening. This appears to be working fine mostly, but when the window is resized to be larger, something fails to keep up. There's stutterring and blank frames and sometimes rendering stops completely for a second or two. I'm able to reproduce this both with and without With the rendering loop throttled to 60fps, it's all nice and smooth at every window size/resolution (including 4K). |
@Spasi |
can we close this issue? |
Yes, DriftFX/LWJGL integration is complete. |
Unfortunately, this project has been deprecated. |
Opening this issue to discuss a simple way to integrate DriftFX and LWJGL.
After looking at the current example code, I don't think DriftFX needs to know anything about LWJGL (like #8 suggests). The opposite is a cleaner approach, i.e. the integration work should happen in LWJGL:
This way users could get started much more easily with DriftFX and efxclipse-drift maintainers don't have any extra work to do.
There is just one thing that will simplify the process: It would be nice if DriftFX exposed a C API. LWJGL will then be able to auto-generate the bindings and it would lessen maintenance work going forward. Note that you could still use C++ internally, only the public API would be C. You could also layer the C API on top of the C++ API, assuming there are users that prefer a C++ API.
The text was updated successfully, but these errors were encountered: