[naga] Implement atan2 in const (#8222)

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
Sam 2025-09-24 20:23:25 +02:00 committed by GitHub
parent d2ee4b8be5
commit 084431b548
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View File

@ -134,6 +134,8 @@ fails-if(metal) webgpu:api,operation,uncapturederror:iff_uncaptured:*
//FAIL: webgpu:api,operation,uncapturederror:onuncapturederror_order_wrt_addEventListener
// There are also two unimplemented SKIPs in uncapturederror not enumerated here.
webgpu:api,validation,encoding,queries,general:occlusion_query,query_type:*
webgpu:shader,execution,expression,call,builtin,atan2:f16:*
webgpu:shader,execution,expression,call,builtin,atan2:f32:*
webgpu:shader,execution,expression,call,builtin,textureSample:sampled_1d_coords:*
webgpu:shader,execution,expression,call,builtin,textureSampleBaseClampToEdge:2d_coords:stage="c";textureType="texture_2d<f32>";*
webgpu:shader,execution,flow_control,return:*

View File

@ -1178,6 +1178,11 @@ impl<'a> ConstantEvaluator<'a> {
crate::MathFunction::Atan => {
component_wise_float!(self, span, [arg], |e| { Ok([e.atan()]) })
}
crate::MathFunction::Atan2 => {
component_wise_float!(self, span, [arg, arg1.unwrap()], |y, x| {
Ok([y.atan2(x)])
})
}
crate::MathFunction::Asinh => {
component_wise_float!(self, span, [arg], |e| { Ok([e.asinh()]) })
}
@ -1346,8 +1351,7 @@ impl<'a> ConstantEvaluator<'a> {
crate::MathFunction::Cross => self.cross_product(arg, arg1.unwrap(), span),
// unimplemented
crate::MathFunction::Atan2
| crate::MathFunction::Modf
crate::MathFunction::Modf
| crate::MathFunction::Frexp
| crate::MathFunction::Ldexp
| crate::MathFunction::Dot