summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/D3D12/Render.cpp
diff options
context:
space:
mode:
authorEmptyChaos <EmptyChaos@users.noreply.github.com>2016-03-01 11:01:02 +0000
committerEmptyChaos <EmptyChaos@users.noreply.github.com>2016-03-01 23:55:19 +1100
commitcc36dec9b51ecccbbe463016a10feb0c78439b81 (patch)
tree52ffcf53ab2062e10a1f4c6b2983e6eba89d74e9 /Source/Core/VideoBackends/D3D12/Render.cpp
parent8e1aff34df7650717d3aa5a70095ffaac1ea5035 (diff)
D3D12: Cleanup DX12::Renderer::SetSamplerState
Remove uninitialized non-static variable. Replace test to avoid unnecessary state changes with a simpler one.
Diffstat (limited to 'Source/Core/VideoBackends/D3D12/Render.cpp')
-rw-r--r--Source/Core/VideoBackends/D3D12/Render.cpp29
1 files changed, 14 insertions, 15 deletions
diff --git a/Source/Core/VideoBackends/D3D12/Render.cpp b/Source/Core/VideoBackends/D3D12/Render.cpp
index 4881fec717..cd4785569c 100644
--- a/Source/Core/VideoBackends/D3D12/Render.cpp
+++ b/Source/Core/VideoBackends/D3D12/Render.cpp
@@ -90,7 +90,7 @@ typedef struct _Nv_Stereo_Image_Header
#define NVSTEREO_IMAGE_SIGNATURE 0x4433564e
// GX pipeline state
-struct
+static struct
{
SamplerState sampler[8];
BlendState blend;
@@ -1235,42 +1235,41 @@ void Renderer::SetDitherMode()
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 TexMode0& tm0 = tex.texMode0[stage];
const TexMode1& tm1 = tex.texMode1[stage];
+ SamplerState new_state = {};
if (tex_index)
stage += 4;
if (g_ActiveConfig.bForceFiltering)
{
- gx_state.sampler[stage].min_filter = 6; // 4 (linear mip) | 2 (linear min)
- gx_state.sampler[stage].mag_filter = 1; // linear mag
+ new_state.min_filter = 6; // 4 (linear min) | 2 (linear mip)
+ new_state.mag_filter = 1; // linear mag
}
else
{
- gx_state.sampler[stage].min_filter = static_cast<u32>(tm0.min_filter);
- gx_state.sampler[stage].mag_filter = static_cast<u32>(tm0.mag_filter);
+ new_state.min_filter = tm0.min_filter;
+ new_state.mag_filter = tm0.mag_filter;
}
- gx_state.sampler[stage].wrap_s = static_cast<u32>(tm0.wrap_s);
- gx_state.sampler[stage].wrap_t = static_cast<u32>(tm0.wrap_t);
- gx_state.sampler[stage].max_lod = static_cast<u32>(tm1.max_lod);
- gx_state.sampler[stage].min_lod = static_cast<u32>(tm1.min_lod);
- gx_state.sampler[stage].lod_bias = static_cast<s32>(tm0.lod_bias);
+ new_state.wrap_s = tm0.wrap_s;
+ new_state.wrap_t = tm0.wrap_t;
+ new_state.max_lod = tm1.max_lod;
+ new_state.min_lod = tm1.min_lod;
+ new_state.lod_bias = tm0.lod_bias;
// custom textures may have higher resolution, so disable the max_lod
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);
- s_previous_sampler_state[stage].hex = gx_state.sampler[stage].hex;
}
}