Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple pixel formats at runtime? #118

Open
ccawley2011 opened this issue Mar 11, 2024 · 4 comments
Open

Support multiple pixel formats at runtime? #118

ccawley2011 opened this issue Mar 11, 2024 · 4 comments

Comments

@ccawley2011
Copy link

At the moment, the pixel format used by the 16-bit renderer is specifed at compile time using the USE_BGR555 and USE_BGR565 defines. Would it be possible for it to be selected at runtime? It would be useful to have for porting to RISC OS, where different machines may not have hardware support for the format specified at compile time.

@irixxxx
Copy link
Owner

irixxxx commented Mar 12, 2024

I recently abstracted the menu stuff into some macros in platform/libpicofe, so that shouldn't pose a lot of problems. Just modify the pixel conversion macros in platform/libpicofe/plat.h.

The emulator screen rendering takes place in pico/draw* and pico/mode4.c. Some of it is in ARM assembly and very hardcoded for speed reasons.
The 8bit renderers generate a colour indexed image along with a 256 entry colour palette. This palette is generated in one of the last steps in the rendering process and shouldn't pose much of a problem.
The 16bit renderer is directly generating display ready pixel output by replacing the colour indexed data by their converted output data right away. It however uses the same colour palette conversion functions, just that they are called more often for higher rendering accuracy, depending on how often the emulated software modifies it.

So in a nutshell: yes, it should be possible. If you want to tackle that I can help in the process by pointing at the right functions to look at and do some infrastructure work to support this better. E.g. on my wish list is to abstract the conversion macros in the drawing code so that the conversion core comes from some macros in the platform directory.

@irixxxx
Copy link
Owner

irixxxx commented Mar 12, 2024

Ah, RISC OS is running on early ARM, isn't it? So, the ARM assembler functions would need to be modified. Just to say it, it's usually much more work to write the asm stuff and, more importantly, debug it. Besides, most of the ARM assembly relies on having at least an ARMv4 architecture.

@tlsa
Copy link

tlsa commented Mar 16, 2024

There's a very old RISC OS port here: http://picodrive.acornarcade.com/

@irixxxx
Copy link
Owner

irixxxx commented Mar 17, 2024

After my experience with psp and ps2 I'm certainly not too inclined of doing another emulator-only port. Too many cases of it running fine in the emulation but not on real hardware, which has cost me quite some time to sort out without a clue why it's not working. So, IMHO someone with some porting experience and the real hardware should take this on.

I'm however willing to assist with knowledge about the internal platform API, and I'm willing to discuss and consider integrating the result with the official repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants