ClearVolume / clearvolume

ClearVolume is a real-time live 3D visualization library designed for high-end volumetric microscopes such as SPIM and DLSM microscopes. With ClearVolume you can see live on your screen the stacks acquired by your microscope instead of waiting for offline post-processing to give you an intuitive and comprehensive view on your data.
http://clearvolume.github.io
GNU Lesser General Public License v3.0
44 stars 11 forks source link

Remove const modifier on float4 color definition in volume kernel #80

Closed beowulfey closed 2 years ago

beowulfey commented 3 years ago

There is a bug with the ClearVolume Fiji plugin where it is unable to compile the VolumeRender kernel on Intel GPUs. The plugin works fine on Nvidia GPUs, but on a PC with an Intel GPU the window appears blank, and an error message appears in the log (as well as a full output of the source code). An example of this error code can be found in #76; there are a lot of other examples of errors with NullPointerExceptions, and I wonder if they are related!

Basically, there is a float4 definition for "color" that is labeled const, but then immediately modified right after that. For whatever reason, Nvidia GPUs seem to be fine with this, but Intel must be stricter and fails to compile. Removing the "const" allows the kernel to compile on both Nvidia and Intel, but I haven't tested it anywhere else yet.

I think, given the code that is right below the color variable definition, it is NOT meant to be const, but I am absolutely not familiar with OpenCL development at all, nor could I even safely call myself a Java developer. If this change is dangerous, I hope someone else might catch it; however, I can say that I am very happy to finally be able to use CV on my intel-GPU laptop!

nicost commented 2 years ago

Is there anyone still monitoring this repository? Just realized that some of the newer NVidia GPUs do the same checking as the Intel GPUs (fair enough! if you make something const, most languages will not let you modify it), resulting in empty 3D viewers in both Fiji and Micro-Manager. It would be really awesome to merge this PR, and push out a new version to https://maven.scijava.org. If nobody is maintaining the repository, please let's discuss how to keep this usable. There are plenty of people making use of the ClearVolume plugins in Fiji and Micro-Manager (and they really like them!).

nicost commented 2 years ago

I can attest that this simple change fixes display issues under both Fiji and Micro-Manager on my laptop using Intel GPU. Also suspect that newer NVidia drivers may do the same checking for const that the Intel GPU drivers do.