TextureCache: load all mipmap levels from custom textures

This drops the "feature" to load level 0 from the custom texture
and all other levels from the native one if the size matches.
But in my opinion, when a custom texture only provide one level,
no more should be used at all.
This commit is contained in:
degasus
2015-03-01 13:04:48 +01:00
parent 8c46bd2d1d
commit 35373c5185
12 changed files with 44 additions and 34 deletions

View File

@ -1868,13 +1868,13 @@ void Renderer::SetDitherMode()
glDisable(GL_DITHER);
}
void Renderer::SetSamplerState(int stage, int texindex)
void Renderer::SetSamplerState(int stage, int texindex, bool custom_tex)
{
auto const& tex = bpmem.tex[texindex];
auto const& tm0 = tex.texMode0[stage];
auto const& tm1 = tex.texMode1[stage];
g_sampler_cache->SetSamplerState((texindex * 4) + stage, tm0, tm1);
g_sampler_cache->SetSamplerState((texindex * 4) + stage, tm0, tm1, custom_tex);
}
void Renderer::SetInterlacingMode()

View File

@ -58,7 +58,7 @@ public:
void SetDepthMode() override;
void SetLogicOpMode() override;
void SetDitherMode() override;
void SetSamplerState(int stage,int texindex) override;
void SetSamplerState(int stage, int texindex, bool custom_tex) override;
void SetInterlacingMode() override;
void SetViewport() override;

View File

@ -20,7 +20,7 @@ SamplerCache::~SamplerCache()
Clear();
}
void SamplerCache::SetSamplerState(int stage, const TexMode0& tm0, const TexMode1& tm1)
void SamplerCache::SetSamplerState(int stage, const TexMode0& tm0, const TexMode1& tm1, bool custom_tex)
{
// TODO: can this go somewhere else?
if (m_last_max_anisotropy != g_ActiveConfig.iMaxAnisotropy)
@ -38,6 +38,12 @@ void SamplerCache::SetSamplerState(int stage, const TexMode0& tm0, const TexMode
params.tm0.mag_filter |= 0x1;
}
// custom textures may have higher resolution, so disable the max_lod
if (custom_tex)
{
params.tm1.max_lod = 255;
}
// TODO: Should keep a circular buffer for each stage of recently used samplers.
auto& active_sampler = m_active_samplers[stage];

View File

@ -14,7 +14,7 @@ public:
SamplerCache();
~SamplerCache();
void SetSamplerState(int stage, const TexMode0& tm0, const TexMode1& tm1);
void SetSamplerState(int stage, const TexMode0& tm0, const TexMode1& tm1, bool custom_tex);
void Clear();
private: