OpenGL 3+ RenderSystem
-
scrawl
- OGRE Expert User

- Posts: 1119
- Joined: Sat Jan 01, 2011 7:57 pm
- x 220
Re: OpenGL 3+ RenderSystem
Still have not tried this yet, due to the aforementioned error.
Just found this analysis of Ogre's GL2 renderer (which looks pretty bad): https://github.com/realXtend/naali/issues/440
I guess that most of the issues would hopefully be addressed by state caching (as in the roadmap) and the new GL3 renderer. It might be worth to use gDebugger, it alerts you of legacy functions and redundant calls.
Just found this analysis of Ogre's GL2 renderer (which looks pretty bad): https://github.com/realXtend/naali/issues/440
I guess that most of the issues would hopefully be addressed by state caching (as in the roadmap) and the new GL3 renderer. It might be worth to use gDebugger, it alerts you of legacy functions and redundant calls.
-
sparkprime
- Ogre Magi
- Posts: 1137
- Joined: Mon May 07, 2007 3:43 am
- Location: Ossining, New York
- x 13
Re: OpenGL 3+ RenderSystem
My batch count is currently about 4 or 5 times what it should be, and has been getting worse the more I have been using shaders and the like. I haven't properly investigated it yet, but I'm pretty sure it's worse in GL than D3D. I'm expecting to have to do significant work within Ogre to resolve this, and don't plan to do that for a few months. I may even do it on D3D9-only at first since that's where most of the users are. But i'm interested in discussing the subject generally.
-
sparkprime
- Ogre Magi
- Posts: 1137
- Joined: Mon May 07, 2007 3:43 am
- Location: Ossining, New York
- x 13
Re: OpenGL 3+ RenderSystem
My shaders use dozens of uniforms, most of the values of which do not change from frame to frame, so uniform buffers seem like a good thing to explore.
-
masterfalcon
- OGRE Retired Team Member

- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: OpenGL 3+ RenderSystem
Definitely. That's a high priority item.
The only thing that I need to figure out is exactly when we should use them. Only for shared parameter blocks?
The only thing that I need to figure out is exactly when we should use them. Only for shared parameter blocks?
-
sparkprime
- Ogre Magi
- Posts: 1137
- Joined: Mon May 07, 2007 3:43 am
- Location: Ossining, New York
- x 13
Re: OpenGL 3+ RenderSystem
What are shared parameter blocks exactly? These are the GpuProgramParameters objects that are reference counted and shared between GPU programs?
I believe I have one per material so I am probably not sharing those very much (no more than material sharing either). But if that means repeated renders (across frames) with no changes to materials run a lot faster, that is a big step forwards.
What about splitting off the scene stuff into a separate block of uniforms? It could be possible to provide a single block with all of the per-frame stuff in it, like sun colour, shadow camera settings, and whatever. This stuff does change for me every frame (there is a day/night cycle) but it could be uploaded and then shared by all the draw calls in that frame. Some room for custom parameters within the scene uniforms would be good too. Maybe this should be per render target actually?
Also splitting off custom movable object parameters into their own block (per movable object) -- is that a good idea?
I believe I have one per material so I am probably not sharing those very much (no more than material sharing either). But if that means repeated renders (across frames) with no changes to materials run a lot faster, that is a big step forwards.
What about splitting off the scene stuff into a separate block of uniforms? It could be possible to provide a single block with all of the per-frame stuff in it, like sun colour, shadow camera settings, and whatever. This stuff does change for me every frame (there is a day/night cycle) but it could be uploaded and then shared by all the draw calls in that frame. Some room for custom parameters within the scene uniforms would be good too. Maybe this should be per render target actually?
Also splitting off custom movable object parameters into their own block (per movable object) -- is that a good idea?
-
masterfalcon
- OGRE Retired Team Member

- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: OpenGL 3+ RenderSystem
Yeah that's right. The main purpose of them now is to make groups of parameters easily shared between Ogre program definitions. But it could be used as a hint to create a UBO, which would still be useful for a single material.
I don't think we should have a large built in shared parameter block. Not all of them would be necessary for everyone and it would result extra uniforms being updated and larger uniform buffers.
I don't think we should have a large built in shared parameter block. Not all of them would be necessary for everyone and it would result extra uniforms being updated and larger uniform buffers.
-
PhilipLB
- Google Summer of Code Student

- Posts: 550
- Joined: Thu Jun 04, 2009 5:07 pm
- Location: Berlin
- x 108
Re: OpenGL 3+ RenderSystem
OpenGL 4.3 just got released and adds Compute Shader. So they are available for DX11 and GL4.3 now and it's imaginable to have them in Ogre, too?
http://www.opengl.org/documentation/current_version/
http://www.opengl.org/documentation/current_version/
Google Summer of Code 2012 Student
Topic: "Volume Rendering with LOD aimed at terrain"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Mattan Furst
Volume GFX, accepting donations.
Topic: "Volume Rendering with LOD aimed at terrain"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Mattan Furst
Volume GFX, accepting donations.
-
sparkprime
- Ogre Magi
- Posts: 1137
- Joined: Mon May 07, 2007 3:43 am
- Location: Ossining, New York
- x 13
Re: OpenGL 3+ RenderSystem
How large would it be though? About 20 floats or something? And it'd updated once per frame. I dunno about GL but in CUDA the constant buffer on a nvidia card is about 64k (8k of it being cached or something like that) so I don't think we'd have a space problem. It'd probably be worse to try and have custom buffers for every material anyway (with only the uniforms they needed). That would be duplication, surely?masterfalcon wrote:I don't think we should have a large built in shared parameter block. Not all of them would be necessary for everyone and it would result extra uniforms being updated and larger uniform buffers.
-
sparkprime
- Ogre Magi
- Posts: 1137
- Joined: Mon May 07, 2007 3:43 am
- Location: Ossining, New York
- x 13
Re: OpenGL 3+ RenderSystem
Related to this sort of thing -- At the moment I'm binding 5 textures for every draw --
* shadow texture 1
* shadow texture 2
* shadow texture 3
* PCF noise texture
* stipple texture (for fade)
These ought to be candidates for some sort of 'scene' state too, right? Keep these guys bound in the first few slots while changing everything else from draw to draw?
disclaimer: Actually since I started using deferred shading only forward shaded objects are like this, but there is still that stipple guy for everything else too.
* shadow texture 1
* shadow texture 2
* shadow texture 3
* PCF noise texture
* stipple texture (for fade)
These ought to be candidates for some sort of 'scene' state too, right? Keep these guys bound in the first few slots while changing everything else from draw to draw?
disclaimer: Actually since I started using deferred shading only forward shaded objects are like this, but there is still that stipple guy for everything else too.
-
sparkprime
- Ogre Magi
- Posts: 1137
- Joined: Mon May 07, 2007 3:43 am
- Location: Ossining, New York
- x 13
Re: OpenGL 3+ RenderSystem
Or is it in fact better to have the first 5 textures in your materials be the same, so that there is no actual state change (even if Ogre issues one to the render system)?
-
Shtuka
- Greenskin
- Posts: 146
- Joined: Mon Jan 10, 2011 7:39 pm
- x 9
Re: OpenGL 3+ RenderSystem
The most recent update is from 23/07/2012. What is missing? Can I somehow help?
-
masterfalcon
- OGRE Retired Team Member

- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: OpenGL 3+ RenderSystem
I've got a whole lot of work in progress. Some of which I could commit. Just been busy.
-
TheSHEEEP
- OGRE Retired Team Member

- Posts: 972
- Joined: Mon Jun 02, 2008 6:52 pm
- Location: Berlin
- x 65
Re: OpenGL 3+ RenderSystem
I'd be interested in this as well.PhilipLB wrote:OpenGL 4.3 just got released and adds Compute Shader. So they are available for DX11 and GL4.3 now and it's imaginable to have them in Ogre, too?
http://www.opengl.org/documentation/current_version/
Compute Shaders sound very useful, indeed. And as I'm not a friend of DirectX (or rather programming in different languages for different platforms when OpenGL works everywhere), it would be great to have access to those in Ogre.
Then again, I guess you could simply use Compute Shaders yourself without Ogre offering any interface for it (as long as Ogre itself does use OpenGL, of course).
From the examples I've seen so far - this one is DirectX, but OpenGL can't be that different here - that shouldn't pose that much of a problem.
-
sparkprime
- Ogre Magi
- Posts: 1137
- Joined: Mon May 07, 2007 3:43 am
- Location: Ossining, New York
- x 13
Re: OpenGL 3+ RenderSystem
Are they much different to OpenCL / CUDA?
-
TheSHEEEP
- OGRE Retired Team Member

- Posts: 972
- Joined: Mon Jun 02, 2008 6:52 pm
- Location: Berlin
- x 65
Re: OpenGL 3+ RenderSystem
I've read somewhere that they are indeed very different to OpenCL.
I haven't used them, of course, but what I read was that OpenCL was designed to be primarily for that - doing all sorts of calculations on the GPU. It has an extra interface, which seems to be very different from the normal shader interface, etc.
But focusing on OpenCL/CUDA is of very limited use to 95% of projects, I'd say. Too much hassle for not enough gain. Also, how much % of the current hardware does support that at all?
Most OpenGL projects may want to use it "just a bit" at some points. For those projects, going the full OpenCL/CUDA way would be madness, so Compute Shaders were introduced to OpenGL for those developers.
At least, this is how I see it.
And in any case, it will be some time anyway before 4.3 will be spread enough to be implemented and then used.
Like using DirectX 10 features was rather pointless in the beginning as almost no client PC would be able to use them.
So I'd say, don't mind that for now and focus on the 3.0+ support, as I think you're doing anyway, without me playing Captain Obvious
I haven't used them, of course, but what I read was that OpenCL was designed to be primarily for that - doing all sorts of calculations on the GPU. It has an extra interface, which seems to be very different from the normal shader interface, etc.
But focusing on OpenCL/CUDA is of very limited use to 95% of projects, I'd say. Too much hassle for not enough gain. Also, how much % of the current hardware does support that at all?
Most OpenGL projects may want to use it "just a bit" at some points. For those projects, going the full OpenCL/CUDA way would be madness, so Compute Shaders were introduced to OpenGL for those developers.
At least, this is how I see it.
And in any case, it will be some time anyway before 4.3 will be spread enough to be implemented and then used.
Like using DirectX 10 features was rather pointless in the beginning as almost no client PC would be able to use them.
So I'd say, don't mind that for now and focus on the 3.0+ support, as I think you're doing anyway, without me playing Captain Obvious
-
Kojack
- OGRE Moderator

- Posts: 7157
- Joined: Sun Jan 25, 2004 7:35 am
- Location: Brisbane, Australia
- x 538
Re: OpenGL 3+ RenderSystem
(Neil Trevett is the president of the Khronos Group)The OpenGL compute shader is not designed to replace APIs like OpenCL, which has the advantage of being able to run on CPUs, GPUs and other processors.
“OpenCL is designed for large, standalone compute applications,” explains Trevett. “OpenGL shaders are designed for smaller amounts of compute that you can express in a GLSL shader but want to interoperate with the rest of the GL pipeline. Quite different use cases.”
There have also been some developments to OpenCL that make it easier to develop OpenCL applications using a new Open Source API for OpenCL Prototyping called CLU. According to Trevett, CLU should help reduce the time it takes programmers to develop their first OpenCL application from two days to an hour.
http://develop3d.com/blog/2012/08/siggr ... n-graphics
-
holocronweaver
- Google Summer of Code Student

- Posts: 273
- Joined: Mon Oct 29, 2012 8:52 pm
- Location: Princeton, NJ
- x 47
Re: OpenGL 3+ RenderSystem
Just to be clear, tessellation shaders from OpenGL 4 are being implemented in this render system update, correct?
This is the #1 feature that is preventing me from using OGRE in my game engine. I rely heavily upon tessellation shaders for procedural terrain and meshes. The performance boost and ease of maintenance have saved me weeks worth of development time.
If there is anything I can do to help implement tessellation shaders and get them into the 1.9 repository, let me know. Coding, testing, whatever you like, I am on it.
This is the #1 feature that is preventing me from using OGRE in my game engine. I rely heavily upon tessellation shaders for procedural terrain and meshes. The performance boost and ease of maintenance have saved me weeks worth of development time.
If there is anything I can do to help implement tessellation shaders and get them into the 1.9 repository, let me know. Coding, testing, whatever you like, I am on it.
-
masterfalcon
- OGRE Retired Team Member

- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: OpenGL 3+ RenderSystem
They will be. I haven't yet but I've been planning on doing so very soon. Though I'll be testing it on linux. Someone will need to do the Win32 support.
-
holocronweaver
- Google Summer of Code Student

- Posts: 273
- Joined: Mon Oct 29, 2012 8:52 pm
- Location: Princeton, NJ
- x 47
Re: OpenGL 3+ RenderSystem
So long as it does not involve conversion from OpenGL to D3D, I could try my hand at the Win32 port. Is the Linux implementation far enough along to begin porting? If not, do you possibly have an ETA on when it will? Cross-platform compilation is important to my current project so I have a strong interest in seeing this through.
-
masterfalcon
- OGRE Retired Team Member

- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: OpenGL 3+ RenderSystem
Well basically I just need to update the windowing to create a the right context. Also, and I cannot reiterate this enough:
The GL3+ rendersystem will not be final for 1.9, but will be included as experimental or alpha. It's functional, but not finished. There will be bugs and possibly performance regressions. But it's a very large step forward and those issues will be resolved with time.
The GL3+ rendersystem will not be final for 1.9, but will be included as experimental or alpha. It's functional, but not finished. There will be bugs and possibly performance regressions. But it's a very large step forward and those issues will be resolved with time.
-
TheSHEEEP
- OGRE Retired Team Member

- Posts: 972
- Joined: Mon Jun 02, 2008 6:52 pm
- Location: Berlin
- x 65
Re: OpenGL 3+ RenderSystem
Would it make sense to have rather structured plan (probably Excel or Google Drive spreadsheet) explaining what remains to be done for GL3+?
This way, it would be easier to split into single tasks and with single tasks defined, other people might be able help out.
This way, it would be easier to split into single tasks and with single tasks defined, other people might be able help out.
-
masterfalcon
- OGRE Retired Team Member

- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: OpenGL 3+ RenderSystem
That will also come soon. I have a list locally that I've been working off of.
-
Wolfmanfx
- OGRE Team Member

- Posts: 1525
- Joined: Fri Feb 03, 2006 10:37 pm
- Location: Austria - Leoben
- x 100
-
spacegaier
- OGRE Team Member

- Posts: 4308
- Joined: Mon Feb 04, 2008 2:02 pm
- Location: Germany
- x 137
Re: OpenGL 3+ RenderSystem
+1Wolfmanfx wrote:Jira!
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
-
TheSHEEEP
- OGRE Retired Team Member

- Posts: 972
- Joined: Mon Jun 02, 2008 6:52 pm
- Location: Berlin
- x 65
