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
44
data/hlsl/tessellation/passthrough.tese
Normal file
44
data/hlsl/tessellation/passthrough.tese
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
// Copyright 2020 Google LLC
|
||||
|
||||
struct UBO
|
||||
{
|
||||
float4x4 projection;
|
||||
float4x4 model;
|
||||
float tessAlpha;
|
||||
};
|
||||
|
||||
cbuffer ubo : register(b1) { UBO ubo; }
|
||||
|
||||
struct HSOutput
|
||||
{
|
||||
float4 Pos : SV_POSITION;
|
||||
[[vk::location(0)]] float3 Normal : NORMAL0;
|
||||
[[vk::location(1)]] float2 UV : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct ConstantsHSOutput
|
||||
{
|
||||
float TessLevelOuter[3] : SV_TessFactor;
|
||||
float TessLevelInner : SV_InsideTessFactor;
|
||||
};
|
||||
|
||||
struct DSOutput
|
||||
{
|
||||
float4 Pos : SV_POSITION;
|
||||
[[vk::location(0)]] float3 Normal : NORMAL0;
|
||||
[[vk::location(1)]] float2 UV : TEXCOORD0;
|
||||
};
|
||||
|
||||
[domain("tri")]
|
||||
DSOutput main(ConstantsHSOutput input, float3 TessCoord : SV_DomainLocation, const OutputPatch<HSOutput, 3> patch)
|
||||
{
|
||||
DSOutput output = (DSOutput)0;
|
||||
output.Pos = (TessCoord.x * patch[0].Pos) +
|
||||
(TessCoord.y * patch[1].Pos) +
|
||||
(TessCoord.z * patch[2].Pos);
|
||||
output.Pos = mul(ubo.projection, mul(ubo.model, output.Pos));
|
||||
|
||||
output.Normal = TessCoord.x*patch[0].Normal + TessCoord.y*patch[1].Normal + TessCoord.z*patch[2].Normal;
|
||||
output.UV = TessCoord.x*patch[0].UV + TessCoord.y*patch[1].UV + TessCoord.z*patch[2].UV;
|
||||
return output;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue