libobs-d3d11: Avoid temporary ComPtr objects

The ternary operator promotes both sides to the same type if possible,
so it created and destroyed a temporary ComPtr. Found by PVS Studio.
master
Richard Stanway 2021-03-04 17:57:41 +01:00
parent 43a291806e
commit 13cfd95fef
1 changed files with 10 additions and 2 deletions

View File

@ -1468,13 +1468,21 @@ static void device_load_texture_internal(gs_device_t *device, gs_texture_t *tex,
void device_load_texture(gs_device_t *device, gs_texture_t *tex, int unit)
{
ID3D11ShaderResourceView *view = tex ? tex->shaderRes : NULL;
ID3D11ShaderResourceView *view;
if (tex)
view = tex->shaderRes;
else
view = NULL;
return device_load_texture_internal(device, tex, unit, view);
}
void device_load_texture_srgb(gs_device_t *device, gs_texture_t *tex, int unit)
{
ID3D11ShaderResourceView *view = tex ? tex->shaderResLinear : NULL;
ID3D11ShaderResourceView *view;
if (tex)
view = tex->shaderResLinear;
else
view = NULL;
return device_load_texture_internal(device, tex, unit, view);
}