mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
GL: Delete code for GL_TEXTURE_RECTANGLE_ARB in case of non-pow2 textures - all modern GFX cards that can run Dolphin should support non-pow2 textures anyway. This removes some complexity and reduces the numbers of pixel shaders that need to be generated in some situations. Also fixes some texture mirroring problems. Let me know if this breaks things on ATI for some reason.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3833 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -40,11 +40,6 @@ static u32 lastAlpha = 0;
|
||||
static u32 lastTexDims[8]={0}; // width | height << 16 | wrap_s << 28 | wrap_t << 30
|
||||
static u32 lastZBias = 0;
|
||||
|
||||
// lower byte describes if a texture is nonpow2 or pow2
|
||||
// next byte describes whether the repeat wrap mode is enabled for the s channel
|
||||
// next byte is for t channel
|
||||
static u32 s_texturemask = 0;
|
||||
|
||||
void PixelShaderManager::Init()
|
||||
{
|
||||
s_nColorsChanged[0] = s_nColorsChanged[1] = 0;
|
||||
@ -208,26 +203,15 @@ void PixelShaderManager::SetConstants()
|
||||
|
||||
void PixelShaderManager::SetPSTextureDims(int texid)
|
||||
{
|
||||
// non pow 2 textures - texdims.xy are the real texture dimensions used for wrapping
|
||||
// pow 2 textures - texdims.xy are reciprocals of the real texture dimensions
|
||||
// both - texdims.zw are the scaled dimensions
|
||||
// texdims.xy are reciprocals of the real texture dimensions
|
||||
// texdims.zw are the scaled dimensions
|
||||
float fdims[4];
|
||||
if (s_texturemask & (1 << texid))
|
||||
{
|
||||
TCoordInfo& tc = bpmem.texcoords[texid];
|
||||
fdims[0] = (float)(lastTexDims[texid] & 0xffff);
|
||||
fdims[1] = (float)((lastTexDims[texid] >> 16) & 0xfff);
|
||||
fdims[2] = (float)(tc.s.scale_minus_1 + 1)*lastCustomTexScale[texid][0];
|
||||
fdims[3] = (float)(tc.t.scale_minus_1 + 1)*lastCustomTexScale[texid][1];
|
||||
}
|
||||
else
|
||||
{
|
||||
TCoordInfo& tc = bpmem.texcoords[texid];
|
||||
fdims[0] = 1.0f / (float)(lastTexDims[texid] & 0xffff);
|
||||
fdims[1] = 1.0f / (float)((lastTexDims[texid] >> 16) & 0xfff);
|
||||
fdims[2] = (float)(tc.s.scale_minus_1 + 1) * lastCustomTexScale[texid][0];
|
||||
fdims[3] = (float)(tc.t.scale_minus_1 + 1) * lastCustomTexScale[texid][1];
|
||||
}
|
||||
|
||||
TCoordInfo& tc = bpmem.texcoords[texid];
|
||||
fdims[0] = 1.0f / (float)(lastTexDims[texid] & 0xffff);
|
||||
fdims[1] = 1.0f / (float)((lastTexDims[texid] >> 16) & 0xfff);
|
||||
fdims[2] = (float)(tc.s.scale_minus_1 + 1) * lastCustomTexScale[texid][0];
|
||||
fdims[3] = (float)(tc.t.scale_minus_1 + 1) * lastCustomTexScale[texid][1];
|
||||
|
||||
PRIM_LOG("texdims%d: %f %f %f %f\n", texid, fdims[0], fdims[1], fdims[2], fdims[3]);
|
||||
SetPSConstant4fv(C_TEXDIMS + texid, fdims);
|
||||
@ -328,23 +312,6 @@ void PixelShaderManager::SetZTextureTypeChanged()
|
||||
s_bZTextureTypeChanged = true;
|
||||
}
|
||||
|
||||
void PixelShaderManager::SetTexturesUsed(u32 nonpow2tex)
|
||||
{
|
||||
if (s_texturemask != nonpow2tex)
|
||||
{
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
if (nonpow2tex & (0x10101 << i))
|
||||
{
|
||||
// this check was previously implicit, but should it be here?
|
||||
if (s_nTexDimsChanged )
|
||||
s_nTexDimsChanged |= 1 << i;
|
||||
}
|
||||
}
|
||||
s_texturemask = nonpow2tex;
|
||||
}
|
||||
}
|
||||
|
||||
void PixelShaderManager::SetTexCoordChanged(u8 texmapid)
|
||||
{
|
||||
s_nTexDimsChanged |= 1 << texmapid;
|
||||
@ -368,8 +335,3 @@ void PixelShaderManager::SetColorMatrix(const float* pmatrix, const float* pfCon
|
||||
SetPSConstant4fv(C_COLORMATRIX+3, pmatrix+12);
|
||||
SetPSConstant4fv(C_COLORMATRIX+4, pfConstAdd);
|
||||
}
|
||||
|
||||
u32 PixelShaderManager::GetTextureMask()
|
||||
{
|
||||
return s_texturemask;
|
||||
}
|
||||
|
Reference in New Issue
Block a user