mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
parent
12e60b7273
commit
94d1df8c7d
@ -107,21 +107,18 @@ func (cs *compileState) parseType(block *block, fname string, expr ast.Expr) (sh
|
||||
}
|
||||
|
||||
func canBeFloatImplicitly(expr shaderir.Expr, t shaderir.Type) bool {
|
||||
// TODO: For integers, should only constants be allowed?
|
||||
if expr.Const != nil && canTruncateToFloat(expr.Const) {
|
||||
return true
|
||||
}
|
||||
|
||||
// canBeFloatImplicitly is used for a cast-like functions like float() or vec2().
|
||||
// A non-constant integer value is acceptable.
|
||||
if t.Main == shaderir.Int {
|
||||
return true
|
||||
}
|
||||
if t.Main == shaderir.Float {
|
||||
return true
|
||||
}
|
||||
if expr.Const != nil {
|
||||
if expr.Const.Kind() == gconstant.Int {
|
||||
return true
|
||||
}
|
||||
if expr.Const.Kind() == gconstant.Float {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user