From 37abb87ff89b858697d2832f43140cc1b230792a Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Fri, 30 Dec 2022 13:00:36 -0800 Subject: [PATCH] Fix GL "too many blend modes" crash --- Sources/Plasma/FeatureLib/pfGLPipeline/plGLPipeline.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sources/Plasma/FeatureLib/pfGLPipeline/plGLPipeline.cpp b/Sources/Plasma/FeatureLib/pfGLPipeline/plGLPipeline.cpp index 5e7a31e40b..b7599e17b3 100644 --- a/Sources/Plasma/FeatureLib/pfGLPipeline/plGLPipeline.cpp +++ b/Sources/Plasma/FeatureLib/pfGLPipeline/plGLPipeline.cpp @@ -776,6 +776,7 @@ void plGLPipeline::IRenderBufferSpan(const plIcicle& span, LOG_GL_ERROR_CHECK("PRE Render failed"); + hsRefCnt_SafeAssign(fCurrMaterial, material); mRef->SetupTextureRefs(); /* Vertex Buffer stuff */ @@ -835,7 +836,8 @@ void plGLPipeline::IRenderBufferSpan(const plIcicle& span, if (mRef->uPassNumber != -1) glUniform1i(mRef->uPassNumber, pass); - plLayerInterface* lay = material->GetLayer(mRef->GetPassIndex(pass)); + fCurrLayerIdx = mRef->GetPassIndex(pass); + plLayerInterface* lay = material->GetLayer(fCurrLayerIdx); ICalcLighting(mRef, lay, &span); @@ -1053,7 +1055,7 @@ void plGLPipeline::IHandleBlendMode(hsGMatState flags) default: { - hsAssert(false, "Too many blend modes specified in material"); + hsAssert(false, ST::format("Too many blend modes specified in material {}", fCurrMaterial->GetKeyName()).c_str()); plLayer* lay = plLayer::ConvertNoRef(fCurrMaterial->GetLayer(fCurrLayerIdx)->BottomOfStack()); if (lay) {