D3D12: Cleanup DX12::Renderer::SetSamplerState
Remove uninitialized non-static variable. Replace test to avoid unnecessary state changes with a simpler one.
This commit is contained in:
parent
8e1aff34df
commit
cc36dec9b5
|
@ -90,7 +90,7 @@ typedef struct _Nv_Stereo_Image_Header
|
||||||
#define NVSTEREO_IMAGE_SIGNATURE 0x4433564e
|
#define NVSTEREO_IMAGE_SIGNATURE 0x4433564e
|
||||||
|
|
||||||
// GX pipeline state
|
// GX pipeline state
|
||||||
struct
|
static struct
|
||||||
{
|
{
|
||||||
SamplerState sampler[8];
|
SamplerState sampler[8];
|
||||||
BlendState blend;
|
BlendState blend;
|
||||||
|
@ -1235,42 +1235,41 @@ void Renderer::SetDitherMode()
|
||||||
|
|
||||||
void Renderer::SetSamplerState(int stage, int tex_index, bool custom_tex)
|
void Renderer::SetSamplerState(int stage, int tex_index, bool custom_tex)
|
||||||
{
|
{
|
||||||
SamplerState s_previous_sampler_state[8];
|
|
||||||
|
|
||||||
const FourTexUnits& tex = bpmem.tex[tex_index];
|
const FourTexUnits& tex = bpmem.tex[tex_index];
|
||||||
const TexMode0& tm0 = tex.texMode0[stage];
|
const TexMode0& tm0 = tex.texMode0[stage];
|
||||||
const TexMode1& tm1 = tex.texMode1[stage];
|
const TexMode1& tm1 = tex.texMode1[stage];
|
||||||
|
SamplerState new_state = {};
|
||||||
|
|
||||||
if (tex_index)
|
if (tex_index)
|
||||||
stage += 4;
|
stage += 4;
|
||||||
|
|
||||||
if (g_ActiveConfig.bForceFiltering)
|
if (g_ActiveConfig.bForceFiltering)
|
||||||
{
|
{
|
||||||
gx_state.sampler[stage].min_filter = 6; // 4 (linear mip) | 2 (linear min)
|
new_state.min_filter = 6; // 4 (linear min) | 2 (linear mip)
|
||||||
gx_state.sampler[stage].mag_filter = 1; // linear mag
|
new_state.mag_filter = 1; // linear mag
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gx_state.sampler[stage].min_filter = static_cast<u32>(tm0.min_filter);
|
new_state.min_filter = tm0.min_filter;
|
||||||
gx_state.sampler[stage].mag_filter = static_cast<u32>(tm0.mag_filter);
|
new_state.mag_filter = tm0.mag_filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
gx_state.sampler[stage].wrap_s = static_cast<u32>(tm0.wrap_s);
|
new_state.wrap_s = tm0.wrap_s;
|
||||||
gx_state.sampler[stage].wrap_t = static_cast<u32>(tm0.wrap_t);
|
new_state.wrap_t = tm0.wrap_t;
|
||||||
gx_state.sampler[stage].max_lod = static_cast<u32>(tm1.max_lod);
|
new_state.max_lod = tm1.max_lod;
|
||||||
gx_state.sampler[stage].min_lod = static_cast<u32>(tm1.min_lod);
|
new_state.min_lod = tm1.min_lod;
|
||||||
gx_state.sampler[stage].lod_bias = static_cast<s32>(tm0.lod_bias);
|
new_state.lod_bias = tm0.lod_bias;
|
||||||
|
|
||||||
// custom textures may have higher resolution, so disable the max_lod
|
// custom textures may have higher resolution, so disable the max_lod
|
||||||
if (custom_tex)
|
if (custom_tex)
|
||||||
{
|
{
|
||||||
gx_state.sampler[stage].max_lod = 255;
|
new_state.max_lod = 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gx_state.sampler[stage].hex != s_previous_sampler_state[stage].hex)
|
if (new_state.hex != gx_state.sampler[stage].hex)
|
||||||
{
|
{
|
||||||
|
gx_state.sampler[stage].hex = new_state.hex;
|
||||||
D3D::command_list_mgr->SetCommandListDirtyState(COMMAND_LIST_STATE_SAMPLERS, true);
|
D3D::command_list_mgr->SetCommandListDirtyState(COMMAND_LIST_STATE_SAMPLERS, true);
|
||||||
s_previous_sampler_state[stage].hex = gx_state.sampler[stage].hex;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue