Pārlūkot izejas kodu

Updated glslang.

Branimir Karadžić 7 gadi atpakaļ
vecāks
revīzija
3939fbb916

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 175 - 146
3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.c


+ 7 - 7
3rdparty/glslang/Test/baseLegalResults/hlsl.partialFlattenLocal.vert.out

@@ -2,7 +2,7 @@ hlsl.partialFlattenLocal.vert
 WARNING: AST will form illegal SPIR-V; need to transform to legalize
 // Module Version 10000
 // Generated by (magic number): 80004
-// Id's are bound by 165
+// Id's are bound by 169
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
@@ -52,22 +52,22 @@ WARNING: AST will form illegal SPIR-V; need to transform to legalize
                               Store 137 38
                               Branch 100
              100:             Label
-             164:     21(int) Phi 25 5 119 106
-             105:    54(bool) SLessThan 164 31
+             168:     21(int) Phi 25 5 119 106
+             105:    54(bool) SLessThan 168 31
                               LoopMerge 101 106 None
                               BranchConditional 105 106 101
              106:               Label
-             138:     39(ptr)   AccessChain 133 164
+             138:     39(ptr)   AccessChain 133 168
              110:   18(fvec2)   Load 138
-             139:     34(ptr)   AccessChain 131 164
+             139:     34(ptr)   AccessChain 131 168
              112:   14(fvec3)   Load 139
              113:   18(fvec2)   VectorShuffle 112 112 0 1
              114:   18(fvec2)   FAdd 113 110
-             140:     34(ptr)   AccessChain 131 164
+             140:     34(ptr)   AccessChain 131 168
              116:   14(fvec3)   Load 140
              117:   14(fvec3)   VectorShuffle 116 114 3 4 2
                                 Store 140 117
-             119:     21(int)   IAdd 164 31
+             119:     21(int)   IAdd 168 31
                                 Branch 100
              101:             Label
              142:          17 Load 131

+ 6 - 0
3rdparty/glslang/Test/baseResults/matrix2.frag.out

@@ -158,6 +158,9 @@ Shader version: 150
 0:49            'FragColor' ( out 4-component vector of float)
 0:49            Constant:
 0:49              3 (const int)
+0:50      matrix mult second child into first child ( temp 3X4 matrix of float)
+0:50        'm34' ( temp 3X4 matrix of float)
+0:50        'colorTransform' ( uniform 3X3 matrix of float)
 0:?   Linker Objects
 0:?     'colorTransform' ( uniform 3X3 matrix of float)
 0:?     'Color' ( smooth in 3-component vector of float)
@@ -331,6 +334,9 @@ Shader version: 150
 0:49            'FragColor' ( out 4-component vector of float)
 0:49            Constant:
 0:49              3 (const int)
+0:50      matrix mult second child into first child ( temp 3X4 matrix of float)
+0:50        'm34' ( temp 3X4 matrix of float)
+0:50        'colorTransform' ( uniform 3X3 matrix of float)
 0:?   Linker Objects
 0:?     'colorTransform' ( uniform 3X3 matrix of float)
 0:?     'Color' ( smooth in 3-component vector of float)

+ 7 - 1
3rdparty/glslang/Test/baseResults/matrixError.vert.out

@@ -6,7 +6,9 @@ ERROR: 0:18: 'assign' :  cannot convert from ' temp 2-component vector of float'
 ERROR: 0:19: 'xy' : does not apply to this type:  temp 2X3 matrix of float
 ERROR: 0:21: '[' :  matrix index out of range '2'
 ERROR: 0:21: '[' :  vector index out of range '4'
-ERROR: 7 compilation errors.  No code generated.
+ERROR: 0:22: 'assign' :  cannot convert from ' temp 2X3 matrix of float' to ' temp 2X3 matrix of float'
+ERROR: 0:23: 'assign' :  cannot convert from ' uniform 3X2 matrix of float' to ' temp 2X3 matrix of float'
+ERROR: 9 compilation errors.  No code generated.
 
 
 Shader version: 120
@@ -32,6 +34,8 @@ ERROR: node is still EOpNull!
 0:21                2 (const int)
 0:21            Constant:
 0:21              4 (const int)
+0:22      'm23' ( temp 2X3 matrix of float)
+0:23      'm23' ( temp 2X3 matrix of float)
 0:?   Linker Objects
 0:?     'v3' ( in 3-component vector of float)
 0:?     'm32' ( uniform 3X2 matrix of float)
@@ -64,6 +68,8 @@ ERROR: node is still EOpNull!
 0:21                2 (const int)
 0:21            Constant:
 0:21              4 (const int)
+0:22      'm23' ( temp 2X3 matrix of float)
+0:23      'm23' ( temp 2X3 matrix of float)
 0:?   Linker Objects
 0:?     'v3' ( in 3-component vector of float)
 0:?     'm32' ( uniform 3X2 matrix of float)

+ 2 - 0
3rdparty/glslang/Test/baseResults/preprocessor.pragma.vert.err

@@ -0,0 +1,2 @@
+WARNING: 0:10: '#pragma once' : not implemented 
+

+ 2 - 0
3rdparty/glslang/Test/baseResults/preprocessor.pragma.vert.out

@@ -7,6 +7,8 @@
 
 #pragma undefined_pragma(x,4)
 
+#pragma once
+
 int main(){
 }
 

+ 1 - 0
3rdparty/glslang/Test/matrix2.frag

@@ -47,4 +47,5 @@ void main()
     FragColor *= inv4;
 
     FragColor = vec4(FragColor * matrixCompMult(un34, un34), FragColor.w);
+    m34 *= colorTransform;
 }

+ 2 - 0
3rdparty/glslang/Test/matrixError.vert

@@ -19,4 +19,6 @@ void main()
     m23.xy;            // ERROR, can't use .
 
     gl_Position = vec4(m23 * m32 * v3, m24[2][4]);  // ERROR, 2 and 4 are out of range
+    m23 *= m23;        // ERROR, right side needs to be square
+    m23 *= m32;        // ERROR, left columns must match right rows
 }

+ 2 - 0
3rdparty/glslang/Test/preprocessor.pragma.vert

@@ -7,5 +7,7 @@
 
 #pragma undefined_pragma(x, 4)
 
+#pragma once
+
 int main() {
 }

+ 1 - 1
3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp

@@ -2706,7 +2706,7 @@ bool TIntermediate::promoteBinary(TIntermBinary& node)
                 node.setOp(op = EOpMatrixTimesScalarAssign);
             }
         } else if (left->isMatrix() && right->isMatrix()) {
-            if (left->getMatrixCols() != left->getMatrixRows() || left->getMatrixCols() != right->getMatrixCols() || left->getMatrixCols() != right->getMatrixRows())
+            if (left->getMatrixCols() != right->getMatrixCols() || left->getMatrixCols() != right->getMatrixRows())
                 return false;
             node.setOp(op = EOpMatrixTimesMatrixAssign);
         } else if (!left->isMatrix() && !right->isMatrix()) {

+ 5 - 0
3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp

@@ -266,6 +266,8 @@ void TParseContext::handlePragma(const TSourceLoc& loc, const TVector<TString>&
         if (tokens.size() != 1)
             error(loc, "extra tokens", "#pragma", "");
         intermediate.setUseStorageBuffer();
+    } else if (tokens[0].compare("once") == 0) {
+        warn(loc, "not implemented", "#pragma once", "");
     }
 }
 
@@ -1583,6 +1585,9 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
     case EOpInterpolateAtCentroid:
     case EOpInterpolateAtSample:
     case EOpInterpolateAtOffset:
+#ifdef AMD_EXTENSIONS
+    case EOpInterpolateAtVertex:
+#endif
         // Make sure the first argument is an interpolant, or an array element of an interpolant
         if (arg0->getType().getQualifier().storage != EvqVaryingIn) {
             // It might still be an array element.

+ 7 - 0
3rdparty/glslang/hlsl/hlslParseHelper.cpp

@@ -550,6 +550,13 @@ void HlslParseContext::handlePragma(const TSourceLoc& loc, const TVector<TString
             warn(loc, "unknown pack_matrix pragma value", tokens[2].c_str(), "");
             globalUniformDefaults.layoutMatrix = globalBufferDefaults.layoutMatrix = ElmRowMajor;
         }
+        return;
+    }
+
+    // Handle once
+    if (lowerTokens[0] == "once") {
+        warn(loc, "not implemented", "#pragma once", "");
+        return;
     }
 }
 

+ 1 - 1
3rdparty/glslang/known_good.json

@@ -5,7 +5,7 @@
       "site" : "github",
       "subrepo" : "KhronosGroup/SPIRV-Tools",
       "subdir" : "External/spirv-tools",
-      "commit" : "9e19fc0f31ceaf1f6bc907dbf17dcfded85f2ce8"
+      "commit" : "4e4a254bc85ea41af93a048f1713ef27e04c01ab"
     },
     {
       "name" : "spirv-tools/external/spirv-headers",

+ 13 - 9
3rdparty/glslang/update_glslang_sources.py

@@ -28,8 +28,12 @@ import sys
 
 KNOWN_GOOD_FILE = 'known_good.json'
 
+SITE_TO_KNOWN_GOOD_FILE = { 'github' : 'known_good.json',
+                            'gitlab' : 'known_good_khr.json' }
+
 # Maps a site name to its hostname.
-SITE_TO_HOST = { 'github' : 'github.com' }
+SITE_TO_HOST = { 'github' : 'https://github.com/',
+                 'gitlab' : '[email protected]:' }
 
 VERBOSE = True
 
@@ -82,14 +86,11 @@ class GoodCommit(object):
         self.subdir = json['subdir'] if ('subdir' in json) else '.'
         self.commit = json['commit']
 
-    def GetUrl(self, style='https'):
+    def GetUrl(self):
         """Returns the URL for the repository."""
         host = SITE_TO_HOST[self.site]
-        sep = '/' if (style is 'https') else ':'
-        return '{style}://{host}{sep}{subrepo}'.format(
-                    style=style,
+        return '{host}{subrepo}'.format(
                     host=host,
-                    sep=sep,
                     subrepo=self.subrepo)
 
     def AddRemote(self):
@@ -120,9 +121,10 @@ class GoodCommit(object):
         command_output(['git', 'checkout', self.commit], self.subdir)
 
 
-def GetGoodCommits():
+def GetGoodCommits(site):
     """Returns the latest list of GoodCommit objects."""
-    with open(KNOWN_GOOD_FILE) as known_good:
+    known_good_file = SITE_TO_KNOWN_GOOD_FILE[site]
+    with open(known_good_file) as known_good:
         return [GoodCommit(c) for c in json.loads(known_good.read())['commits']]
 
 
@@ -130,10 +132,12 @@ def main():
     parser = argparse.ArgumentParser(description='Get Glslang source dependencies at a known-good commit')
     parser.add_argument('--dir', dest='dir', default='.',
                         help="Set target directory for Glslang source root. Default is \'.\'.")
+    parser.add_argument('--site', dest='site', default='github',
+                        help="Set git server site. Default is github.")
 
     args = parser.parse_args()
 
-    commits = GetGoodCommits()
+    commits = GetGoodCommits(args.site)
 
     distutils.dir_util.mkpath(args.dir)
     print('Change directory to {d}'.format(d=args.dir))

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels