Fix rendering with custom feature-set

This commit is contained in:
Wojtek Figat
2023-01-31 16:18:04 +01:00
parent b071cdb843
commit 831af77eff
2 changed files with 6 additions and 16 deletions

View File

@@ -181,24 +181,13 @@ void PostProcessingPass::Dispose()
void PostProcessingPass::Render(RenderContext& renderContext, GPUTexture* input, GPUTexture* output, GPUTexture* colorGradingLUT)
{
PROFILE_GPU_CPU("Post Processing");
auto device = GPUDevice::Instance;
auto context = device->GetMainContext();
auto& view = renderContext.View;
PROFILE_GPU_CPU("Post Processing");
context->ResetRenderTarget();
// Ensure to have valid data
if (checkIfSkipPass())
{
// Resources are missing. Do not perform rendering. Just copy raw frame
context->SetRenderTarget(*output);
context->Draw(input);
return;
}
// Cache data
PostProcessSettings& settings = renderContext.List->Settings;
bool useBloom = EnumHasAnyFlags(view.Flags, ViewFlags::Bloom) && settings.Bloom.Enabled && settings.Bloom.Intensity > 0.0f;
bool useToneMapping = EnumHasAnyFlags(view.Flags, ViewFlags::ToneMapping);
@@ -206,9 +195,10 @@ void PostProcessingPass::Render(RenderContext& renderContext, GPUTexture* input,
bool useLensFlares = EnumHasAnyFlags(view.Flags, ViewFlags::LensFlares) && settings.LensFlares.Intensity > 0.0f && useBloom;
// Ensure to have valid data and if at least one effect should be applied
if (!(useBloom || useToneMapping || useCameraArtifacts))
if (checkIfSkipPass() || !(useBloom || useToneMapping || useCameraArtifacts))
{
// Resources are missing. Do not perform rendering. Just copy raw frame
context->SetViewportAndScissors(output->Width(), output->Height());
context->SetRenderTarget(*output);
context->Draw(input);
return;

View File

@@ -312,6 +312,7 @@ void RenderInner(SceneRenderTask* task, RenderContext& renderContext, RenderCont
// Initialize setup
RenderSetup& setup = renderContext.List->Setup;
const bool isGBufferDebug = GBufferPass::IsDebugView(renderContext.View.Mode);
{
PROFILE_CPU_NAMED("Setup");
if (renderContext.View.Origin != renderContext.View.PrevOrigin)
@@ -319,7 +320,7 @@ void RenderInner(SceneRenderTask* task, RenderContext& renderContext, RenderCont
const int32 screenWidth = renderContext.Buffers->GetWidth();
const int32 screenHeight = renderContext.Buffers->GetHeight();
setup.UpscaleLocation = renderContext.Task->UpscaleLocation;
if (screenWidth < 16 || screenHeight < 16 || renderContext.Task->IsCameraCut)
if (screenWidth < 16 || screenHeight < 16 || renderContext.Task->IsCameraCut || isGBufferDebug || renderContext.View.Mode == ViewMode::NoPostFx)
setup.UseMotionVectors = false;
else
{
@@ -344,7 +345,6 @@ void RenderInner(SceneRenderTask* task, RenderContext& renderContext, RenderCont
renderContext.Buffers->Prepare();
// Build batch of render contexts (main view and shadow projections)
const bool isGBufferDebug = GBufferPass::IsDebugView(renderContext.View.Mode);
{
PROFILE_CPU_NAMED("Collect Draw Calls");