From 76172c88f3d845aac30a5b0dab78fc0bc2e8ebc3 Mon Sep 17 00:00:00 2001
From: Connor McLaughlin <mclaughc@outlook.com>
Date: Wed, 13 Nov 2019 22:48:37 +1000
Subject: [PATCH] GPU/HW: Disable blending when updating VRAM

Fixes random breakage when it was previously enabled.
---
 src/core/gpu_hw_opengl.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/core/gpu_hw_opengl.cpp b/src/core/gpu_hw_opengl.cpp
index 6ea972ea3..8f2748683 100644
--- a/src/core/gpu_hw_opengl.cpp
+++ b/src/core/gpu_hw_opengl.cpp
@@ -136,6 +136,7 @@ void GPU_HW_OpenGL::SetCapabilities(HostDisplay* host_display)
   if (m_supports_texture_buffer)
   {
     glGetIntegerv(GL_MAX_TEXTURE_BUFFER_SIZE, reinterpret_cast<GLint*>(&m_max_texture_buffer_size));
+    Log_InfoPrintf("Max texel buffer size: %u", m_max_texture_buffer_size);
     if (m_max_texture_buffer_size < VRAM_WIDTH * VRAM_HEIGHT)
       Log_WarningPrintf("Maximum texture buffer size is less than VRAM size, VRAM writes may be slower.");
   }
@@ -613,7 +614,9 @@ void GPU_HW_OpenGL::UpdateVRAM(u32 x, u32 y, u32 width, u32 height, const void*
     const u32 scaled_x = x * m_resolution_scale;
     const u32 scaled_y = y * m_resolution_scale;
     const u32 scaled_flipped_y = m_vram_texture->GetHeight() - scaled_y - scaled_height;
-    glScissor(scaled_x, scaled_flipped_y, scaled_width, scaled_height);
+    glViewport(scaled_x, scaled_flipped_y, scaled_width, scaled_height);
+    glDisable(GL_BLEND);
+    glDisable(GL_SCISSOR_TEST);
 
     m_vram_write_program.Bind();
     glBindTexture(GL_TEXTURE_BUFFER, m_texture_buffer_r16ui_texture);