shaderir: Add space lines between functions

This commit is contained in:
Hajime Hoshi 2020-06-08 01:41:47 +09:00
parent 84fb951729
commit 399bb93044
2 changed files with 8 additions and 4 deletions

View File

@ -202,6 +202,7 @@ func Bar(x vec2) vec2 {
l1 = l2;
return;
}
void F1(in vec2 l0, out vec2 l1) {
l1 = l0;
return;
@ -230,6 +231,7 @@ func Bar(x float) (float, float) {
l1 = vec2(l4, l5);
return;
}
void F1(in float l0, out float l1, out float l2) {
l1 = l0;
l2 = l0;

View File

@ -86,15 +86,17 @@ func (p *Program) Glsl() (vertexShader, fragmentShader string) {
for i, t := range p.Varyings {
vslines = append(vslines, fmt.Sprintf("varying %s;", p.glslVarDecl(&t, fmt.Sprintf("V%d", i))))
}
if len(vslines) > 0 && len(p.Funcs) > 0 {
vslines = append(vslines, "")
}
for _, f := range p.Funcs {
if len(vslines) > 0 {
vslines = append(vslines, "")
}
vslines = append(vslines, p.glslFunc(&f)...)
}
if len(p.VertexFunc.Block.Stmts) > 0 {
vslines = append(vslines, "")
if len(vslines) > 0 {
vslines = append(vslines, "")
}
vslines = append(vslines, "void main(void) {")
vslines = append(vslines, p.glslBlock(&p.VertexFunc.Block, 0, 0)...)
vslines = append(vslines, "}")