Sign in to follow this  

Parser for a cg or hlsl shader file

Recommended Posts


I'm trying to build a parser for cg or hlsl shaders but I'm not very experienced in shading languages. What I need from the parser is to scan the whole file and get the names of the variables used for passing the shader's parameters from an XNA application. The problem is that I'm not sure which keywords I should search for. Declaring a variable like this for example "float4 var" outside of any struct means that it's definitely gonna be used to pass parameters in the shader? A shader isn't using any global variables internally? Generally speaking which keywords should I search for in the lines i read? Any suggestions on the steps I should make for the development of the parser?

Also what are the "< >" operators are used for in the following example?

float gSceneIntensity <
string UIName = "Scene Intensity";
string UIWidget = "slider";
float UIMin = 0.0f;
float UIMax = 2.0f;
float UIStep = 0.1f;
> = 0.5f;

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this