cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

riza_guntur
Journeyman III

Ternary operator reduce funtion error in float4

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.

0 Likes
1 Reply
gaurav_garg
Adept I

Comparison operators >, < , ==, != are not supported for vector datatypes

0 Likes