Skip to content

Commit

Permalink
[wgsl] remove outerProduct (gfx-rs#2535)
Browse files Browse the repository at this point in the history
  • Loading branch information
teoxoy authored Oct 5, 2023
1 parent 6668d06 commit f37db5a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
3 changes: 1 addition & 2 deletions src/back/wgsl/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1529,7 +1529,6 @@ impl<W: Write> Writer<W> {
Mf::Pow => Function::Regular("pow"),
// geometry
Mf::Dot => Function::Regular("dot"),
Mf::Outer => Function::Regular("outerProduct"),
Mf::Cross => Function::Regular("cross"),
Mf::Distance => Function::Regular("distance"),
Mf::Length => Function::Regular("length"),
Expand Down Expand Up @@ -1568,7 +1567,7 @@ impl<W: Write> Writer<W> {
Mf::Unpack2x16snorm => Function::Regular("unpack2x16snorm"),
Mf::Unpack2x16unorm => Function::Regular("unpack2x16unorm"),
Mf::Unpack2x16float => Function::Regular("unpack2x16float"),
Mf::Inverse => {
Mf::Inverse | Mf::Outer => {
return Err(Error::UnsupportedMathFunction(fun));
}
};
Expand Down
1 change: 0 additions & 1 deletion src/front/wgsl/parse/conv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ pub fn map_standard_fun(word: &str) -> Option<crate::MathFunction> {
"pow" => Mf::Pow,
// geometry
"dot" => Mf::Dot,
"outerProduct" => Mf::Outer,
"cross" => Mf::Cross,
"distance" => Mf::Distance,
"length" => Mf::Length,
Expand Down
3 changes: 2 additions & 1 deletion tests/in/glsl/math-functions.frag
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ void main() {
vec4 minOut = min(a, b);
vec4 reflectOut = reflect(a, b);
vec3 crossOut = cross(a.xyz, b.xyz);
mat4 outerProductOut = outerProduct(a, b);
// TODO: support outerProduct function in wgsl output
// mat4 outerProductOut = outerProduct(a, b);
float distanceOut = distance(a, b);
vec4 stepOut = step(a, b);
// TODO: support out params in wgsl output
Expand Down
24 changes: 10 additions & 14 deletions tests/out/wgsl/math-functions.frag.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ fn main_1() {
var minOut: vec4<f32>;
var reflectOut: vec4<f32>;
var crossOut: vec3<f32>;
var outerProductOut: mat4x4<f32>;
var distanceOut: f32;
var stepOut: vec4<f32>;
var ldexpOut: f32;
Expand Down Expand Up @@ -146,22 +145,19 @@ fn main_1() {
crossOut = cross(_e205.xyz, _e207.xyz);
let _e213 = a;
let _e214 = b;
outerProductOut = outerProduct(_e213, _e214);
distanceOut = distance(_e213, _e214);
let _e219 = a;
let _e220 = b;
distanceOut = distance(_e219, _e220);
let _e225 = a;
let _e226 = b;
stepOut = step(_e225, _e226);
let _e229 = a;
stepOut = step(_e219, _e220);
let _e223 = a;
let _e226 = a;
let _e228 = i;
ldexpOut = ldexp(_e226.x, _e228);
let _e232 = a;
let _e234 = i;
ldexpOut = ldexp(_e232.x, _e234);
let _e238 = a;
rad = radians(_e238);
let _e241 = a;
let _e243 = a;
deg = degrees(_e243.x);
rad = radians(_e232);
let _e235 = a;
let _e237 = a;
deg = degrees(_e237.x);
smoothStepScalar = smoothstep(0.0, 1.0, 0.5);
smoothStepVector = smoothstep(vec4(0.0), vec4(1.0), vec4(0.5));
smoothStepMixed = smoothstep(vec4(0.0), vec4(1.0), vec4(0.5));
Expand Down

0 comments on commit f37db5a

Please sign in to comment.