diff options
| author | Mehmet Oguz Derin <mehmetoguzderin@mehmetoguzderin.com> | 2025-06-26 20:16:18 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-26 17:16:18 +0000 |
| commit | 1be819f4f0dbd001d1b222d7461a4fd87452dee2 (patch) | |
| tree | 7f829606ec418c39dd2ea396db3a7f5c64285e61 /source | |
| parent | a58675b161d9fea8a73a6ded15e5a79b1fc020ef (diff) | |
Support `mad` in WGSL (#7538)
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/hlsl.meta.slang | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source/slang/hlsl.meta.slang b/source/slang/hlsl.meta.slang index 9800f2e65..32d7ea824 100644 --- a/source/slang/hlsl.meta.slang +++ b/source/slang/hlsl.meta.slang @@ -11157,7 +11157,7 @@ matrix<T,N,M> log2(matrix<T,N,M> x) /// @category math __generic<T : __BuiltinFloatingPointType> [__readNone] -[require(cpp_cuda_glsl_hlsl_metal_spirv, shader5_sm_5_0)] +[require(cpp_cuda_glsl_hlsl_metal_spirv_wgsl, shader5_sm_5_0)] T mad(T mvalue, T avalue, T bvalue) { __target_switch @@ -11170,12 +11170,13 @@ T mad(T mvalue, T avalue, T bvalue) case spirv: return spirv_asm { OpExtInst $$T result glsl450 Fma $mvalue $avalue $bvalue }; + case wgsl: __intrinsic_asm "fma"; } } __generic<T : __BuiltinFloatingPointType, let N : int> [__readNone] -[require(cpp_cuda_glsl_hlsl_metal_spirv, shader5_sm_5_0)] +[require(cpp_cuda_glsl_hlsl_metal_spirv_wgsl, shader5_sm_5_0)] vector<T, N> mad(vector<T, N> mvalue, vector<T, N> avalue, vector<T, N> bvalue) { __target_switch @@ -11186,6 +11187,7 @@ vector<T, N> mad(vector<T, N> mvalue, vector<T, N> avalue, vector<T, N> bvalue) case spirv: return spirv_asm { OpExtInst $$vector<T, N> result glsl450 Fma $mvalue $avalue $bvalue }; + case wgsl: __intrinsic_asm "fma"; default: VECTOR_MAP_TRINARY(T, N, mad, mvalue, avalue, bvalue); } |
