Module scalar_swizzle

Module scalar_swizzle 

Source
Expand description

Pass: scalar .xxx swizzle broadcast โ†’ vec constructor.

Functionsยง

rewrite_scalar_swizzle ๐Ÿ”’
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>.
walk_block_for_scalar_swizzle ๐Ÿ”’
walk_expr_for_scalar_swizzle ๐Ÿ”’
walk_stmt_for_scalar_swizzle ๐Ÿ”’