Homebrew Programming - C3D_FrameSplit, also, multiple transfers to vram?

DiscostewSM

Well-Known Member
OP
Member
Joined
Feb 10, 2009
Messages
5,484
Trophies
2
Location
Sacramento, California
Website
lazerlight.x10.mx
XP
5,491
Country
United States
So I have an idea of what I want to do with a project I'm planning, but I'm not sure how to go about doing it. Here is the walkthrough of what I want to do...

Start frame
Transfer texture(s) and vbos to vram (assuming changes were made since the last transfer)
Process a scene while the transfer is being done
Once scene is ready and transfer is done, render scene
(loop)If scene requires changes in textures/vbos within the same frame, then....
-make changes to texture(s) and vbos in FCRAM while waiting for render to finish
-transfer texture(s) and vbos to vram
-process additional part of scene while transfer is being done
-once scene is ready and transfer is done, render scene
(continue loop as needed)
End frame

May seem odd and convoluted, and people may ask why I'd do such a thing. Well, I have my reasons, but anyways. So what you see is me wanting to transfer texture data and vbos into vram, then render part of a scene I built, but, I want to possibly edit the texture(s) and vbos, then render more of the scene within the same frame. I haven't seen any examples demonstrating multiple renders within the same frame, let alone do anything like I want to do that includes editing textures/vbos, but looking through the source of citro3d, I see there is C3D_FrameSplit. Is this what I would need to use for my purposes, or would I need to use C3D_FrameStart/End multiple times, but not use C3D_FRAME_SYNCDRAW for its flags?

Also, this idea requires that I copy multiple textures/vbos into vram for purposes of not just faster rendering, but allows me to edit textures/vbos while a render is happening. The biggest texture is roughly 128KB, but there's only about 4-5 textures I'd transfer over (making it about 400KB total I think). The vbos probably total about 360KB. The thing is, I'm not going to need to transfer the entirety of them. Just the spots where they are edited (which won't be a whole lot per frame). My idea was to only copy the sections that are considered the start/end of where the edits were done for each instance, reducing the need to transfer more than is required. The problem is that I don't know if this is allowed. Are the methods designed to allow me to simply toss in a bunch of transfers in a row to get them processed automatically, or do I need to use the GX Queue functions? And are these done in the background, allowing me to do other things while they process, or do they require that I have to wait till they complete?

Sorry for the many questions. I'm in the planning stages, and haven't done any actual coding, and I just don't want to run into an issue because I didn't know what could be done.
 

MasterFeizz

Well-Known Member
Member
Joined
Oct 15, 2015
Messages
1,098
Trophies
1
Age
29
XP
3,710
Country
United States
I'm in the process of optimizing my openGL implementation and have done something similar. I have wrapped the GX functions within a dispatcher. What I do is lock a lightlock, set a callback to certain you event that will unlock this lightlock and then call the GX functions. I also started avoiding using vram for things that will be changed alot.

This may sound confusing since I'm at work writing this on my phone, but if you can't understand it I'll send the source code later.

Edit: I'm working directly with gpu registers so you might be a little more complicated to do it with citro3d
 
Last edited by MasterFeizz,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    SylverReZ @ SylverReZ: @salazarcosplay, Good.