Semantics: Map noise*() to an operator for PureOperatorBuiltins mode.
authorJohn Kessenich <cepheus@frii.com>
Tue, 2 Feb 2016 22:59:12 +0000 (15:59 -0700)
committerJohn Kessenich <cepheus@frii.com>
Tue, 2 Feb 2016 22:59:12 +0000 (15:59 -0700)
Fixes issue #157.

Test/120.vert
Test/baseResults/120.vert.out
glslang/Include/intermediate.h
glslang/MachineIndependent/Initialize.cpp
glslang/MachineIndependent/intermOut.cpp

index cc7a872..b7724b4 100644 (file)
@@ -139,6 +139,14 @@ void foo2()
     bool b = any(lessThan(v4, attv4));  // tests aggregate arg to unary built-in 
 }
 
+void noise()\r
+{\r
+    float f1 = noise1(1.0);\r
+    vec2 f2 = noise2(vec2(1.0));\r
+    vec3 f3 = noise3(vec3(1.0));\r
+    vec4 f4 = noise4(vec4(1.0));\r
+}
+
 // version 130 features
 
 uniform int c;
index 4c06909..6c63744 100644 (file)
@@ -45,39 +45,39 @@ ERROR: 0:108: 'overloadE' : no matching overloaded function found
 ERROR: 0:111: 'overloadE' : no matching overloaded function found 
 ERROR: 0:117: 'overloadF' : no matching overloaded function found 
 ERROR: 0:121: 'gl_TexCoord array size' : must be less than gl_MaxTextureCoords (32)
-ERROR: 0:157: 'switch' : Reserved word. 
-ERROR: 0:163: 'default' : Reserved word. 
-ERROR: 0:157: 'switch statements' : not supported for this version or the enabled extensions 
-ERROR: 0:168: 'bit shift left' : not supported for this version or the enabled extensions 
-ERROR: 0:168: 'bit shift right' : not supported for this version or the enabled extensions 
-ERROR: 0:168: 'bitwise and' : not supported for this version or the enabled extensions 
-ERROR: 0:168: 'bitwise inclusive or' : not supported for this version or the enabled extensions 
-ERROR: 0:171: 'modf' : no matching overloaded function found 
-ERROR: 0:171: '=' :  cannot convert from 'const float' to 'temp 3-component vector of float'
-ERROR: 0:172: 'trunc' : no matching overloaded function found 
-ERROR: 0:173: 'round' : no matching overloaded function found 
-ERROR: 0:173: '=' :  cannot convert from 'const float' to 'temp 2-component vector of float'
-ERROR: 0:174: 'roundEven' : no matching overloaded function found 
-ERROR: 0:174: '=' :  cannot convert from 'const float' to 'temp 2-component vector of float'
-ERROR: 0:175: 'isnan' : no matching overloaded function found 
-ERROR: 0:175: '=' :  cannot convert from 'const float' to 'temp 2-component vector of bool'
-ERROR: 0:176: 'isinf' : no matching overloaded function found 
-ERROR: 0:176: '=' :  cannot convert from 'const float' to 'temp 4-component vector of bool'
-ERROR: 0:178: 'sinh' : no matching overloaded function found 
-ERROR: 0:179: 'cosh' : no matching overloaded function found 
-ERROR: 0:179: 'tanh' : no matching overloaded function found 
-ERROR: 0:180: 'c4D' : undeclared identifier 
-ERROR: 0:180: 'asinh' : no matching overloaded function found 
-ERROR: 0:180: 'acosh' : no matching overloaded function found 
-ERROR: 0:181: 'atanh' : no matching overloaded function found 
-ERROR: 0:183: 'gl_VertexID' : undeclared identifier 
-ERROR: 0:183: '=' :  cannot convert from 'temp float' to 'temp int'
-ERROR: 0:184: 'gl_ClipDistance' : undeclared identifier 
-ERROR: 0:184: 'gl_ClipDistance' :  left of '[' is not of type array, matrix, or vector  
-ERROR: 0:184: 'assign' :  l-value required (can't modify a const)
-ERROR: 0:190: 'token pasting (##)' : not supported for this version or the enabled extensions 
-ERROR: 0:190: '##' : token pasting not implemented (internal error) 
-ERROR: 0:190: '' :  syntax error
+ERROR: 0:165: 'switch' : Reserved word. 
+ERROR: 0:171: 'default' : Reserved word. 
+ERROR: 0:165: 'switch statements' : not supported for this version or the enabled extensions 
+ERROR: 0:176: 'bit shift left' : not supported for this version or the enabled extensions 
+ERROR: 0:176: 'bit shift right' : not supported for this version or the enabled extensions 
+ERROR: 0:176: 'bitwise and' : not supported for this version or the enabled extensions 
+ERROR: 0:176: 'bitwise inclusive or' : not supported for this version or the enabled extensions 
+ERROR: 0:179: 'modf' : no matching overloaded function found 
+ERROR: 0:179: '=' :  cannot convert from 'const float' to 'temp 3-component vector of float'
+ERROR: 0:180: 'trunc' : no matching overloaded function found 
+ERROR: 0:181: 'round' : no matching overloaded function found 
+ERROR: 0:181: '=' :  cannot convert from 'const float' to 'temp 2-component vector of float'
+ERROR: 0:182: 'roundEven' : no matching overloaded function found 
+ERROR: 0:182: '=' :  cannot convert from 'const float' to 'temp 2-component vector of float'
+ERROR: 0:183: 'isnan' : no matching overloaded function found 
+ERROR: 0:183: '=' :  cannot convert from 'const float' to 'temp 2-component vector of bool'
+ERROR: 0:184: 'isinf' : no matching overloaded function found 
+ERROR: 0:184: '=' :  cannot convert from 'const float' to 'temp 4-component vector of bool'
+ERROR: 0:186: 'sinh' : no matching overloaded function found 
+ERROR: 0:187: 'cosh' : no matching overloaded function found 
+ERROR: 0:187: 'tanh' : no matching overloaded function found 
+ERROR: 0:188: 'c4D' : undeclared identifier 
+ERROR: 0:188: 'asinh' : no matching overloaded function found 
+ERROR: 0:188: 'acosh' : no matching overloaded function found 
+ERROR: 0:189: 'atanh' : no matching overloaded function found 
+ERROR: 0:191: 'gl_VertexID' : undeclared identifier 
+ERROR: 0:191: '=' :  cannot convert from 'temp float' to 'temp int'
+ERROR: 0:192: 'gl_ClipDistance' : undeclared identifier 
+ERROR: 0:192: 'gl_ClipDistance' :  left of '[' is not of type array, matrix, or vector  
+ERROR: 0:192: 'assign' :  l-value required (can't modify a const)
+ERROR: 0:198: 'token pasting (##)' : not supported for this version or the enabled extensions 
+ERROR: 0:198: '##' : token pasting not implemented (internal error) 
+ERROR: 0:198: '' :  syntax error
 ERROR: 79 compilation errors.  No code generated.
 
 
@@ -314,66 +314,99 @@ ERROR: node is still EOpNull!
 0:139            Compare Less Than (global 4-component vector of bool)
 0:139              'v4' (temp 4-component vector of float)
 0:139              'attv4' (in 4-component vector of float)
-0:154  Function Definition: foo213( (global void)
-0:154    Function Parameters: 
-0:156    Sequence
-0:156      Sequence
-0:156        move second child to first child (temp float)
-0:156          'f' (temp float)
-0:156          Constant:
-0:156            3.000000
-0:157      switch
-0:157      condition
-0:157        'c' (uniform int)
-0:157      body
-0:157        Sequence
-0:158          case:  with expression
-0:158            Constant:
-0:158              1 (const int)
+0:142  Function Definition: noise( (global void)
+0:142    Function Parameters: 
+0:144    Sequence
+0:144      Sequence
+0:144        move second child to first child (temp float)
+0:144          'f1' (temp float)
+0:144          noise (global float)
+0:144            Constant:
+0:144              1.000000
+0:145      Sequence
+0:145        move second child to first child (temp 2-component vector of float)
+0:145          'f2' (temp 2-component vector of float)
+0:145          noise (global 2-component vector of float)
+0:145            Constant:
+0:145              1.000000
+0:145              1.000000
+0:146      Sequence
+0:146        move second child to first child (temp 3-component vector of float)
+0:146          'f3' (temp 3-component vector of float)
+0:146          noise (global 3-component vector of float)
+0:146            Constant:
+0:146              1.000000
+0:146              1.000000
+0:146              1.000000
+0:147      Sequence
+0:147        move second child to first child (temp 4-component vector of float)
+0:147          'f4' (temp 4-component vector of float)
+0:147          noise (global 4-component vector of float)
+0:147            Constant:
+0:147              1.000000
+0:147              1.000000
+0:147              1.000000
+0:147              1.000000
+0:162  Function Definition: foo213( (global void)
+0:162    Function Parameters: 
+0:164    Sequence
+0:164      Sequence
+0:164        move second child to first child (temp float)
+0:164          'f' (temp float)
+0:164          Constant:
+0:164            3.000000
+0:165      switch
+0:165      condition
+0:165        'c' (uniform int)
+0:165      body
+0:165        Sequence
+0:166          case:  with expression
+0:166            Constant:
+0:166              1 (const int)
 0:?           Sequence
-0:159            move second child to first child (temp float)
-0:159              'f' (temp float)
-0:159              sine (global float)
-0:159                'f' (temp float)
-0:160            Branch: Break
-0:161          case:  with expression
-0:161            Constant:
-0:161              2 (const int)
+0:167            move second child to first child (temp float)
+0:167              'f' (temp float)
+0:167              sine (global float)
+0:167                'f' (temp float)
+0:168            Branch: Break
+0:169          case:  with expression
+0:169            Constant:
+0:169              2 (const int)
 0:?           Sequence
-0:162            move second child to first child (temp float)
-0:162              'f' (temp float)
-0:162              component-wise multiply (temp float)
-0:162                'f' (temp float)
-0:162                'f' (temp float)
-0:163          default: 
+0:170            move second child to first child (temp float)
+0:170              'f' (temp float)
+0:170              component-wise multiply (temp float)
+0:170                'f' (temp float)
+0:170                'f' (temp float)
+0:171          default: 
 0:?           Sequence
-0:164            move second child to first child (temp float)
-0:164              'f' (temp float)
-0:164              Constant:
-0:164                3.000000
-0:168      inclusive-or (temp int)
-0:168        left-shift (temp int)
-0:168          'i' (temp int)
-0:168          Constant:
-0:168            3 (const int)
-0:168        Constant:
-0:168          69 (const int)
-0:172      Sequence
-0:172        move second child to first child (temp float)
-0:172          't' (temp float)
-0:172          Constant:
-0:172            0.000000
-0:178      Constant:
-0:178        0.000000
-0:180      Constant:
-0:180        0.000000
-0:181      Constant:
-0:181        0.000000
-0:184      move second child to first child (temp float)
-0:184        Constant:
-0:184          0.000000
-0:184        Constant:
-0:184          0.300000
+0:172            move second child to first child (temp float)
+0:172              'f' (temp float)
+0:172              Constant:
+0:172                3.000000
+0:176      inclusive-or (temp int)
+0:176        left-shift (temp int)
+0:176          'i' (temp int)
+0:176          Constant:
+0:176            3 (const int)
+0:176        Constant:
+0:176          69 (const int)
+0:180      Sequence
+0:180        move second child to first child (temp float)
+0:180          't' (temp float)
+0:180          Constant:
+0:180            0.000000
+0:186      Constant:
+0:186        0.000000
+0:188      Constant:
+0:188        0.000000
+0:189      Constant:
+0:189        0.000000
+0:192      move second child to first child (temp float)
+0:192        Constant:
+0:192          0.000000
+0:192        Constant:
+0:192          0.300000
 0:?   Linker Objects
 0:?     'i' (in 4-component vector of float)
 0:?     'o' (smooth out 4-component vector of float)
@@ -633,66 +666,99 @@ ERROR: node is still EOpNull!
 0:139            Compare Less Than (global 4-component vector of bool)
 0:139              'v4' (temp 4-component vector of float)
 0:139              'attv4' (in 4-component vector of float)
-0:154  Function Definition: foo213( (global void)
-0:154    Function Parameters: 
-0:156    Sequence
-0:156      Sequence
-0:156        move second child to first child (temp float)
-0:156          'f' (temp float)
-0:156          Constant:
-0:156            3.000000
-0:157      switch
-0:157      condition
-0:157        'c' (uniform int)
-0:157      body
-0:157        Sequence
-0:158          case:  with expression
-0:158            Constant:
-0:158              1 (const int)
+0:142  Function Definition: noise( (global void)
+0:142    Function Parameters: 
+0:144    Sequence
+0:144      Sequence
+0:144        move second child to first child (temp float)
+0:144          'f1' (temp float)
+0:144          noise (global float)
+0:144            Constant:
+0:144              1.000000
+0:145      Sequence
+0:145        move second child to first child (temp 2-component vector of float)
+0:145          'f2' (temp 2-component vector of float)
+0:145          noise (global 2-component vector of float)
+0:145            Constant:
+0:145              1.000000
+0:145              1.000000
+0:146      Sequence
+0:146        move second child to first child (temp 3-component vector of float)
+0:146          'f3' (temp 3-component vector of float)
+0:146          noise (global 3-component vector of float)
+0:146            Constant:
+0:146              1.000000
+0:146              1.000000
+0:146              1.000000
+0:147      Sequence
+0:147        move second child to first child (temp 4-component vector of float)
+0:147          'f4' (temp 4-component vector of float)
+0:147          noise (global 4-component vector of float)
+0:147            Constant:
+0:147              1.000000
+0:147              1.000000
+0:147              1.000000
+0:147              1.000000
+0:162  Function Definition: foo213( (global void)
+0:162    Function Parameters: 
+0:164    Sequence
+0:164      Sequence
+0:164        move second child to first child (temp float)
+0:164          'f' (temp float)
+0:164          Constant:
+0:164            3.000000
+0:165      switch
+0:165      condition
+0:165        'c' (uniform int)
+0:165      body
+0:165        Sequence
+0:166          case:  with expression
+0:166            Constant:
+0:166              1 (const int)
 0:?           Sequence
-0:159            move second child to first child (temp float)
-0:159              'f' (temp float)
-0:159              sine (global float)
-0:159                'f' (temp float)
-0:160            Branch: Break
-0:161          case:  with expression
-0:161            Constant:
-0:161              2 (const int)
+0:167            move second child to first child (temp float)
+0:167              'f' (temp float)
+0:167              sine (global float)
+0:167                'f' (temp float)
+0:168            Branch: Break
+0:169          case:  with expression
+0:169            Constant:
+0:169              2 (const int)
 0:?           Sequence
-0:162            move second child to first child (temp float)
-0:162              'f' (temp float)
-0:162              component-wise multiply (temp float)
-0:162                'f' (temp float)
-0:162                'f' (temp float)
-0:163          default: 
+0:170            move second child to first child (temp float)
+0:170              'f' (temp float)
+0:170              component-wise multiply (temp float)
+0:170                'f' (temp float)
+0:170                'f' (temp float)
+0:171          default: 
 0:?           Sequence
-0:164            move second child to first child (temp float)
-0:164              'f' (temp float)
-0:164              Constant:
-0:164                3.000000
-0:168      inclusive-or (temp int)
-0:168        left-shift (temp int)
-0:168          'i' (temp int)
-0:168          Constant:
-0:168            3 (const int)
-0:168        Constant:
-0:168          69 (const int)
-0:172      Sequence
-0:172        move second child to first child (temp float)
-0:172          't' (temp float)
-0:172          Constant:
-0:172            0.000000
-0:178      Constant:
-0:178        0.000000
-0:180      Constant:
-0:180        0.000000
-0:181      Constant:
-0:181        0.000000
-0:184      move second child to first child (temp float)
-0:184        Constant:
-0:184          0.000000
-0:184        Constant:
-0:184          0.300000
+0:172            move second child to first child (temp float)
+0:172              'f' (temp float)
+0:172              Constant:
+0:172                3.000000
+0:176      inclusive-or (temp int)
+0:176        left-shift (temp int)
+0:176          'i' (temp int)
+0:176          Constant:
+0:176            3 (const int)
+0:176        Constant:
+0:176          69 (const int)
+0:180      Sequence
+0:180        move second child to first child (temp float)
+0:180          't' (temp float)
+0:180          Constant:
+0:180            0.000000
+0:186      Constant:
+0:186        0.000000
+0:188      Constant:
+0:188        0.000000
+0:189      Constant:
+0:189        0.000000
+0:192      move second child to first child (temp float)
+0:192        Constant:
+0:192          0.000000
+0:192        Constant:
+0:192          0.300000
 0:?   Linker Objects
 0:?     'i' (in 4-component vector of float)
 0:?     'o' (smooth out 4-component vector of float)
index cf70177..54bd96e 100644 (file)
@@ -238,6 +238,8 @@ enum TOperator {
 
     EOpFtransform,
 
+    EOpNoise,
+
     EOpEmitVertex,           // geometry only
     EOpEndPrimitive,         // geometry only
     EOpEmitStreamVertex,     // geometry only
index 089751b..4b0c015 100644 (file)
@@ -3696,6 +3696,11 @@ void IdentifyBuiltIns(int version, EProfile profile, int spv, EShLanguage langua
         symbolTable.relateToOperator("textureGatherOffset",     EOpTextureGatherOffset);
         symbolTable.relateToOperator("textureGatherOffsets",    EOpTextureGatherOffsets);
 
+        symbolTable.relateToOperator("noise1", EOpNoise);
+        symbolTable.relateToOperator("noise2", EOpNoise);
+        symbolTable.relateToOperator("noise3", EOpNoise);
+        symbolTable.relateToOperator("noise4", EOpNoise);
+
         if (spv == 0 && (IncludeLegacy(version, profile, spv) || (profile == EEsProfile && version == 100))) {
             symbolTable.relateToOperator("ftransform",               EOpFtransform);
 
index d319c6f..dd0769f 100644 (file)
@@ -318,6 +318,8 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
     case EOpFindLSB:                out.debug << "findLSB";               break;
     case EOpFindMSB:                out.debug << "findMSB";               break;
 
+    case EOpNoise:                  out.debug << "noise";                 break;
+
     default: out.debug.message(EPrefixError, "Bad unary op");
     }