summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon
diff options
context:
space:
mode:
authorNolan Check <Nolan.Check@gmail.com>2010-10-20 00:39:45 +0000
committerNolan Check <Nolan.Check@gmail.com>2010-10-20 00:39:45 +0000
commit0e534dd033e7dd0b2e40be63ad7ab6849c8ee525 (patch)
tree9d9b47da4de9b58a81fa6ea49fd738b3feb455c5 /Source/Core/VideoCommon
parent9a03484d64a310525265757fa04f0c17d5d44be7 (diff)
Clarify texture cache code. Previously, there were THREE sets of texture dimensions, and it was hard to tell which set was for what purpose.
Now, there are two: Real dimensions: Width and height of the original GameCube texture Virtual dimensions: Width and height of the texture used by dolphin-emu's renderer git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6291 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/VideoCommon')
-rw-r--r--Source/Core/VideoCommon/Src/TextureCacheBase.cpp24
-rw-r--r--Source/Core/VideoCommon/Src/TextureCacheBase.h12
2 files changed, 21 insertions, 15 deletions
diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp
index d2980b0680..4ae678c66a 100644
--- a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp
+++ b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp
@@ -263,8 +263,8 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
// TODO: Is the mipLevels check needed?
if (!entry->isRenderTarget &&
- ((!entry->isDynamic && width == entry->w && height == entry->h && full_format == entry->format && entry->mipLevels == maxlevel)
- || (entry->isDynamic && entry->w == width && entry->h == height)))
+ ((!entry->isDynamic && width == entry->realW && height == entry->realH && full_format == entry->format && entry->mipLevels == maxlevel)
+ || (entry->isDynamic && entry->realW == width && entry->realH == height)))
{
// reuse the texture
}
@@ -319,11 +319,11 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
entry->mipLevels = maxlevel;
entry->size_in_bytes = texture_size;
- entry->scaledW = entry->w = width;
- entry->scaledH = entry->h = height;
+ entry->virtualW = width;
+ entry->virtualH = height;
- entry->nativeH = nativeH;
- entry->nativeW = nativeW;
+ entry->realW = nativeW;
+ entry->realH = nativeH;
entry->isRenderTarget = false;
entry->isNonPow2 = false;
@@ -608,8 +608,8 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer,
TCacheEntryBase *entry = textures[address];
if (entry)
{
- if ((entry->isRenderTarget && entry->scaledW == scaled_tex_w && entry->scaledH == scaled_tex_h)
- || (entry->isDynamic && entry->w == tex_w && entry->h == tex_h))
+ if ((entry->isRenderTarget && entry->virtualW == scaled_tex_w && entry->virtualH == scaled_tex_h)
+ || (entry->isDynamic && entry->realW == tex_w && entry->realH == tex_h))
{
texture_is_dynamic = entry->isDynamic;
}
@@ -635,11 +635,11 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer,
entry->addr = address;
entry->hash = 0;
- entry->w = entry->nativeW = tex_w;
- entry->h = entry->nativeH = tex_h;
+ entry->realW = tex_w;
+ entry->realH = tex_h;
- entry->scaledW = scaled_tex_w;
- entry->scaledH = scaled_tex_h;
+ entry->virtualW = scaled_tex_w;
+ entry->virtualH = scaled_tex_h;
entry->format = copyfmt;
entry->mipLevels = 0;
diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.h b/Source/Core/VideoCommon/Src/TextureCacheBase.h
index 3db40c7164..0793f8dd19 100644
--- a/Source/Core/VideoCommon/Src/TextureCacheBase.h
+++ b/Source/Core/VideoCommon/Src/TextureCacheBase.h
@@ -24,9 +24,15 @@ public:
u32 format;
int frameCount;
- unsigned int w, h, mipLevels;
- // TODO: it looks like scaledW/H can be removed and w/h can be used in their place
- unsigned int scaledW, scaledH, nativeW, nativeH;
+
+ unsigned int realW, realH; // Texture dimensions from the GameCube's point of view
+ unsigned int virtualW, virtualH; // Texture dimensions from OUR point of view
+ // Real and virtual dimensions are usually the same, but may be
+ // different if e.g. we use high-res textures. Then, realW,realH will
+ // be the dimensions of the original GameCube texture and
+ // virtualW,virtualH will be the dimensions of the high-res texture.
+
+ unsigned int mipLevels;
bool isRenderTarget;
bool isDynamic; // mofified from cpu