I successfully ported his examples to directx and ran into the same issues. Unfortunately, there were several places where the y and z components needed to be flipped. Both in the vertex shader and the pixel shader. First, get your vertex shader to draw properly.
Swap your final output y and z components in the vertex shader( but before you transform the vertex so the transform is correct).
This will mess up your pixel shader. So try swaping the z and y components back at the beginning of the pixel shader.
Then, make sure to swap the z and y components of anything externally set and used in all of the shaders, i.e. cameraposition, sunnormal
When dealing with shaders, ALL code is executed, including ALL branches, all function calls, etc. The ONLY exception for this is if something is known at compile time that will allow the compiler to remove a particular piece of code.
This is how all graphics cards work, AMD, NVIDIA, etc. So, your additional cost is of the if statement, and in your example, you are adding an extra if instruction. This is a zero cost on gpus. If you want to read on it, check out vectors processors and data hazards.
If you somehow split our shader up and added an if statement to the middle thinking that it would speed up your code, you would get NO speedup. because ALL paths will be executed.