mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-08 11:30:06 +00:00
85244d7486
This PR only changes a few lines of code, but is subtle. In HLSL, comparison operators (<,>,<=,>=,==,!=) operate component-wise when given a vector operand. If a whole vector equality or inequality is desired, then all() or any() can be used on the resulting bool vector. This PR enables this change. Existing shape conversion is used when one of the two arguments is a vector and one is a scalar. Some existing HLSL tests had assumed == and != meant vector-wise instead of component-wise comparisons. These tests have been changed to add an explicit any() or all() to the test source. This verifably does not change the final SPIR-V binary relative to the old behavior for == and !=. The AST does change for the (now explicit, formerly implicit) any() and all(). Also, a few tests changes where they previously had the return type wrong, e.g, from a vec < vec comparison in hlsl.shapeConv.frag. Promotion of comparison opcodes to vector forms (EOpEqual->EOpVectorEqual) is handled in promoteBinary(), as is setting the proper vector type of the result. EOpVectorEqual and EOpVectorNotEqual are now accepted as either aggregate or binary nodes, similar to how the other operators are handled. Partial support already existed for this: it has been fleshed out in the printing functions in intermOut.cpp. There is an existing defect around shape conversion with 1-vectors, but that is orthogonal to this PR and not addressed by it.
35 lines
567 B
GLSL
35 lines
567 B
GLSL
uniform float4 uf4;
|
|
|
|
void Bug1( float4 a )
|
|
{
|
|
float4 v04 = float4( 0.0, 0.0, 0.0, 0.0 );
|
|
float v01 = 0.0;
|
|
|
|
bool4 r00 = a == v04;
|
|
bool4 r01 = a != v04;
|
|
bool4 r02 = a < v04;
|
|
bool4 r03 = a > v04;
|
|
|
|
bool4 r10 = a == v01;
|
|
bool4 r11 = a != v01;
|
|
bool4 r12 = a < v01;
|
|
bool4 r13 = a > v01;
|
|
|
|
bool4 r20 = v01 == a;
|
|
bool4 r21 = v01 != a;
|
|
bool4 r22 = v01 < a;
|
|
bool4 r23 = v01 > a;
|
|
}
|
|
|
|
struct PS_OUTPUT
|
|
{
|
|
float4 Color : SV_Target0;
|
|
};
|
|
|
|
PS_OUTPUT main()
|
|
{
|
|
PS_OUTPUT psout;
|
|
psout.Color = 0;
|
|
return psout;
|
|
}
|