mapjfx icon indicating copy to clipboard operation
mapjfx copied to clipboard

Resizing map too fast causes to to completely break - D3DTextureResource.getResource() null

Open TheRedSpy15 opened this issue 2 years ago • 8 comments

I have the map inside a splitpane, so the user can resize sections of the screen as much as they like

But doing to much too quickly leads to the map to completely freeze and spit this out into the console: java.lang.NullPointerException: Cannot invoke "com.sun.prism.d3d.D3DTextureData.getContext()" because the return value of "com.sun.prism.d3d.D3DTextureResource.getResource()" is null at javafx.graphics/com.sun.prism.d3d.D3DTexture.getContext(D3DTexture.java:85) at javafx.graphics/com.sun.prism.d3d.D3DTexture.update(D3DTexture.java:210) at javafx.graphics/com.sun.prism.d3d.D3DTexture.update(D3DTexture.java:154) at javafx.graphics/com.sun.prism.impl.BaseContext.flushMask(BaseContext.java:115) at javafx.graphics/com.sun.prism.impl.BaseContext.drawQuads(BaseContext.java:124) at javafx.graphics/com.sun.prism.impl.VertexBuffer.flush(VertexBuffer.java:98) at javafx.graphics/com.sun.prism.impl.BaseContext.flushVertexBuffer(BaseContext.java:107) at javafx.graphics/com.sun.prism.impl.ps.BaseShaderContext.setRenderTarget(BaseShaderContext.java:789) at javafx.graphics/com.sun.prism.impl.BaseContext.setRenderTarget(BaseContext.java:149) at javafx.graphics/com.sun.prism.impl.BaseGraphics.<init>(BaseGraphics.java:107) at javafx.graphics/com.sun.prism.impl.ps.BaseShaderGraphics.<init>(BaseShaderGraphics.java:86) at javafx.graphics/com.sun.prism.d3d.D3DGraphics.<init>(D3DGraphics.java:42) at javafx.graphics/com.sun.prism.d3d.D3DGraphics.create(D3DGraphics.java:65) at javafx.graphics/com.sun.prism.d3d.D3DSwapChain.createGraphics(D3DSwapChain.java:148) at javafx.graphics/com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:88) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) at javafx.graphics/com.sun.javafx.tk.RenderJob.run(RenderJob.java:58) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:126) at java.base/java.lang.Thread.run(Thread.java:833)

TheRedSpy15 avatar Feb 07 '22 05:02 TheRedSpy15

On which OS with which Java version is this happening?

sothawo avatar Feb 08 '22 14:02 sothawo

Windows 11 & Java 17

TheRedSpy15 avatar Feb 10 '22 12:02 TheRedSpy15

Windows I can only test Windows 10 in a VMware installation on my Mac. I don not have the time currently to try this (maybe on the weekend): Create an application that has a split pane with two webviews (not mapjfx, plain WebView, with some standard page). Try to reproduce it there. But as I wrote, I can only test this on mac machines.

sothawo avatar Feb 10 '22 20:02 sothawo

Can you provide a minimum compilable example to reproduce this?

sothawo avatar Feb 11 '22 06:02 sothawo

Yah I'll send a some fxml code shortly once I get a moment. I'll also try to make a gif of how it happens

on a side note (instead of opening another issue): is there anyway to remove the attribution button in the bottom right?

TheRedSpy15 avatar Feb 12 '22 03:02 TheRedSpy15

Ok I completely lost track of time.

From what we can tell it appears to be happening when GPU usage hits 100%. Which only happens when we are displaying a coordinate line (of about 400+ coordinates) and interacting with the map

The work around we're currently using is just limiting how much the user is able to resize the pane containing the mapview

I think it is worth noting, we're experiencing high gpu usage on a gtx 1650 with the latest drivers at the moment

EDIT: it seems java is only using intel graphics to display the mapview. Hence the high gpu usage, and problems when using the mapview. Anyway to get javafx use gpu 1?

TheRedSpy15 avatar Feb 19 '22 23:02 TheRedSpy15

Thanks for the information. I don't know if there is anything you can configure with regards to that. And I don't know if this is something that should be addressed in JavaFx or in the WebKit browser that JavaFX uses. mapfjfx uses a WebView which is just a browser that displays a html page with JavaScript that uses OpenLayers.

But I am afraid that I cannot do anything here.

sothawo avatar Feb 21 '22 19:02 sothawo

Just found your issue, because we had the same error. For me increasing the VRAM helped by passing the option "-Dprism.maxvram=2G" as VM option. If you like to debug your VRAM-Usage pass the option "-Dprism.poolstats=true".

See Bug on openjfdk for detailed information

Andi1218 avatar Jul 14 '22 16:07 Andi1218