Search this blog

14 September, 2009

Fix for FXComposer 2.5 clear bug

The new Nvidia FXComposer is still mostly made of dog poo. Sorry, but it's an application that adds zero useful features, and a tons of bugs. Well not really, shader debugging would be useful to me, but I tried to debug my posteffect, made with SAS, and it failed miserably, so...

Unfortunately, FXComposer 1.8 is getting really old nowadays and sometimes it crashes on newer cards... so I'm forced to juggle between to two to find the one that has less bugs...

One incredibly annoying thing is that 2.5 on XP does not clear the screen, if you're using SAS at least. It doesn't work both on my Macbook 17'' and my Dell Pc at work (nothing weird, two of the most popular products in their categories, both with NVidia GPUs), so I had to find a workaround. Ironically, they seem to have so many bugs in SAS just now that for the first time since the beginning of FX composer, they released a little documentation about it... So now you kind of know how to use it, but you can't because it's bugged...

If you're having the same problem, here's my fix. I hope that NVidia engineers will make this post obsolete soon by showing some love for their product and fix this, as it's such a huge bug.

#define USEFAKECLEAR

[...]

struct FSQuadVS_InOut // fullscreen quad
{
float4 Pos : POSITION;
float2 UV : TEXCOORD0;
};

FSQuadVS_InOut FSQuadVS(FSQuadVS_InOut In)
{
return In;
}

#ifdef USEFAKECLEAR
struct FakeClear_Out
{
float4 c0 : COLOR0;
float4 c1 : COLOR1;
float4 c2 : COLOR2;
float4 c3 : COLOR3;

float d : DEPTH;
};

FakeClear_Out FakeClearPS(FSQuadVS_InOut In)
{
FakeClear_Out Out = (FakeClear_Out)0;
Out.d = 1.f;

return Out;
}
#endif

[...]

#ifdef USEFAKECLEAR
pass FakeClear
<
string Script =
"RenderColorTarget0=ColorBuffer1;"
"Draw=Buffer;";
>
{
ZEnable = true;
ZWriteEnable = true;
ZFunc = Always;

VertexShader = compile vs_3_0 FSQuadVS();
PixelShader = compile ps_3_0 FakeClearPS();
}
#endif

4 comments:

Hightree said...

Soon you'll be able to put FX Composer in the trash and use Visual Studio instead, hopefully with less bugs.

http://news.developer.nvidia.com/2009/08/nexus-visualstudio-based-gpu-development.html

DEADC0DE said...

Hightree: no unfortunately I don't think so. Nexus seems to be only a debugger/profiler, not a rapid prototyping environment. And as a debugger/profiler, I was already quite happy with Pix, this tool is mostly aimed at GPU computing (Cuda, openCL). I guess that's the cool area now and who cares a shit about shaders anymore... :(

Unknown said...

This is what Ive had to do too.

Sadly, don't expect any improvements

DEADC0DE said...

KB: yeah, I think a replacement for FX Composer could indeed be a very nice opensource project. I really don't know any other tool that can do that job. RenderMonkey is more dead than alive. VVVV could be probably used for the task, but I doubt it. Right now, the easier way to prototype is to roll a small testbed in C# using SlimDX. Importing Wavefront Obj files is very easy too, but you have still to code every time stuff like arcball camera rotation etc.