diff --git a/internal/shader/testdata/issue1236.expected.hlsl b/internal/shader/testdata/issue1236.expected.hlsl index 4eaa6fa54..cf356f3e9 100644 --- a/internal/shader/testdata/issue1236.expected.hlsl +++ b/internal/shader/testdata/issue1236.expected.hlsl @@ -1,3 +1,5 @@ +void F0(in float4 l0, out float4 l1); + void F0(in float4 l0, out float4 l1) { float4 l2 = 0.0; l2 = mul(l0, float4x4FromScalar(1.0)); diff --git a/internal/shader/testdata/out.expected.hlsl b/internal/shader/testdata/out.expected.hlsl index 83a37eaed..791cc290f 100644 --- a/internal/shader/testdata/out.expected.hlsl +++ b/internal/shader/testdata/out.expected.hlsl @@ -1,3 +1,5 @@ +void F0(out float l0, out float l1[4], out float4 l2); + void F0(out float l0, out float l1[4], out float4 l2) { l0 = 0.0; l1[0] = 0.0; diff --git a/internal/shaderir/hlsl/hlsl.go b/internal/shaderir/hlsl/hlsl.go index 7b0a3b455..b2bfde782 100644 --- a/internal/shaderir/hlsl/hlsl.go +++ b/internal/shaderir/hlsl/hlsl.go @@ -122,6 +122,9 @@ func Compile(p *shaderir.Program) (string, []int) { if len(p.Funcs) > 0 { lines = append(lines, "") + for _, f := range p.Funcs { + lines = append(lines, c.function(p, &f, true)...) + } for _, f := range p.Funcs { if len(lines) > 0 && lines[len(lines)-1] != "" { lines = append(lines, "")