Skip to content

Instantly share code, notes, and snippets.

@rtroe
Created May 9, 2018 17:20
Show Gist options
  • Save rtroe/c112c848a89bb3743aa32b5d431ee7f6 to your computer and use it in GitHub Desktop.
Save rtroe/c112c848a89bb3743aa32b5d431ee7f6 to your computer and use it in GitHub Desktop.
#if OPENGL
#define SV_POSITION POSITION
#define VS_SHADERMODEL vs_3_0
#define PS_SHADERMODEL ps_3_0
#else
#define VS_SHADERMODEL vs_4_0_level_9_1
#define PS_SHADERMODEL ps_4_0_level_9_1
#endif
matrix WorldViewProjection;
struct VertexShaderInput
{
float4 Position : POSITION0;
float4 Color : COLOR0;
};
struct VertexShaderOutput
{
float4 Position : SV_POSITION;
float4 Color : COLOR0;
};
VertexShaderOutput MainVS(in VertexShaderInput input)
{
VertexShaderOutput output = (VertexShaderOutput)0;
output.Position = mul(input.Position, WorldViewProjection);
output.Color = input.Color;
return output;
}
float4 MainPS(VertexShaderOutput input) : COLOR
{
return input.Color;
}
technique BasicColorDrawing
{
pass P0
{
VertexShader = compile VS_SHADERMODEL MainVS();
PixelShader = compile PS_SHADERMODEL MainPS();
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment