From b200260d85263d3c902ae79d6a6e9acd1ddff751 Mon Sep 17 00:00:00 2001 From: stephena Date: Tue, 22 May 2012 15:22:02 +0000 Subject: [PATCH] Huge speedup in OpenGL rendering, by only updating part of the texture instead of the entire area. This fixes the speed regression from 3.6, since the main TIA texture is now larger than before. Previously it was 160 pixels wide out of 256 total (rounded to power of two), now it's 560 wide out of 1024 total. In 3.6 it was updating a buffer 256 pixels wide, in the latest beta releases it was sending 4 times as much data (256 -> 1024). Now it sends only 160/560. Similar improvements happened with the height as well (210 lines vs 256). On my test systems at least, this is an extremely large win, resulting in similar speeds as 3.6 even though we've moved to a 32-bit framebuffer. Bumped version # for next beta release. Pushed release date to June 1, to make absolutely sure I have everything fixed and ready to go. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2493 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- Changes.txt | 2 +- Readme.txt | 2 +- debian/changelog | 2 +- src/common/FBSurfaceGL.cxx | 8 ++++++-- src/common/FBSurfaceTIA.cxx | 14 +++++++++++--- src/common/Version.hxx | 2 +- src/unix/stella.spec | 2 +- 7 files changed, 22 insertions(+), 10 deletions(-) diff --git a/Changes.txt b/Changes.txt index 35cc23018..d418b91a1 100644 --- a/Changes.txt +++ b/Changes.txt @@ -12,7 +12,7 @@ Release History =========================================================================== -3.6.1 to 3.7: (May 25, 2012) +3.6.1 to 3.7: (June 1, 2012) * Added Blargg TV effects, with presets for Composite, S-video, RGB, and badly adjusted TV, and well as a custom mode with full diff --git a/Readme.txt b/Readme.txt index 589f9a8eb..e7ca819e3 100644 --- a/Readme.txt +++ b/Readme.txt @@ -9,4 +9,4 @@ the Stella Website at: Enjoy, The Stella Team -May 25, 2012 +June 1, 2012 diff --git a/debian/changelog b/debian/changelog index 74e2d0f41..c5062a64f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,7 +2,7 @@ stella (3.7-1) stable; urgency=high * Version 3.7 release - -- Stephen Anthony Fri, 25 May 2012 18:38:25 +0200 + -- Stephen Anthony Fri, 1 Jun 2012 18:38:25 +0200 stella (3.6.1-1) stable; urgency=high diff --git a/src/common/FBSurfaceGL.cxx b/src/common/FBSurfaceGL.cxx index 16c8423c4..2bed848e1 100644 --- a/src/common/FBSurfaceGL.cxx +++ b/src/common/FBSurfaceGL.cxx @@ -256,7 +256,9 @@ void FBSurfaceGL::update() // and antialiasing myGL.ActiveTexture(GL_TEXTURE0); myGL.BindTexture(GL_TEXTURE_2D, myTexID); - myGL.TexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, myTexWidth, myTexHeight, + myGL.PixelStorei(GL_UNPACK_ALIGNMENT, 1); + myGL.PixelStorei(GL_UNPACK_ROW_LENGTH, myPitch); + myGL.TexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, myImageW, myImageH, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, myTexture->pixels); @@ -313,7 +315,9 @@ void FBSurfaceGL::reload() myGL.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); // Create the texture in the most optimal format - myGL.TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, myTexWidth, myTexHeight, 0, + myGL.PixelStorei(GL_UNPACK_ALIGNMENT, 1); + myGL.PixelStorei(GL_UNPACK_ROW_LENGTH, myPitch); + myGL.TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, myTexWidth, myTexHeight, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, myTexture->pixels); diff --git a/src/common/FBSurfaceTIA.cxx b/src/common/FBSurfaceTIA.cxx index 7034a3203..b90ec8ee4 100644 --- a/src/common/FBSurfaceTIA.cxx +++ b/src/common/FBSurfaceTIA.cxx @@ -34,6 +34,8 @@ FBSurfaceTIA::FBSurfaceTIA(FrameBufferGL& buffer) myGL(myFB.p_gl), myTexture(NULL), myVBOID(0), + myBaseW(0), + myBaseH(0), myScanlinesEnabled(false), myScanlineIntensityI(50), myScanlineIntensityF(0.5) @@ -142,7 +144,9 @@ void FBSurfaceTIA::update() // Update TIA image (texture 0), then blend scanlines (texture 1) myGL.ActiveTexture(GL_TEXTURE0); myGL.BindTexture(GL_TEXTURE_2D, myTexID[0]); - myGL.TexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, myTexWidth, myTexHeight, + myGL.PixelStorei(GL_UNPACK_ALIGNMENT, 1); + myGL.PixelStorei(GL_UNPACK_ROW_LENGTH, myPitch); + myGL.TexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, myBaseW, myBaseH, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, myTexture->pixels); @@ -225,7 +229,9 @@ void FBSurfaceTIA::reload() myGL.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); // Create the texture in the most optimal format - myGL.TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, myTexWidth, myTexHeight, 0, + myGL.PixelStorei(GL_UNPACK_ALIGNMENT, 1); + myGL.PixelStorei(GL_UNPACK_ROW_LENGTH, myPitch); + myGL.TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, myTexWidth, myTexHeight, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, myTexture->pixels); @@ -237,7 +243,9 @@ void FBSurfaceTIA::reload() myGL.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); static uInt32 const scanline[2] = { 0x00000000, 0xff000000 }; - myGL.TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 1, 2, 0, + myGL.PixelStorei(GL_UNPACK_ALIGNMENT, 1); + myGL.PixelStorei(GL_UNPACK_ROW_LENGTH, 1); + myGL.TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 2, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, scanline); diff --git a/src/common/Version.hxx b/src/common/Version.hxx index f2555aee8..620fb29a6 100644 --- a/src/common/Version.hxx +++ b/src/common/Version.hxx @@ -22,7 +22,7 @@ #include -#define STELLA_VERSION "3.7_beta2" +#define STELLA_VERSION "3.7_beta3" #define STELLA_BUILD atoi("$Rev$" + 6) #endif diff --git a/src/unix/stella.spec b/src/unix/stella.spec index 9099c5f04..e90bc5f6c 100644 --- a/src/unix/stella.spec +++ b/src/unix/stella.spec @@ -108,7 +108,7 @@ rm -rf $RPM_BUILD_DIR/%{name}-%{version} %_datadir/icons/large/%{name}.png %changelog -* Fri May 25 2012 Stephen Anthony 3.7-1 +* Fri Jun 1 2012 Stephen Anthony 3.7-1 - Version 3.7 release * Fri Mar 16 2012 Stephen Anthony 3.6-1