diff --git a/pcsx2/GS/Renderers/DX11/GSDevice11.cpp b/pcsx2/GS/Renderers/DX11/GSDevice11.cpp index 0fd88f9d53715..07cbc3f24181d 100644 --- a/pcsx2/GS/Renderers/DX11/GSDevice11.cpp +++ b/pcsx2/GS/Renderers/DX11/GSDevice11.cpp @@ -2447,7 +2447,10 @@ void GSDevice11::VSSetShader(ID3D11VertexShader* vs, ID3D11Buffer* vs_cb) void GSDevice11::PSSetShaderResource(int i, GSTexture* sr) { // Update local state only, PSUpdateShaderState updates gpu state. - m_state.ps_pending_srv[i] = *static_cast(sr); + if (sr) + m_state.ps_pending_srv[i] = *static_cast(sr); + else + m_state.ps_pending_srv[i] = nullptr; } void GSDevice11::PSSetSamplerState(ID3D11SamplerState* ss0) diff --git a/pcsx2/GS/Renderers/OpenGL/GSDeviceOGL.cpp b/pcsx2/GS/Renderers/OpenGL/GSDeviceOGL.cpp index 73a4dbb939586..57a98d28bfc07 100644 --- a/pcsx2/GS/Renderers/OpenGL/GSDeviceOGL.cpp +++ b/pcsx2/GS/Renderers/OpenGL/GSDeviceOGL.cpp @@ -2153,7 +2153,7 @@ void GSDeviceOGL::PSSetShaderResource(int i, GSTexture* sr) { pxAssert(i < static_cast(std::size(GLState::tex_unit))); - const GLuint id = static_cast(sr)->GetID(); + const GLuint id = sr ? static_cast(sr)->GetID() : 0; if (GLState::tex_unit[i] != id) { GLState::tex_unit[i] = id; @@ -2855,10 +2855,7 @@ void GSDeviceOGL::RenderHW(GSHWDrawConfig& config) // Clear texture binding when it's bound to RT or DS. if (!config.tex && ((draw_rt && static_cast(draw_rt)->GetID() == GLState::tex_unit[0]) || (draw_ds && static_cast(draw_ds)->GetID() == GLState::tex_unit[0]))) - { - GLState::tex_unit[0] = 0; - glBindTextureUnit(0, 0); - } + PSSetShaderResource(0, nullptr); // Avoid changing framebuffer just to switch from rt+depth to rt and vice versa. bool fb_optimization_needs_barrier = false;