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

Question: Is it possible to change a render target's frame buffer format mid-program? #49

Open
BallM4788 opened this issue Dec 2, 2019 · 3 comments

Comments

@BallM4788
Copy link

BallM4788 commented Dec 2, 2019

I'm trying to improve a program that can run different classic adventure games, each having their own color format(s) under which they run. Some of the more graphically-intensive games that have a 16-bit native color format (namely RGB565) run slowly on the 3DS because they're being converted up to RGBA8 so they can be passed to the render target.

I can't just change the program to run in a 16-bit color format because some of the games have a native 32-bit color format, so I think the best solution would be to change the render target's color buffer appropriately when a game is started. Is this even possible to do with citro3d? If so, do you have any suggestions on how I should go about it? I've been trying on my own, but I've not had any luck.

Here's the backend source for reference, and here is what I've done so far: BallM4788/scummvm@08e9557. Most of the relevant code is in "osystem-graphics.cpp," "sprite.h," and "sprite.cpp." "OSystem_3DS::initGraphics" is called during startup, and "OSystem_3DS::initSize" is called when loading up a game.

In what I've done so far, everything works fine with games that are non-16-bit or can adapt to 32-bit, but attempting to start up a 16-bit game (in my case, I've been using Riven for testing), a black screen shows, but the 3DS doesn't crash. The only way to get back to the 3DS home screen at that point is to hold the power button until the 3DS turns off and then turn it back on again.

@asiekierka
Copy link

Wouldn't C3D_RenderTargetDelete and creating a new one be sufficient for your use-case? As long as it happens outside of C3D_Frame... It's what I'm doing, at least.

@fincs
Copy link
Member

fincs commented Jun 15, 2020

While @asiekierka provided a workaround, I feel like that is somehow not right. With the advent of wide mode, I think it would be worthwhile to look into this again and provide a way to alias the same region of memory for multiple rendertargets with different formats and even dimensions. I can't guarantee a timeframe in which the necessary design/work will be done, though.

@BallM4788
Copy link
Author

I ended up working around this with help a long time ago. @fincs were you still looking into this, or can I close this issue?

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