scenerygraphics / sciview

sciview is a tool for visualization and interaction with ND image and mesh data
BSD 2-Clause "Simplified" License
64 stars 17 forks source link

Updates for Java 21 #547

Closed kephale closed 4 months ago

kephale commented 5 months ago

Update sciview to use java21.

kephale commented 5 months ago

When running ImageJMain and doing Add Box I got:

java.lang.NullPointerException: Cannot invoke "java.util.List.stream()" because the return value of "org.scijava.module.ModuleItem.getChoices()" is null
    at org.scijava.widget.WidgetModel.getChoices(WidgetModel.java:140)
    at org.scijava.ui.swing.widget.SwingObjectWidget.supports(SwingObjectWidget.java:101)
    at org.scijava.ui.swing.widget.SwingObjectWidget.supports(SwingObjectWidget.java:54)
    at org.scijava.plugin.TypedService.find(TypedService.java:70)
    at org.scijava.plugin.WrapperService.create(WrapperService.java:64)
    at org.scijava.widget.AbstractInputHarvester.addInput(AbstractInputHarvester.java:110)
    at org.scijava.widget.AbstractInputHarvester.buildPanel(AbstractInputHarvester.java:84)
    at org.scijava.widget.InputHarvester.harvest(InputHarvester.java:67)
    at org.scijava.ui.AbstractInputHarvesterPlugin.process(AbstractInputHarvesterPlugin.java:74)
    at org.scijava.module.ModuleRunner.preProcess(ModuleRunner.java:103)
    at org.scijava.module.ModuleRunner.run(ModuleRunner.java:154)
    at org.scijava.module.ModuleRunner.call(ModuleRunner.java:125)
    at org.scijava.module.ModuleRunner.call(ModuleRunner.java:64)
    at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:247)
    at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:317)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    at java.base/java.lang.Thread.run(Thread.java:1583)

the render still worked

kephale commented 5 months ago

@skalarproduktraum I am finding that Meshes work, but Volumes seem to freeze the renderer (i.e. the sciview UI still works but the renderer panel seems to be frozen.

I'm debugging and see some threads stuck on updateBlocks in VolumeManager.

Update 1: this brought me to the gpu.await() in BVV's PboChain

kephale commented 5 months ago

I got

[mvk-error] VK_ERROR_INITIALIZATION_FAILED: Shader library compile failed (Error code 3):
program_source:860:1931: error: 'sampler' attribute parameter is out of bounds: must be between 0 and 15
fragment main0_out main0(main0_in in [[stage_in]], constant currentEye_t& currentEye [[buffer(0)]], constant VRParameters& vrParameters [[buffer(1)]], constant ShaderProperties& _127 [[buffer(3)]], texture2d<float> InputZBuffer [[texture(0)]], texture3d<float> volumeCache [[texture(1)]], texture3d<uint> lutSampler_x_764_x_ [[texture(2)]], texture2d<float> transferFunction_x_765_x_ [[texture(3)]], texture2d<float> colorMap_x_766_x_ [[texture(4)]], texture3d<uint> lutSampler_x_787_x_ [[texture(5)]], texture2d<float> transferFunction_x_788_x_ [[texture(6)]], texture2d<float> colorMap_x_789_x_ [[texture(7)]], texture3d<uint> lutSampler_x_810_x_ [[texture(8)]], texture2d<float> transferFunction_x_811_x_ [[texture(9)]], texture2d<float> colorMap_x_812_x_ [[texture(10)]], texture3d<float> volume_x_832_x_ [[texture(11)]], texture2d<float> transferFunction_x_833_x_ [[texture(12)]], texture2d<float> colorMap_x_834_x_ [[texture(13)]], texture3d<float> volume_x_851_x_ [[texture(14)]], texture2d<float> transferFunction_x_852_x_ [[texture(15)]], texture2d<float> colorMap_x_853_x_ [[texture(16)]], sampler InputZBufferSmplr [[sampler(0)]], sampler volumeCacheSmplr [[sampler(1)]], sampler lutSampler_x_764_x_Smplr [[sampler(2)]], sampler transferFunction_x_765_x_Smplr [[sampler(3)]], sampler colorMap_x_766_x_Smplr [[sampler(4)]], sampler lutSampler_x_787_x_Smplr [[sampler(5)]], sampler transferFunction_x_788_x_Smplr [[sampler(6)]], sampler colorMap_x_789_x_Smplr [[sampler(7)]], sampler lutSampler_x_810_x_Smplr [[sampler(8)]], sampler transferFunction_x_811_x_Smplr [[sampler(9)]], sampler colorMap_x_812_x_Smplr [[sampler(10)]], sampler volume_x_832_x_Smplr [[sampler(11)]], sampler transferFunction_x_833_x_Smplr [[sampler(12)]], sampler colorMap_x_834_x_Smplr [[sampler(13)]], sampler volume_x_851_x_Smplr [[sampler(14)]], sampler transferFunction_x_852_x_Smplr [[sampler(15)]], sampler colorMap_x_853_x_Smplr [[sampler(16)]])
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ^
program_source:975:16: warning: unused variable 'fb' [-Wunused-variable]
        float4 fb = wback - wfront;
               ^
program_source:878:12: warning: unused variable 'vp' [-Wunused-variable]
    float2 vp = _127.viewportSize - _127.dsp;
           ^
program_source:879:14: warning: unused variable 't' [-Wunused-variable]
    float4x4 t = _127.transform;
             ^
program_source:971:11: warning: unused variable 'currentSceneDepth' [-Wunused-variable]
    float currentSceneDepth = InputZBuffer.sample(InputZBufferSmplr, depthUV).x;
          ^
.
[mvk-error] VK_ERROR_INVALID_SHADER_NV: Fragment shader function could not be compiled into pipeline. See previous logged error.

When trying to run the flybrain out of core demo after having run the volume rendering demo.

Running the flybrain demo directly is fine though.

kephale commented 4 months ago

[edit: I don't see the Vulkan issue now, but the getChoices one is still there.]

skalarproduktraum commented 4 months ago

The Vulkan issue you're seeing might be related to the number of samplers per shader being limited in Metal. I've seen that one in the past and had implemented a workaround for some scenarios, but I'll check what's happening there.

skalarproduktraum commented 4 months ago

Also wanted to add for the record - the issue with the volumes freezing up the renderer comes from missing --add-opens directives, you need:

--add-opens=java.base/java.lang=ALL-UNNAMED
--add-opens=java.base/java.lang.invoke=ALL-UNNAMED
--add-opens=java.base/java.net=ALL-UNNAMED
--add-opens=java.base/java.nio=ALL-UNNAMED
--add-opens=java.base/java.time=ALL-UNNAMED
--add-opens=java.base/java.util=ALL-UNNAMED
--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED
--add-opens=java.base/sun.nio.ch=ALL-UNNAMED
--add-opens=java.base/sun.util.calendar=ALL-UNNAMED