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

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.

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

Postby Assaf Raman » Mon Jan 03, 2011 8:44 pm

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.

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. - 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
Kudos: 79
Joined: 11 Apr 2006
Location: TLV, Israel

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

Postby Assaf Raman » Tue Jan 04, 2011 7:22 pm

I created a CMakeLists.txt for hlsl2glslfork, and submitted it as a patch: 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 260 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.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
 
Posts: 3092
Kudos: 79
Joined: 11 Apr 2006
Location: TLV, Israel

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

Postby criatura » Thu Aug 02, 2012 6:56 am

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
criatura
Gnoblar
 
Posts: 17
Kudos: 1
Joined: 17 Jul 2011

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

Postby Assaf Raman » Thu Aug 02, 2012 8:03 am

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.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
 
Posts: 3092
Kudos: 79
Joined: 11 Apr 2006
Location: TLV, Israel

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

Postby simedj » Wed Mar 05, 2014 10:44 pm

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.
simedj
Goblin
 
Posts: 260
Kudos: 3
Joined: 18 Nov 2011

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

Postby masterfalcon » Thu Mar 06, 2014 7:18 am

It was me who built it. I basically just took the OS X project and switched the SDK and targets. That's it!
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
 
Posts: 4267
Kudos: 130
Joined: 25 Feb 2007
Location: Bloomington, MN

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

Postby simedj » Thu Mar 06, 2014 9:28 am

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: 260
Kudos: 3
Joined: 18 Nov 2011

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

Postby simedj » Thu Mar 06, 2014 4:14 pm

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.
simedj
Goblin
 
Posts: 260
Kudos: 3
Joined: 18 Nov 2011

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

Postby masterfalcon » Thu Mar 06, 2014 5:29 pm

for iOS you just need to remove that include and instead include assert.h
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
 
Posts: 4267
Kudos: 130
Joined: 25 Feb 2007
Location: Bloomington, MN

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

Postby simedj » Thu Mar 06, 2014 6:30 pm

Awesome, thanks.
Looking to find experienced Ogre & shader developers/artists. PM me with a contact email address if interested.
simedj
Goblin
 
Posts: 260
Kudos: 3
Joined: 18 Nov 2011


Return to Mobile Devices

Who is online

Users browsing this forum: acsabo and 1 guest