From 90ee59512bb0dcea72be837e2eda7cf6c5b97656 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Wed, 7 Jul 2021 13:36:36 -0700 Subject: [PATCH] don't crash when refraction pass is empty --- filament/src/RenderPass.h | 1 + filament/src/Renderer.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/filament/src/RenderPass.h b/filament/src/RenderPass.h index c3c3e55630..6abe578eb8 100644 --- a/filament/src/RenderPass.h +++ b/filament/src/RenderPass.h @@ -280,6 +280,7 @@ public: Command const* begin() const noexcept { return mCommandBegin; } Command const* end() const noexcept { return mCommandEnd; } + bool empty() const noexcept { return begin() == end(); } // This is the main function of this class, this appends commands to the pass using // the current camera, geometry and flags set. This can be called multiple times if needed. diff --git a/filament/src/Renderer.cpp b/filament/src/Renderer.cpp index 55e3780e05..7d955dacf0 100644 --- a/filament/src/Renderer.cpp +++ b/filament/src/Renderer.cpp @@ -497,7 +497,7 @@ void FRenderer::renderJob(ArenaScope& arena, FView& view) { // the color pass + refraction + color-grading as subpass if needed // this cancels the colorPass() call above if refraction is active. - if (view.isScreenSpaceRefractionEnabled()) { + if (view.isScreenSpaceRefractionEnabled() && !pass.empty()) { colorPassOutput = refractionPass(fg, config, colorGradingConfigForColor, pass, view); }