GS: Fix Using memset() on struct which contains a floating point number warning.

Codacy.
This commit is contained in:
lightningterror 2023-09-08 18:13:42 +02:00
parent 1b983111f6
commit 2a9c379a1c
4 changed files with 7 additions and 7 deletions

View File

@ -2019,16 +2019,16 @@ void GSDevice11::OMSetDepthStencilState(ID3D11DepthStencilState* dss, u8 sref)
}
}
void GSDevice11::OMSetBlendState(ID3D11BlendState* bs, float bf)
void GSDevice11::OMSetBlendState(ID3D11BlendState* bs, u8 bf)
{
if (m_state.bs != bs || m_state.bf != bf)
{
m_state.bs = bs;
m_state.bf = bf;
const float BlendFactor[] = {bf, bf, bf, 0};
const GSVector4 col(static_cast<float>(bf) / 128.0f);
m_ctx->OMSetBlendState(bs, BlendFactor, 0xffffffff);
m_ctx->OMSetBlendState(bs, col.v, 0xffffffff);
}
}

View File

@ -178,7 +178,7 @@ private:
ID3D11DepthStencilState* dss;
u8 sref;
ID3D11BlendState* bs;
float bf;
u8 bf;
ID3D11RenderTargetView* rt_view;
ID3D11DepthStencilView* dsv;
} m_state;
@ -352,7 +352,7 @@ public:
void PSSetSamplerState(ID3D11SamplerState* ss0);
void OMSetDepthStencilState(ID3D11DepthStencilState* dss, u8 sref);
void OMSetBlendState(ID3D11BlendState* bs, float bf);
void OMSetBlendState(ID3D11BlendState* bs, u8 bf);
void OMSetRenderTargets(GSTexture* rt, GSTexture* ds, const GSVector4i* scissor = nullptr);
void SetViewport(const GSVector2i& viewport);
void SetScissor(const GSVector4i& scissor);

View File

@ -334,5 +334,5 @@ void GSDevice11::SetupOM(OMDepthStencilSelector dssel, OMBlendSelector bsel, u8
j = m_om_bs.try_emplace(bsel, std::move(bs)).first;
}
OMSetBlendState(j->second.get(), (float)(int)afix / 0x80);
OMSetBlendState(j->second.get(), afix);
}

View File

@ -2230,7 +2230,7 @@ void GSDeviceOGL::OMSetBlendState(bool enable, GLenum src_factor, GLenum dst_fac
if (is_constant && GLState::bf != constant)
{
GLState::bf = constant;
const float bf = (float)constant / 128.0f;
const float bf = static_cast<float>(constant) / 128.0f;
glBlendColor(bf, bf, bf, bf);
}