mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 12:08:58 +01:00
shaderir: Bug fix: Wrong implementation of isValidSwizzling
This commit is contained in:
parent
7e274050a3
commit
e1d0800f19
@ -37,18 +37,21 @@ func isValidSwizzling(s string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
case strings.IndexByte(rgba, s[0]) >= 0:
|
case strings.IndexByte(rgba, s[0]) >= 0:
|
||||||
for _, c := range s {
|
for _, c := range s {
|
||||||
if strings.IndexRune(rgba, c) == -1 {
|
if strings.IndexRune(rgba, c) == -1 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
case strings.IndexByte(strq, s[0]) >= 0:
|
case strings.IndexByte(strq, s[0]) >= 0:
|
||||||
for _, c := range s {
|
for _, c := range s {
|
||||||
if strings.IndexRune(strq, c) == -1 {
|
if strings.IndexRune(strq, c) == -1 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -225,7 +228,7 @@ func (p *Program) glslBlock(b *Block, level int, localVarIndex int) []string {
|
|||||||
case BuiltinFuncExpr:
|
case BuiltinFuncExpr:
|
||||||
return string(e.BuiltinFunc)
|
return string(e.BuiltinFunc)
|
||||||
case SwizzlingExpr:
|
case SwizzlingExpr:
|
||||||
if isValidSwizzling(e.Swizzling) {
|
if !isValidSwizzling(e.Swizzling) {
|
||||||
return fmt.Sprintf("?(unexpected swizzling: %s)", e.Swizzling)
|
return fmt.Sprintf("?(unexpected swizzling: %s)", e.Swizzling)
|
||||||
}
|
}
|
||||||
return e.Swizzling
|
return e.Swizzling
|
||||||
|
Loading…
Reference in New Issue
Block a user