From 3fcbcacd43f54f6101bcf8419a741fb4705f5039 Mon Sep 17 00:00:00 2001 From: Wojciech Figat Date: Thu, 15 Dec 2022 17:33:14 +0100 Subject: [PATCH] Fix empty draw call submitting --- Source/Engine/Graphics/Models/Mesh.cpp | 3 ++- Source/Engine/Graphics/Models/SkinnedMesh.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/Engine/Graphics/Models/Mesh.cpp b/Source/Engine/Graphics/Models/Mesh.cpp index b75db1949..a115ddec7 100644 --- a/Source/Engine/Graphics/Models/Mesh.cpp +++ b/Source/Engine/Graphics/Models/Mesh.cpp @@ -574,7 +574,8 @@ void Mesh::Draw(const RenderContextBatch& renderContextBatch, const DrawInfo& in // Push draw call to the render lists const auto shadowsMode = (ShadowsCastingMode)(entry.ShadowsMode & slot.ShadowsMode); const DrawPass drawModes = (DrawPass)(info.DrawModes & material->GetDrawModes()); - renderContextBatch.GetMainContext().List->AddDrawCall(renderContextBatch, drawModes, info.Flags, shadowsMode, info.Bounds, drawCall, entry.ReceiveDecals); + if (drawModes != DrawPass::None) + renderContextBatch.GetMainContext().List->AddDrawCall(renderContextBatch, drawModes, info.Flags, shadowsMode, info.Bounds, drawCall, entry.ReceiveDecals); } bool Mesh::DownloadDataGPU(MeshBufferType type, BytesContainer& result) const diff --git a/Source/Engine/Graphics/Models/SkinnedMesh.cpp b/Source/Engine/Graphics/Models/SkinnedMesh.cpp index 17c63ac8e..3a4c2cc68 100644 --- a/Source/Engine/Graphics/Models/SkinnedMesh.cpp +++ b/Source/Engine/Graphics/Models/SkinnedMesh.cpp @@ -278,7 +278,8 @@ void SkinnedMesh::Draw(const RenderContextBatch& renderContextBatch, const DrawI // Push draw call to the render lists const auto shadowsMode = (ShadowsCastingMode)(entry.ShadowsMode & slot.ShadowsMode); const DrawPass drawModes = (DrawPass)(info.DrawModes & material->GetDrawModes()); - renderContextBatch.GetMainContext().List->AddDrawCall(renderContextBatch, drawModes, StaticFlags::None, shadowsMode, info.Bounds, drawCall, entry.ReceiveDecals); + if (drawModes != DrawPass::None) + renderContextBatch.GetMainContext().List->AddDrawCall(renderContextBatch, drawModes, StaticFlags::None, shadowsMode, info.Bounds, drawCall, entry.ReceiveDecals); } bool SkinnedMesh::DownloadDataGPU(MeshBufferType type, BytesContainer& result) const