Skip to content

Commit e04fcc1

Browse files
committed
add EXT guard for optional blend mode extension
1 parent eba3fe7 commit e04fcc1

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Source/Managers/PrimitiveMan.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,10 @@ void PrimitiveMan::DrawPrimitives(int player, BITMAP* targetBitmap, const Vector
235235
std::array<int, 4> lastBlendAmounts = {BlendAmountLimits::MinBlend, BlendAmountLimits::MinBlend, BlendAmountLimits::MinBlend, BlendAmountLimits::MinBlend};
236236
GLint currentShader = rlGetShaderCurrent();
237237
rlDrawRenderBatchActive();
238-
glBlendBarrierKHR();
239-
rlEnableAdvancedColorBlend();
238+
if (GLAD_GL_KHR_blend_equation_advanced_coherent){
239+
glBlendBarrierKHR();
240+
rlEnableAdvancedColorBlend();
241+
}
240242
rlEnableColorBlend();
241243
for (const std::unique_ptr<GraphicalPrimitive>& primitive: m_ScheduledPrimitives) {
242244
if (int playerToDrawFor = primitive->m_Player; playerToDrawFor == player || playerToDrawFor == -1) {
@@ -258,13 +260,17 @@ void PrimitiveMan::DrawPrimitives(int player, BITMAP* targetBitmap, const Vector
258260
glUniform4f(colorUniform, 1.0f, 1.0f, 1.0f, 1.0f);
259261
lastBlendMode = DrawBlendMode::NoBlend;
260262
}
261-
glBlendBarrierKHR();
263+
if (GLAD_GL_KHR_blend_equation_advanced_coherent) {
264+
glBlendBarrierKHR();
265+
}
262266
rlZDepth(primitive->m_Depth);
263267
primitive->DrawTiled(targetBitmap, targetPos);
264268
}
265269
}
266270
rlDrawRenderBatchActive();
267-
rlDisableAdvancedColorBlend();
271+
if (GLAD_GL_KHR_blend_equation_advanced_coherent) {
272+
rlDisableAdvancedColorBlend();
273+
}
268274
rlSetBlendMode(RL_BLEND_ALPHA);
269275
rlEnableShader(currentShader);
270276
GLint colorUniform = glGetUniformLocation(rlGetShaderCurrent(), "rteColor");

0 commit comments

Comments
 (0)