shaderir: Refactoring

This commit is contained in:
Hajime Hoshi 2020-05-17 02:45:03 +09:00
parent e1d0800f19
commit 8a6140a92f
3 changed files with 5 additions and 6 deletions

View File

@ -228,10 +228,10 @@ func (p *Program) glslBlock(b *Block, level int, localVarIndex int) []string {
case BuiltinFuncExpr:
return string(e.BuiltinFunc)
case SwizzlingExpr:
if !isValidSwizzling(e.Swizzling) {
return fmt.Sprintf("?(unexpected swizzling: %s)", e.Swizzling)
if !isValidSwizzling(e.Ident) {
return fmt.Sprintf("?(unexpected swizzling: %s)", e.Ident)
}
return e.Swizzling
return e.Ident
case Ident:
return e.Ident
case Unary:

View File

@ -101,7 +101,7 @@ func builtinFuncExpr(f BuiltinFunc) Expr {
func swizzlingExpr(swizzling string) Expr {
return Expr{
Type: SwizzlingExpr,
Swizzling: swizzling,
Ident: swizzling,
}
}

View File

@ -89,7 +89,6 @@ type Expr struct {
Int int32
Float float32
BuiltinFunc BuiltinFunc
Swizzling string
Ident string
Op Op
}