OpenGL Renderer: massive performance decrease in Juce V.2

45 posts / 0 new
Last post
friscokid
Offline
Last seen: 6 months 1 week ago
Joined: 28 Dec 2007 - 11:06
OpenGL Renderer: massive performance decrease in Juce V.2

Hello,

today (April 22. 2012) I updated to the latest commit and I noticed a massive performance decrease of the OpenGL Renderer compared to the commit from February 12. 2012.
When I compile the Juce Demo in Release mode using the Version from Feb. 12. and use the OpenGL Renderer to render "Paths - Linear gradient" set the size to maximum and animate all other properties, the render time is about 2 ms.
Now, when I do exactly the same test, using the latest Juce Version from April 22., the render time is about 35ms.

These results are 100% reproducable, so there must have been some changes between February and today that led to a massive loss of performance.

You can easily test this yourself by compiling the Juce Demo using the current Juce Version 2 and then resetting the Master to the commit from May 12 (make sure to not just reset the index but to use the actual files from this date) and compiling the demo again.
The differences of the render times and the performance are huge, when using the two different versions of the OpenGl Renderer!

EDIT:
Actually the commit that is responible for the performance loss is:

Revision: b338698e346d3cb14e33e568f838a7e8523bb544
Author: jules
Date: 15/03/2012 12:13:38
Message:
OpenGL: removed the fixed-function rendering code, replacing it with a simple software renderer that blits its results to the GL context. Removed the public OpenGLGraphicsContext class, replacing it with a createOpenGLGraphicsContext() function which returns an appropriate shader-based or software-based renderer object.

All versions before this commit show great performance. All newer commits suffer from the performance problem.

The problem occurs at least on Windows 7 64 bit; Juce Demo compiled in 32 bit Release mode; other platforms not yet tested.

jules
Online
Last seen: 4 min 27 sec ago
Joined: 29 Apr 2013 - 18:37
Re: OpenGL Renderer: massive performance decrease in Juce V.

Sounds like you're using a graphics card without shader support?

friscokid
Offline
Last seen: 6 months 1 week ago
Joined: 28 Dec 2007 - 11:06
Re: OpenGL Renderer: massive performance decrease in Juce V.

I tested this on a MacBook Pro (running Win 7) with a GeForce 9600M GT that supports: Shading language version: 3.30 NVIDIA via Cg compiler
I really don't know much about OpenGL hardware requirements, but I assume that this card should support shaders.

Anyways, even if the performance issue should be due to my hardware restrictions, would it be possible to add a fall back to the OpenGL Renderer version that was used before the mentioned commit, if shaders are not supported, because the performance was really great compared to the Software Renderer and to the OpenGL Renderer of the current version? So users without shader support could benefit from this, too.

But first of all we should make sure that this issue is actually related to the missing shader support.

jules
Online
Last seen: 4 min 27 sec ago
Joined: 29 Apr 2013 - 18:37
Re: OpenGL Renderer: massive performance decrease in Juce V.

Ok, well if your system has shaders, it shouldn't be using the non-shader code path at all - maybe it's failing to recognise the shader engine on your system for some reason?

Could you see what it does in the createOpenGLContext() function (in juce_opengl_OpenGLGraphicsContext.cpp)? That's where it checks for shader availability, and it sounds like it should work on your machine (unless the windows drivers don't provide that feature for some reason)

friscokid
Offline
Last seen: 6 months 1 week ago
Joined: 28 Dec 2007 - 11:06
Re: OpenGL Renderer: massive performance decrease in Juce V.

Will check that tomorrow and give you some feedback.
Nevertheless, what do you think about a fallback for users without shader support?

jules
Online
Last seen: 4 min 27 sec ago
Joined: 29 Apr 2013 - 18:37
Re: OpenGL Renderer: massive performance decrease in Juce V.

Quote:
Nevertheless, what do you think about a fallback for users without shader support?

There is a fallback: the software renderer. The old fixed-function code that I removed was actually extremely slow compared the software renderer. I presume that when the old version was working fast, you were actually seeing the shader-based renderer working correctly, and not the old fixed-function pipeline.

friscokid
Offline
Last seen: 6 months 1 week ago
Joined: 28 Dec 2007 - 11:06
Re: OpenGL Renderer: massive performance decrease in Juce V.

Ok, I see.

I just had time for one quick test. When I debug the code in the function you mentioned:

if (target.context.areShadersAvailable())
        return new ShaderContext (target);

it enters the line and returns a new ShaderContext. So I assume that shaders are detected.

I'm sorry, but I don't have time for further investigations right now. I'm gonna make some more test tomorrow..
Thanks for now.

jules
Online
Last seen: 4 min 27 sec ago
Joined: 29 Apr 2013 - 18:37
Re: OpenGL Renderer: massive performance decrease in Juce V.

Weird.. Well, I really don't know what might have changed in that commit that would make a difference. Certainly the removal of the old fixed-function stuff will be irrelevant because you'd always have been running the shader code..

Bruce Wheaton
Offline
Last seen: 1 day 10 hours ago
Joined: 17 Aug 2006 - 01:43
Re: OpenGL Renderer: massive performance decrease in Juce V.

I feel obliged to mention that once the OpenGL Renderer is on, those times/frame become somewhat arbitrary. They probably just represent to time to issue all the OpenGL Commands, not the CPU time taken by the driver, and certainly not the time the GPU requires to actually do the work.

Bruce

sonic59
Offline
Last seen: 3 months 3 weeks ago
Joined: 9 Mar 2010 - 16:51
Re: OpenGL Renderer: massive performance decrease in Juce V.

I have a similar system so I thought it would be worth testing.

I have a MacBook with a GeForce 9400M and Windows 7 64-bit.
Updated to tip (April 22), compiled JuceDemo 32-bit Release mode.
Set Juce Demo to "Use OpenGL Renderer", "Paths - Linear Gradient", hit maximise button, animated all properties.

Software Renderer: 12ms - 26ms Render Time
OpenGL Renderer: 6ms - 15ms Render Time

Times vary due to scaling animation. When scale of path is small, I get the smaller time, when scale of path is huge, I get the larger time. I think this is expected behaviour. There is a larger area to paint and I think Juce is uploading a new edgetable every time it the scale of a path changes as the path always looks great and never pixelated.

Not sure why your superior MacBook Pro is seeing worse performance than my inferior MacBook.

Bruce Wheaton
Offline
Last seen: 1 day 10 hours ago
Joined: 17 Aug 2006 - 01:43
Re: OpenGL Renderer: massive performance decrease in Juce V.

OSX 10.7, MacBook Pro, GT 330M, 8GB RAM

Software: 4-12 ms
OpenGL 1.5-2.0 ms

Pages