Export (0) Print
Expand All

log - vs

Full precision log₂(x).

Syntax

log dst, src

 

where

  • dst is the destination register.
  • src is a source register. Source register requires explicit use of replicate swizzle, that is, exactly one of the .x, .y, .z, .w swizzle components (or the .r, .g, .b, .a equivalents) must be specified.

Remarks

Vertex shader versions1_12_02_x2_sw3_03_sw
logxxxxxx

 

The following code fragment shows the operations performed.



float v = abs(src);
if (v != 0)
{
    dest.x = dest.y = dest.z = dest.w = 
        (float)(log(v)/log(2));  
}
else
{
    dest.x = dest.y = dest.z = dest.w = -FLT_MAX;
}


This instruction accepts a scalar source whose sign bit is ignored. The result is replicated to all four channels.

This instruction provides 21 bits of precision.

 

 

Community Additions

ADD
Show:
© 2015 Microsoft