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

Extended Vertex Shader Caps Sim • D3DVS20CAPS_PREDICATION • Predication is a method of conditionally executing code on a per-component basis • For instance, you could test if a value was > 0.0f before performing a RSQ • Faster than executing a branch for short code sequences

Vertex Shader Predication – HLSL Sim This example adds in specular when the selfshadowing term is greater than zero. if ( dot(light_vector, vertex_normal) > 0.0f ) { total_light += light_color; } If targeting a vs_2_x profile, the compiler should use predication for a short conditional block

Vertex <strong>Shader</strong> Predication – HLSL<br />

Sim<br />

This example adds in specular when <strong>the</strong> selfshadowing<br />

term is greater than zero.<br />

if ( dot(light_vec<strong>to</strong>r, vertex_normal) > 0.0f )<br />

{<br />

<strong>to</strong>tal_light += light_color;<br />

}<br />

If targeting a vs_2_x profile, <strong>the</strong> compiler should use<br />

predication for a short conditional block

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

Saved successfully!

Ooh no, something went wrong!