shaderir/glsl: Refactoring

This commit is contained in:
Hajime Hoshi 2020-08-07 01:53:02 +09:00
parent 6576a1da76
commit 00ccc8ad85

View File

@ -243,20 +243,8 @@ func (c *compileContext) glslVarInit(p *shaderir.Program, t *shaderir.Type) stri
return "false" return "false"
case shaderir.Int: case shaderir.Int:
return "0" return "0"
case shaderir.Float: case shaderir.Float, shaderir.Vec2, shaderir.Vec3, shaderir.Vec4, shaderir.Mat2, shaderir.Mat3, shaderir.Mat4:
return "float(0)" return fmt.Sprintf("%s(0)", basicTypeString(t.Main))
case shaderir.Vec2:
return "vec2(0)"
case shaderir.Vec3:
return "vec3(0)"
case shaderir.Vec4:
return "vec4(0)"
case shaderir.Mat2:
return "mat2(0)"
case shaderir.Mat3:
return "mat3(0)"
case shaderir.Mat4:
return "mat4(0)"
default: default:
t0, t1 := c.glslType(p, t) t0, t1 := c.glslType(p, t)
panic(fmt.Sprintf("?(unexpected type: %s%s)", t0, t1)) panic(fmt.Sprintf("?(unexpected type: %s%s)", t0, t1))