-
Notifications
You must be signed in to change notification settings - Fork 326
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
Constant attribute does not update #474
Comments
This seems very similar to #483. In that issue, attributes are left in a possibly-active state so that if you destroy the buffers previous commands have referenced, webgl complains, even though the attributes and now-destroyed buffers are unused for the current command. It seems like the checks near lib/core.js:2250 might need to be beefed up a bit in order to catch more subtle changes. |
Nope. Only superficially similar. #483 was fixed long ago, while this remains an issue. |
@dy After (finnallly) digging into this a fair amount, I believe the issue is that the decision about whether an attribute is constant or not seems to be made here in the parseAttributes section: Line 1623 in 6204ca3
while that state is then used in the emitAttributes section: Lines 2296 to 2307 in 6204ca3
The result is that I think the (in my opinion very highly desirable) decision of whether an attribute is constant or not simply can't be made at runtime. The problem then is that it doesn't prevent you from trying and (I haven't totally debugged this part but) it seems like the state gets corrupted. So strictly speaking what you've tried to do is invalid usage and it just happens that refreshing the state resets things to what in this particular case is the desired state—but it would be very easy to come up with a situation in which it resets things to what's not the desired state. Personally I would find deferring the decision until runtime to be highly desirable. This would allow very useful abstraction like writing commands that are agnostic to whether a color, for example, is an attribute or a uniform. I'd like to modify the structure to defer the decision, but I'm interested in whether @mikolalysenko thinks the penalty (performance, complexity, or otherwise) might be prohibitive. |
Oh. I might be totally wrong about that. There clearly is some runtime allowance if the state is neither pointer nor const. Okay, investigating how to get to that branch. Maybe a dynamic property…… |
Okay, yup, I spoke too soon. The problem appears to be this conditional: Line 2239 in 6204ca3
That appears to be preventing it from reenabling vertex attrib array when the state is switched away from constant. Simply removing the conditional fixes it, but there's probably a way to target it a bit more precisely. |
Oh. It just needs an else with |
Oof, the more I look at this, the more I start to understand what it's trying to do, but what it's trying to do actually seems to actually make sense, just not work. Okay, we can get this. |
Okay, had to agonize over this a bit, but finally got to the bottom of it. I've merged it in #545 and have published v1.3.12 to npm. It's too bad travis isn't working anymore (there's a successor to headless-gl now, isn't there??), but I feel pretty good about it and made sure to get all the tests passing (including odd extension interaction), so I went ahead and published. 🎉 And have confirmed that npm installing regl and running the original code in this issue now produces the desired result 🎉🎉🎉🎉🎉 |
As for the tests, we can try to set up tape-run, it runs them in electron. |
Consider simple setup:
The last draw call does not recognize new
active
array and keeps constant attribute[1]
.The need to insert
regl._refresh()
reduces performance in plotlyregl-*
components (around 6 times for regl-splom).Related: plotly/plotly.js#2586, possibly #427.
The text was updated successfully, but these errors were encountered: