From 7e594a861f9c497819dc5e089b7726651337dfec Mon Sep 17 00:00:00 2001 From: Lynix Date: Mon, 17 Oct 2016 14:47:15 +0200 Subject: [PATCH] Graphics: Fix EnableInstancing(bool) having no impact --- src/Nazara/Graphics/DeferredGeometryPass.cpp | 2 +- src/Nazara/Graphics/ForwardRenderTechnique.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Nazara/Graphics/DeferredGeometryPass.cpp b/src/Nazara/Graphics/DeferredGeometryPass.cpp index dbdb95f5a..79e651926 100644 --- a/src/Nazara/Graphics/DeferredGeometryPass.cpp +++ b/src/Nazara/Graphics/DeferredGeometryPass.cpp @@ -82,7 +82,7 @@ namespace Nz if (pipelineEntry.maxInstanceCount > 0) { - bool instancing = (pipelineEntry.maxInstanceCount > NAZARA_GRAPHICS_INSTANCING_MIN_INSTANCES_COUNT); + bool instancing = instancingEnabled && (pipelineEntry.maxInstanceCount > NAZARA_GRAPHICS_INSTANCING_MIN_INSTANCES_COUNT); UInt32 flags = ShaderFlags_Deferred; if (instancing) diff --git a/src/Nazara/Graphics/ForwardRenderTechnique.cpp b/src/Nazara/Graphics/ForwardRenderTechnique.cpp index 8a8973415..91db219ab 100644 --- a/src/Nazara/Graphics/ForwardRenderTechnique.cpp +++ b/src/Nazara/Graphics/ForwardRenderTechnique.cpp @@ -412,7 +412,7 @@ namespace Nz const Shader* lastShader = nullptr; const ShaderUniforms* shaderUniforms = nullptr; - if (Renderer::HasCapability(RendererCap_Instancing)) + if (m_instancingEnabled && Renderer::HasCapability(RendererCap_Instancing)) { VertexBuffer* instanceBuffer = Renderer::GetInstanceBuffer(); instanceBuffer->SetVertexDeclaration(&s_billboardInstanceDeclaration); @@ -592,7 +592,7 @@ namespace Nz if (pipelineEntry.maxInstanceCount > 0) { - bool instancing = (pipelineEntry.maxInstanceCount > NAZARA_GRAPHICS_INSTANCING_MIN_INSTANCES_COUNT); + bool instancing = m_instancingEnabled && (pipelineEntry.maxInstanceCount > NAZARA_GRAPHICS_INSTANCING_MIN_INSTANCES_COUNT); const MaterialPipeline::Instance& pipelineInstance = pipeline->Apply((instancing) ? ShaderFlags_Instancing : 0); const Shader* shader = pipelineInstance.uberInstance->GetShader();