Skip to content

Commit

Permalink
Disable picking for multiview rendering (#8502)
Browse files Browse the repository at this point in the history
Picking is not designed to work with multiview rendering. Disable it
when multiview is enabled.
  • Loading branch information
z3moon authored Mar 7, 2025
1 parent c24535a commit 0e3ef4b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
3 changes: 3 additions & 0 deletions filament/src/details/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,9 @@ void FRenderer::renderJob(RootArenaScope& rootArenaScope, FView& view) {
if (isRenderingMultiview) {
hasPostProcess = false;
msaaOptions.enabled = false;

// Picking is not supported for multiview rendering. Clear any pending picking queries.
view.clearPickingQueries();
}
const uint8_t msaaSampleCount = msaaOptions.enabled ? msaaOptions.sampleCount : 1u;

Expand Down
16 changes: 10 additions & 6 deletions filament/src/details/View.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,7 @@ FView::~FView() noexcept = default;
void FView::terminate(FEngine& engine) {
// Here we would cleanly free resources we've allocated, or we own (currently none).

while (mActivePickingQueriesList) {
FPickingQuery* const pQuery = mActivePickingQueriesList;
mActivePickingQueriesList = pQuery->next;
pQuery->callback(pQuery->result, pQuery);
FPickingQuery::put(pQuery);
}
clearPickingQueries();

DriverApi& driver = engine.getDriverApi();
driver.destroyBufferObject(mLightUbh);
Expand Down Expand Up @@ -1178,6 +1173,15 @@ void FView::executePickingQueries(DriverApi& driver,
}
}

void FView::clearPickingQueries() noexcept {
while (mActivePickingQueriesList) {
FPickingQuery* const pQuery = mActivePickingQueriesList;
mActivePickingQueriesList = pQuery->next;
pQuery->callback(pQuery->result, pQuery);
FPickingQuery::put(pQuery);
}
}

void FView::setTemporalAntiAliasingOptions(TemporalAntiAliasingOptions options) noexcept {
options.feedback = clamp(options.feedback, 0.0f, 1.0f);
options.filterWidth = std::max(0.2f, options.filterWidth); // below 0.2 causes issues
Expand Down
2 changes: 2 additions & 0 deletions filament/src/details/View.h
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,8 @@ class FView : public View {
void executePickingQueries(backend::DriverApi& driver,
backend::RenderTargetHandle handle, math::float2 scale) noexcept;

void clearPickingQueries() noexcept;

void setMaterialGlobal(uint32_t index, math::float4 const& value);

math::float4 getMaterialGlobal(uint32_t index) const;
Expand Down

0 comments on commit 0e3ef4b

Please sign in to comment.