Introduction to the DirectX 9 Shader Models - Nvidia

Introduction to the DirectX 9 Shader Models - Nvidia Introduction to the DirectX 9 Shader Models - Nvidia

30.04.2014 Views

How to use fp16 • When using pixel shader 2.0+ assembly, you can ask for 16-bit precision via _PP modifier – Modifier applies to instructions – Modifier applies to inputs dcl_[pp] dest[.mask] dcl_pp t0.xyz // declare t0 as partial precision sub_pp r0, r1, t0 // perform math at fp16

Precision Pitfalls • An IEEE-like fp16 is 1 sign bit, 5 bits of exponent and 10 bits of mantissa • Think of mantissa as tick marks on a ruler • The Exponent is the length of ruler – +/-1024 ticks, no matter what, so .1% precision across whatever range you have Inches Feet

How <strong>to</strong> use fp16<br />

• When using pixel shader 2.0+ assembly, you can<br />

ask for 16-bit precision via _PP modifier<br />

– Modifier applies <strong>to</strong> instructions<br />

– Modifier applies <strong>to</strong> inputs<br />

dcl_[pp] dest[.mask]<br />

dcl_pp t0.xyz // declare t0 as partial precision<br />

sub_pp r0, r1, t0 // perform math at fp16

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!