GLSL Bytecode

Started by
14 comments, last by Lord_Evil 13 years, 4 months ago
EngineCoder do you have an example.
Advertisement
Quote:Original post by kubapl
EngineCoder do you have an example.


1. Download and install Cg toolkit.
2. Open command prompt. CD into a directory that contains your GLSL shader.
3. cgc -oglsl -profile arbfp1 normal_map.fp > normal_map.frag.asm
In this example, normal_map.fp is the GLSL fragment program and normal_map.frag.asm will be the compiled assembly file.
My iOS 3D action/hacking game: http://itunes.apple....73873?ls=1&mt=8
Blog
EngineCode:

I've compiled the shader as per your instructions and I get this error:

vertexshader.glsl(0) : error C5052: gl_Vertex is not accessable in this profile(0) : error C5052: gl_MultiTexCoord0 is not accessable in this profile(0) : error C5052: gl_Position is not accessable in this profile


this is my GLSL code

varying vec2 vTexCoord;void main(void){   vTexCoord = gl_MultiTexCoord0.xy;   gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;}
Quote:Original post by kubapl
Okay so maybe I wasn't to clear. I'm working on a project that does not support any high level shader languages. So what I am trying to do is write a GLSL shader and then have that translated to the equivalent ARB Assembly or Bytecode.

Thanks



What do you mean by this exactly? "Does not support any high level shader languages" A project can't not support high level shader languages. If it supports GL 2.0, it supports high level shader languages. If it doesn't support GL 2.0, then you are either on a cell phone and don't have access to a GPU anyway, or your target market is a 7 year old PC.

My guess is that it does actually support high level shader languages and you are...mistaken or confused somehow.
Looks like you are trying to compile a vertex shader with a fragment shader profile..
Quote:
3. cgc -oglsl -profile arbfp1 normal_map.fp > normal_map.frag.asm
In this example, normal_map.fp is the GLSL fragment program and normal_map.frag.asm will be the compiled assembly file.
Please also keep in mind that not all GLSL features are available in ARB shaders (branching, instruction counts etc.), so you might run into problems with this, too.

Thus you can't just take an existing GLSL shader and convert that to ARB.
If I was helpful, feel free to rate me up ;)If I wasn't and you feel to rate me down, please let me know why!

This topic is closed to new replies.

Advertisement