OpenGL 3+ RenderSystem

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: OpenGL 3+ RenderSystem

Post by masterfalcon »

Luckily I have answers for all your questions.

Binary programs haven't been really tested yet and may not work right.

Actually both of those should be included at least for now. Mainly just as a temporary measure during development. However, at this point I may be able to skip adding the regular GLSL directory.

Yes, not all of the shaders have been updated yet. I may actually have that one done locally, I'll have to check.
dermont
Bugbear
Posts: 812
Joined: Thu Dec 09, 2004 2:51 am
x 42

Re: OpenGL 3+ RenderSystem

Post by dermont »

masterfalcon wrote: Binary programs haven't been really tested yet and may not work right.
Yeah I can delete cache.bin between runs.
masterfalcon wrote: Yes, not all of the shaders have been updated yet. I may actually have that one done locally, I'll have to check.
After updating it hardware skinning is enabled but only if software blending technique is removed, why is this?

Out of interest I was trying to get retrieve the source from a unified vertex program via getSource but it appears that I need a further step via the program returned by _getBindingDelegate(). How does the RTShaderLib handle this?

Also the browser samples and the libraries I tried updating btOgre/ogreode appear to be 30% slower than GL2.

Thanks for all your help so far and sorry for all the dumb questions; I'm not familiar with ogre sample framework/sdktrays so it's pretty difficult finding exactly what is need for GL3.
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: OpenGL 3+ RenderSystem

Post by masterfalcon »

I haven't profiled yet but I would bet that a large amount of the performance decrease is due to the RTSS generated shaders.
dermont
Bugbear
Posts: 812
Joined: Thu Dec 09, 2004 2:51 am
x 42

Re: OpenGL 3+ RenderSystem

Post by dermont »

It appears that the GL3 renderer segfaults on Linux startup:

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
0xb7c09ff8 in Ogre::GpuProgramManager::setSaveMicrocodesToCache(bool) ()
   from /home/dermont/TEST/build/v1-9/lib/libOgreMain.so.1.9.0
(gdb) bt
#0  0xb7c09ff8 in Ogre::GpuProgramManager::setSaveMicrocodesToCache(bool) ()
   from /home/dermont/TEST/build/v1-9/lib/libOgreMain.so.1.9.0
#1  0xb3e29685 in Ogre::GL3PlusRenderSystem::createRenderSystemCapabilities() const () from /home/dermont/TEST/build/v1-9/lib/RenderSystem_GL3Plus.so.1.9.0
#2  0xb3e3b199 in Ogre::GL3PlusRenderSystem::_createRenderWindow(std::string const&, unsigned int, unsigned int, bool, std::map<std::string, std::string, std::less<std::string>, Ogre::STLAllocator<std::pair<std::string const, std::string>, Ogre::CategorisedAllocPolicy<(Ogre::MemoryCategory)0> > > const*) ()
   from /home/dermont/TEST/build/v1-9/lib/RenderSystem_GL3Plus.so.1.9.0
#3  0xb3dfec21 in Ogre::GLXGLSupport::createWindow(bool, Ogre::GL3PlusRenderSystem*, std::string const&) ()
   from /home/dermont/TEST/build/v1-9/lib/RenderSystem_GL3Plus.so.1.9.0
#4  0xb3e40e27 in Ogre::GL3PlusRenderSystem::_initialise(bool, std::string const&) () from /home/dermont/TEST/build/v1-9/lib/RenderSystem_GL3Plus.so.1.9.0
#5  0xb7e16fed in Ogre::Root::initialise(bool, std::string const&, std::string const&) () from /home/dermont/TEST/build/v1-9/lib/libOgreMain.so.1.9.0
#6  0x08052b04 in OgreBites::SampleBrowser::createWindow() ()
#7  0x08063cc0 in OgreBites::SampleBrowser::setup() ()
#8  0x080526df in OgreBites::SampleContext::initApp(OgreBites::Sample*) ()
#9  0x08052538 in OgreBites::SampleContext::go(OgreBites::Sample*) ()
#10 0x0804ff4c in main ()
If I revert the setSaveMicrocodesToCache to how it was set previously in initialiseFromRenderSystemCapabilities after the GL3PlusGpuProgramManager is instantiated it runs OK. Hopefully this isn't related to the recent fix for the unity build.

One more thing when running VTests via the cfg file and the GL3 renderer fails it appears to fall back to running the tests for the GL renderer or does it run the tests for all render systems.
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: OpenGL 3+ RenderSystem

Post by masterfalcon »

I don't think that it's related to that build fix. However do you recall which revision made that change?

I'm not very concerned about the visual tests running at this moment. Hopefully I'll be able to revisits them soon though.
dermont
Bugbear
Posts: 812
Joined: Thu Dec 09, 2004 2:51 am
x 42

Re: OpenGL 3+ RenderSystem

Post by dermont »

Unity build fix (second one where you had to update for OSX)
https://bitbucket.org/sinbad/ogre/commi ... 1e6adfa42e

https://bitbucket.org/sinbad/ogre/commi ... 0585cb2037

The setSaveMicrocodesToCache update.

https://bitbucket.org/sinbad/ogre/diff/ ... 8e&at=v1-9

Sorry looking at the cache update it is very recent (10 hours ago) - you probably haven't had time to fully test.
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: OpenGL 3+ RenderSystem

Post by masterfalcon »

Yeah, I also don't really have a machine that fully supports that extension either, I don't think. I'll have to get back to you on that
dermont
Bugbear
Posts: 812
Joined: Thu Dec 09, 2004 2:51 am
x 42

Re: OpenGL 3+ RenderSystem

Post by dermont »

Sorry not quite user what extension you are referring to.

The cause of the segfault is simply that you are calling mGpuProgramManager->setSaveMicrocodesToCache before mGpuProgramManager (GL3PlusGpuProgramManager) has even been created.
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: OpenGL 3+ RenderSystem

Post by masterfalcon »

My linux machine isn't working at the moment so I can't test out a situation where retrieving program binaries is possible. Would you be able to test this out?

Code: Select all

diff --git a/RenderSystems/GL3Plus/src/OgreGL3PlusRenderSystem.cpp b/RenderSystems/GL3Plus/src/OgreGL3PlusRenderSystem.cpp
--- a/RenderSystems/GL3Plus/src/OgreGL3PlusRenderSystem.cpp
+++ b/RenderSystems/GL3Plus/src/OgreGL3PlusRenderSystem.cpp
@@ -447,9 +447,6 @@
         if (mGLSupport->checkExtension("GL_ARB_get_program_binary") || gl3wIsSupported(4, 1))
 		{
 			rsc->setCapability(RSC_CAN_GET_COMPILED_SHADER_BUFFER);
-
-            // Enable microcache
-            mGpuProgramManager->setSaveMicrocodesToCache(true);
 		}
 
         if (mGLSupport->checkExtension("GL_ARB_instanced_arrays") || gl3wIsSupported(3, 3))
@@ -518,6 +515,12 @@
         // Create the texture manager        
         mTextureManager = new GL3PlusTextureManager(*mGLSupport);
 
+        if (caps->hasCapability(RSC_CAN_GET_COMPILED_SHADER_BUFFER))
+		{
+            // Enable microcache
+            mGpuProgramManager->setSaveMicrocodesToCache(true);
+		}
+
         mGLInitialised = true;
     }
dermont
Bugbear
Posts: 812
Joined: Thu Dec 09, 2004 2:51 am
x 42

Re: OpenGL 3+ RenderSystem

Post by dermont »

masterfalcon wrote:My linux machine isn't working at the moment so I can't test out a situation where retrieving program binaries is possible. Would you be able to test this out?
Yes that works it's pretty much how I updated.

Also when RTShaderSystem is disabled the build fails.

Code: Select all

diff --git a/RenderSystems/GL3Plus/src/OgreGL3PlusRenderSystem.cpp b/RenderSystems/GL3Plus/src/OgreGL3PlusRenderSystem.cpp
--- a/RenderSystems/GL3Plus/src/OgreGL3PlusRenderSystem.cpp
+++ b/RenderSystems/GL3Plus/src/OgreGL3PlusRenderSystem.cpp
@@ -154,7 +154,9 @@
         mCurrentDomainProgram = 0;
         mCurrentComputeProgram = 0;
         mPolygonMode = GL_FILL;
+#ifdef RTSHADER_SYSTEM_BUILD_CORE_SHADERS
         mEnableFixedPipeline = false;
+#endif
     }
 
     GL3PlusRenderSystem::~GL3PlusRenderSystem()
Since the SampleBrowser will not run without the RTShaderSystem lib it's not possible to test this, so it's your choice whether you implement this.
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: OpenGL 3+ RenderSystem

Post by masterfalcon »

The RTSS is required for GL3+ just like it is for DX11 and GL ES 2. None of them have a fixed function pipeline and need the RTSS for emulation of that functionality.
dermont
Bugbear
Posts: 812
Joined: Thu Dec 09, 2004 2:51 am
x 42

Re: OpenGL 3+ RenderSystem

Post by dermont »

OK I had been using one version of Ogre built with RTSS disabled to test simple shader based materials. So this is not possible?

For me it is next to impossible to track down via RTSS why RTTS is implementing it's own fragment/vertex shader code for my shader based materials (using ShaderGeneratorTechniqueResolverListener) and what this code looks like so at least I can update accordingly.
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: OpenGL 3+ RenderSystem

Post by masterfalcon »

What do your material and shaders look like? It could be a simple issue.
User avatar
holocronweaver
Google Summer of Code Student
Google Summer of Code Student
Posts: 273
Joined: Mon Oct 29, 2012 8:52 pm
Location: Princeton, NJ
x 47

Re: OpenGL 3+ RenderSystem

Post by holocronweaver »

Not sure if this is the right thread to discuss OpenGL ES matters.

I managed to compile your ogre-glesw branch, but cannot remember what tests you wanted done. Could you refresh my memory? I am using the AMD OpenGL ES SDK on Linux (Ubuntu 13.04 x64).
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: OpenGL 3+ RenderSystem

Post by masterfalcon »

Nope, let's keep that out of this thread. I really just wanted to make sure that it works for everyone. Let me know on twitter.
uelkfr
Gnoblar
Posts: 12
Joined: Wed Jun 05, 2013 6:19 am

Re: OpenGL 3+ RenderSystem

Post by uelkfr »

This is good piece of information for development I think:
https://developer.nvidia.com/sites/defa ... cs/Porting Source to Linux.pdf
User avatar
holocronweaver
Google Summer of Code Student
Google Summer of Code Student
Posts: 273
Joined: Mon Oct 29, 2012 8:52 pm
Location: Princeton, NJ
x 47

Re: OpenGL 3+ RenderSystem

Post by holocronweaver »

Anyone else having trouble with GL3+ in the SampleBrowser in Linux recently? It was running fine until I did my first pull in about a month and now I get allot of INVALID_OPERATION GLSL linker errors:

ERROR: error(#401) Function: FFP_TransformTexCoord(fv1;fv2;fv2; is not implemented

Looking in GLSL150/FFPLib_Texturing.glsl, this function is definitely defined, so something further up the RTSS chain or in the SampleBrowser must be awry.

(Legacy OpenGL works fine with the SampleBrowser.)
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: OpenGL 3+ RenderSystem

Post by masterfalcon »

Does it sound like the same issue as this? http://www.ogre3d.org/forums/viewtopic.php?f=2&t=78126
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: OpenGL 3+ RenderSystem

Post by masterfalcon »

Nevermind. I figured out when I broke it.
User avatar
holocronweaver
Google Summer of Code Student
Google Summer of Code Student
Posts: 273
Joined: Mon Oct 29, 2012 8:52 pm
Location: Princeton, NJ
x 47

Re: OpenGL 3+ RenderSystem

Post by holocronweaver »

I was just hunting down the revision myself. :) Which was it? How did you figure it out?
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: OpenGL 3+ RenderSystem

Post by masterfalcon »

Revision 4693. I tracked it down with a regular binary search. I added new shader parameters but forgot to notify the RTSS of the changes.
User avatar
holocronweaver
Google Summer of Code Student
Google Summer of Code Student
Posts: 273
Joined: Mon Oct 29, 2012 8:52 pm
Location: Princeton, NJ
x 47

Re: OpenGL 3+ RenderSystem

Post by holocronweaver »

masterfalcon wrote:I tracked it down with a regular binary search.
Do you mean via a debugger, or Mercurial? I am pretty new to Mercurial so I am not sure what tools are available for quickly figuring out what revision broke what. I was rewinding revisions in my local repo until I reached a point that everything worked (in my case, 4680), then fastforward from there to each revision that seemed relevant.

EDIT:
BTW, I tested your commit and the SampleBrowser lives once more.
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: OpenGL 3+ RenderSystem

Post by masterfalcon »

I did it via mercurial. Just go back a ways, and check it out.
User avatar
holocronweaver
Google Summer of Code Student
Google Summer of Code Student
Posts: 273
Joined: Mon Oct 29, 2012 8:52 pm
Location: Princeton, NJ
x 47

Re: OpenGL 3+ RenderSystem

Post by holocronweaver »

*faceplam* I did not know about hg bisect. That is much easier than what I was doing.

Edit: Is there a way to get around recompiling Ogre from scratch each time I want to test a revision?
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2703
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 51

Re: OpenGL 3+ RenderSystem

Post by syedhs »

Maybe you can enable unity build in CMAKE configuration which is a lot quicker.
A willow deeply scarred, somebody's broken heart
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me