Fix validation and glsl parsing of ldexp (#2449)

Fixes #1908.
This commit is contained in:
Fredrik Fornwall authored and GitHub committed 2023-09-01 18:44:48 +02:00
1 parent 0491d39232
commit f49314dbbd
10 files changed
+160 -95

No files matched your search

+10 -4
View File
@@ -1280,14 +1280,14 @@ fn inject_common_builtin(
0b10 => Some(VectorSize::Tri),
_ => Some(VectorSize::Quad),
};
let ty = || match size {
let ty = |kind| match size {
Some(size) => TypeInner::Vector {
size,
kind: Sk::Float,
kind,
width: float_width,
},
None => TypeInner::Scalar {
kind: Sk::Float,
kind,
width: float_width,
},
};
@@ -1300,9 +1300,15 @@ fn inject_common_builtin(
_ => unreachable!(),
};
let second_kind = if fun == MacroCall::MathFunction(MathFunction::Ldexp) {
Sk::Sint
} else {
Sk::Float
};
declaration
.overloads
.push(module.add_builtin(vec![ty(), ty()], fun))
.push(module.add_builtin(vec![ty(Sk::Float), ty(second_kind)], fun))
}
}
"transpose" => {