Skip to content

Commit

Permalink
Fix GL "too many blend modes" crash
Browse files Browse the repository at this point in the history
  • Loading branch information
dpogue committed Apr 22, 2023
1 parent 81a80ae commit 37abb87
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Sources/Plasma/FeatureLib/pfGLPipeline/plGLPipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 37abb87

Please sign in to comment.