Skip to content

Commit

Permalink
refactor(shader-ast): update/add op2 info tags (incl. integer ops)
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Jun 24, 2019
1 parent 4f7ca39 commit 4e0cf46
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions packages/shader-ast/src/ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -550,12 +550,16 @@ export const op1 = <T extends Type>(op: Operator, val: Term<T>): Op1<T> => ({
});

const OP_INFO: IObjectOf<string> = {
mv: "mv",
vm: "vm",
vf: "vn",
mf: "vn",
fv: "nv",
fm: "nv"
mave: "mv",
vema: "vm",
vefl: "vn",
mafl: "vn",
flve: "nv",
flma: "nv",
ivin: "vn",
iniv: "nv",
uvui: "vn",
uiuv: "nv"
};

export const op2 = (
Expand All @@ -571,7 +575,7 @@ export const op2 = (
return {
tag: "op2",
type,
info: info || OP_INFO[l.type[0] + r.type[0]],
info: info || OP_INFO[l.type.substr(0, 2) + r.type.substr(0, 2)],
op,
l,
r
Expand Down

0 comments on commit 4e0cf46

Please sign in to comment.