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:
parent
10a1ecaf7b
commit
cce75f1859
287 changed files with 11263 additions and 0 deletions
43
data/hlsl/geometryshader/normaldebug.geom
Normal file
43
data/hlsl/geometryshader/normaldebug.geom
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
// Copyright 2020 Google LLC
|
||||
|
||||
struct UBO
|
||||
{
|
||||
float4x4 projection;
|
||||
float4x4 model;
|
||||
};
|
||||
|
||||
cbuffer ubo : register(b1) { UBO ubo; }
|
||||
|
||||
struct VSOutput
|
||||
{
|
||||
[[vk::location(0)]] float4 Pos : POSITION0;
|
||||
[[vk::location(1)]] float3 Normal : NORMAL0;
|
||||
};
|
||||
|
||||
struct GSOutput
|
||||
{
|
||||
float4 Pos : SV_POSITION;
|
||||
[[vk::location(0)]] float3 Color : COLOR0;
|
||||
};
|
||||
|
||||
[maxvertexcount(6)]
|
||||
void main(triangle VSOutput input[3], inout LineStream<GSOutput> outStream)
|
||||
{
|
||||
float normalLength = 0.02;
|
||||
for(int i=0; i<3; i++)
|
||||
{
|
||||
float3 pos = input[i].Pos.xyz;
|
||||
float3 normal = input[i].Normal.xyz;
|
||||
|
||||
GSOutput output = (GSOutput)0;
|
||||
output.Pos = mul(ubo.projection, mul(ubo.model, float4(pos, 1.0)));
|
||||
output.Color = float3(1.0, 0.0, 0.0);
|
||||
outStream.Append( output );
|
||||
|
||||
output.Pos = mul(ubo.projection, mul(ubo.model, float4(pos + normal * normalLength, 1.0)));
|
||||
output.Color = float3(0.0, 0.0, 1.0);
|
||||
outStream.Append( output );
|
||||
|
||||
outStream.RestartStrip();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue