ps2dev / gsKit

gsKit is a C interface to the PS2 Graphics Synthesizer
Other
107 stars 28 forks source link

Adding functions for render a texture with list of vertices #57

Closed fjtrujy closed 2 years ago

fjtrujy commented 2 years ago

I have used a specific SDL example to test performance increase,

image

Before: INFO: 469.61 frames per second After: UV -> INFO: 520.80 frames per second ST -> INFO: 547.89 frames per second

fjtrujy commented 2 years ago

I have also added the STQ way, and performance for the previous example is even better, I suppose because I avoid some floating operations

INFO: 547.89 frames per second
fjtrujy commented 2 years ago

Please @F0bes could you take a look?

F0bes commented 2 years ago

When you set TEX0, you're setting TFX (The texture function) to MODULATE. Which may have unintended side effects.

The valid TFX values are defined here image

I would either expose this in the GSTEXTURE structure, or force it to 1 (Decal). Decal simply keeps the input texture colour and outputs as is.

Also both functions are named Gouraud, which is the shading method defined by IIP in PRIM. This might be confusing if I were to want a flat shaded textured triangle. Of course, if you force DECAL, this has no meaning.

uyjulian commented 2 years ago

Don’t forget about -Wdeclaration-after-statement, since SDL has that enabled and would probably include gsInline.h