@@ -47,25 +47,28 @@ struct PushConstants {
4747[[vk::push_constant]] PushConstants pc;
4848
4949struct VertexStageOutput {
50- float4 position : SV_Position;
50+ float4 sv_Position : SV_Position;
5151 float3 color;
5252 float3 normal;
5353};
5454
5555[shader("vertex")]
56- void vertexMain(uint vertexID : SV_VertexID,
57- uint instanceID : SV_InstanceID,
58- out VertexStageOutput output)
56+ VertexStageOutput vertexMain(uint vertexID : SV_VertexID,
57+ uint instanceID : SV_InstanceID)
5958{
6059 float4x4 proj = pc.perFrame->proj;
6160 float4x4 view = pc.perFrame->view;
6261 float4x4 model = pc.perObject->model[instanceID];
6362
6463 Vertex v = pc.vb->vertices[vertexID];
6564
66- output.position = mul(float4(v.x, v.y, v.z, 1.0), mul(model, mul(view, proj)));
67- output.color = float3(v.r, v.g, v.b);
68- output.normal = normalize(float3(v.x, v.y, v.z)); // object space normal
65+ VertexStageOutput out;
66+
67+ out.sv_Position = mul(float4(v.x, v.y, v.z, 1.0), mul(model, mul(view, proj)));
68+ out.color = float3(v.r, v.g, v.b);
69+ out.normal = normalize(float3(v.x, v.y, v.z)); // object space normal
70+
71+ return out;
6972}
7073
7174float4 triplanar(uint tex, float3 worldPos, float3 normal) {
@@ -86,9 +89,7 @@ float4 triplanar(uint tex, float3 worldPos, float3 normal) {
8689}
8790
8891[shader("fragment")]
89- float4 fragmentMain(
90- VertexStageOutput input,
91- float4 position : SV_Position) : SV_Target
92+ float4 fragmentMain(VertexStageOutput input) : SV_Target
9293{
9394 // triplanar mapping in object-space; for our icosahedron, object-space position and normal vectors are the same
9495 float4 t0 = triplanar(pc.perFrame->texture0, input.normal, input.normal);
0 commit comments