mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-24 16:31:11 +01:00
* [hlsl-out] Write `mad` intrinsic for `fma` function - This should be enough because we only support f32 for now. - Adds a new test for WGSL functions, in the spirit of operators.wgsl. - Closes #1579 * Add FMA feature to glsl backend - I think this is right. Just iterate all known expressions in all functions and entry points to locate any `fma` function call. Should not need to walk the statement DAG. * Transform GLSL fma function into an airthmetic expression when necessary * Add tests for GLSL fma function tranformation * Remove the hazard comment from the webgl test input * Add helper method for fma function support checks * Address review comment
16 lines
362 B
WebGPU Shading Language
16 lines
362 B
WebGPU Shading Language
fn test_fma() -> vec2<f32> {
|
|
let a = vec2<f32>(2.0, 2.0);
|
|
let b = vec2<f32>(0.5, 0.5);
|
|
let c = vec2<f32>(0.5, 0.5);
|
|
|
|
// Hazard: HLSL needs a different intrinsic function for f32 and f64
|
|
// See: https://github.com/gfx-rs/naga/issues/1579
|
|
return fma(a, b, c);
|
|
}
|
|
|
|
|
|
[[stage(compute), workgroup_size(1)]]
|
|
fn main() {
|
|
let a = test_fma();
|
|
}
|