Fixed hires textures not scaling. Also increased max size of custom textures to 2048x2048.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6254 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
ec648ed221
commit
d57b0a14d0
|
@ -115,9 +115,9 @@ PC_TexFormat GetHiresTex(const char *fileName, int *pWidth, int *pHeight, int te
|
||||||
return PC_TEX_FMT_NONE;
|
return PC_TEX_FMT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (width > 1024 || height > 1024)
|
if (width > 2048 || height > 2048)
|
||||||
{
|
{
|
||||||
ERROR_LOG(VIDEO, "Custom texture %s is too large (%ix%i); textures can only be 1024 pixels tall and wide", textureMap[key].c_str(), width, height);
|
ERROR_LOG(VIDEO, "Custom texture %s is too large (%ix%i); textures can only be 2048 pixels tall and wide", textureMap[key].c_str(), width, height);
|
||||||
SOIL_free_image_data(temp);
|
SOIL_free_image_data(temp);
|
||||||
return PC_TEX_FMT_NONE;
|
return PC_TEX_FMT_NONE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ TextureCache::TexCache TextureCache::textures;
|
||||||
|
|
||||||
extern int frameCount;
|
extern int frameCount;
|
||||||
|
|
||||||
#define TEMP_SIZE (1024*1024*4)
|
#define TEMP_SIZE (2048*2048*4)
|
||||||
#define TEXTURE_KILL_THRESHOLD 200
|
#define TEXTURE_KILL_THRESHOLD 200
|
||||||
|
|
||||||
void TextureCache::TCacheEntry::Destroy(bool shutdown)
|
void TextureCache::TCacheEntry::Destroy(bool shutdown)
|
||||||
|
@ -283,6 +283,8 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
|
||||||
// Make an entry in the table
|
// Make an entry in the table
|
||||||
TCacheEntry& entry = textures[texID];
|
TCacheEntry& entry = textures[texID];
|
||||||
entry.isDynamic = TextureisDynamic;
|
entry.isDynamic = TextureisDynamic;
|
||||||
|
entry.Realw = width;
|
||||||
|
entry.Realh = height;
|
||||||
PC_TexFormat pcfmt = PC_TEX_FMT_NONE;
|
PC_TexFormat pcfmt = PC_TEX_FMT_NONE;
|
||||||
|
|
||||||
if (g_ActiveConfig.bHiresTextures)
|
if (g_ActiveConfig.bHiresTextures)
|
||||||
|
@ -299,6 +301,8 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
|
||||||
{
|
{
|
||||||
expandedWidth = width;
|
expandedWidth = width;
|
||||||
expandedHeight = height;
|
expandedHeight = height;
|
||||||
|
entry.Realw = oldWidth;
|
||||||
|
entry.Realh = oldHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,8 +394,6 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
|
||||||
entry.frameCount = frameCount;
|
entry.frameCount = frameCount;
|
||||||
entry.w = width;
|
entry.w = width;
|
||||||
entry.h = height;
|
entry.h = height;
|
||||||
entry.Scaledw = width;
|
|
||||||
entry.Scaledh = height;
|
|
||||||
entry.fmt = FullFormat;
|
entry.fmt = FullFormat;
|
||||||
|
|
||||||
if (g_ActiveConfig.bDumpTextures)
|
if (g_ActiveConfig.bDumpTextures)
|
||||||
|
@ -475,8 +477,8 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, boo
|
||||||
entry.isRenderTarget = true;
|
entry.isRenderTarget = true;
|
||||||
entry.hash = 0;
|
entry.hash = 0;
|
||||||
entry.frameCount = frameCount;
|
entry.frameCount = frameCount;
|
||||||
entry.w = tex_w;
|
entry.w = entry.Realw = tex_w;
|
||||||
entry.h = tex_h;
|
entry.h = entry.Realh = tex_h;
|
||||||
entry.Scaledw = Scaledtex_w;
|
entry.Scaledw = Scaledtex_w;
|
||||||
entry.Scaledh = Scaledtex_h;
|
entry.Scaledh = Scaledtex_h;
|
||||||
entry.fmt = copyfmt;
|
entry.fmt = copyfmt;
|
||||||
|
|
|
@ -39,8 +39,7 @@ public:
|
||||||
u32 oldpixel;
|
u32 oldpixel;
|
||||||
|
|
||||||
int frameCount;
|
int frameCount;
|
||||||
int w, h, fmt,MipLevels;
|
int w, h, fmt,MipLevels, Realw, Realh, Scaledw, Scaledh;
|
||||||
int Scaledw, Scaledh;
|
|
||||||
|
|
||||||
bool isRenderTarget;
|
bool isRenderTarget;
|
||||||
bool isDynamic;// mofified from cpu
|
bool isDynamic;// mofified from cpu
|
||||||
|
@ -59,6 +58,8 @@ public:
|
||||||
isNonPow2 = true;
|
isNonPow2 = true;
|
||||||
w = 0;
|
w = 0;
|
||||||
h = 0;
|
h = 0;
|
||||||
|
Realw = 0;
|
||||||
|
Realh = 0;
|
||||||
Scaledw = 0;
|
Scaledw = 0;
|
||||||
Scaledh = 0;
|
Scaledh = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,7 @@ void VertexManager::vFlush()
|
||||||
if (tentry)
|
if (tentry)
|
||||||
{
|
{
|
||||||
// 0s are probably for no manual wrapping needed.
|
// 0s are probably for no manual wrapping needed.
|
||||||
PixelShaderManager::SetTexDims(i, tentry->w, tentry->h, 0, 0);
|
PixelShaderManager::SetTexDims(i, tentry->Realw, tentry->Realh, 0, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ERROR_LOG(VIDEO, "error loading texture");
|
ERROR_LOG(VIDEO, "error loading texture");
|
||||||
|
|
|
@ -59,7 +59,7 @@ TextureCache::TexCache TextureCache::textures;
|
||||||
extern int frameCount;
|
extern int frameCount;
|
||||||
static u32 s_TempFramebuffer = 0;
|
static u32 s_TempFramebuffer = 0;
|
||||||
|
|
||||||
#define TEMP_SIZE (1024*1024*4)
|
#define TEMP_SIZE (2048*2048*4)
|
||||||
#define TEXTURE_KILL_THRESHOLD 200
|
#define TEXTURE_KILL_THRESHOLD 200
|
||||||
|
|
||||||
static const GLint c_MinLinearFilter[8] = {
|
static const GLint c_MinLinearFilter[8] = {
|
||||||
|
@ -373,6 +373,8 @@ TextureCache::TCacheEntry* TextureCache::Load(int texstage, u32 address, int wid
|
||||||
TCacheEntry& entry = textures[texID];
|
TCacheEntry& entry = textures[texID];
|
||||||
entry.isDynamic = TextureisDynamic;
|
entry.isDynamic = TextureisDynamic;
|
||||||
entry.isRenderTarget = false;
|
entry.isRenderTarget = false;
|
||||||
|
entry.Realw = width;
|
||||||
|
entry.Realh = height;
|
||||||
PC_TexFormat pcfmt = PC_TEX_FMT_NONE;
|
PC_TexFormat pcfmt = PC_TEX_FMT_NONE;
|
||||||
|
|
||||||
if (g_ActiveConfig.bHiresTextures)
|
if (g_ActiveConfig.bHiresTextures)
|
||||||
|
@ -380,6 +382,9 @@ TextureCache::TCacheEntry* TextureCache::Load(int texstage, u32 address, int wid
|
||||||
// Load Custom textures
|
// Load Custom textures
|
||||||
char texPathTemp[MAX_PATH];
|
char texPathTemp[MAX_PATH];
|
||||||
|
|
||||||
|
int oldWidth = width;
|
||||||
|
int oldHeight = height;
|
||||||
|
|
||||||
sprintf(texPathTemp, "%s_%08x_%i", globals->unique_id, (unsigned int) texHash, tex_format);
|
sprintf(texPathTemp, "%s_%08x_%i", globals->unique_id, (unsigned int) texHash, tex_format);
|
||||||
pcfmt = HiresTextures::GetHiresTex(texPathTemp, &width, &height, tex_format, temp);
|
pcfmt = HiresTextures::GetHiresTex(texPathTemp, &width, &height, tex_format, temp);
|
||||||
|
|
||||||
|
@ -387,6 +392,8 @@ TextureCache::TCacheEntry* TextureCache::Load(int texstage, u32 address, int wid
|
||||||
{
|
{
|
||||||
expandedWidth = width;
|
expandedWidth = width;
|
||||||
expandedHeight = height;
|
expandedHeight = height;
|
||||||
|
entry.Realw = oldWidth;
|
||||||
|
entry.Realh = oldHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -768,8 +775,8 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, boo
|
||||||
}
|
}
|
||||||
|
|
||||||
entry.addr = address;
|
entry.addr = address;
|
||||||
entry.w = w;
|
entry.w = entry.Realw = w;
|
||||||
entry.h = h;
|
entry.h = entry.Realh = h;
|
||||||
entry.Scaledw = Scaledtex_w;
|
entry.Scaledw = Scaledtex_w;
|
||||||
entry.Scaledh = Scaledtex_h;
|
entry.Scaledh = Scaledtex_h;
|
||||||
entry.fmt = copyfmt;
|
entry.fmt = copyfmt;
|
||||||
|
|
|
@ -44,7 +44,7 @@ public:
|
||||||
TexMode1 mode1; // current filter and clamp modes that texture is set to
|
TexMode1 mode1; // current filter and clamp modes that texture is set to
|
||||||
|
|
||||||
int frameCount;
|
int frameCount;
|
||||||
int w, h, fmt,MipLevels;
|
int w, h, fmt,MipLevels, Realw, Realh;
|
||||||
int Scaledw, Scaledh;
|
int Scaledw, Scaledh;
|
||||||
|
|
||||||
bool isRenderTarget; // if render texture, then rendertex is filled with the direct copy of the render target
|
bool isRenderTarget; // if render texture, then rendertex is filled with the direct copy of the render target
|
||||||
|
|
|
@ -163,7 +163,7 @@ void VertexManager::vFlush()
|
||||||
if (tentry)
|
if (tentry)
|
||||||
{
|
{
|
||||||
// 0s are probably for no manual wrapping needed.
|
// 0s are probably for no manual wrapping needed.
|
||||||
PixelShaderManager::SetTexDims(i, tentry->w, tentry->h, 0, 0);
|
PixelShaderManager::SetTexDims(i, tentry->Realw, tentry->Realh, 0, 0);
|
||||||
|
|
||||||
if (g_ActiveConfig.iLog & CONF_SAVETEXTURES)
|
if (g_ActiveConfig.iLog & CONF_SAVETEXTURES)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue