shader-slang/slang

frexp requires wrong shader model version

Closed this issue · 1 comments

https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-frexp says SM 3.0 is required...

__generic<T : __BuiltinFloatingPointType>
[__readNone]
[ForceInline]
[require(cpp_cuda_glsl_hlsl_metal_spirv_wgsl, **sm_4_0_version**)]
T frexp(T x, out int exp)
{
    __target_switch
    {
    case cpp: __intrinsic_asm "$P_frexp($0, $1)";
    case cuda: __intrinsic_asm "$P_frexp($0, $1)";
    case glsl: __intrinsic_asm "frexp";
    case hlsl: __intrinsic_asm "frexp";
    case metal: __intrinsic_asm "frexp($0, *($1))";
    case spirv: return spirv_asm {
        result:$$T = OpExtInst glsl450 Frexp $x &exp
    };
    case wgsl:
        T fract;
        __wgsl_frexp<T>(x, fract, exp);
        return fract;
    }
}

Slang only supports DX11 and later, which corresponds to SM 5. It's not essential that we differentiate anything below SM 5. It's okay to mark features as supported below 5.0, but not necessary. Also, we haven't defined capabilities below SM 4 so that's the cutoff for what SM capability we can document as required.

Closing WNF.