From 209d7c67e9336465a50af7fc49b22ea59dde3602 Mon Sep 17 00:00:00 2001
From: Connor McLaughlin <stenzek@gmail.com>
Date: Wed, 8 Jul 2020 01:57:51 +1000
Subject: [PATCH] GPU/OpenGL: Prefer SSBOs over small texel buffers+subimage

---
 src/core/gpu_hw_opengl.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/core/gpu_hw_opengl.cpp b/src/core/gpu_hw_opengl.cpp
index 2c9a4dfad..44a1491db 100644
--- a/src/core/gpu_hw_opengl.cpp
+++ b/src/core/gpu_hw_opengl.cpp
@@ -179,7 +179,8 @@ void GPU_HW_OpenGL::SetCapabilities(HostDisplay* host_display)
     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.");
   }
-  else
+
+  if (!m_supports_texture_buffer || m_max_texture_buffer_size < VRAM_WIDTH * VRAM_HEIGHT)
   {
     // Try SSBOs.
     GLint64 max_ssbo_size = 0;
@@ -838,7 +839,7 @@ void GPU_HW_OpenGL::UpdateVRAM(u32 x, u32 y, u32 width, u32 height, const void*
 
     // update texture data
     glTexSubImage2D(GL_TEXTURE_2D, 0, x, flipped_y, width, height, GL_RGBA, GL_UNSIGNED_BYTE,
-                    reinterpret_cast<void*>(map_result.index_aligned * sizeof(u32)));
+                    reinterpret_cast<void*>(map_result.buffer_offset));
     m_texture_stream_buffer->Unbind();
 
     if (m_resolution_scale > 1)