Don't recreate every pipeline in CElementGen, only those relevent to CParticle instances

This commit is contained in:
Phillip Stephens 2021-04-20 18:00:03 -07:00
parent 54691cf035
commit 518e639f69
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
1 changed files with 8 additions and 5 deletions

View File

@ -214,6 +214,10 @@ CElementGen::CElementGen(TToken<CGenDescription> gen, EModelOrientationType orie
} }
_RecreatePipelines(); _RecreatePipelines();
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
CElementGenShaders::BuildShaderDataBinding(ctx, *this);
return true;
} BooTrace);
} }
CElementGen::~CElementGen() { CElementGen::~CElementGen() {
@ -238,7 +242,7 @@ bool CElementGen::Update(double t) {
bool ret = InternalUpdate(t); bool ret = InternalUpdate(t);
CParticleGlobals::instance()->m_currentParticleSystem = prevSystem; CParticleGlobals::instance()->m_currentParticleSystem = prevSystem;
if (oldMax != x90_MAXP) { if (oldMax < x90_MAXP) {
_RecreatePipelines(); _RecreatePipelines();
} }
return ret; return ret;
@ -256,7 +260,6 @@ void CElementGen::_RecreatePipelines() {
m_instBufPmus = ctx.newDynamicBuffer(boo::BufferUse::Vertex, ShadClsSizes[size_t(m_shaderClass)], maxInsts); m_instBufPmus = ctx.newDynamicBuffer(boo::BufferUse::Vertex, ShadClsSizes[size_t(m_shaderClass)], maxInsts);
m_uniformBufPmus = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(SParticleUniforms), 1); m_uniformBufPmus = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(SParticleUniforms), 1);
} }
CElementGenShaders::BuildShaderDataBinding(ctx, *this);
return true; return true;
} BooTrace); } BooTrace);
} }
@ -828,8 +831,8 @@ void CElementGen::Render(const CActorLights* actorLights) {
return; return;
} }
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CElementGen::Render {}"), SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CElementGen::Render {}"), *x1c_genDesc.GetObjectTag()).c_str(),
*x1c_genDesc.GetObjectTag()).c_str(), zeus::skYellow); zeus::skYellow);
CGenDescription* desc = x1c_genDesc.GetObj(); CGenDescription* desc = x1c_genDesc.GetObj();