Skip to content

Commit

Permalink
Release 0.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseTG committed Jun 3, 2024
1 parent 946da15 commit 853c879
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
> breaking changes may be introduced
> at any time without warning.
## [0.1.4] - 2024-06-03

### Fixed

- Prevent a failure to import PyOpenGL from stopping `ModernGlVideoDriver`
from being imported.

## [0.1.3] - 2024-06-02

### Fixed
Expand Down
25 changes: 18 additions & 7 deletions src/libretro/drivers/video/opengl/moderngl.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
try:
import moderngl_window
from moderngl_window.context.base import BaseWindow

# These features require moderngl_window,
# but I don't want to require that it be installed
except ImportError:
moderngl_window = None
BaseWindow = None
Expand All @@ -25,7 +28,11 @@
VertexArray,
create_context,
)
from OpenGL import GL

try:
from OpenGL import GL
except ImportError:
GL = None

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

self._has_debug = (
"GL_KHR_debug" in self._context.extensions
or "GL_ARB_debug_output" in self._context.extensions
GL
and GL.glObjectLabel
and (
"GL_KHR_debug" in self._context.extensions
or "GL_ARB_debug_output" in self._context.extensions
)
)
self._context.gc_mode = "auto"
self.__init_fbo()
Expand All @@ -426,7 +437,7 @@ def reinit(self) -> None:
)
# TODO: Make the particular names configurable

if self._has_debug and GL.glObjectLabel:
if self._has_debug:
GL.glObjectLabel(
GL.GL_PROGRAM, self._shader_program.glo, -1, b"libretro.py Shader Program"
)
Expand Down Expand Up @@ -624,7 +635,7 @@ def __init_fbo(self):
# Similar to glGenFramebuffers, glBindFramebuffer, and glFramebufferTexture2D
self._fbo = self._context.framebuffer(self._color, self._depth)

if self._has_debug and GL.glObjectLabel:
if self._has_debug:
GL.glObjectLabel(
GL.GL_TEXTURE, self._color.glo, -1, b"libretro.py Main FBO Color Attachment"
)
Expand Down Expand Up @@ -667,7 +678,7 @@ def __init_hw_render(self):
)
self._hw_render_fbo.clear()

if self._has_debug and GL.glObjectLabel:
if self._has_debug:
GL.glObjectLabel(
GL.GL_FRAMEBUFFER,
self._hw_render_fbo.glo,
Expand Down Expand Up @@ -713,7 +724,7 @@ def __update_cpu_texture(self, data: memoryview, width: int, height: int, pitch:
)
# moderngl can't natively express GL_RGB5

if self._has_debug and GL.glObjectLabel:
if self._has_debug:
GL.glObjectLabel(
GL.GL_TEXTURE, self._cpu_color.glo, -1, b"libretro.py CPU-Rendered Frame"
)
Expand Down

0 comments on commit 853c879

Please sign in to comment.