Add HLSL reference shader outputs
This commit is contained in:
parent
e717953004
commit
d6b3efaaaf
31
reference/shaders-hlsl/frag/basic.frag
Normal file
31
reference/shaders-hlsl/frag/basic.frag
Normal 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;
|
||||
}
|
47
reference/shaders-hlsl/vert/basic.vert
Normal file
47
reference/shaders-hlsl/vert/basic.vert
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user