Assigning varying value to uniform value

25 views
Skip to first unread message

Martin Šošić

unread,
Apr 28, 2013, 10:52:18 AM4/28/13
to ispc-...@googlegroups.com
Hi all,
I read in ispc guide that it is not valid to assign varying value to uniform value.
However it sounds like neccesary thing to do then returning values through referenced array, like in this example from ispc guide:

export void simple(uniform float vin[], uniform float vout[], uniform int count) { foreach (index = 0 ... count) { float v = vin[index]; if (v < 3.) v = v * v; else v = sqrt(v); vout[index] = v; } }

vout is uniform and v is varying but it is still ok to do vout[index] = v, how is that?
Thank you

Brooke Hodgman

unread,
May 2, 2013, 11:12:43 PM5/2/13
to ispc-...@googlegroups.com
vout is a uniform pointer to uniform floats, but index is varying, so vout+index (vout[index] is the same as *(vout+index)) is a varying pointer to a uniform float. So each 'SIMD lane' (is 'lane' the right terminology?) is copying it's own varying float to it's own varying location.
Reply all
Reply to author
Forward
0 new messages