Fix render pass resource checking

This commit is contained in:
Wojciech Figat
2022-04-06 13:16:12 +02:00
parent 34c0d6c442
commit 430ef09ab1
4 changed files with 6 additions and 5 deletions

View File

@@ -249,7 +249,7 @@ bool SortDecal(Decal* const& a, Decal* const& b)
void GBufferPass::RenderDebug(RenderContext& renderContext)
{
// Check if has resources loaded
if (setupResources())
if (checkIfSkipPass())
return;
// Cache data

View File

@@ -170,7 +170,8 @@ bool GlobalSignDistanceFieldPass::setupResources()
_csGenerateMip1 = shader->GetCS("CS_GenerateMip", 1);
// Init buffer
_modelsBuffer = New<DynamicStructuredBuffer>(64u * (uint32)sizeof(ModelRasterizeData), (uint32)sizeof(ModelRasterizeData), false, TEXT("GlobalSDF.ModelsBuffer"));
if (!_modelsBuffer)
_modelsBuffer = New<DynamicStructuredBuffer>(64u * (uint32)sizeof(ModelRasterizeData), (uint32)sizeof(ModelRasterizeData), false, TEXT("GlobalSDF.ModelsBuffer"));
// Create pipeline state
GPUPipelineState::Description psDesc = GPUPipelineState::Description::DefaultFullscreenTriangle;
@@ -229,7 +230,7 @@ bool GlobalSignDistanceFieldPass::Get(const RenderBuffers* buffers, BindingData&
bool GlobalSignDistanceFieldPass::Render(RenderContext& renderContext, GPUContext* context, BindingData& result)
{
// Skip if not supported
if (setupResources())
if (checkIfSkipPass())
return true;
if (renderContext.List->Scenes.Count() == 0)
return true;

View File

@@ -186,7 +186,7 @@ void GlobalSurfaceAtlasPass::Dispose()
bool GlobalSurfaceAtlasPass::Render(RenderContext& renderContext, GPUContext* context, BindingData& result)
{
// Skip if not supported
if (setupResources())
if (checkIfSkipPass())
return true;
if (renderContext.List->Scenes.Count() == 0)
return true;

View File

@@ -245,7 +245,7 @@ void MotionBlurPass::RenderDebug(RenderContext& renderContext, GPUTextureView* f
{
auto context = GPUDevice::Instance->GetMainContext();
const auto motionVectors = renderContext.Buffers->MotionVectors;
if (!motionVectors->IsAllocated() || setupResources())
if (!motionVectors->IsAllocated() || checkIfSkipPass())
{
context->Draw(frame);
return;