gbdev / rgbds

Rednex Game Boy Development System - An assembly toolchain for the Nintendo Game Boy and Game Boy Color
https://rgbds.gbdev.io
MIT License
1.35k stars 172 forks source link

issues with palettes when using indexed png files #1127

Closed Retro-Hax closed 1 year ago

Retro-Hax commented 1 year ago
rgbgfx -o -t -p assets/gfx/TitleScreen.2bpp assets/gfx/TitleScreen.png
rgbgfx: /build/rgbds/src/rgbds/src/gfx/process.cpp:662: static uint16_t TileData::rowBitplanes(const Png::TilesVisitor::Tile&, const Palette&, uint32_t): Assertion `index < palette.size()' failed.
Aborted (core dumped)

This happens also when doing rgbfx -o as well

evie-calico commented 1 year ago

Looks like rgbgfx breaks when you don't give -o an argument. If you could provide the core dump that would be great.

Retro-Hax commented 1 year ago

Hope this is everything that is needed

           PID: 1788596 (rgbgfx)
           UID: 1000 (retro-hax)
           GID: 1000 (retro-hax)
        Signal: 6 (ABRT)
  Command Line: rgbgfx -o -t -p assets/gfx/TitleScreen.2bpp assets/gfx/TitleScreen.png
    Executable: /usr/bin/rgbgfx
 Control Group: /user.slice/user-1000.slice/session-5.scope
          Unit: session-5.scope
         Slice: user-1000.slice
       Session: 5
     Owner UID: 1000 (retro-hax)
      Hostname: archlinux
       Storage: /var/lib/systemd/coredump/core.rgbgfx.1000.ac5455bf8d82422eaea362dfcc91a566.1788596.1675087002000000.zst (present)
  Size on Disk: 66.8K
       Message: Process 1788596 (rgbgfx) of user 1000 dumped core.

                Stack trace of thread 1788596:
                #0  0x00007fc8b94a164c n/a (libc.so.6 + 0x8864c)
                #1  0x00007fc8b9451938 raise (libc.so.6 + 0x38938)
                #2  0x00007fc8b943b53d abort (libc.so.6 + 0x2253d)
                #3  0x00007fc8b943b45c n/a (libc.so.6 + 0x2245c)
                #4  0x00007fc8b944a486 __assert_fail (libc.so.6 + 0x31486)
                #5  0x000056041aa4c3e4 n/a (rgbgfx + 0x133e4)
                #6  0x000056041aa4f16f n/a (rgbgfx + 0x1616f)
                #7  0x000056041aa3d8e8 n/a (rgbgfx + 0x48e8)
                #8  0x00007fc8b943c290 n/a (libc.so.6 + 0x23290)
                #9  0x00007fc8b943c34a __libc_start_main (libc.so.6 + 0x2334a)
                #10 0x000056041aa3f0f5 n/a (rgbgfx + 0x60f5)
                ELF object binary architecture: AMD x86-64
ISSOtm commented 1 year ago

Someone else provided me an image that trips this bug; one pixel ends up outside of the computed palette. More investigation is necessary.