Legacy D3D9 ps_3_0 half versus float

Started by
2 comments, last by pcmaster 5 years, 2 months ago

Hi! I have a legacy question about HLSL SM 3.0 half versus float. I know that in the ps_5_0 profile, half is just a 'typedef' of float and the GPUs generally aren't required to support half-precision ALU.

However when I run this simple shader:


float x;

float4 main() : COLOR0
{
    half y = x * 0.125; // <- "TYPECAST" HERE
    return float4(y, y, y, y);    
}

through fxc.exe /T ps_3_0, it generates a "mul_pp" DXBC instruction, whereas with floats only, it generates "mul".

What is the driver going to do with it? I reckon it won't honour this and just use single-precision floats everywhere. Do desktop SM 3.0 GPUs even support half-precision ALU?

Thanks!


 

Advertisement
7 hours ago, pcmaster said:

Do desktop SM 3.0 GPUs even support half-precision ALU?

If memory serves... The GeForce 9/FX series introduced half-precision processing instructions, and was about twice as fast if you used them (or alternatively - it was twice as slow if you needed 32bit precision....). Also, a lot of SM3.0 level GPU's didn't run 32bit computation by default a lot of the time -- they'd do things in 24 bit precision where possible, and most weren't IEEE 754 compliant.
Not sure on the timing, but the idea of half-precision computation was phased out pretty soon afterwards, and is only just being introduced now in Dx12 level GPUs!

Thank you. I'm aware of what's happening with DX12 and what happened with PS4 Pro but I never really worked with D3D9 (until now :D) and nobody in my office remembered anymore. It's what I feared, that it might actually differ.

This topic is closed to new replies.

Advertisement