From 81632b91bbf156aa59621afed6c37087ec9e0fb8 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Wed, 26 Aug 2020 20:30:51 +0100 Subject: [PATCH] [dxso] Allocate shader compiler on the heap In some apps that call us with limited stack space, this can stack overflow --- src/dxso/dxso_module.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/dxso/dxso_module.cpp b/src/dxso/dxso_module.cpp index 3b2bb25b4..43f9fda92 100644 --- a/src/dxso/dxso_module.cpp +++ b/src/dxso/dxso_module.cpp @@ -3,6 +3,8 @@ #include "dxso_code.h" #include "dxso_compiler.h" +#include + namespace dxvk { DxsoModule::DxsoModule(DxsoReader& reader) @@ -24,22 +26,22 @@ namespace dxvk { const std::string& fileName, const DxsoAnalysisInfo& analysis, const D3D9ConstantLayout& layout) { - DxsoCompiler compiler( + auto compiler = std::make_unique( fileName, moduleInfo, m_header.info(), analysis, layout); - this->runCompiler(compiler, m_code.iter()); - m_isgn = compiler.isgn(); + this->runCompiler(*compiler, m_code.iter()); + m_isgn = compiler->isgn(); - m_meta = compiler.meta(); - m_constants = compiler.constants(); - m_usedSamplers = compiler.usedSamplers(); - m_usedRTs = compiler.usedRTs(); + m_meta = compiler->meta(); + m_constants = compiler->constants(); + m_usedSamplers = compiler->usedSamplers(); + m_usedRTs = compiler->usedRTs(); - compiler.finalize(); + compiler->finalize(); - return compiler.compile(); + return compiler->compile(); } void DxsoModule::runAnalyzer(