-
-
Notifications
You must be signed in to change notification settings - Fork 312
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
fix nan handling in WGLMakie #4282
Conversation
455d1bf
to
eab2c34
Compare
Would be nice to get some feedback/direction. @ffreyer |
I don't have time to think about this more deeply atm because of the GeometryBasics refactor. I remember that there were some issues with the number of (varying) buffer variables when we reworked the WGLMakie line shaders. I think that was with vertex -> fragment shader buffers, but I'm not sure anymore. That would be something to check. If there are no issues with those limits then I think this approach is fine for now. The code in Shaders.js looks like there is some encoding or decoding missing for ints, I'd guess either with serialize_tree on the Julia side or that attribute_type function? |
Thank you for the context switch and reply to this PR. I haven't run into any issues with the number of buffer variables in the shaders, and I've been plotting complex figures with this change for over a week now. Was there a more direct check you had in mind? I took another look at |
Did some googling again to figure out what I'm actually talking about. There is a GPU-dependent maximum number of vec4's that can go into a shader stage. I thought it was (also) WebGL Version dependent, maybe not? All GPUs allow 8+, most 12+, see https://opengles.gpuinfo.org/displaycapability.php?name=GL_MAX_VARYING_VECTORS&esversion=2 We have:
where vec4 and vec3 count for 1 slot, vec2 for 0.5 slots and float for 0.25 slots, so 4+2+0.5+0.5 = 7 total. (See https://stackoverflow.com/questions/26682631/webgl-shaders-maximum-number-of-varying-variables) You're adding another pair of uints, which should count as half a vec4 slot if I understand things correctly. So I think we're fine here. Is this producing the same indices as GLMakie? |
This is producing the same indices, though maybe in a round-about way. The code returns Makie.jl/WGLMakie/src/picking.jl Line 22 in 8617742
I chose to leave the Also, it looks like the tests are failing because offset arrays can have negative indices. I can revert Makie.jl/WGLMakie/src/wglmakie.js Line 539 in 8617742
I'll need to think about how to do this in a way that'll preserve the full uint range. Please let me know if you have any suggestions. |
Now that I think about it I wonder why we let OffsetArrays get this far. @asinghvi17 Is there any good reason to not convert them in convert_arguments? |
Ideally offset arrays should be converted in convert_arguments IMO. I had a PR to do that generically but it's pretty outdated now I think. Will see about resurrecting it though. |
Ok, I think we should handle OffsetArray in convert_arguments then and not complicate picking by considering OffsetArrays there. I guess we can have something like |
Ok, I added a |
I've increased code coverage and the coverage check is still complaining. I think the code coverage pipeline is broken because it shows 40% and 80% coverage, but when I look at the detailed view all I see is 80%. |
I tested this locally, seems to be working fine. @SimonDanisch Is there a way we can test picking in WGLMakie? @asinghvi17 Do you think we need any other OffsetArray conversions for lines/PointBased? |
I think |
@SimonDanisch would you point me to a working example? I need a screen object to test pick and I can't find a single WGLMakie test that generates a screen object in CI. The following code just hangs in a headless machine:
|
On headless you need:
Which should already be part of the WGLMakie CI! |
Hmm, I can't seem to get this working locally. I just get the following error:
Would you please post a MWE for pick without nan and I can then modify it to test the NaN case. |
Maybe we should just handle that in a separate pr then. We'll need to make one for picking other plots anyway |
What do you think @SimonDanisch? Shall we merge as is? |
I'm fine with that :) |
Description
Fixes #4109
Fixes #3672
This PR is a proof of concept, mainly to solicit feedback from the developers. Instead of reading the instance id from the shader, use the index that's already computed when handling nans and creating line loops. It's not ideal that the index needs to be serialized and passed to the front end as it adds additional overhead, but I don't think the shaders current have enough information to infer the index otherwise.
Type of change
Checklist