Skip to content
Snippets Groups Projects
Commit 56421b68 authored by Jaswant Panchumarti (Kitware)'s avatar Jaswant Panchumarti (Kitware)
Browse files

Fix RemoveViewProp() in webgpu renderer

- when a prop is removed, invalidate the render bundle.
- since the bundle is invalidated outside the `DeviceRender` call,
  modify the `InvalidateBundle` function to also reset `Bundle` to null
parent 1f89fddc
No related branches found
No related tags found
No related merge requests found
......@@ -51,7 +51,7 @@ int TestRemoveActors(int argc, char* argv[])
}
renderer->ResetCamera();
renderer->SetBackground(0.1, 0.1, 0.1);
renderer->SetBackground(1, 1, 1);
vtkNew<vtkRenderWindowInteractor> iren;
iren->SetRenderWindow(renWin);
......@@ -62,6 +62,20 @@ int TestRemoveActors(int argc, char* argv[])
renderer->RemoveAllViewProps();
renWin->Render();
vtkNew<vtkUnsignedCharArray> pixels;
renWin->GetRGBACharPixelData(0, 0, renWin->GetSize()[0] - 1, renWin->GetSize()[1] - 1, 0, pixels);
for (vtkIdType i = 0; i < pixels->GetNumberOfTuples(); ++i)
{
for (int c = 0; c < pixels->GetNumberOfComponents() - 1; ++c)
{
const auto value = pixels->GetComponent(i, c);
if (value != 255)
{
std::cerr << "Unexpected pixel value " << int(value) << '\n';
return EXIT_FAILURE;
}
}
}
const int retVal = vtkRegressionTestImage(renWin);
if (retVal == vtkRegressionTester::DO_INTERACTOR)
......
......@@ -1512,6 +1512,13 @@ void vtkWebGPUPolyDataMapper::ReleaseGraphicsResources(vtkWindow* w)
}
this->CellConverter->ReleaseGraphicsResources(w);
this->RebuildGraphicsPipelines = true;
for (auto& it : this->CachedActorRendererProperties)
{
if (auto* wgpuRenderer = vtkWebGPURenderer::SafeDownCast(it.first.second))
{
wgpuRenderer->InvalidateBundle();
}
}
this->CachedActorRendererProperties.clear();
}
......
......@@ -172,7 +172,11 @@ public:
* @note This does not use vtkSetMacro because the actor MTime should not be affected when a
* render bundle is invalidated.
*/
inline void InvalidateBundle() { this->RebuildRenderBundle = true; }
inline void InvalidateBundle()
{
this->RebuildRenderBundle = true;
this->Bundle = nullptr;
}
/**
* Get whether the render bundle associated with this actor must be reset by the renderer.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment