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