summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/VertexManagerBase.cpp
diff options
context:
space:
mode:
authorScott Mansell <phiren@gmail.com>2024-06-05 18:16:24 +1200
committerGitHub <noreply@github.com>2024-06-05 18:16:24 +1200
commita57962cedb04229a61c4c3c58bad7b867340b6aa (patch)
tree67284361a16cf3bf9e30ddc5f6ec98ad41239690 /Source/Core/VideoCommon/VertexManagerBase.cpp
parentc04460d88b4f18d4b42dc81359aae1399776d2b0 (diff)
parentc2bc2ccd23cfabc2a6d8ac0295fef7b669206e28 (diff)
Merge pull request #12825 from iwubcode/texture_cache_sampler_split
VideoCommon: pull texture sampler out of texture cache for later reuse
Diffstat (limited to 'Source/Core/VideoCommon/VertexManagerBase.cpp')
-rw-r--r--Source/Core/VideoCommon/VertexManagerBase.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/Source/Core/VideoCommon/VertexManagerBase.cpp b/Source/Core/VideoCommon/VertexManagerBase.cpp
index b51cfa19e0..02edb56d35 100644
--- a/Source/Core/VideoCommon/VertexManagerBase.cpp
+++ b/Source/Core/VideoCommon/VertexManagerBase.cpp
@@ -563,13 +563,19 @@ void VertexManagerBase::Flush()
const auto used_textures = UsedTextures();
std::vector<std::string> texture_names;
Common::SmallVector<u32, 8> texture_units;
+ std::array<SamplerState, 8> samplers;
if (!m_cull_all)
{
if (!g_ActiveConfig.bGraphicMods)
{
for (const u32 i : used_textures)
{
- g_texture_cache->Load(TextureInfo::FromStage(i));
+ const auto cache_entry = g_texture_cache->Load(TextureInfo::FromStage(i));
+ if (!cache_entry)
+ continue;
+ const float custom_tex_scale = cache_entry->GetWidth() / float(cache_entry->native_width);
+ samplers[i] = TextureCacheBase::GetSamplerState(
+ i, custom_tex_scale, cache_entry->is_custom_tex, cache_entry->has_arbitrary_mips);
}
}
else
@@ -585,6 +591,10 @@ void VertexManagerBase::Flush()
texture_names.push_back(cache_entry->texture_info_name);
texture_units.push_back(i);
}
+
+ const float custom_tex_scale = cache_entry->GetWidth() / float(cache_entry->native_width);
+ samplers[i] = TextureCacheBase::GetSamplerState(
+ i, custom_tex_scale, cache_entry->is_custom_tex, cache_entry->has_arbitrary_mips);
}
}
}
@@ -633,7 +643,7 @@ void VertexManagerBase::Flush()
// Texture loading can cause palettes to be applied (-> uniforms -> draws).
// Palette application does not use vertices, only a full-screen quad, so this is okay.
// Same with GPU texture decoding, which uses compute shaders.
- g_texture_cache->BindTextures(used_textures);
+ g_texture_cache->BindTextures(used_textures, samplers);
if (PerfQueryBase::ShouldEmulate())
g_perf_query->EnableQuery(bpmem.zcontrol.early_ztest ? PQG_ZCOMP_ZCOMPLOC : PQG_ZCOMP);