Added: Cg support to the ES 2.x render system

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
Post Reply
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Added: Cg support to the ES 2.x render system

Post by Assaf Raman »

I just committed Cg support for ES 2.x render system.

NVIDIA doesn't provide it's Cg parser source code (at least not a usable one), so a Cg to glsl converter is used to do the trick.
You can download it from: http://code.google.com/p/hlsl2glslfork/

I added a new CMake flag named "OGRE_CG_SUPPORT_FOR_GLES2" that is available if you have the ES 2.x render system.

The code needed for this support on the OGRE side is finished as far as I can tell.

[s]The converter doesn't do such a good job in many cases, I fixed some of them in this patch - there is still some work on it to get it to be prefect.[/s] - edit - they committed my changes.

Unity3D uses the same parser so it has the same or worse Cg support for ES 2.x.

All the code is committed to the trunk.
Watch out for my OGRE related tweets here.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: Added: Cg support to the ES 2.x render system

Post by Assaf Raman »

[s]I created a CMakeLists.txt for hlsl2glslfork, and submitted it as a patch:[/s] EDIT: Added to hlsl2glslfork source control.


hlsl2glslfork generates files with windows exes that come from the source control as part of the win32 visual studio build process, I assume that some OGRE users don't have access to windows, so I attached the files to this thread
MachineIndependent.zip
(51.68 KiB) Downloaded 1655 times
the files path is: hlslang\MachineIndependent
EDIT: I tried to fix it in the CMakeLists.txt for LINUX and MAC - I will happy for feedback.

I also asked the source control owner to add the files to the source control.
EDIT: He didn't want to do it yet - he asked for a sample of platforms that the files are not created on when you run CMake
Watch out for my OGRE related tweets here.
criatura
Gnoblar
Posts: 23
Joined: Sun Jul 17, 2011 1:35 am
x 1

Re: Added: Cg support to the ES 2.x render system

Post by criatura »

Hi, compiling at Linux I have the following problems with hlsl2glsltest.cpp :

Cant find OpenGL/OpenGL.h and <AGL/agl.h>, it seems that is trying to include files related with a Mac environment instead of Linux.

Greetings
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: Added: Cg support to the ES 2.x render system

Post by Assaf Raman »

Sorry, I don't have a linux test environment, you will have to try to solve this on your own.
Watch out for my OGRE related tweets here.
simedj
Goblin
Posts: 262
Joined: Fri Nov 18, 2011 6:50 pm
x 3

Re: Added: Cg support to the ES 2.x render system

Post by simedj »

Sorry to dredge an old thread but it seemed relevant. Is there any setup to build HLSL2GLSLfork for iOS? I just cloned the source from github and there only seems to be OSX support for Mac, I couldn't see any options in CMake scripts either.

I am using a pre-built version of this library but I don't know where it came from or who built it! Maybe someone's fork has iOS support already?
Looking to find experienced Ogre & shader developers/artists. PM me with a contact email address if interested.
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126
Contact:

Re: Added: Cg support to the ES 2.x render system

Post by masterfalcon »

It was me who built it. I basically just took the OS X project and switched the SDK and targets. That's it!
simedj
Goblin
Posts: 262
Joined: Fri Nov 18, 2011 6:50 pm
x 3

Re: Added: Cg support to the ES 2.x render system

Post by simedj »

That's what I was going to do myself, I had to do the same for MyGUI. So it should be OK.

I wish I knew CMake better, so I could do this in CMake and submit it - and then figure out how to integrate HLSL2GLSL into my OgreDeps setup. Is that what you've done, or like me do you have a mess of different libraries you have to build individually?

It would be really cool if hlsl2glsl and glsloptimiser could be supplied in the iOS dependencies download, I know they're a little of an edge case but they're not very big.
Looking to find experienced Ogre & shader developers/artists. PM me with a contact email address if interested.
simedj
Goblin
Posts: 262
Joined: Fri Nov 18, 2011 6:50 pm
x 3

Re: Added: Cg support to the ES 2.x render system

Post by simedj »

Hmm, actually it seems a bit more complex.

OSDependent/Mac has osinclude.h which tries to include <Carbon/carbon.h>

I'll see if I can skip this entire file, some of the stuff in there I have no idea what it's for :)
Looking to find experienced Ogre & shader developers/artists. PM me with a contact email address if interested.
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126
Contact:

Re: Added: Cg support to the ES 2.x render system

Post by masterfalcon »

for iOS you just need to remove that include and instead include assert.h
simedj
Goblin
Posts: 262
Joined: Fri Nov 18, 2011 6:50 pm
x 3

Re: Added: Cg support to the ES 2.x render system

Post by simedj »

Awesome, thanks.
Looking to find experienced Ogre & shader developers/artists. PM me with a contact email address if interested.
Post Reply