DX9: Added another comment to further elaborate what drawShadedTexQuad is doing.

This comment should give a great speed increase, numerous games (SMG, NSMBW, DKCR, ...) which I tested are at least 20% faster now!


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6574 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
NeoBrainX 2010-12-13 18:51:08 +00:00
parent 7cf3ef6ddc
commit 4f4f5325f6
1 changed files with 3 additions and 1 deletions

View File

@ -374,6 +374,9 @@ void quad2d(float x1, float y1, float x2, float y2, u32 color, float u1, float v
So generally speaking the correct coordinate range is [-1-0.5/(w/2);1-0.5/(w/2)] So generally speaking the correct coordinate range is [-1-0.5/(w/2);1-0.5/(w/2)]
which can be simplified to [-1-1/w;1-1/w]. which can be simplified to [-1-1/w;1-1/w].
Note that while for D3DFVF_XYZRHW the y coordinate of the bottom of the screen is positive,
it's negative for D3DFVF_XYZW. This is why we need to _add_ 1/h for the second position component instead of subtracting it.
For a detailed explanation of this read the MSDN article "Directly Mapping Texels to Pixels (Direct3D 9)". For a detailed explanation of this read the MSDN article "Directly Mapping Texels to Pixels (Direct3D 9)".
*/ */
void drawShadedTexQuad(IDirect3DTexture9 *texture, void drawShadedTexQuad(IDirect3DTexture9 *texture,
@ -394,7 +397,6 @@ void drawShadedTexQuad(IDirect3DTexture9 *texture,
float v1=((float)rSource->top) * sh; float v1=((float)rSource->top) * sh;
float v2=((float)rSource->bottom) * sh; float v2=((float)rSource->bottom) * sh;
// TODO: Why do we ADD dh here?
struct Q2DVertex { float x,y,z,rhw,u,v,w,h,L,T,R,B; } coords[4] = { struct Q2DVertex { float x,y,z,rhw,u,v,w,h,L,T,R,B; } coords[4] = {
{-1.0f - dw,-1.0f + dh, 0.0f,1.0f, u1, v2, sw, sh,u1,v1,u2,v2}, {-1.0f - dw,-1.0f + dh, 0.0f,1.0f, u1, v2, sw, sh,u1,v1,u2,v2},
{-1.0f - dw, 1.0f + dh, 0.0f,1.0f, u1, v1, sw, sh,u1,v1,u2,v2}, {-1.0f - dw, 1.0f + dh, 0.0f,1.0f, u1, v1, sw, sh,u1,v1,u2,v2},