Merge pull request #3692 from EmptyChaos/d3d12-static

D3D12: Fix uninitialized variable in SetSamplerState
This commit is contained in:
Pierre Bourdon 2016-03-02 15:52:44 +01:00
commit 643cf4553f
1 changed files with 14 additions and 15 deletions

View File

@ -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;
}
}