HLSL: Fix issue #442, smear and truncate shape conversions for == and !=.
authorJohn Kessenich <cepheus@frii.com>
Sat, 3 Sep 2016 03:12:23 +0000 (21:12 -0600)
committerJohn Kessenich <cepheus@frii.com>
Sat, 3 Sep 2016 03:12:23 +0000 (21:12 -0600)
Test/baseResults/hlsl.shapeConv.frag.out
Test/hlsl.shapeConv.frag
glslang/MachineIndependent/Intermediate.cpp
hlsl/hlslGrammar.cpp

index beeda4a..cbf6228 100755 (executable)
@@ -82,8 +82,27 @@ gl_FragCoord origin is upper left
 0:19          7.000000
 0:19          7.000000
 0:19        'foo' (temp 3-component vector of float)
-0:21      Branch: Return with expression
-0:21        'input' (in 4-component vector of float)
+0:21      Compare Equal (temp bool)
+0:21        Construct vec4 (temp 4-component vector of float)
+0:21          direct index (temp float)
+0:21            'v' (temp 4-component vector of float)
+0:21            Constant:
+0:21              0 (const int)
+0:21        'v' (temp 4-component vector of float)
+0:22      Compare Not Equal (temp bool)
+0:22        Construct vec4 (temp 4-component vector of float)
+0:22          'f' (in float)
+0:22        'v' (temp 4-component vector of float)
+0:26      Compare Equal (temp bool)
+0:26        'f1' (temp 1-component vector of float)
+0:26        Construct float (temp 1-component vector of float)
+0:26          'v' (temp 4-component vector of float)
+0:27      Compare Less Than (temp bool)
+0:27        Construct float (temp 1-component vector of float)
+0:27          'v' (temp 4-component vector of float)
+0:27        'f1' (temp 1-component vector of float)
+0:29      Branch: Return with expression
+0:29        'input' (in 4-component vector of float)
 0:?   Linker Objects
 
 
@@ -173,13 +192,32 @@ gl_FragCoord origin is upper left
 0:19          7.000000
 0:19          7.000000
 0:19        'foo' (temp 3-component vector of float)
-0:21      Branch: Return with expression
-0:21        'input' (in 4-component vector of float)
+0:21      Compare Equal (temp bool)
+0:21        Construct vec4 (temp 4-component vector of float)
+0:21          direct index (temp float)
+0:21            'v' (temp 4-component vector of float)
+0:21            Constant:
+0:21              0 (const int)
+0:21        'v' (temp 4-component vector of float)
+0:22      Compare Not Equal (temp bool)
+0:22        Construct vec4 (temp 4-component vector of float)
+0:22          'f' (in float)
+0:22        'v' (temp 4-component vector of float)
+0:26      Compare Equal (temp bool)
+0:26        'f1' (temp 1-component vector of float)
+0:26        Construct float (temp 1-component vector of float)
+0:26          'v' (temp 4-component vector of float)
+0:27      Compare Less Than (temp bool)
+0:27        Construct float (temp 1-component vector of float)
+0:27          'v' (temp 4-component vector of float)
+0:27        'f1' (temp 1-component vector of float)
+0:29      Branch: Return with expression
+0:29        'input' (in 4-component vector of float)
 0:?   Linker Objects
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 58
+// Id's are bound by 81
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
@@ -196,6 +234,7 @@ gl_FragCoord origin is upper left
                               Name 33  "V"
                               Name 34  "MyVal"
                               Name 37  "foo"
+                              Name 69  "f1"
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -223,6 +262,9 @@ gl_FragCoord origin is upper left
               48:   22(fvec3) ConstantComposite 47 47 47
               51:    6(float) Constant 1088421888
               52:   22(fvec3) ConstantComposite 51 51 51
+              55:             TypeInt 32 0
+              56:     55(int) Constant 0
+              61:             TypeVector 41(bool) 4
          4(main):           2 Function None 3
                5:             Label
                               FunctionEnd
@@ -236,6 +278,7 @@ gl_FragCoord origin is upper left
            33(V):      9(ptr) Variable Function
        34(MyVal):     23(ptr) Variable Function
          37(foo):     23(ptr) Variable Function
+          69(f1):      9(ptr) Variable Function
                               Store 15(v) 17
                               Store 15(v) 19
               20:    6(float) Load 12(f)
@@ -259,6 +302,25 @@ gl_FragCoord origin is upper left
               50:    41(bool) FOrdLessThan 48 49
               53:   22(fvec3) Load 37(foo)
               54:    41(bool) FOrdLessThanEqual 52 53
-              55:    7(fvec4) Load 11(input)
-                              ReturnValue 55
+              57:      9(ptr) AccessChain 15(v) 56
+              58:    6(float) Load 57
+              59:    7(fvec4) CompositeConstruct 58 58 58 58
+              60:    7(fvec4) Load 15(v)
+              62:   61(bvec4) FOrdEqual 59 60
+              63:    41(bool) All 62
+              64:    6(float) Load 12(f)
+              65:    7(fvec4) CompositeConstruct 64 64 64 64
+              66:    7(fvec4) Load 15(v)
+              67:   61(bvec4) FOrdNotEqual 65 66
+              68:    41(bool) Any 67
+              70:    6(float) Load 69(f1)
+              71:    7(fvec4) Load 15(v)
+              72:    6(float) CompositeExtract 71 0
+              73:    41(bool) FOrdEqual 70 72
+              74:    7(fvec4) Load 15(v)
+              75:    6(float) CompositeExtract 74 0
+              76:    6(float) Load 69(f1)
+              77:    41(bool) FOrdLessThan 75 76
+              78:    7(fvec4) Load 11(input)
+                              ReturnValue 78
                               FunctionEnd
index 3147b61..3ecb33a 100644 (file)
@@ -9,14 +9,22 @@ float4 PixelShaderFunction(float4 input, float f) : COLOR0
     u = float(2.0);
     u = float(f);
     float2 w = 2.0;
-    float V = 1;\r
+    float V = 1;
     float3 MyVal = V;
 
-    float3 foo;\r
-    foo > 4.0;\r
-    foo >= 5.0;\r
+    float3 foo;
+    foo > 4.0;
+    foo >= 5.0;
     6.0 < foo;
     7.0 <= foo;
 
+    v.x == v;
+    f != v;
+
+    float1 f1;
+
+    f1 == v;
+    v < f1;
+
     return input;
 }
index ee9c251..3a5a3f6 100644 (file)
@@ -702,6 +702,8 @@ TIntermTyped* TIntermediate::addShapeConversion(TOperator op, const TType& type,
     case EOpGreaterThan:
     case EOpLessThanEqual:
     case EOpGreaterThanEqual:
+    case EOpEqual:
+    case EOpNotEqual:
     case EOpFunctionCall:
         break;
     default:
index 6ddd1bf..a4fe38e 100755 (executable)
@@ -525,7 +525,7 @@ bool HlslGrammar::acceptQualifier(TQualifier& qualifier)
 //
 // layout_qualifier
 //      : identifier
-//      | identifier EQUAL expresion
+//      | identifier EQUAL expression
 //
 // Zero or more of these, so this can't return false.
 //