KOS vs Ninja - simple test.

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
111
DCEmu Junior
DCEmu Junior
Posts: 42
Joined: Thu Jul 07, 2016 7:11 pm
Has liked: 0
Been liked: 5 times

KOS vs Ninja - simple test.

Post by 111 » Sat Jan 04, 2020 11:56 am

Long story short: I made 3 simple programs to roughly compare "polygon count" performance of KOS' pvr api to Ninja library (from official sdk. No Kamui2 version for now). The goal was to see which one is faster "out of box" i.e. by only using high level api and no sh-4 assembly (at least explicitly).
Test model has 2088 vertices, 2608 "optimized" triangles, and 860 triangle strips (only these are used for obvious reasons).

Here is a brief description for every program:
- "NINJA_default" - loads and displays a model ("num_bigs" times) exported with default settings (probably not the best ones, but it's not important this time).
- "KOS_pvr_prim_1024" - uses pvr_prim() for vertex submissions. Vertex buffer size is 1024 kilobytes.
- "KOS_DR_1024" - uses "direct render" for vertex submissions.

Use dpad left and right to remove\add an instance.

FPS counters are (supposedly) kinda broken, so they are not really reliable but they are there anyway.

Only test this on real hardware, since emulators are useless for that. But here is a pic anyway:
Image


I don't have a dreamcast, but from what I was told (thanks, megavolt85!), "direct render" version runs rather well and is comparable to Ninja. KOS versions don't have near z clipping, libparallax is used for matrix management and vertices are transformed with "mat_trans_single3" macro, so there is a notable amout of assembly involvement (it's not explicit though, so I won't consider this as "cheating").
=======================

A preliminary verdict would be this: it IS possible to get a decent "polycount performance" with KOS, BUT you absolutly have to use assembly (and do it "the right way"). So perhaps I was partially wrong about KOS' inferiority to official tools and had jumped to conclusions too quickly, BUT I was talking from an "average hobbyst programmer" (i.e. someone who mostly uses high level APIs and is not low-level hardware pro) point of view.

And if anyone here has an overclocked dreamcast I'd like to hear you feedback on this.

PS: performance is not the only problem I had with KOS, but that's another story for another thread.
Attachments
big_test_src.zip
(44.17 KiB) Downloaded 10 times
big_test.zip
(1.41 MiB) Downloaded 11 times
Last edited by 111 on Sun Jan 05, 2020 12:37 am, edited 1 time in total.
These users liked the author 111 for the post (total 3):
Ian Robinsonmaslevin|darc|
User avatar
Ian Robinson
DCEmu Cool Newbie
DCEmu Cool Newbie
Posts: 11
Joined: Mon Mar 11, 2019 7:12 am
Has liked: 11 times
Been liked: 0

Re: KOS vs Ninja - simple test.

Post by Ian Robinson » Sat Jan 04, 2020 6:32 pm

Really good test thank you for doing this 111 :)
111
DCEmu Junior
DCEmu Junior
Posts: 42
Joined: Thu Jul 07, 2016 7:11 pm
Has liked: 0
Been liked: 5 times

Re: KOS vs Ninja - simple test.

Post by 111 » Sun Jan 05, 2020 12:38 am

Added KOS version sources if anyone needs it.
These users liked the author 111 for the post:
Ian Robinson
mrneo240
DCEmu Freak
DCEmu Freak
Posts: 66
Joined: Wed Mar 14, 2018 12:22 am
Has liked: 7 times
Been liked: 9 times

Re: KOS vs Ninja - simple test.

Post by mrneo240 » Sun Jan 05, 2020 12:37 pm

pvr_prim() is garbage.
User avatar
ThePerfectK
Insane DCEmu
Insane DCEmu
Posts: 121
Joined: Thu Apr 27, 2006 10:15 am
Has liked: 20 times
Been liked: 18 times

Re: KOS vs Ninja - simple test.

Post by ThePerfectK » Sun Jan 05, 2020 4:47 pm

^so what's a smarter method of submitting vertex data? I've looked into DMA and using store queues for vertex submission, but doesn't PVR_Prim() already use DMA for vertex submission?

EDIT: old reading: https://web.archive.org/web/20121022004 ... -dreamcast
These users liked the author ThePerfectK for the post (total 2):
mrneo240Ian Robinson
Still Thinking!~~
User avatar
ThePerfectK
Insane DCEmu
Insane DCEmu
Posts: 121
Joined: Thu Apr 27, 2006 10:15 am
Has liked: 20 times
Been liked: 18 times

Re: KOS vs Ninja - simple test.

Post by ThePerfectK » Tue Jan 21, 2020 10:52 pm

the Dreamcast's SH4 has SIMD opcodes, correct? Anybody have any idea how useful these opcodes are for, say, vector transformations? Preferably with an example to demonstrate?
Still Thinking!~~
User avatar
Moopthehedgehog
DCEmu Freak
DCEmu Freak
Posts: 67
Joined: Wed Jan 05, 2011 4:25 pm
Has liked: 3 times
Been liked: 26 times

Re: KOS vs Ninja - simple test.

Post by Moopthehedgehog » Mon Jan 27, 2020 2:06 am

ThePerfectK wrote:
Tue Jan 21, 2020 10:52 pm
the Dreamcast's SH4 has SIMD opcodes, correct? Anybody have any idea how useful these opcodes are for, say, vector transformations? Preferably with an example to demonstrate?
https://github.com/Moopthehedgehog/Drea ... sh4_math.h

Extremely. Let me know if it breaks.
These should run circles around the official stuff (currently this doesn't take advantage of ILP, but that's honestly just because I don't know what would be useful to do with integers while doing all the matrix float math).
These users liked the author Moopthehedgehog for the post (total 2):
ThePerfectKIan Robinson
I'm sure Aleron Ives feels weird with his postcount back to <10668
:D
Post Reply