DX11 Legacy D3D9 ps_3_0 half versus float

Recommended Posts

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!

Edited by pcmaster

Share on other sites
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!

Share on other sites

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.

Create an account

Register a new account

• What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 12
• 13
• 9
• 25
• 18
• Forum Statistics

• Total Topics
634438
• Total Posts
3017470
×