Sign in to follow this  
akhin

How to convert HLSL/CG to GPU ASM ?

Recommended Posts

Hi all ,

Which tools are used to do this ?

I guess it is cgc.exe coming with CG Toolkit and fxc.exe for HLSL coming with DX SDK but i could not figure out the parameters

any help will be appreciated

Share this post


Link to post
Share on other sites
To be clear, there's no such thing as "GPU ASM". Direct3D has an intermediate "shader assembly" that's still the compilation target fro HLSL shaders. However the "ARB_vertex_program/ARB_fragment_program" program stuff is from back before GLSL, and thus doesn't have a modern feature set. Cg can be compiled to Nvidia's extended assembly set, but it's an Nvidia-only extension. Otherwise you have to cross-compile to GLSL. GLSL doesn't support any type of intermediate assembly language, you have to compile at runtime. The two notable exceptions to this is the new ARB_get_program_binary extension (which lets you save off a compiled shader in an opaque binary format that can only be loaded on the same GPU/driver combo) and the optional glShaderBinary for OpenGL ES (which has the same restrictions).

Anyway I'm not familiar enough with the CG toolkit to help you with that one, but fxc is really easy. At minimum you need to specify the shader profile (ps_2_0, vs_3_0, etc.) with the "/T" switch, the shader entry point function with "/E", and the name of the file containing the shader.

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