Skip to content
Posted on:June 23, 2007 at 10:55 AM

Converting .fx to CgFX

Converting .fx to CgFX

FX Composer 2안에 이런 것이 있었다. HLSL로 작성된 .fx 파일을 cgfx로 변환시켜 주는 방법이다.

FX Composer 2 comes with a Perl script that automatically converts HLSL .fx files
to CgFX. It is called “convert_fx.pl” and you can find it in the Utilities sub-folder of
the FX Composer 2 installed location.
convert_fx.pl outputs a copy of the input effect with Microsoft FX/CgFX 1.2
specific state assignments converted to the new OpenGL specific state assignments
in CgFX 1.5.
Perl must be installed for the script to run. (You can download a free Perl
distribution from www.activeperl.com.) To run the script, execute the following
command:

perl convert_fx.pl input.fx output.cgfx

LimitationsMultiple state assignments on a single line are not supported. If the input file

contains any lines similar to the following:

SrcBlend = One; DestBlend = Zero;

you must move these state assignments to their own line before running this script,
as shown below:

SrcBlend = One;
DestBlend = Zero;

State that has no direct OpenGL equivalent will not be changed; instead, this script
will add a comment to the line indicating that the state will have to be manually
updated. Search for “FIXME” in the output file to locate these problem states.
See the declaration of the unsupportedState array below for a list of state that is not
supported.

  • Sampler state inside a pass block is not supported by CgFX 1.5 or this script
    and will need to be manually moved into a sampler_state block.

  • This script only updates state assignments inside a pass or sampler_state block;
    it will not modify any shaders, annotations, or semantics.

Web Analytics