#150123 - nce - Wed Jan 30, 2008 7:16 am
Hi,
I'm currently trying to find one good way to render my 3d scene in my project.
I've then start to look in the GXFIFO ( it's time. I've always worked in immediat mode 'til now)
Reading the gbatek and some of the thread here, I'm starting to get an idea of how to do it.
But I have several questions to be sure that I've understood everything correctly.
The main idea is to try to freeze the cpu as less as possible.
having a scene defines as several block, each block having a displaylist.
And a small table saved in DTCM representing the position of each block. ( and some other stuff like the camera frustrum )
it should be possible to :
1 - find a block to draw and launch a DMA copy on GXFIFO
2 - while the DMA is busy. compute the visiblity of other blocks and put the visible one in a small stack
3 - as soon as the dma is not busy launch a DMA copy of the next block in the stack. and go back to point 2
If I've understood correctly, if all my data are in DTCM or cache the cpu should be able to continue the computation even during the dma copy. right ?
Do I have to put my code in ITCM too ?
Next point is about the gfx fifo it-self. ( I had to read that part a lot of time to understand it :) )
the fifo is 256 entries the dma will wait (without freezing the cpu) until the fifo get 128 entries free and then it will copy 112 words of data.
The 112 words will be unpacked and if those unpacked commands fill the fifo the dma and cpu will be frezzed !
in the gbatek this exemple is used : sending 112 x Packed(00151515h) to GXFIFO would write 336 x Cmd(15h) to the FIFO
for me 0x00151515 is not word but dword, this probably means that gbatek use the word "word" for 32bit value and not 16bit like I'm used to. right ?
so it means that when you build the call list you have to check that each 112 words doesn't unpack in more that 128 entries and you will never freeze you cpu at render time...
what do you think about this idea ?
I was also thinking about doing more or less the same thing when rendering my characters.
because characters are using skeleton I need the gfx to compute matrix stuff so I can't compute the skeleton at the same time as rendering the character.
But maybe I can :
1 - compute the skeleton matrix for each characters
2 - set all matrix in the stack for one character
3 - dma the call list
4 - while dma is busy, compute the AI for the next frame
5 - while dma is free back to 2
one last thought.
I know that the BOX_TEST exist. It should be possible for each block to send a box_test and doing something while waiting for the result as for the character and then during the rendering again doing something else.
But, what can I do ? that's the question :) During the box_test I could do my collision code, but during the rendering ?
- not the sound it uses dma too (I think, never played with that yet)
- I was thinking of maybe doing some sort of bloom, but I can't store the buffer in DTCM ( too big )
any idea ?
what do you thing will be faster ? the first or the second idea ?
thanks,
_________________
-jerome-
I'm currently trying to find one good way to render my 3d scene in my project.
I've then start to look in the GXFIFO ( it's time. I've always worked in immediat mode 'til now)
Reading the gbatek and some of the thread here, I'm starting to get an idea of how to do it.
But I have several questions to be sure that I've understood everything correctly.
The main idea is to try to freeze the cpu as less as possible.
having a scene defines as several block, each block having a displaylist.
And a small table saved in DTCM representing the position of each block. ( and some other stuff like the camera frustrum )
it should be possible to :
1 - find a block to draw and launch a DMA copy on GXFIFO
2 - while the DMA is busy. compute the visiblity of other blocks and put the visible one in a small stack
3 - as soon as the dma is not busy launch a DMA copy of the next block in the stack. and go back to point 2
If I've understood correctly, if all my data are in DTCM or cache the cpu should be able to continue the computation even during the dma copy. right ?
Do I have to put my code in ITCM too ?
Next point is about the gfx fifo it-self. ( I had to read that part a lot of time to understand it :) )
the fifo is 256 entries the dma will wait (without freezing the cpu) until the fifo get 128 entries free and then it will copy 112 words of data.
The 112 words will be unpacked and if those unpacked commands fill the fifo the dma and cpu will be frezzed !
in the gbatek this exemple is used : sending 112 x Packed(00151515h) to GXFIFO would write 336 x Cmd(15h) to the FIFO
for me 0x00151515 is not word but dword, this probably means that gbatek use the word "word" for 32bit value and not 16bit like I'm used to. right ?
so it means that when you build the call list you have to check that each 112 words doesn't unpack in more that 128 entries and you will never freeze you cpu at render time...
what do you think about this idea ?
I was also thinking about doing more or less the same thing when rendering my characters.
because characters are using skeleton I need the gfx to compute matrix stuff so I can't compute the skeleton at the same time as rendering the character.
But maybe I can :
1 - compute the skeleton matrix for each characters
2 - set all matrix in the stack for one character
3 - dma the call list
4 - while dma is busy, compute the AI for the next frame
5 - while dma is free back to 2
one last thought.
I know that the BOX_TEST exist. It should be possible for each block to send a box_test and doing something while waiting for the result as for the character and then during the rendering again doing something else.
But, what can I do ? that's the question :) During the box_test I could do my collision code, but during the rendering ?
- not the sound it uses dma too (I think, never played with that yet)
- I was thinking of maybe doing some sort of bloom, but I can't store the buffer in DTCM ( too big )
any idea ?
what do you thing will be faster ? the first or the second idea ?
thanks,
_________________
-jerome-