With the ATI_fs patch series v4 applied (even the ones that are not in master yet), I see no such glitches in KotOR 2. Shadows are correct, and fog is correct. The only problem I see is that enabling soft shadows makes the shadows so faint they are barely visible, but I think that's a bug in the game. I'm using latest Mesa from git, llvm 3.7.1, Wine 1.9.6. Note that Steam only offers the remastered version of KotOR2 now, which doesn't use ATI_fs anymore. The screenshots on the store page may be from the old version though.