Actually I think the outline shader for a 2D game is kinda unnecessary. The loaded sprite can already be shipped with an outline. (Or, one sprite with and one sprite without an outline; if both are required) However, I kinda find it neat to dynamically apply an outline to whatever object I want to. Fundamental …
Structure The code starts with #defines we already know from C or C++. We basically map HLSL and GLSL constants (shader and vertex models, etc.) into a variable; beeing chosed during the compile time, in order to support HLSL and GLSL in one single .fx file.
#define SV_POSITION POSITION
#define VS_SHADERMODEL vs_3_0
#define PS_SHADERMODEL ps_3_0
#define VS_SHADERMODEL vs_4_0_level_9_1
#define PS_SHADERMODEL ps_4_0_level_9_1