Home | Forums | What's new | Resources | |
SCU DSP for matrix transformation? |
XL2 - Oct 31, 2017 |
1 | 2 | Next> |
XL2 | Oct 31, 2017 | |||
So I've started to work on a BSP/PVS solution (very early) for my game, which made me realize that I could also save several clock cycles by changing the 3d implementation to skip the z-sort (I'm not saying I will do it, just that it would be interesting to look at). According to Sega's documentation, it's possible to use the SCU DSP for matrix transformation and Sega suggested back in 1995 to use the SCU DSP for the matrix and the SH2 for the polygon processing in parallel. Sega even give an example of assembly code to do the matrix transformation. (https://antime.kapsi.fi/sega/files/ST-240-A-042795...) Now, I know that SGL doesn't support matrix transformation with the SCU DSP and the SGL functions for the SCU DSP seem pretty much useless for almost everything, but before I waste too much time one this, as anyone tried doing it? The SCU DSP doesn't support divisions, but it can do multiplications/additions, so it should be fine for matrix transformation, and even it's slower than the SH2, it won't need to do slower operations such as nearclipping/light normals processing/gouraud shading processing, so it might still be possible to keep it synched. It seems like it can hold 256 sint32 values, which is more than what my maps have on each quad planes (since each quad is like 64 pixels wide and each plane is 256 pixels wide, I should be fine) It would require writing a new 3d implementation or using the obscure one from SBL that nobody used (AFAIK), but it would still be nice to know about others' experience with it. Thanks! |
mrkotfw | Nov 2, 2017 | |||
To really answer your question, I don't think anyone has really tried the SCU DSP. Except for maybe Rockin'-B, but he's been MIA for a few years. How about also do some tests and see if it's worth all the trouble? Maybe it's faster to do it on the slave CPU since you still have to do the perspective divide on the CPU. |
XL2 | Nov 2, 2017 | |||||
Yeah, if nobody tried it I might, but I need to plan ahead. I'll dig deeper in Sega's documentation. If I ever make it work I'll make sure to update the fps demo with it. |
mrkotfw | Nov 2, 2017 | |||
The SCU DSP documentation has wrong information (opcodes) I believe. So be wary of that... |
XL2 | Nov 3, 2017 | |||
I don't know who said that Quake on Saturn didn't use the SCU DSP, but it seems like it does actually according to Yabause. I've yet to learn assembly, so I'm not sure what it is exactly, but it seems to involve several multiplications/additions. Could it be matrix transformation? |
mrkotfw | Nov 3, 2017 | |||
Can you dump the 1KiB and disassemble it using antime's SCU DSP disassembler? You can probably use the DSP as a non-VLIW arch at the beginning. I myself don't fully understand the idea how memory is segmented. |
XL2 | Nov 3, 2017 | ||||
Code:
(after 060 it's just end code) The code seems to stay the same everytime I look at it ingame, which (I guess) means it's always using the same function. |
XL2 | Nov 3, 2017 | |||
Ok, I feel retarded : SBL (Sega Basic Library) already has all the functions in, with source code. Including 3d processing using the SH2 and SCU DSP working in parallel. I don't know the performance level, so maybe SGL is still faster, but it does include the source code. From the SPR manual : (3) USE_DSP When USE_DSP is defined, the coordinate transform matrix calculations are done with the DSP in parallel the SH side. Commenting the define out disables this feature. |
WingMantis | Nov 5, 2017 | |||||
Is USE_DSP defined by default in one of the required libraries, and the developers comment it out if they don't want to use it? Or do they have to define it explicitly in their project? I just loaded up Elan Doree in Yabause and checked the SCU-DSP debug and it just has 20 lines saying "END" so that game isn't using it. How do we tell whether a game is using SGL or not? |
XL2 | Nov 5, 2017 | |||||
You just need to define it and call the proper functions, but I'm pretty sure SGL is faster as they already stopped supporting the SBL 3d functions in 1995/1996. You can't tell if a game is using SGL, but only few games are as it was too little too late. Night is supposedly using SGL, and isn't using the SCU DSP. Games using the SCU DSP that I know of : Sonic R, Quake and Burning Rangers. They all have in common that they are late games and look amazing. |
mrkotfw | Nov 6, 2017 | |||
Have you been able to understand what Quake is doing? |
XL2 | Nov 6, 2017 | |||||
It's almost exactly 1:1 the same code as the matrix transformation example in the SCU DSP manual / SBL SCU DSP functions, so I guess it's matrix transformation. It could also be related to lightning. |
WingMantis | Nov 7, 2017 | |||||
I got out Fighters Megamix and tried it in Yabause and it looks like that is using the SCU DSP. That was released Dec 1996 in Japan. The debug code list didn't seem as dense as what you posted for Quake though. Can you point me to the manual that has the USE_DSP and functions etc? I was looking through some of the antime list of stuff the other day but didn't see it yet. Thanks |
XL2 | Nov 7, 2017 | |||||
It's in the SBL folder under the MAN (manual) folder if I remember correctly. The 3d functions are under SPR in the Segalib folder (again, if I remember right). The USE_DSP is simply in the SBL code, always on. I never tried to display a quad in SBL, but I will look at it and maybe try to modify it a bit just to see if it could be improved. |
WingMantis | Nov 7, 2017 | |||||
Can you cheat the quad 3D system by having 2 points share the same coordinates to get triangles? Obviously no speed advantage but more flexibility in 3D model design if possible |
XL2 | Nov 7, 2017 | |||||
Yes, you can. My map tool for Sonic Z-Treme does it when I detect a triangle. But the textures get all squished and it just look bad, unless you use untextured triangles, so I would avoid it. It's also easy to merge 2 triangles in Blender to do a quad, so you can avoid it most of the time. Rockin B also made a texture mapping demo, but I never looked how he did it. It will be slower than just using sprites, so I would avoid it too. |
XL2 | Nov 8, 2017 | |||
On a side-note, mixing maps from different games can lead to weird moments : At least nobody is shooting at Sonic... |
itsstillthinking | Nov 12, 2017 | |||
Just wait, some Sonic fans are somewhere on the map waiting to do some bashing |
1 | 2 | Next> |