mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-27 14:58:32 +00:00
VideoCommon: pull texture sampler out of texture cache so that it can be used in other places in the future
This commit is contained in:
parent
46a89936ae
commit
c2bc2ccd23
3 changed files with 26 additions and 12 deletions
|
@ -1012,8 +1012,8 @@ static bool IsAnisostropicEnhancementSafe(const TexMode0& tm0)
|
|||
return !(tm0.min_filter == FilterMode::Near && tm0.mag_filter == FilterMode::Near);
|
||||
}
|
||||
|
||||
static void SetSamplerState(u32 index, float custom_tex_scale, bool custom_tex,
|
||||
bool has_arbitrary_mips)
|
||||
SamplerState TextureCacheBase::GetSamplerState(u32 index, float custom_tex_scale, bool custom_tex,
|
||||
bool has_arbitrary_mips)
|
||||
{
|
||||
const TexMode0& tm0 = bpmem.tex.GetUnit(index).texMode0;
|
||||
|
||||
|
@ -1073,13 +1073,11 @@ static void SetSamplerState(u32 index, float custom_tex_scale, bool custom_tex,
|
|||
state.tm0.anisotropic_filtering = false;
|
||||
}
|
||||
|
||||
g_gfx->SetSamplerState(index, state);
|
||||
auto& system = Core::System::GetInstance();
|
||||
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
||||
pixel_shader_manager.SetSamplerState(index, state.tm0.hex, state.tm1.hex);
|
||||
return state;
|
||||
}
|
||||
|
||||
void TextureCacheBase::BindTextures(BitSet32 used_textures)
|
||||
void TextureCacheBase::BindTextures(BitSet32 used_textures,
|
||||
const std::array<SamplerState, 8>& samplers)
|
||||
{
|
||||
auto& system = Core::System::GetInstance();
|
||||
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
||||
|
@ -1091,8 +1089,9 @@ void TextureCacheBase::BindTextures(BitSet32 used_textures)
|
|||
g_gfx->SetTexture(i, tentry->texture.get());
|
||||
pixel_shader_manager.SetTexDims(i, tentry->native_width, tentry->native_height);
|
||||
|
||||
const float custom_tex_scale = tentry->GetWidth() / float(tentry->native_width);
|
||||
SetSamplerState(i, custom_tex_scale, tentry->is_custom_tex, tentry->has_arbitrary_mips);
|
||||
auto& state = samplers[i];
|
||||
g_gfx->SetSamplerState(i, state);
|
||||
pixel_shader_manager.SetSamplerState(i, state.tm0.hex, state.tm1.hex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue