mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 11:48:55 +01:00
shaderir: Fix integer literals
This commit is contained in:
parent
909ba638a3
commit
3118657fff
@ -55,7 +55,7 @@ func Foo(foo vec2) vec4 {
|
|||||||
return vec4(foo, 0, 1)
|
return vec4(foo, 0, 1)
|
||||||
}`,
|
}`,
|
||||||
VS: `void F0(in vec2 l0, out vec4 l1) {
|
VS: `void F0(in vec2 l0, out vec4 l1) {
|
||||||
l1 = vec4(l0, 0, 1);
|
l1 = vec4(l0, 0.0, 1.0);
|
||||||
return;
|
return;
|
||||||
}`,
|
}`,
|
||||||
},
|
},
|
||||||
@ -124,10 +124,9 @@ func Foo(foo vec2) vec4 {
|
|||||||
r := vec4(foo, 0, 1)
|
r := vec4(foo, 0, 1)
|
||||||
return r
|
return r
|
||||||
}`,
|
}`,
|
||||||
// TODO: number literals must be floats.
|
|
||||||
VS: `void F0(in vec2 l0, out vec4 l1) {
|
VS: `void F0(in vec2 l0, out vec4 l1) {
|
||||||
vec4 l2 = vec4(0.0);
|
vec4 l2 = vec4(0.0);
|
||||||
l2 = vec4(l0, 0, 1);
|
l2 = vec4(l0, 0.0, 1.0);
|
||||||
l1 = l2;
|
l1 = l2;
|
||||||
return;
|
return;
|
||||||
}`,
|
}`,
|
||||||
|
@ -234,7 +234,8 @@ func (p *Program) glslBlock(b *Block, level int, localVarIndex int) []string {
|
|||||||
glslExpr = func(e *Expr) string {
|
glslExpr = func(e *Expr) string {
|
||||||
switch e.Type {
|
switch e.Type {
|
||||||
case IntExpr:
|
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:
|
case FloatExpr:
|
||||||
return fmt.Sprintf("%.9e", e.Float)
|
return fmt.Sprintf("%.9e", e.Float)
|
||||||
case UniformVariable:
|
case UniformVariable:
|
||||||
|
Loading…
Reference in New Issue
Block a user