rewrite_scalar_swizzle

Function rewrite_scalar_swizzle 

Source
pub(crate) fn rewrite_scalar_swizzle(src: &str) -> String
Expand description

HLSL allows <scalar>.xxx to broadcast a scalar to a float3 (and .xx to float2, etc.). WGSL has no swizzle on scalars — naga rejects with invalid field accessor 'xxx' or stranger expected ')'; found 'x3' tokenisation. Rewrite to a constructor call floatN(<scalar>); the regex replace_types pass then lowers the float3 to vec3<f32>.