mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/shader: bug fix: a number literal must be represented as floats in some contexts
This commit is contained in:
parent
406b8a4a08
commit
0a537b7ad2
@ -109,8 +109,11 @@ func (cs *compileState) parseStmt(block *block, fname string, stmt ast.Stmt, inP
|
||||
return nil, false
|
||||
}
|
||||
case shaderir.Vec2, shaderir.Vec3, shaderir.Vec4, shaderir.Mat2, shaderir.Mat3, shaderir.Mat4:
|
||||
if rts[0].Main == shaderir.Float || rhs[0].Const != nil {
|
||||
// ok
|
||||
if rts[0].Main == shaderir.Float {
|
||||
// OK
|
||||
} else if rhs[0].Const != nil && rhs[0].Const.Kind() == gconstant.Int {
|
||||
rhs[0].Const = gconstant.ToFloat(rhs[0].Const)
|
||||
rhs[0].ConstType = shaderir.ConstTypeFloat
|
||||
} else {
|
||||
cs.addError(stmt.Pos(), fmt.Sprintf("invalid operation: mismatched types %s and %s", lts[0].String(), rts[0].String()))
|
||||
return nil, false
|
||||
|
Loading…
Reference in New Issue
Block a user