Page 1 of 1

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

Posted: Mon Jan 03, 2011 8:44 pm
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.

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

Posted: Tue Jan 04, 2011 7:22 pm
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

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

Posted: Thu Aug 02, 2012 6:56 am
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

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

Posted: Thu Aug 02, 2012 8:03 am
by Assaf Raman
Sorry, I don't have a linux test environment, you will have to try to solve this on your own.

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

Posted: Wed Mar 05, 2014 10:44 pm
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?

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

Posted: Thu Mar 06, 2014 7:18 am
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!

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

Posted: Thu Mar 06, 2014 9:28 am
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.

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

Posted: Thu Mar 06, 2014 4:14 pm
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 :)

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

Posted: Thu Mar 06, 2014 5:29 pm
by masterfalcon
for iOS you just need to remove that include and instead include assert.h

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

Posted: Thu Mar 06, 2014 6:30 pm
by simedj
Awesome, thanks.