Jump to content
  • Advertisement
pcmaster

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 this post


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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!