Skip to content

Commit 084431b

Browse files
authored
[naga] Implement atan2 in const (#8222)
Signed-off-by: sagudev <[email protected]>
1 parent d2ee4b8 commit 084431b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

cts_runner/test.lst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ fails-if(metal) webgpu:api,operation,uncapturederror:iff_uncaptured:*
134134
//FAIL: webgpu:api,operation,uncapturederror:onuncapturederror_order_wrt_addEventListener
135135
// There are also two unimplemented SKIPs in uncapturederror not enumerated here.
136136
webgpu:api,validation,encoding,queries,general:occlusion_query,query_type:*
137+
webgpu:shader,execution,expression,call,builtin,atan2:f16:*
138+
webgpu:shader,execution,expression,call,builtin,atan2:f32:*
137139
webgpu:shader,execution,expression,call,builtin,textureSample:sampled_1d_coords:*
138140
webgpu:shader,execution,expression,call,builtin,textureSampleBaseClampToEdge:2d_coords:stage="c";textureType="texture_2d<f32>";*
139141
webgpu:shader,execution,flow_control,return:*

naga/src/proc/constant_evaluator.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,6 +1178,11 @@ impl<'a> ConstantEvaluator<'a> {
11781178
crate::MathFunction::Atan => {
11791179
component_wise_float!(self, span, [arg], |e| { Ok([e.atan()]) })
11801180
}
1181+
crate::MathFunction::Atan2 => {
1182+
component_wise_float!(self, span, [arg, arg1.unwrap()], |y, x| {
1183+
Ok([y.atan2(x)])
1184+
})
1185+
}
11811186
crate::MathFunction::Asinh => {
11821187
component_wise_float!(self, span, [arg], |e| { Ok([e.asinh()]) })
11831188
}
@@ -1346,8 +1351,7 @@ impl<'a> ConstantEvaluator<'a> {
13461351
crate::MathFunction::Cross => self.cross_product(arg, arg1.unwrap(), span),
13471352

13481353
// unimplemented
1349-
crate::MathFunction::Atan2
1350-
| crate::MathFunction::Modf
1354+
crate::MathFunction::Modf
13511355
| crate::MathFunction::Frexp
13521356
| crate::MathFunction::Ldexp
13531357
| crate::MathFunction::Dot

0 commit comments

Comments
 (0)