Skip to content

Instantly share code, notes, and snippets.

@xeechou
Last active September 23, 2022 17:35
Show Gist options
  • Save xeechou/6489408c5b90d9d5c5f1b4189db9c87c to your computer and use it in GitHub Desktop.
Save xeechou/6489408c5b90d9d5c5f1b4189db9c87c to your computer and use it in GitHub Desktop.
HLSL: multiple struct parameters in entry point
struct VSBasicIn
{
[[vk::location(0)]] float4 Pos : POSITION;
[[vk::location(1)]] float3 Norm : NORMAL;
[[vk::location(2)]] float2 Tex : TEXCOORD0;
};
struct VSBasicIn1
{
[[vk::location(3)]] float4 tangent : TANGENT;
[[vk::location(4)]] float4 bitangent : BINORMAL;
};
struct VSOutput
{
[[vk::location(0)]] float3 fragpos : POSITION0;
[[vk::location(1)]] float2 uv : TEXCOORD0;
[[vk::location(2)]] float3 tangent : TANGENT;
[[vk::location(3)]] float3 bitangent : BINORMAL;
};
VSOutput main(VSBasicIn input0, VSBasicIn1 input1)
{
VSOutput output = (VSOutput)0;
output.fragpos = input0.Pos.xyz;
output.uv = input0.Tex;
output.tangent = input1.tangent.xyz;
output.bitangent = input1.bitangent.xyz;
return output;
}
//to compile with dxc
//dxc -spirv -Fo sample.vs.spv -T vs_6_1 -E main sample.vs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment