Volker wrote:
Since shaders are only resources that can be loaded at runtime, I don't think it would be a big problem if we have separate shaders for desktop and mobile systems. Horde3D should be capable to run both depending on what rendering backend has been selected. So if Horde3D is running the ES renderer, you load the GLSL ES shaders and on desktop systems you load the desktop renderer with it's shaders.
That would work. My issue is that as an Indie developer working in a real world project, i would definitely not like to have two or more sets of shaders and have to maintain them, so all my design work thinking about the port was with the intuit of having the least amount of work managing assets and shaders.
Quote:
In a perfect world, you can detect the system automatically and have shader implementations that results in the same rendering on both systems. Of course that means that you are limited to the capabilities of the ES platform you have. But I don't think that we should go the Qt way to try to merge both shader languages to one, to avoid rewrite of shader code. For common code parts you already have the Code resources we can include in shaders (or isn't that possible in ES shaders? ).
For this case the deprecated resource directories became useful again, because you could just change the resource directory for shaders to something like DESKTOP or MOBILE and don't have to duplicate materials only for loading another kind of shader.
Well GLSL ES has different qualifiers, and the languages aren't really fully compatible. So the amount of "common code" is not as common as one would hope for. There are a few conversion tools
http://sourceforge.net/projects/hlsl2glsl/ that help but that's adding extra tools to the pipeline. Something i try to avoid like the plague.
This is one source of struggle with the design of the port. Do we simply extend the engine and use different shaders, like for instance openscenegraph is doing. Use different code branches and create a tool to compile Code resources for each and have the runtime pick the correct option.
Then my brain goes into abstract more and tries to come up with anwsers to stuff like: How to accommodate to different backends if we port to DX9/10/11, how to support different languages and geometry, compute shaders... then there's the OpenGL 3.x context that also removes fixed function and requires that you use uniforms instead of the GL matrix commands, like ES 2.x, etc... So now you have manage (X) shaders for every (X) backend. Would it be simpler to use Cg and parse to diff contexts.... there is allot of design work and design decisions to be done and quite frankly it's allot of work, and many intrusive operations, so if anyone was going to pursue this it would possibly be best to develop another branch. If you try to be as abstract and general as possible to accommodate all sort of backends, the job gets tough. A really super extensible system is possible but it requires a huge amount of work so it may be counter producent. I tried to do this sort of system once and lost 6 months with no real solution, and at the time only 3 APIs DX9, OGL 2.x, OGL ES 2.x. It's a huge task.
So adding just iPhone support is a much more manageable task. If we just pragmatically do the changes necessary to support it: replace the gl matrix code, use different shaders for each version Desktop or Mobile is not a huge problem and there are tools that can help to port and manage the differences. OpenSceneGraph has a list of mini tasks that covers many of the things necessary to port to ES 2.x
http://www.openscenegraph.org/projects/ ... /OpenGL-ESOpenGL 3.x actually has allot of stuff in common with ES 2.x (i read somewhere that the spec goals, like remove fixed function and make the API more compact to be able to use ES 2.x and OGL 3.x in close relation) so it may not be a bad idea to try and figure out how to support it as well. I actually now have a OGL 3.1 card so i may try and write something in OGL 3.x and see what similarities there are with ES 2.x
Quote:
Another problem is that we have to add some kind of compiled shader resource for the ES backend, but that shouldn't be a problem, should it?
No, that is actually the easy part of the problem. If you read the book i mentioned a few posts ago it shows exactly how to build such a framework.
I mentioned the Qt/3D because they try to solve many issues in a abstract and general way. So if you want to latter add support for Android and other devices Qt provides the abstraction layer and API to do the changes with the least amount of work on H3D part, since they are the ones that add support for more platforms, windowing, UI, and other plumbing issues. But they are also in a very embryonic state. Perhaps by the time of Qt 4.8 this will be a viable option and for now we should just do what everyone else is doing and do a simple port, use two sets of shaders and then try to come up with a smart way to manage platform differences.