Uniform buffers for shader props, allow variable number of channels, update deck.gl to 9.2.9#924
Uniform buffers for shader props, allow variable number of channels, update deck.gl to 9.2.9#924xinaesthete wants to merge 77 commits intohms-dbmi:mainfrom
Conversation
…ean. some tests are failing with this revision, runtime not tried.
… i is clean." This reverts commit c51bffe.
|
New Issues (3)Checkmarx found the following issues in this Pull Request
Fixed Issues (3)Great job! The following issues were fixed in this Pull Request
Use @Checkmarx to interact with Checkmarx PR Assistant. |
ilan-gold
left a comment
There was a problem hiding this comment.
I think it's reasonable to ask in deck.gl slack or on the github what the implications of a custom ShaderAssembler would be. I really couldn't know off hand. As you can probably tell, I did a lot of this by just looking at the underlying code and ballparking what would be needed. The upside is it works. The downside is that it has a bunch of private accesses. At the time, I was under paper pressure :/
I don't feel too strongly about how off-the-beaten-path this goes as long as it works. We advertise breaking changes on the minor version so I'm also not worried about any breaking changes. I'll try to download the deck.gl slack on Monday again.
|
|
||
| const _RENDER = `\ | ||
| float intensityArray[6] = float[6](intensityValue0, intensityValue1, intensityValue2, intensityValue3, intensityValue4, intensityValue5); | ||
| float intensityArray[NUM_CHANNELS] = float[NUM_CHANNELS](intensityValue0, intensityValue1, intensityValue2, intensityValue3, intensityValue4, intensityValue5); |
There was a problem hiding this comment.
Note that there is one other place where I have something more like
float array[NUM_CHANNELS] = float[NUM_CHANNELS](
value<VIV_CHANNEL_INDEX>,
);
and that also works...
Now I'm trying to get that to also work for uniform vec2 constastLimits<VIV_CHANNEL_INDEX>; with the new shaderInputs UBO binding and finding it tricky.
There was a problem hiding this comment.
Or rather... the syntax I mentioned works ok, but the new
uniform xrLayerUniforms {
vec2 contrastLimits<VIV_CHANNEL_INDEX>;
} xrLayer;
I'm struggling with.
There was a problem hiding this comment.
I think the issue may be that I was trying to implement setting shaderInputs in the draw() method and moving this to updateState() makes a significant difference (just about to try this). edit: also, working in js rather than ts and having typos.
| // does any of this existing logic need to change? | ||
| // (like, is there ever more than one model?) |
There was a problem hiding this comment.
I think the way our extensions are structured, no, because extension is attached to XRLayer which does its own rendering?
There was a problem hiding this comment.
Yes I don't anticipate a problem there... In some places I'm looping over this.getModels() and it may be that it would be somewhat safer to do that a bit more consistently, but I'm pretty sure it isn't likely to matter in foreseeable future. Slight balance between consistency and avoiding changes where there isn't a solid reason for it.
|
@ilan-gold Ib already expressed some enthusiasm about viv updating deck versions and I'm sure he'll be happy to give some more feedback at some point. I'll add a pointer to this PR over there now. |
|
n.b. I've made all the CI pass and will try to keep commits clean WRT that, but bear in mind that I don't think the configuration is properly working for |
|
Also I think that volume minimum intensity projection is already buggy - it looks similar in this branch to production avivator build, which is to say, not good. |
Yes it is, should eventually fix that... |
|
I am not sure that minimum intensity projection has bugs, it is just that it is not really useful, conceptually, for most images. I think it was implemented because it is very easy once you implement the max-intensity projection. But why would I want to view the "minimum-intensity" pixels, when they are just going to correspond the black space that I am not typically interested in? I think the only time it would really make sense is if the image colors have been inverted for some reason. (Maybe I am wrong, but before we assume it has bugs we should verify with another viewer that supports MinIP) |
|
You're right @keller-mark I was mostly speaking from an experience where I wanted the inversion actually and remember it not working properly. But I don't know for sure. |
|
Documentation probably still needs some work. |
add helper function for better type in test
|
There seems to be a fairly major performance degradation with volume rendering currently – I would expect it to be faster than before as long as it's rendering a lower number of channels, and I believe this was the case previously, so I'll try to figure out what's going on there. |
edit: I have noticed that it seems much worse for camera interactions than tweaking contrast-limits. At least with my local changes there are intermittent pauses when moving the camera, so this is something to investigate; seems like the shader details are not so relevant. I might post on the deck.gl Slack. Also, I think I've been seeing some stutters in 2D as well, but not on the same level. older commentsI've realised I've got channel-expansion to arrays inside the hot-path of the raymarch loop in the volume shader... whoops...
Hopefully it's just a case of tweaking |
…sible, fixes bug with always selecting default colormap
|
@xinaesthete Apologies, was probably https://github.com/xinaesthete/viv/blob/deck_9.2/packages/viewers/src/VivViewer.jsx#L73-L75 which doesn't actually seem to work on everyone's machines/site builds. I reverted it in #948 but am waiting on @keller-mark there. Maybe I should just revert globally. Sorry for the trouble! |
commit 91560ab Author: Ilan Gold <ilanbassgold@gmail.com> Date: Thu Mar 19 17:22:12 2026 +0100 fix: remove debounce (hms-dbmi#952)
| - uses: actions/checkout@v4 | ||
| - uses: pnpm/action-setup@v4 | ||
| with: | ||
| version: 9.5.0 |
There was a problem hiding this comment.
I changed these because at one point I didn't realise that CI on the branch was running on an automatic merge with main and I was trying to figure out why CI was failing when everything worked locally. package.json has "packageManager": "pnpm@9.5.0", there may be something to be said for making sure that these are all tied to the same version, but the change isn't necessary to the PR (CI was breaking because of silently auto-merged pnpm-lock.yml I think), and if we make a separate change it'd probably also update to a newer version.


Fixes #687
Background
#687 as well as elsewhere for discussion of UBO etc.
This is work-in-progress... started out just trying to update to latest luma.gl/deck.gl to deal with some peer-dependency issues downstream. Latest versions remove the deprecated
setUniformsetc, so this is becoming more pressing.This is still WIP as of this writing, but I think starting to take shape for a way of supporting N-channels without too much pain for extension authors.
Change List
model.shaderInputsrather thansetUniformsupdateState()rather thandraw(), I think this is more in line with how things are supposed to beMAX_CHANNELS = 6is findable in the code etc...NUM_CHANNELSwhich should be used consistently where relevantVivShaderAssemblerclass for expanding lines with<VIV_CHANNEL_INDEX>...Checklist