-
-
Notifications
You must be signed in to change notification settings - Fork 382
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(webgpu): Fix support of WebGPU render backend #2816
fix(webgpu): Fix support of WebGPU render backend #2816
Conversation
@floryst there is still an error when mousing over the render window. There are many calls to You must have had that error that would explain why you added the check |
A quick fix would be the following implementation. I don't know if there are any unintended effects, however. For instance, I don't know if we would need to worry if @@ -202,22 +202,23 @@ function vtkWidgetManager(publicAPI, model) {
async function captureBuffers(x1, y1, x2, y2) {
if (model._captureInProgress) {
+ await model._captureInProgress;
return;
}
- model._captureInProgress = true;
renderPickingBuffer();
model._capturedBuffers = null;
- model._capturedBuffers = await model._selector.getSourceDataAsync(
+ model._captureInProgress = model._selector.getSourceDataAsync(
model._renderer,
x1,
y1,
x2,
y2
);
+ model._capturedBuffers = await model._captureInProgress;
model.previousSelectedData = null;
+ model._captureInProgress = null;
renderFrontBuffer();
- model._captureInProgress = false;
} I did try it out with WebGPU + Chrome Canary, and I don't see anymore getSelection errors. However, the LineWidget cannot be interacted with once placed, and the spheres are not correctly colored. I haven't investigated that bit yet. |
Thanks for your tweak, I added it to the PR. In WebGPU, there are many rendering warnings which might be related: In WebGL, it is working the same way as the existing example. |
LGTM after the RenderWindow conflict is resolved. Seems like there's more work to do with the WebGPU implementation. |
1967c53
to
465b9fd
Compare
model._onSizeChanged = (_publicAPI, _model, newValue) => | ||
publicAPI.invokeWindowResizeEvent({ | ||
width: newValue[0], | ||
height: newValue[1], | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@finetjul I was going to fix the conflicts and realized that model._onSizeChanged
is not wired up anywhere. Is there a pathway for invoking the window resize event now that publicAPI.setSize()
no longer directly invokes the event?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm partially reverting this such that setSize directly invokes the window resize event in both the OpenGL and WebGPU RenderWindows. The changes are all internal, so if you want to continue with the idea you had for _onSizeChanged, you can do that without a breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_onSizeChanged
was being called since this following commit
63787d5
TBH, I do not remember anything from this current PR though...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that's good to know. I forgot about that change. We should document it somewhere.
With WebGPU, moving the mouse over was triggering many errors due to asynchronous captureBuffer calls
Allow passing defaultViewAPI in vtkFullscreenRenderWindow newInstance. vtkFullscreenRenderWindow, vtkGenericRenderWindow and vtkViewProxy are now exposing `getApiSpecificRenderWindow()` instead of `getOpenGLRenderWindow()`. `OpenGL/vtkBufferObject` and `OpenGL/vtkHardwareSelector` still expose `getOpenGLRenderWindow()`.
465b9fd
to
1435f51
Compare
Context
Running the LineWidget example with WebGPU backend generated an error because WidgetManager requires onWindowResizeEvent public function.
Moreover in many places
getOpenGLRenderWindow()
was still called (even in a WebGPU context)Results
Expose onWindowResizeEvent and trigger it when the size of the window is modified.
Rename
getOpenGLRenderWindow()
intogetApiSpecificRenderWindow()
Changes
PR and Code Checklist
npm run reformat
to have correctly formatted codeTesting