diff --git a/internal/shader/shader_test.go b/internal/shader/shader_test.go index fe4ca2f11..898a1107b 100644 --- a/internal/shader/shader_test.go +++ b/internal/shader/shader_test.go @@ -55,7 +55,7 @@ func Foo(foo vec2) vec4 { return vec4(foo, 0, 1) }`, VS: `void F0(in vec2 l0, out vec4 l1) { - l1 = vec4(l0, 0, 1); + l1 = vec4(l0, 0.0, 1.0); return; }`, }, @@ -124,10 +124,9 @@ func Foo(foo vec2) vec4 { r := vec4(foo, 0, 1) return r }`, - // TODO: number literals must be floats. VS: `void F0(in vec2 l0, out vec4 l1) { vec4 l2 = vec4(0.0); - l2 = vec4(l0, 0, 1); + l2 = vec4(l0, 0.0, 1.0); l1 = l2; return; }`, diff --git a/internal/shaderir/glsl.go b/internal/shaderir/glsl.go index caa9a0d39..4b0d41c07 100644 --- a/internal/shaderir/glsl.go +++ b/internal/shaderir/glsl.go @@ -234,7 +234,8 @@ func (p *Program) glslBlock(b *Block, level int, localVarIndex int) []string { glslExpr = func(e *Expr) string { switch e.Type { case IntExpr: - return fmt.Sprintf("%d", e.Int) + // TODO: Cast to int if the context requries integers. + return fmt.Sprintf("%d.0", e.Int) case FloatExpr: return fmt.Sprintf("%.9e", e.Float) case UniformVariable: