Skip to content
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

Updates for Java 21 #547

Merged
merged 8 commits into from
Feb 20, 2024
Merged

Updates for Java 21 #547

merged 8 commits into from
Feb 20, 2024

Conversation

kephale
Copy link
Member

@kephale kephale commented Feb 3, 2024

Update sciview to use java21.

@kephale
Copy link
Member Author

kephale commented Feb 3, 2024

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
Copy link
Member Author

kephale commented Feb 3, 2024

@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 kephale changed the title wip updates for java21: works for meshes but fails on volumes wip updates for java21 Feb 3, 2024
@kephale
Copy link
Member Author

kephale commented Feb 3, 2024

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
Copy link
Member Author

kephale commented Feb 15, 2024

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

@kephale kephale marked this pull request as ready for review February 15, 2024 01:49
@skalarproduktraum
Copy link
Member

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
Copy link
Member

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

@kephale kephale changed the title wip updates for java21 Updates for java21 Feb 19, 2024
@skalarproduktraum skalarproduktraum changed the title Updates for java21 Updates for Java 21 Feb 19, 2024
Copy link
Member Author

@kephale kephale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@kephale kephale merged commit a41f0b8 into main Feb 20, 2024
4 checks passed
@kephale kephale deleted the switch-to-java-21 branch February 20, 2024 02:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants