SoftRasterizer: Fix bug where the texture wrap mode would be applied inconsistently under multithreaded rendering.

(Regression from 032622e.)
This commit is contained in:
rogerman 2016-12-05 11:45:40 -08:00
parent e767018e2a
commit 7711f8288b
2 changed files with 7 additions and 17 deletions

View File

@ -332,6 +332,7 @@ protected:
SoftRasterizerTexture *currentTexture;
VERT* verts[MAX_CLIPPED_VERTS];
int polynum;
u8 _textureWrapMode;
public:
bool _debug_thisPoly;
@ -353,7 +354,8 @@ public:
return RENDER3DERROR_NOERR;
}
theTexture->SetRenderWrapMode(thePoly.texParam);
this->_textureWrapMode = (thePoly.texParam >> 16) & 0x0F;
theTexture->ResetCacheAge();
theTexture->IncreaseCacheUsageCount(1);
@ -379,7 +381,7 @@ public:
}
const u32 *textureData = this->currentTexture->GetRenderData();
this->currentTexture->GetRenderSamplerCoordinates(iu, iv);
this->currentTexture->GetRenderSamplerCoordinates(this->_textureWrapMode, iu, iv);
FragmentColor color;
color.color = textureData[( iv << this->currentTexture->GetRenderWidthShift() ) + iu];
@ -1218,19 +1220,9 @@ u32 SoftRasterizerTexture::GetRenderWidthShift() const
return this->_renderWidthShift;
}
u8 SoftRasterizerTexture::GetRenderWrapMode() const
FORCEINLINE void SoftRasterizerTexture::GetRenderSamplerCoordinates(const u8 wrapMode, s32 &iu, s32 &iv) const
{
return this->_renderWrapMode;
}
void SoftRasterizerTexture::SetRenderWrapMode(u32 texParam)
{
this->_renderWrapMode = (texParam >> 16) & 0x0F;
}
FORCEINLINE void SoftRasterizerTexture::GetRenderSamplerCoordinates(s32 &iu, s32 &iv) const
{
switch (this->_renderWrapMode)
switch (wrapMode)
{
//flip none
case 0x0: _hclamp(iu); _vclamp(iv); break;

View File

@ -77,10 +77,8 @@ public:
s32 GetRenderWidthMask() const;
s32 GetRenderHeightMask() const;
u32 GetRenderWidthShift() const;
u8 GetRenderWrapMode() const;
void SetRenderWrapMode(u32 texParam);
void GetRenderSamplerCoordinates(s32 &iu, s32 &iv) const;
void GetRenderSamplerCoordinates(const u8 wrapMode, s32 &iu, s32 &iv) const;
void SetUseDeposterize(bool willDeposterize);
void SetScalingFactor(size_t scalingFactor);