From 43d1678fb2befa4bf72a54e2f86be600ada3018b Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Sun, 24 Nov 2013 00:52:17 +1300 Subject: [PATCH] Dynamically allocate color textures. Saves ram when the video software backend isn't being used. --- Source/Core/VideoBackends/Software/Src/SWRenderer.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/Core/VideoBackends/Software/Src/SWRenderer.cpp b/Source/Core/VideoBackends/Software/Src/SWRenderer.cpp index 62d2970160..0970a633b9 100644 --- a/Source/Core/VideoBackends/Software/Src/SWRenderer.cpp +++ b/Source/Core/VideoBackends/Software/Src/SWRenderer.cpp @@ -20,7 +20,7 @@ static GLint attr_pos = -1, attr_tex = -1; static GLint uni_tex = -1; static GLuint program; -static u8 s_xfbColorTexture[2][640*568*4]; +static u8 *s_xfbColorTexture[2]; static int s_currentColorTexture = 0; static volatile bool s_bScreenshot; @@ -41,6 +41,8 @@ void SWRenderer::Init() void SWRenderer::Shutdown() { + delete s_xfbColorTexture[0]; + delete s_xfbColorTexture[1]; glDeleteProgram(program); glDeleteTextures(1, &s_RenderTarget); #ifndef USE_GLES @@ -79,7 +81,9 @@ void CreateShaders() void SWRenderer::Prepare() { - memset(s_xfbColorTexture, 0, sizeof(s_xfbColorTexture)); + s_xfbColorTexture[0] = new u8[640*568*4]; + s_xfbColorTexture[1] = new u8[640*568*4]; + s_currentColorTexture = 0; glClearColor(0.0f, 0.0f, 0.0f, 0.0f);