Skip to content

Commit 853c879

Browse files
committed
Release 0.1.4
1 parent 946da15 commit 853c879

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
> breaking changes may be introduced
1111
> at any time without warning.
1212
13+
## [0.1.4] - 2024-06-03
14+
15+
### Fixed
16+
17+
- Prevent a failure to import PyOpenGL from stopping `ModernGlVideoDriver`
18+
from being imported.
19+
1320
## [0.1.3] - 2024-06-02
1421

1522
### Fixed

src/libretro/drivers/video/opengl/moderngl.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
try:
1313
import moderngl_window
1414
from moderngl_window.context.base import BaseWindow
15+
16+
# These features require moderngl_window,
17+
# but I don't want to require that it be installed
1518
except ImportError:
1619
moderngl_window = None
1720
BaseWindow = None
@@ -25,7 +28,11 @@
2528
VertexArray,
2629
create_context,
2730
)
28-
from OpenGL import GL
31+
32+
try:
33+
from OpenGL import GL
34+
except ImportError:
35+
GL = None
2936

3037
from libretro.api.av import retro_game_geometry, retro_system_av_info
3138
from libretro.api.video import (
@@ -401,8 +408,12 @@ def reinit(self) -> None:
401408
self._context = create_context(require=ver, standalone=True, share=self._shared)
402409

403410
self._has_debug = (
404-
"GL_KHR_debug" in self._context.extensions
405-
or "GL_ARB_debug_output" in self._context.extensions
411+
GL
412+
and GL.glObjectLabel
413+
and (
414+
"GL_KHR_debug" in self._context.extensions
415+
or "GL_ARB_debug_output" in self._context.extensions
416+
)
406417
)
407418
self._context.gc_mode = "auto"
408419
self.__init_fbo()
@@ -426,7 +437,7 @@ def reinit(self) -> None:
426437
)
427438
# TODO: Make the particular names configurable
428439

429-
if self._has_debug and GL.glObjectLabel:
440+
if self._has_debug:
430441
GL.glObjectLabel(
431442
GL.GL_PROGRAM, self._shader_program.glo, -1, b"libretro.py Shader Program"
432443
)
@@ -624,7 +635,7 @@ def __init_fbo(self):
624635
# Similar to glGenFramebuffers, glBindFramebuffer, and glFramebufferTexture2D
625636
self._fbo = self._context.framebuffer(self._color, self._depth)
626637

627-
if self._has_debug and GL.glObjectLabel:
638+
if self._has_debug:
628639
GL.glObjectLabel(
629640
GL.GL_TEXTURE, self._color.glo, -1, b"libretro.py Main FBO Color Attachment"
630641
)
@@ -667,7 +678,7 @@ def __init_hw_render(self):
667678
)
668679
self._hw_render_fbo.clear()
669680

670-
if self._has_debug and GL.glObjectLabel:
681+
if self._has_debug:
671682
GL.glObjectLabel(
672683
GL.GL_FRAMEBUFFER,
673684
self._hw_render_fbo.glo,
@@ -713,7 +724,7 @@ def __update_cpu_texture(self, data: memoryview, width: int, height: int, pitch:
713724
)
714725
# moderngl can't natively express GL_RGB5
715726

716-
if self._has_debug and GL.glObjectLabel:
727+
if self._has_debug:
717728
GL.glObjectLabel(
718729
GL.GL_TEXTURE, self._cpu_color.glo, -1, b"libretro.py CPU-Rendered Frame"
719730
)

0 commit comments

Comments
 (0)