On Tue, 13 Oct 2020 16:22:36 GMT, Oliver Schmidtmer 
<github.com+10960818+schmi...@openjdk.org> wrote:

>>> The full recreation of the pipeline is only done when D3DERR_DEVICEREMOVED 
>>> is occurring
>> 
>> I see that now. That part is fine then.
>> 
>> Another concern is that this would be the first time we have recreated a 
>> GraphicsPipeline -- they are effectively
>> singletons today. This could have unexpected side effects and would need to 
>> be very carefully reviewed and tested.
>> Have you considered an alternative where you retain the GraphicsPipeline, 
>> but recreate the native device?
>
> I hope I understood your intend. I've tried to replace the recreation of the 
> GraphicsPipeline-Instance by only calling
> the native parts. Unfortunately that doesn't seem to work at all. Probably 
> I'm missing some updates.
>     public boolean reinit() {
>         if (d3dEnabled) {
>             if (creator != Thread.currentThread()) {
>                 throw new IllegalStateException(
>                         "This operation is not permitted on the current 
> thread ["
>                                 + Thread.currentThread().getName() + "]");
>             }
>             notifyAllResourcesReleased();
>             nDispose();
>             for (int i = 0; i != factories.length; ++i) {
>                 factories[i] = null;
>             }
>             nInit(PrismSettings.class);
>             factories = new D3DResourceFactory[nGetAdapterCount()];
>         }
>         return d3dEnabled;
>     }

On a side note, not all resources seem to be freed / recreated on pipeline 
disposal. There are some error outputs, and
some parts in a webview are only rendered after interactions. So it is probably 
better to mark this as WIP. I would be
happy if you have some advice for me. java.lang.IllegalStateException: 
unmanaged resource freed from pool D3D Vram Pool
        at 
com.sun.prism.impl.BaseResourcePool.resourceFreed(BaseResourcePool.java:463)    
     at
com.sun.prism.impl.ManagedResource.dispose(ManagedResource.java:127)    at
com.sun.prism.impl.BaseTexture.dispose(BaseTexture.java:297)    at
com.sun.scenario.effect.impl.prism.ps.PPSDrawable.flush(PPSDrawable.java:69)    
at
com.sun.scenario.effect.impl.ImagePool.dispose(ImagePool.java:267)      at
com.sun.scenario.effect.impl.Renderer.getRenderer(Renderer.java:367)    at
com.sun.scenario.effect.Effect.getCompatibleImage(Effect.java:479)      at
com.sun.javafx.webkit.prism.WCGraphicsPrismContext$Layer.<init>(WCGraphicsPrismContext.java:1369)
       at
com.sun.javafx.webkit.prism.WCGraphicsPrismContext$ClipLayer.<init>(WCGraphicsPrismContext.java:1440)
   at
com.sun.javafx.webkit.prism.WCGraphicsPrismContext.setClip(WCGraphicsPrismContext.java:328)
     at
com.sun.webkit.graphics.GraphicsDecoder.decode(GraphicsDecoder.java:225)        
at
com.sun.webkit.graphics.WCRenderQueue.decode(WCRenderQueue.java:92)     at
com.sun.webkit.WebPage.paint2GC(WebPage.java:736)       at 
com.sun.webkit.WebPage.paint(WebPage.java:703)
        at 
com.sun.javafx.sg.prism.web.NGWebView.renderContent(NGWebView.java:95)
        at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2072)
        at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1964)
        at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:270)
        at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:579)
        at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2072)
        at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1964)
        at com.sun.javafx.tk.quantum.ViewPainter.doPaint(ViewPainter.java:479)
        at com.sun.javafx.tk.quantum.ViewPainter.paintImpl(ViewPainter.java:328)
        at 
com.sun.javafx.tk.quantum.UploadingPainter.run(UploadingPainter.java:143)
        at 
java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at 
java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
        at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
        at 
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
        at 
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
        at 
com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
        at java.base/java.lang.Thread.run(Thread.java:832)

-------------

PR: https://git.openjdk.java.net/jfx/pull/315

Reply via email to