@@ -423,12 +423,7 @@ static bool update_texture_region(GLenum target, GLuint object, GLint level, GLi
423
423
424
424
#endif
425
425
426
- static __forceinline auto get_index_buffer_offset (const GLvoid *indices) -> GLuint
427
- {
428
- return g_current_context->_current_ibo != 0 ? static_cast <uint32_t >(reinterpret_cast <uintptr_t >(indices) / reshade::opengl::get_index_type_size (g_current_context->_current_index_type )) : 0 ;
429
- }
430
-
431
- static __forceinline void update_current_primitive_topology (GLenum mode, GLenum type)
426
+ static void update_current_primitive_topology (GLenum mode, GLenum type)
432
427
{
433
428
assert (g_current_context != nullptr );
434
429
g_current_context->_current_index_type = type;
@@ -455,6 +450,11 @@ static __forceinline void update_current_primitive_topology(GLenum mode, GLenum
455
450
}
456
451
}
457
452
453
+ static __forceinline auto get_index_buffer_offset (const GLvoid *indices) -> GLuint
454
+ {
455
+ return g_current_context->_current_ibo != 0 ? static_cast <uint32_t >(reinterpret_cast <uintptr_t >(indices) / reshade::opengl::get_index_type_size (g_current_context->_current_index_type )) : 0 ;
456
+ }
457
+
458
458
#endif
459
459
460
460
#ifdef GL_VERSION_1_0
@@ -1517,15 +1517,15 @@ void APIENTRY glBindBuffer(GLenum target, GLuint buffer)
1517
1517
void APIENTRY glDeleteProgram (GLuint program)
1518
1518
{
1519
1519
#if RESHADE_ADDON
1520
- if (g_current_context)
1520
+ if (g_current_context && program != 0 )
1521
1521
{
1522
1522
GLint status = GL_FALSE;
1523
1523
gl.GetProgramiv (program, GL_LINK_STATUS, &status);
1524
1524
1525
1525
// Only invoke 'destroy_pipeline' event for programs that had a corresponding 'init_pipeline' event invoked in 'glLinkProgram'
1526
1526
if (GL_FALSE != status)
1527
1527
{
1528
- reshade::invoke_addon_event<reshade::addon_event::destroy_pipeline>(g_current_context, reshade::api::pipeline { program });
1528
+ reshade::invoke_addon_event<reshade::addon_event::destroy_pipeline>(g_current_context, reshade::api::pipeline { ( static_cast < uint64_t >(GL_PROGRAM) << 40 ) | program });
1529
1529
}
1530
1530
}
1531
1531
#endif
@@ -1540,7 +1540,7 @@ void APIENTRY glLinkProgram(GLuint program)
1540
1540
trampoline (program);
1541
1541
1542
1542
#if RESHADE_ADDON
1543
- if (g_current_context)
1543
+ if (g_current_context && program != 0 )
1544
1544
{
1545
1545
// Only invoke 'init_pipeline' event for programs that were successfully compiled and linked
1546
1546
GLint status = GL_FALSE;
@@ -1606,7 +1606,7 @@ void APIENTRY glLinkProgram(GLuint program)
1606
1606
subobjects.push_back ({ subobject_type, 1 , &desc });
1607
1607
}
1608
1608
1609
- reshade::invoke_addon_event<reshade::addon_event::init_pipeline>(g_current_context, reshade::opengl::global_pipeline_layout, static_cast <uint32_t >(subobjects.size ()), subobjects.data (), reshade::api::pipeline { program });
1609
+ reshade::invoke_addon_event<reshade::addon_event::init_pipeline>(g_current_context, reshade::opengl::global_pipeline_layout, static_cast <uint32_t >(subobjects.size ()), subobjects.data (), reshade::api::pipeline { ( static_cast < uint64_t >(GL_PROGRAM) << 40 ) | program });
1610
1610
}
1611
1611
}
1612
1612
#endif
@@ -1695,7 +1695,7 @@ void APIENTRY glUseProgram(GLuint program)
1695
1695
#if RESHADE_ADDON && !RESHADE_ADDON_LITE
1696
1696
if (g_current_context)
1697
1697
{
1698
- reshade::invoke_addon_event<reshade::addon_event::bind_pipeline>(g_current_context, reshade::api::pipeline_stage::all_shader_stages, reshade::api::pipeline { (static_cast <uint64_t >(GL_PROGRAM) << 40 ) | program });
1698
+ reshade::invoke_addon_event<reshade::addon_event::bind_pipeline>(g_current_context, reshade::api::pipeline_stage::all_shader_stages, program != 0 ? reshade::api::pipeline { (static_cast <uint64_t >(GL_PROGRAM) << 40 ) | program } : reshade::api::pipeline { });
1699
1699
}
1700
1700
#endif
1701
1701
}
@@ -4155,7 +4155,8 @@ void APIENTRY glProgramStringARB(GLenum target, GLenum format, GLsizei length, c
4155
4155
assert (glGetProgramivARB != nullptr );
4156
4156
glGetProgramivARB (target, 0x8677 /* GL_PROGRAM_BINDING_ARB */ , reinterpret_cast <GLint *>(&program));
4157
4157
4158
- reshade::invoke_addon_event<reshade::addon_event::init_pipeline>(g_current_context, reshade::opengl::global_pipeline_layout, 1 , &subobject, reshade::api::pipeline { program });
4158
+ if (program != 0 )
4159
+ reshade::invoke_addon_event<reshade::addon_event::init_pipeline>(g_current_context, reshade::opengl::global_pipeline_layout, 1 , &subobject, reshade::api::pipeline { (static_cast <uint64_t >(GL_PROGRAM) << 40 ) | program });
4159
4160
}
4160
4161
else
4161
4162
#endif
@@ -4167,7 +4168,8 @@ void APIENTRY glDeleteProgramsARB(GLsizei n, const GLuint *programs)
4167
4168
if (g_current_context)
4168
4169
{
4169
4170
for (GLsizei i = 0 ; i < n; ++i)
4170
- reshade::invoke_addon_event<reshade::addon_event::destroy_pipeline>(g_current_context, reshade::api::pipeline { programs[i] });
4171
+ if (programs[i] != 0 )
4172
+ reshade::invoke_addon_event<reshade::addon_event::destroy_pipeline>(g_current_context, reshade::api::pipeline { (static_cast <uint64_t >(GL_PROGRAM) << 40 ) | programs[i] });
4171
4173
}
4172
4174
#endif
4173
4175
0 commit comments