Skip to content

Commit

Permalink
Resize GL buffer when geometry changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sergystepanov committed Jul 13, 2024
1 parent 7e61245 commit c40f9c9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/worker/caged/libretro/nanoarch/nanoarch.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,6 @@ func (n *Nanoarch) LoadGame(path string) error {
n.Stopped.Store(false)

if n.Video.gl.enabled {
bufS := uint(n.sys.av.geometry.max_width*n.sys.av.geometry.max_height) * n.Video.PixFmt.BPP
graphics.SetBuffer(int(bufS))
n.log.Debug().Msgf("Set buffer: %v", byteCountBinary(int64(bufS)))
if n.LibCo {
C.same_thread(C.init_video_cgo)
C.same_thread(unsafe.Pointer(Nan0.Video.hw.context_reset))
Expand Down Expand Up @@ -898,6 +895,13 @@ func geometryChange(geom C.struct_retro_game_geometry) {
Nan0.limiter(func() {
old := Nan0.sys.av.geometry
Nan0.sys.av.geometry = geom

if Nan0.Video.gl.enabled {
bufS := uint(geom.max_width*geom.max_height) * Nan0.Video.PixFmt.BPP
graphics.SetBuffer(int(bufS))
Nan0.log.Debug().Msgf("OpenGL frame buffer: %v", byteCountBinary(int64(bufS)))
}

if Nan0.OnSystemAvInfo != nil {
Nan0.log.Debug().Msgf(">>> geometry change %v -> %v", old, geom)
if Nan0.Aspect {
Expand Down

0 comments on commit c40f9c9

Please sign in to comment.