riza.guntur

Ternary operator reduce funtion error in float4

Discussion created by riza.guntur on Jul 6, 2009
Latest reply on Jul 6, 2009 by gaurav.garg

After reading that float4 cloud increase performance I tried to change my finding min max funtion to float4 types.

At first:

reduce void(float4 a<>, reduce float4 b<>)

{

if(a.x > b.x)

b.x = a.x;

if(a.y > b.y)

b.y = a.y;

if(a.z > b.z)

b.z = a.z;

if(a.w > b.w)

b.w = a.w;

}

works fine. After reading User Guide, I saw A.2 Relational Operators on Short Vectors, the ternary operator ?: could do the same thing. So I change it to:

reduce void(float4 a<>, reduce float4 b<>)

{

b = a > b ? a : b;

}

But I get error message containing must use any() or all() for logical operation like that.

Anyone has a clue? Thank you.

Outcomes