SoftRasterizer: Fix bug where texture sampling coordinates were incorrectly calculated when texture upscaling is used with GFX3D_TXTHack enabled.

Fixes issue #5. (Related to commit a8c8a86.)
This commit is contained in:
rogerman 2016-12-08 01:18:41 -08:00
parent 7a573e75b5
commit 36b192af00
1 changed files with 6 additions and 4 deletions

View File

@ -366,18 +366,20 @@ public:
{ {
//finally, we can use floor here. but, it is slower than we want. //finally, we can use floor here. but, it is slower than we want.
//the best solution is probably to wait until the pipeline is full of fixed point //the best solution is probably to wait until the pipeline is full of fixed point
const float fu = u * (float)this->currentTexture->GetRenderWidth() / (float)this->currentTexture->GetWidth();
const float fv = v * (float)this->currentTexture->GetRenderHeight() / (float)this->currentTexture->GetHeight();
s32 iu = 0; s32 iu = 0;
s32 iv = 0; s32 iv = 0;
if (!CommonSettings.GFX3D_TXTHack) if (!CommonSettings.GFX3D_TXTHack)
{ {
iu = s32floor(u * (float)this->currentTexture->GetRenderWidth() / (float)this->currentTexture->GetWidth()); iu = s32floor(fu);
iv = s32floor(v * (float)this->currentTexture->GetRenderHeight() / (float)this->currentTexture->GetHeight()); iv = s32floor(fv);
} }
else else
{ {
iu = round_s(u); iu = round_s(fu);
iv = round_s(v); iv = round_s(fv);
} }
const u32 *textureData = this->currentTexture->GetRenderData(); const u32 *textureData = this->currentTexture->GetRenderData();