@@ -453,7 +453,7 @@ pub fn surfaceInit(surface: *apprt.Surface) !void {
453
453
const self : OpenGL = undefined ;
454
454
455
455
switch (apprt .runtime ) {
456
- else = > @compileError ( "unsupported app runtime for OpenGL" ),
456
+ else = > try self . threadEnter ( surface ),
457
457
458
458
apprt .gtk = > {
459
459
// GTK uses global OpenGL context so we load from null.
@@ -493,12 +493,13 @@ pub fn surfaceInit(surface: *apprt.Surface) !void {
493
493
/// final main thread setup requirements.
494
494
pub fn finalizeSurfaceInit (self : * const OpenGL , surface : * apprt.Surface ) ! void {
495
495
_ = self ;
496
- _ = surface ;
497
496
498
497
// For GLFW, we grabbed the OpenGL context in surfaceInit and we
499
498
// need to release it before we start the renderer thread.
500
499
if (apprt .runtime == apprt .glfw ) {
501
500
glfw .makeContextCurrent (null );
501
+ } else if (apprt .runtime == apprt .gtk ) {} else {
502
+ try surface .finalizeSurfaceInit ();
502
503
}
503
504
}
504
505
@@ -557,7 +558,7 @@ pub fn threadEnter(self: *const OpenGL, surface: *apprt.Surface) !void {
557
558
_ = self ;
558
559
559
560
switch (apprt .runtime ) {
560
- else = > @compileError ( "unsupported app runtime for OpenGL" ),
561
+ else = > try surface . threadEnter ( ),
561
562
562
563
apprt .gtk = > {
563
564
// GTK doesn't support threaded OpenGL operations as far as I can
@@ -595,11 +596,11 @@ pub fn threadEnter(self: *const OpenGL, surface: *apprt.Surface) !void {
595
596
}
596
597
597
598
/// Callback called by renderer.Thread when it exits.
598
- pub fn threadExit (self : * const OpenGL ) void {
599
+ pub fn threadExit (self : * const OpenGL , surface : * apprt.Surface ) void {
599
600
_ = self ;
600
601
601
602
switch (apprt .runtime ) {
602
- else = > @compileError ( "unsupported app runtime for OpenGL" ),
603
+ else = > surface . threadExit ( ),
603
604
604
605
apprt .gtk = > {
605
606
// We don't need to do any unloading for GTK because we may
@@ -2345,7 +2346,7 @@ pub fn drawFrame(self: *OpenGL, surface: *apprt.Surface) !void {
2345
2346
apprt .glfw = > surface .window .swapBuffers (),
2346
2347
apprt .gtk = > {},
2347
2348
apprt .embedded = > {},
2348
- else = > @compileError ( "unsupported runtime" ),
2349
+ else = > try surface . swapBuffers ( ),
2349
2350
}
2350
2351
}
2351
2352
0 commit comments