deltabeard / Peanut-GB

A Game Boy (DMG) emulator single header library written in C99. Performance is prioritised over accuracy.
https://projects.deltabeard.com/peanutgb/
283 stars 40 forks source link

sdl2: Use 8-bit surface for pixel data #26

Open deltabeard opened 5 years ago

deltabeard commented 5 years ago

Use SDL_GetRendererInfo() to find out what the native texture format is for the used driver, then convert the RGB555 values to whatever format is detected. Using a texture format that is native to the system should improve performance on systems that do not natively support RGB555.

deltabeard commented 5 years ago

This will require logic to convert palette colours to selected texture format. Not difficult, but may be time consuming depending on how many texture formats we want to support (only the most popular ones since SDL2 can just convert the format itself as a fallback).

deltabeard commented 1 year ago

The renderer should use an 8-bit surface that Peanut-GB will fill with pixels. By using SDL_SetPaletteColours, the colour of the pixels can be changed. SDL2 will convert the 8-bit surface to whichever format the hardware is using.

This issue depends on #55.