Add HLSL reference shader outputs

This commit is contained in:
Robert Konrad 2017-01-26 11:41:22 +01:00
parent e717953004
commit d6b3efaaaf
2 changed files with 78 additions and 0 deletions

View File

@ -0,0 +1,31 @@
uniform sampler2D uTex;
static float4 FragColor;
static float4 vColor;
static float2 vTex;
struct InputFrag
{
float4 vColor : TEXCOORD0;
float2 vTex : TEXCOORD1;
};
struct OutputFrag
{
float4 FragColor : COLOR;
};
void frag_main()
{
FragColor = vColor * tex2D(uTex, vTex);
}
OutputFrag main(InputFrag input)
{
vColor = input.vColor;
vTex = input.vTex;
frag_main();
OutputFrag output;
output.FragColor = FragColor;
return output;
}

View File

@ -0,0 +1,47 @@
struct _UBO
{
float4x4 uMVP;
};
cbuffer UBO
{
_UBO _16;
};
uniform float4 gl_HalfPixel;
static float4 gl_Position;
static float4 aVertex;
static float3 vNormal;
static float3 aNormal;
struct InputVert
{
float3 aNormal : TEXCOORD0;
float4 aVertex : TEXCOORD1;
};
struct OutputVert
{
float3 vNormal : TEXCOORD0;
float4 gl_Position : POSITION;
};
void vert_main()
{
gl_Position = mul(transpose(_16.uMVP), aVertex);
vNormal = aNormal;
}
OutputVert main(InputVert input)
{
aVertex = input.aVertex;
aNormal = input.aNormal;
vert_main();
OutputVert output;
output.gl_Position = gl_Position;
output.vNormal = vNormal;
output.gl_Position.x = output.gl_Position.x - gl_HalfPixel.x * output.gl_Position.w;
output.gl_Position.y = output.gl_Position.y + gl_HalfPixel.y * output.gl_Position.w;
output.gl_Position.z = (output.gl_Position.z + output.gl_Position.w) * 0.5;
return output;
}