Warnning! fxc compilation bugs(DirectX)

I have been working on DX11 and tessellation lately. It turns out my tessellation shaders are broken when I let fxc optimize my shader. The “solution” is to specify the flag /Od which tells fxc to not do any optimizations.
This will have to do for now, but you realize how deadly it can be. You might work on a problem for a long time and not solve it because of unsafe optimizations, and then suddenly you turn into debug and it works. Scary stuff.
I must note that I don’t have any warnings from fxc.

I tried to look at the assembly code, and the biggest thing I noticed is that the “Release” code has loop unrolling while the “Debug” code has real loops. I think most of the optimizations are the loop unrolling anyway.

Here is the unoptimized shader results compared to the optimized shader results:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s