Add shaders re-implemented in HLSL

These were written against the shaders at revision eddd724e7.
There have been changes made since then, which will need to be mirrored.

See `data/hlsl/README.md` for the current status of each sample.
This commit is contained in:
Ben Clayton 2020-05-21 10:20:19 +00:00
parent 10a1ecaf7b
commit cce75f1859
287 changed files with 11263 additions and 0 deletions

View file

@ -0,0 +1,39 @@
// Copyright 2020 Google LLC
#define LIGHT_COUNT 3
struct UBO
{
float4x4 mvp[LIGHT_COUNT];
float4 instancePos[3];
};
cbuffer ubo : register(b0) { UBO ubo; }
struct VSOutput
{
float4 Pos : SV_POSITION;
[[vk::location(0)]] int InstanceIndex : TEXCOORD0;
};
struct GSOutput
{
float4 Pos : SV_POSITION;
int Layer : SV_RenderTargetArrayIndex;
};
[maxvertexcount(3)]
[instance(3)]
void main(triangle VSOutput input[3], uint InvocationID : SV_GSInstanceID, inout TriangleStream<GSOutput> outStream)
{
float4 instancedPos = ubo.instancePos[input[0].InstanceIndex];
for (int i = 0; i < 3; i++)
{
float4 tmpPos = input[i].Pos + instancedPos;
GSOutput output = (GSOutput)0;
output.Pos = mul(ubo.mvp[InvocationID], tmpPos);
output.Layer = InvocationID;
outStream.Append( output );
}
outStream.RestartStrip();
}