diff --git a/plugins/GSdx/Renderers/DX11/GSDevice11.cpp b/plugins/GSdx/Renderers/DX11/GSDevice11.cpp index d58eaa042c..ab293e4dab 100644 --- a/plugins/GSdx/Renderers/DX11/GSDevice11.cpp +++ b/plugins/GSdx/Renderers/DX11/GSDevice11.cpp @@ -186,7 +186,7 @@ bool GSDevice11::Create(const std::shared_ptr &wnd) std::string convert_mstr[1]; - convert_mstr[0] = format("%d", m_upscale_multiplier); + convert_mstr[0] = format("%d", m_upscale_multiplier ? m_upscale_multiplier : 1); D3D_SHADER_MACRO convert_macro[] = { diff --git a/plugins/GSdx/Renderers/DX11/GSTextureFX11.cpp b/plugins/GSdx/Renderers/DX11/GSTextureFX11.cpp index edab091551..bc8af7d2b7 100644 --- a/plugins/GSdx/Renderers/DX11/GSTextureFX11.cpp +++ b/plugins/GSdx/Renderers/DX11/GSTextureFX11.cpp @@ -233,7 +233,7 @@ void GSDevice11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSe str[21] = format("%d", sel.dfmt); str[22] = format("%d", sel.depth_fmt); str[23] = format("%d", sel.fmt >> 2); - str[24] = format("%d", m_upscale_multiplier); + str[24] = format("%d", m_upscale_multiplier ? m_upscale_multiplier : 1); D3D_SHADER_MACRO macro[] = { diff --git a/plugins/GSdx/Renderers/OpenGL/GSDeviceOGL.cpp b/plugins/GSdx/Renderers/OpenGL/GSDeviceOGL.cpp index ef76508edc..8419fb1984 100644 --- a/plugins/GSdx/Renderers/OpenGL/GSDeviceOGL.cpp +++ b/plugins/GSdx/Renderers/OpenGL/GSDeviceOGL.cpp @@ -377,8 +377,10 @@ bool GSDeviceOGL::Create(const std::shared_ptr &wnd) GL_PUSH("GSDeviceOGL::Convert"); m_convert.cb = new GSUniformBufferOGL("Misc UBO", g_convert_index, sizeof(MiscConstantBuffer)); - // Upload once and forget about it - m_misc_cb_cache.ScalingFactor = GSVector4i(theApp.GetConfigI("upscale_multiplier")); + // Upload once and forget about it. + // Use value of 1 when upscale multiplier is 0 for ScalingFactor, + // this is to avoid doing math with 0 in shader. It helps custom res be less broken. + m_misc_cb_cache.ScalingFactor = GSVector4i(theApp.GetConfigI("upscale_multiplier") ? theApp.GetConfigI("upscale_multiplier") : 1); m_convert.cb->cache_upload(&m_misc_cb_cache); theApp.LoadResource(IDR_CONVERT_GLSL, shader);