title | description | ms.assetid | ms.topic | ms.date | topic_type | api_name | api_type | api_location | |
---|---|---|---|---|---|---|---|---|---|
log - vs |
Full precision log₂(x). | log - vs |
53c91825-ec54-4b04-bf08-52d4b1c5122d |
reference |
05/31/2018 |
|
Full precision log₂(x).
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.
Vertex shader versions | 1_1 | 2_0 | 2_x | 2_sw | 3_0 | 3_sw |
---|---|---|---|---|---|---|
log | x | x | x | x | x | x |
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.