gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Curiosity about texture/poly rendering

#175415 - brave_orakio - Wed Nov 17, 2010 6:02 am

I read somewhere about textured polys that setting up the texture coordinates at the same time as the poly coordinates is faster? Or did I get it wrong? In any case can anyone tell me why it is faster(or slower)

Setting up at the same time:

SET_UPPERLEFTPOLY_COORD
SET_UPPERLEFTTEXTURE_COORD
SET_LOWERLEFTPOLY_COORD
SET_LOWERLEFTTEXTURE_COORD...

Setting up in steps:

SET_UPPERLEFTPOLY_COORD
SET_LOWERLEFTPOLY_COORD...
SET_UPPERLEFTTEXTURE_COORD
SET_LOWERLEFTTEXTURE_COORD...
_________________
help me

#175416 - kusma - Wed Nov 17, 2010 11:16 am

Uhm, the DS 3D-hardware doesn't have any "SET_UPPERLEFTTEXTURE_COORD" command, it's just "TEXCOORD" which updates the current texture coord state. When you emit a new vertex (by issuing one of the VTX-commands), the current texture coord state is copied to that vertex. So you can't choose when to set a texture coordinate, you have to set it before you emit a vertex.

#175418 - ritz - Wed Nov 17, 2010 4:08 pm

brave_orakio wrote:
I read somewhere about textured polys that setting up the texture coordinates at the same time as the poly coordinates is faster?

Maybe you're thinking of this quote from GBATEK: "When texture mapping, the Geometry Engine works faster if you issue commands in the order TexCoord -> Normal -> Vertex."


Last edited by ritz on Fri Dec 03, 2010 12:23 am; edited 1 time in total

#175419 - brave_orakio - Thu Nov 18, 2010 1:36 am

ritz:

Yes exactly, I just couldn't remember where to find it. So what is the reason for that?

kusma:

Yes sorry, I just wanted to make it clear what I meant about the commands, so I just put that as some sort of pseudo code.
_________________
help me

#175422 - ritz - Thu Nov 18, 2010 3:11 pm

brave_orakio wrote:
So what is the reason for that?

I really don't know. Being in quotes, it seems like it might be hearsay. Maybe it just hasn't been tested yet.

#175424 - brave_orakio - Fri Nov 19, 2010 1:34 am

Reading it again, I must have misunderstood it.

Now, I'm not really sure what it means (I guess that's why I put that pseudo code on top). So what does it mean and why?
_________________
help me

#175425 - elhobbs - Fri Nov 19, 2010 1:56 am

Unless you are experiencing a problem - do not worry about it. Certain hardware features require the commands to be in certain order. Ultimately each vertex can have a texture coord and a color and a normal. When you issue a vertex command it uses the last texture coord, normal, and color. The normal can be used with hardware lighting to determine the color or it can be used to effect the texture coord - or not at all depending on the texture and/ or poly attributes. The point being - it depends on what you are trying to do.

#175426 - brave_orakio - Fri Nov 19, 2010 3:18 am

I see. Anyway, thanks, I just thought that maybe it could be important in the long run.
_________________
help me

#175445 - Exophase - Mon Nov 22, 2010 5:44 pm

Both texture coordinates and current color are dependencies for the vertex command, which commits current versions of both of these to texture memory. It's possible that the texture coordinate transformation takes longer than the shading model computation, so the geometry hardware benefits from getting it started earlier.