From 9f2592ed9d70342ba9cd459693013a2814fb5b69 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Wed, 15 Aug 2018 12:59:17 -0700 Subject: [PATCH] Update SPIRV libraries (#99) * Update SPIRV libraries - Update `spirv-cross` - Update `spirv-tools` - Update `glslang` `spirv-tools` contains a fix for an issue we reported (unnecessary promotions to highp in certain expressions). * Add SPIRV-Tools dependency to matinfo --- third_party/glslang/CMakeLists.txt | 0 third_party/glslang/ChooseMSVCCRT.cmake | 0 third_party/glslang/External/CMakeLists.txt | 0 .../glslang/OGLCompilersDLL/CMakeLists.txt | 0 .../glslang/OGLCompilersDLL/InitializeDll.cpp | 0 .../glslang/OGLCompilersDLL/InitializeDll.h | 0 third_party/glslang/README-spirv-remap.txt | 0 third_party/glslang/README.md | 8 +- third_party/glslang/SPIRV/CMakeLists.txt | 1 + third_party/glslang/SPIRV/GLSL.ext.AMD.h | 0 third_party/glslang/SPIRV/GLSL.ext.EXT.h | 0 third_party/glslang/SPIRV/GLSL.ext.NV.h | 0 third_party/glslang/SPIRV/GlslangToSpv.cpp | 193 +- third_party/glslang/SPIRV/GlslangToSpv.h | 0 third_party/glslang/SPIRV/InReadableOrder.cpp | 0 third_party/glslang/SPIRV/Logger.cpp | 0 third_party/glslang/SPIRV/Logger.h | 0 third_party/glslang/SPIRV/SpvBuilder.cpp | 84 +- third_party/glslang/SPIRV/SpvBuilder.h | 15 +- third_party/glslang/SPIRV/SpvPostProcess.cpp | 164 ++ third_party/glslang/SPIRV/bitutils.h | 0 third_party/glslang/SPIRV/doc.h | 0 third_party/glslang/SPIRV/hex_float.h | 0 third_party/glslang/SPIRV/spvIR.h | 39 +- third_party/glslang/SPIRV/tnt/CMakeLists.txt | 1 + .../glslang/StandAlone/DirStackFileIncluder.h | 0 .../glslang/StandAlone/ResourceLimits.cpp | 0 .../glslang/StandAlone/ResourceLimits.h | 0 third_party/glslang/StandAlone/StandAlone.cpp | 171 +- third_party/glslang/StandAlone/Worklist.h | 0 .../glslang/StandAlone/spirv-remap.cpp | 0 third_party/glslang/Test/100.conf | 0 third_party/glslang/Test/100.frag | 0 third_party/glslang/Test/100Limits.vert | 0 .../glslang/Test/100samplerExternal.frag | 0 third_party/glslang/Test/100scope.vert | 0 third_party/glslang/Test/120.frag | 0 third_party/glslang/Test/120.vert | 0 third_party/glslang/Test/130.frag | 0 third_party/glslang/Test/130.vert | 0 third_party/glslang/Test/140.frag | 0 third_party/glslang/Test/140.vert | 0 third_party/glslang/Test/150.frag | 0 third_party/glslang/Test/150.geom | 0 third_party/glslang/Test/150.tesc | 0 third_party/glslang/Test/150.tese | 0 third_party/glslang/Test/150.vert | 0 third_party/glslang/Test/300.frag | 0 third_party/glslang/Test/300.vert | 0 third_party/glslang/Test/300BuiltIns.frag | 0 third_party/glslang/Test/300block.frag | 0 third_party/glslang/Test/300layout.frag | 0 third_party/glslang/Test/300layout.vert | 0 third_party/glslang/Test/300link.frag | 0 third_party/glslang/Test/300link2.frag | 0 third_party/glslang/Test/300link3.frag | 0 third_party/glslang/Test/300operations.frag | 0 .../glslang/Test/300samplerExternal.frag | 0 third_party/glslang/Test/300scope.vert | 0 third_party/glslang/Test/310.comp | 0 third_party/glslang/Test/310.frag | 0 third_party/glslang/Test/310.geom | 0 third_party/glslang/Test/310.tesc | 0 third_party/glslang/Test/310.tese | 0 third_party/glslang/Test/310.vert | 0 third_party/glslang/Test/310AofA.vert | 0 .../Test/310implicitSizeArrayError.vert | 0 third_party/glslang/Test/320.comp | 0 third_party/glslang/Test/320.frag | 0 third_party/glslang/Test/320.geom | 0 third_party/glslang/Test/320.tesc | 0 third_party/glslang/Test/320.tese | 0 third_party/glslang/Test/320.vert | 0 third_party/glslang/Test/330.frag | 0 third_party/glslang/Test/330comp.frag | 0 third_party/glslang/Test/400.frag | 0 third_party/glslang/Test/400.tesc | 0 third_party/glslang/Test/400.tese | 0 third_party/glslang/Test/400.vert | 0 third_party/glslang/Test/410.geom | 0 third_party/glslang/Test/410.tesc | 0 third_party/glslang/Test/410.vert | 0 third_party/glslang/Test/420.frag | 0 third_party/glslang/Test/420.geom | 0 third_party/glslang/Test/420.tesc | 0 third_party/glslang/Test/420.tese | 0 third_party/glslang/Test/420.vert | 0 third_party/glslang/Test/420_size_gl_in.geom | 0 third_party/glslang/Test/430.comp | 0 third_party/glslang/Test/430.vert | 0 third_party/glslang/Test/430AofA.frag | 0 third_party/glslang/Test/430scope.vert | 0 third_party/glslang/Test/435.vert | 0 third_party/glslang/Test/440.frag | 0 third_party/glslang/Test/440.vert | 0 third_party/glslang/Test/450.comp | 0 third_party/glslang/Test/450.frag | 0 third_party/glslang/Test/450.geom | 0 third_party/glslang/Test/450.tesc | 0 third_party/glslang/Test/450.tese | 0 third_party/glslang/Test/450.vert | 0 third_party/glslang/Test/460.frag | 0 third_party/glslang/Test/460.vert | 0 third_party/glslang/Test/Operations.frag | 0 third_party/glslang/Test/aggOps.frag | 0 third_party/glslang/Test/always-discard.frag | 0 third_party/glslang/Test/always-discard2.frag | 0 third_party/glslang/Test/array.frag | 0 third_party/glslang/Test/array100.frag | 0 third_party/glslang/Test/atomic_uint.frag | 0 third_party/glslang/Test/badChars.frag | 0 third_party/glslang/Test/bar.h | 0 .../hlsl.aliasOpaque.frag.out | 0 .../hlsl.flattenOpaque.frag.out | 0 .../hlsl.flattenOpaqueInit.vert.out | 0 .../hlsl.flattenOpaqueInitMix.vert.out | 0 .../glslang/Test/baseResults/100.frag.out | 0 .../Test/baseResults/100Limits.vert.out | 0 .../Test/baseResults/100LimitsConf.vert.out | 0 .../baseResults/100samplerExternal.frag.out | 0 .../Test/baseResults/100scope.vert.out | 0 .../Test/baseResults/110scope.vert.out | 0 .../glslang/Test/baseResults/120.frag.out | 0 .../glslang/Test/baseResults/120.vert.out | 0 .../glslang/Test/baseResults/130.frag.out | 0 .../glslang/Test/baseResults/130.vert.out | 0 .../glslang/Test/baseResults/140.frag.out | 0 .../glslang/Test/baseResults/140.vert.out | 0 .../glslang/Test/baseResults/150.frag.out | 0 .../glslang/Test/baseResults/150.geom.out | 0 .../glslang/Test/baseResults/150.tesc.out | 0 .../glslang/Test/baseResults/150.vert.out | 0 .../glslang/Test/baseResults/300.frag.out | 0 .../glslang/Test/baseResults/300.vert.out | 0 .../Test/baseResults/300BuiltIns.frag.out | 0 .../Test/baseResults/300block.frag.out | 0 .../Test/baseResults/300layout.frag.out | 0 .../Test/baseResults/300layout.vert.out | 0 .../glslang/Test/baseResults/300link.frag.out | 0 .../Test/baseResults/300link2.frag.out | 0 .../Test/baseResults/300link3.frag.out | 0 .../Test/baseResults/300operations.frag.out | 0 .../baseResults/300samplerExternal.frag.out | 0 .../Test/baseResults/300scope.vert.out | 0 .../glslang/Test/baseResults/310.comp.out | 0 .../glslang/Test/baseResults/310.frag.out | 0 .../glslang/Test/baseResults/310.geom.out | 0 .../glslang/Test/baseResults/310.tesc.out | 0 .../glslang/Test/baseResults/310.tese.out | 0 .../glslang/Test/baseResults/310.vert.out | 0 .../glslang/Test/baseResults/310AofA.vert.out | 0 .../310implicitSizeArrayError.vert.out | 0 .../glslang/Test/baseResults/330.frag.out | 0 .../glslang/Test/baseResults/330comp.frag.out | 0 .../glslang/Test/baseResults/400.frag.out | 0 .../glslang/Test/baseResults/400.geom.out | 0 .../glslang/Test/baseResults/400.tesc.out | 0 .../glslang/Test/baseResults/400.tese.out | 0 .../glslang/Test/baseResults/410.geom.out | 0 .../glslang/Test/baseResults/410.tesc.out | 0 .../glslang/Test/baseResults/420.frag.out | 0 .../glslang/Test/baseResults/420.geom.out | 0 .../glslang/Test/baseResults/420.tesc.out | 0 .../glslang/Test/baseResults/420.tese.out | 0 .../glslang/Test/baseResults/420.vert.out | 0 .../Test/baseResults/420_size_gl_in.geom.out | 0 .../glslang/Test/baseResults/430.comp.out | 0 .../glslang/Test/baseResults/430.vert.out | 0 .../glslang/Test/baseResults/430AofA.frag.out | 0 .../Test/baseResults/430scope.vert.out | 0 .../glslang/Test/baseResults/440.frag.out | 0 .../glslang/Test/baseResults/440.vert.out | 0 .../glslang/Test/baseResults/450.comp.out | 0 .../glslang/Test/baseResults/450.frag.out | 0 .../glslang/Test/baseResults/450.geom.out | 0 .../glslang/Test/baseResults/450.tesc.out | 0 .../glslang/Test/baseResults/450.tese.out | 0 .../glslang/Test/baseResults/450.vert.out | 0 .../Test/baseResults/Operations.frag.out | 0 .../glslang/Test/baseResults/aggOps.frag.out | 0 .../Test/baseResults/always-discard.frag.out | 0 .../Test/baseResults/always-discard2.frag.out | 0 .../glslang/Test/baseResults/array.frag.out | 0 .../Test/baseResults/array100.frag.out | 0 .../Test/baseResults/atomic_uint.frag.out | 0 .../Test/baseResults/badChars.frag.out | 0 .../Test/baseResults/badMacroArgs.frag.out | 0 .../glslang/Test/baseResults/comment.frag.out | 0 .../baseResults/conditionalDiscard.frag.out | 0 .../Test/baseResults/constErrors.frag.out | 0 .../Test/baseResults/constFold.frag.out | 0 .../Test/baseResults/constFoldIntMin.frag.out | 0 .../Test/baseResults/conversion.frag.out | 0 .../Test/baseResults/cppComplexExpr.vert.out | 0 .../Test/baseResults/cppIndent.vert.out | 0 .../cppIntMinOverNegativeOne.frag.out | 0 .../glslang/Test/baseResults/cppNest.vert.out | 0 .../Test/baseResults/cppSimple.vert.out | 0 .../glslang/Test/baseResults/dataOut.frag.out | 0 .../Test/baseResults/dataOutIndirect.frag.out | 0 .../glslang/Test/baseResults/dce.frag.out | 0 .../glslang/Test/baseResults/decls.frag.out | 0 .../Test/baseResults/deepRvalue.frag.out | 0 .../Test/baseResults/depthOut.frag.out | 0 .../Test/baseResults/discard-dce.frag.out | 0 .../Test/baseResults/doWhileLoop.frag.out | 0 .../baseResults/earlyReturnDiscard.frag.out | 0 .../glslang/Test/baseResults/empty.frag.out | 0 .../glslang/Test/baseResults/errors.frag.out | 0 .../Test/baseResults/es-link1.frag.out | 0 .../Test/baseResults/findFunction.frag.out | 0 .../Test/baseResults/flowControl.frag.out | 0 .../glslang/Test/baseResults/forLoop.frag.out | 0 .../Test/baseResults/forwardRef.frag.out | 0 .../Test/baseResults/functionCall.frag.out | 0 .../baseResults/functionSemantics.frag.out | 0 .../Test/baseResults/glsl.-D-U.frag.out | 0 .../glsl.entryPointRename.vert.bad.out | 0 .../glsl.entryPointRename.vert.out | 0 .../glsl.entryPointRename2.vert.out | 0 .../Test/baseResults/hlsl.-D-U.frag.out | 0 .../baseResults/hlsl.array.flatten.frag.out | 0 .../hlsl.array.implicit-size.frag.out | 0 .../baseResults/hlsl.array.multidim.frag.out | 0 .../hlsl.attribute.expression.comp.out | 0 .../Test/baseResults/hlsl.automap.frag.out | 0 .../Test/baseResults/hlsl.basic.geom.out | 0 .../hlsl.calculatelod.dx10.frag.out | 0 .../hlsl.calculatelodunclamped.dx10.frag.out | 0 .../hlsl.cbuffer-identifier.vert.out | 0 .../Test/baseResults/hlsl.clip.frag.out | 0 .../baseResults/hlsl.clipdistance-1.frag.out | 0 .../baseResults/hlsl.clipdistance-1.geom.out | 0 .../baseResults/hlsl.clipdistance-1.vert.out | 0 .../baseResults/hlsl.clipdistance-2.frag.out | 0 .../baseResults/hlsl.clipdistance-2.geom.out | 0 .../baseResults/hlsl.clipdistance-2.vert.out | 0 .../baseResults/hlsl.clipdistance-3.frag.out | 0 .../baseResults/hlsl.clipdistance-3.geom.out | 0 .../baseResults/hlsl.clipdistance-3.vert.out | 0 .../baseResults/hlsl.clipdistance-4.frag.out | 0 .../baseResults/hlsl.clipdistance-4.geom.out | 0 .../baseResults/hlsl.clipdistance-4.vert.out | 0 .../baseResults/hlsl.clipdistance-5.frag.out | 0 .../baseResults/hlsl.clipdistance-5.vert.out | 0 .../baseResults/hlsl.clipdistance-6.frag.out | 0 .../baseResults/hlsl.clipdistance-6.vert.out | 0 .../baseResults/hlsl.clipdistance-7.frag.out | 0 .../baseResults/hlsl.clipdistance-7.vert.out | 0 .../baseResults/hlsl.clipdistance-8.frag.out | 0 .../baseResults/hlsl.clipdistance-8.vert.out | 0 .../baseResults/hlsl.clipdistance-9.frag.out | 0 .../baseResults/hlsl.clipdistance-9.vert.out | 0 .../Test/baseResults/hlsl.color.hull.tesc.out | 0 .../baseResults/hlsl.comparison.vec.frag.out | 0 .../baseResults/hlsl.constantbuffer.frag.out | 0 .../baseResults/hlsl.constructexpr.frag.out | 0 .../baseResults/hlsl.constructimat.frag.out | 0 .../Test/baseResults/hlsl.dashI.vert.out | 0 .../hlsl.deadFunctionMissingBody.vert.out | 0 .../Test/baseResults/hlsl.domain.1.tese.out | 0 .../Test/baseResults/hlsl.domain.2.tese.out | 0 .../Test/baseResults/hlsl.domain.3.tese.out | 0 .../hlsl.emptystruct.init.vert.out | 0 .../hlsl.emptystructreturn.frag.out | 0 .../hlsl.emptystructreturn.vert.out | 0 .../baseResults/hlsl.entry.rename.frag.out | 0 .../hlsl.explicitDescriptorSet-2.frag.out | 0 .../hlsl.explicitDescriptorSet.frag.out | 0 .../baseResults/hlsl.flatten.return.frag.out | 0 .../glslang/Test/baseResults/hlsl.frag.out | 0 .../Test/baseResults/hlsl.fraggeom.frag.out | 0 .../hlsl.gather.array.dx10.frag.out | 0 .../hlsl.gather.basic.dx10.frag.out | 0 .../hlsl.gather.basic.dx10.vert.out | 0 .../hlsl.gather.offset.dx10.frag.out | 0 .../hlsl.gather.offsetarray.dx10.frag.out | 0 .../hlsl.gatherRGBA.array.dx10.frag.out | 0 .../hlsl.gatherRGBA.basic.dx10.frag.out | 0 .../hlsl.gatherRGBA.offset.dx10.frag.out | 0 .../hlsl.gatherRGBA.offsetarray.dx10.frag.out | 0 .../hlsl.gathercmpRGBA.offset.dx10.frag.out | 0 .../hlsl.getdimensions.dx10.frag.out | 0 .../hlsl.getdimensions.dx10.vert.out | 0 .../hlsl.getdimensions.rw.dx10.frag.out | 0 .../hlsl.getsampleposition.dx10.frag.out | 0 .../hlsl.global-const-init.frag.out | 0 .../Test/baseResults/hlsl.gs-hs-mix.tesc.out | 0 .../Test/baseResults/hlsl.hlslOffset.vert.out | 0 .../Test/baseResults/hlsl.hull.1.tesc.out | 0 .../Test/baseResults/hlsl.hull.2.tesc.out | 0 .../Test/baseResults/hlsl.hull.4.tesc.out | 0 .../Test/baseResults/hlsl.hull.5.tesc.out | 0 .../baseResults/hlsl.hull.ctrlpt-1.tesc.out | 0 .../baseResults/hlsl.hull.ctrlpt-2.tesc.out | 0 .../Test/baseResults/hlsl.hull.void.tesc.out | 0 .../hlsl.identifier.sample.frag.out | 0 .../hlsl.imagefetch-subvec4.comp.out | 0 .../Test/baseResults/hlsl.init2.frag.out | 0 .../Test/baseResults/hlsl.inoutquals.frag.out | 0 .../baseResults/hlsl.intrinsic.frexp.frag.out | 0 .../baseResults/hlsl.intrinsic.frexp.vert.out | 0 .../hlsl.intrinsics.barriers.comp.out | 0 .../Test/baseResults/hlsl.intrinsics.comp.out | 0 .../hlsl.intrinsics.d3dcolortoubyte4.frag.out | 0 .../hlsl.intrinsics.double.frag.out | 0 .../hlsl.intrinsics.evalfns.frag.out | 0 .../hlsl.intrinsics.f1632.frag.out | 0 .../hlsl.intrinsics.f3216.frag.out | 0 .../Test/baseResults/hlsl.intrinsics.frag.out | 0 .../baseResults/hlsl.intrinsics.lit.frag.out | 0 .../hlsl.intrinsics.negative.comp.out | 0 .../hlsl.intrinsics.negative.frag.out | 0 .../hlsl.intrinsics.negative.vert.out | 0 .../hlsl.intrinsics.promote.down.frag.out | 0 .../hlsl.intrinsics.promote.frag.out | 0 .../hlsl.intrinsics.promote.outputs.frag.out | 0 .../Test/baseResults/hlsl.intrinsics.vert.out | 0 .../Test/baseResults/hlsl.isfinite.frag.out | 0 .../baseResults/hlsl.load.2dms.dx10.frag.out | 0 .../baseResults/hlsl.load.array.dx10.frag.out | 0 .../baseResults/hlsl.load.basic.dx10.frag.out | 0 .../baseResults/hlsl.load.basic.dx10.vert.out | 0 .../hlsl.load.buffer.dx10.frag.out | 0 .../hlsl.load.buffer.float.dx10.frag.out | 0 .../hlsl.load.offset.dx10.frag.out | 0 .../hlsl.load.offsetarray.dx10.frag.out | 0 .../hlsl.load.rwbuffer.dx10.frag.out | 0 .../hlsl.load.rwtexture.array.dx10.frag.out | 0 .../hlsl.load.rwtexture.dx10.frag.out | 0 .../hlsl.localStructuredBuffer.comp.out | 0 .../baseResults/hlsl.logical.binary.frag.out | 0 .../hlsl.logical.binary.vec.frag.out | 0 .../baseResults/hlsl.logical.unary.frag.out | 0 .../Test/baseResults/hlsl.loopattr.frag.out | 0 .../Test/baseResults/hlsl.matNx1.frag.out | 0 .../baseResults/hlsl.matType.bool.frag.out | 0 .../baseResults/hlsl.matType.int.frag.out | 0 .../Test/baseResults/hlsl.matpack-1.frag.out | 0 .../baseResults/hlsl.matpack-pragma.frag.out | 0 .../baseResults/hlsl.matrixindex.frag.out | 0 .../Test/baseResults/hlsl.mintypes.frag.out | 0 .../baseResults/hlsl.mip.negative.frag.out | 0 .../baseResults/hlsl.mip.negative2.frag.out | 0 .../baseResults/hlsl.mip.operator.frag.out | 0 .../baseResults/hlsl.mul-truncate.frag.out | 0 .../hlsl.multiDescriptorSet.frag.out | 0 .../baseResults/hlsl.nonint-index.frag.out | 0 .../baseResults/hlsl.numericsuffixes.frag.out | 0 .../Test/baseResults/hlsl.numthreads.comp.out | 0 .../baseResults/hlsl.opaque-type-bug.frag.out | 0 .../baseResults/hlsl.params.default.frag.out | 0 .../hlsl.params.default.negative.frag.out | 0 .../Test/baseResults/hlsl.pp.line.frag.out | 0 .../Test/baseResults/hlsl.precise.frag.out | 0 .../baseResults/hlsl.preprocessor.frag.out | 0 .../baseResults/hlsl.promote.atomic.frag.out | 0 .../baseResults/hlsl.promote.binary.frag.out | 0 .../baseResults/hlsl.promote.vec1.frag.out | 0 .../Test/baseResults/hlsl.promotions.frag.out | 0 .../hlsl.reflection.binding.frag.out | 0 .../hlsl.reflection.binding.vert.out | 0 .../Test/baseResults/hlsl.reflection.vert.out | 0 .../Test/baseResults/hlsl.rw.atomics.frag.out | 0 .../Test/baseResults/hlsl.rw.bracket.frag.out | 0 .../baseResults/hlsl.rw.register.frag.out | 0 .../hlsl.rw.scalar.bracket.frag.out | 0 .../Test/baseResults/hlsl.rw.swizzle.frag.out | 0 .../baseResults/hlsl.rw.vec2.bracket.frag.out | 0 .../hlsl.sample.array.dx10.frag.out | 0 .../hlsl.sample.basic.dx10.frag.out | 0 .../hlsl.sample.offset.dx10.frag.out | 0 .../hlsl.sample.offsetarray.dx10.frag.out | 0 .../hlsl.sample.sub-vec4.dx10.frag.out | 0 .../hlsl.samplebias.array.dx10.frag.out | 0 .../hlsl.samplebias.basic.dx10.frag.out | 0 .../hlsl.samplebias.offset.dx10.frag.out | 0 .../hlsl.samplebias.offsetarray.dx10.frag.out | 0 .../hlsl.samplecmp.array.dx10.frag.out | 0 .../hlsl.samplecmp.basic.dx10.frag.out | 0 .../hlsl.samplecmp.dualmode.frag.out | 0 .../hlsl.samplecmp.negative.frag.out | 0 .../hlsl.samplecmp.negative2.frag.out | 0 .../hlsl.samplecmp.offset.dx10.frag.out | 0 .../hlsl.samplecmp.offsetarray.dx10.frag.out | 0 ...lsl.samplecmplevelzero.array.dx10.frag.out | 0 ...lsl.samplecmplevelzero.basic.dx10.frag.out | 0 ...sl.samplecmplevelzero.offset.dx10.frag.out | 0 ...mplecmplevelzero.offsetarray.dx10.frag.out | 0 .../hlsl.samplegrad.array.dx10.frag.out | 0 .../hlsl.samplegrad.basic.dx10.frag.out | 0 .../hlsl.samplegrad.basic.dx10.vert.out | 0 .../hlsl.samplegrad.offset.dx10.frag.out | 0 .../hlsl.samplegrad.offsetarray.dx10.frag.out | 0 .../hlsl.samplelevel.array.dx10.frag.out | 0 .../hlsl.samplelevel.basic.dx10.frag.out | 0 .../hlsl.samplelevel.basic.dx10.vert.out | 0 .../hlsl.samplelevel.offset.dx10.frag.out | 0 ...hlsl.samplelevel.offsetarray.dx10.frag.out | 0 .../baseResults/hlsl.scalar-length.frag.out | 0 .../baseResults/hlsl.scalar2matrix.frag.out | 0 .../Test/baseResults/hlsl.semantic-1.vert.out | 0 .../Test/baseResults/hlsl.semicolons.frag.out | 0 .../baseResults/hlsl.shift.per-set.frag.out | 29 +- .../Test/baseResults/hlsl.snorm.uav.comp.out | 0 ...sl.store.rwbyteaddressbuffer.type.comp.out | 0 .../baseResults/hlsl.stringtoken.frag.out | 0 .../baseResults/hlsl.struct.split-1.vert.out | 0 .../hlsl.struct.split.array.geom.out | 0 .../hlsl.struct.split.assign.frag.out | 0 .../hlsl.struct.split.call.vert.out | 0 .../hlsl.struct.split.nested.geom.out | 0 .../hlsl.struct.split.trivial.geom.out | 0 .../hlsl.struct.split.trivial.vert.out | 0 .../hlsl.structarray.flatten.frag.out | 0 .../hlsl.structarray.flatten.geom.out | 0 .../hlsl.structbuffer.append.fn.frag.out | 0 .../hlsl.structbuffer.append.frag.out | 0 .../hlsl.structbuffer.atomics.frag.out | 0 .../hlsl.structbuffer.byte.frag.out | 0 .../hlsl.structbuffer.coherent.frag.out | 0 .../hlsl.structbuffer.floatidx.comp.out | 0 .../baseResults/hlsl.structbuffer.fn.frag.out | 0 .../hlsl.structbuffer.fn2.comp.out | 0 .../baseResults/hlsl.structbuffer.frag.out | 0 ...hlsl.structbuffer.incdec.frag.hlslfun1.out | 0 .../hlsl.structbuffer.incdec.frag.out | 0 .../baseResults/hlsl.structbuffer.rw.frag.out | 0 .../hlsl.structbuffer.rwbyte.frag.out | 0 .../Test/baseResults/hlsl.subpass.frag.out | 0 .../baseResults/hlsl.templatetypes.frag.out | 0 .../baseResults/hlsl.texture.struct.frag.out | 0 .../baseResults/hlsl.texture.subvec4.frag.out | 0 .../baseResults/hlsl.texturebuffer.frag.out | 0 .../Test/baseResults/hlsl.tx.bracket.frag.out | 0 .../baseResults/hlsl.tx.overload.frag.out | 0 .../Test/baseResults/hlsl.type.half.frag.out | 0 .../baseResults/hlsl.type.identifier.frag.out | 0 .../baseResults/hlsl.wavebroadcast.comp.out | 0 .../Test/baseResults/hlsl.waveprefix.comp.out | 0 .../Test/baseResults/hlsl.wavequad.comp.out | 0 .../Test/baseResults/hlsl.wavequery.comp.out | 0 .../Test/baseResults/hlsl.wavequery.frag.out | 0 .../baseResults/hlsl.wavereduction.comp.out | 0 .../Test/baseResults/hlsl.wavevote.comp.out | 0 .../Test/baseResults/hlsl.y-negate-1.vert.out | 0 .../Test/baseResults/hlsl.y-negate-2.vert.out | 0 .../Test/baseResults/hlsl.y-negate-3.vert.out | 0 .../glslang/Test/baseResults/include.vert.out | 0 .../Test/baseResults/invalidSwizzle.vert.out | 0 .../glslang/Test/baseResults/length.frag.out | 0 .../baseResults/lineContinuation.vert.out | 0 .../baseResults/lineContinuation100.vert.out | 0 .../glslang/Test/baseResults/link1.frag.out | 0 .../Test/baseResults/link1.vk.frag.out | 0 .../Test/baseResults/localAggregates.frag.out | 0 .../glslang/Test/baseResults/loops.frag.out | 0 .../Test/baseResults/loopsArtificial.frag.out | 0 .../glslang/Test/baseResults/mains1.frag.out | 0 .../glslang/Test/baseResults/matrix.frag.out | 0 .../glslang/Test/baseResults/matrix2.frag.out | 0 .../Test/baseResults/matrixError.vert.out | 0 .../baseResults/maxClipDistances.vert.out | 0 .../Test/baseResults/max_vertices_0.geom.out | 0 .../baseResults/negativeArraySize.comp.out | 0 .../Test/baseResults/newTexture.frag.out | 0 .../glslang/Test/baseResults/noMain.vert.out | 0 .../Test/baseResults/nonSquare.vert.out | 0 .../Test/baseResults/nonVulkan.frag.out | 0 .../glslang/Test/baseResults/nosuffix.out | 0 .../glslang/Test/baseResults/numeral.frag.out | 0 ...vShaderNoperspectiveInterpolation.frag.out | 0 .../Test/baseResults/overlongLiteral.frag.out | 0 .../Test/baseResults/pointCoord.frag.out | 0 .../glslang/Test/baseResults/precise.tesc.out | 0 .../baseResults/precise_struct_block.vert.out | 0 .../Test/baseResults/precision.frag.out | 0 .../Test/baseResults/precision.vert.out | 0 .../glslang/Test/baseResults/prepost.frag.out | 0 .../preprocessor.cpp_style___FILE__.vert.err | 0 .../preprocessor.cpp_style___FILE__.vert.out | 0 ...rocessor.cpp_style_line_directive.vert.err | 0 ...rocessor.cpp_style_line_directive.vert.out | 0 .../baseResults/preprocessor.defined.vert.err | 0 .../baseResults/preprocessor.defined.vert.out | 0 .../preprocessor.edge_cases.vert.err | 0 .../preprocessor.edge_cases.vert.out | 0 .../preprocessor.eof_missing.vert.err | 0 .../preprocessor.eof_missing.vert.out | 0 .../baseResults/preprocessor.errors.vert.err | 0 .../baseResults/preprocessor.errors.vert.out | 0 .../preprocessor.extensions.vert.err | 0 .../preprocessor.extensions.vert.out | 0 .../preprocessor.function_macro.vert.err | 0 .../preprocessor.function_macro.vert.out | 0 .../preprocessor.include.disabled.vert.err | 0 .../preprocessor.include.disabled.vert.out | 0 .../preprocessor.include.enabled.vert.err | 0 .../preprocessor.include.enabled.vert.out | 0 .../baseResults/preprocessor.line.frag.err | 0 .../baseResults/preprocessor.line.frag.out | 0 .../baseResults/preprocessor.line.vert.err | 0 .../baseResults/preprocessor.line.vert.out | 0 .../preprocessor.many.endif.vert.err | 0 .../preprocessor.many.endif.vert.out | 0 .../baseResults/preprocessor.pragma.vert.err | 0 .../baseResults/preprocessor.pragma.vert.out | 0 .../baseResults/preprocessor.simple.vert.err | 0 .../baseResults/preprocessor.simple.vert.out | 0 ...essor.success_if_parse_would_fail.vert.err | 0 ...essor.success_if_parse_would_fail.vert.out | 0 .../Test/baseResults/recurse1.vert.out | 0 .../Test/baseResults/reflection.vert.out | 0 .../baseResults/remap.basic.dcefunc.frag.out | 0 .../remap.basic.dcevartype.frag.out | 0 .../remap.basic.everything.frag.out | 0 .../baseResults/remap.basic.none.frag.out | 0 .../baseResults/remap.basic.strip.frag.out | 0 ...emap.hlsl.sample.basic.everything.frag.out | 0 .../remap.hlsl.sample.basic.none.frag.out | 0 .../remap.hlsl.sample.basic.strip.frag.out | 0 ...map.hlsl.templatetypes.everything.frag.out | 0 .../remap.hlsl.templatetypes.none.frag.out | 0 .../baseResults/remap.if.everything.frag.out | 0 .../Test/baseResults/remap.if.none.frag.out | 0 .../baseResults/remap.invalid-spirv-1.out | 0 .../baseResults/remap.invalid-spirv-2.out | 0 .../remap.literal64.everything.spv.out | 0 .../baseResults/remap.literal64.none.spv.out | 0 .../remap.similar_1a.everything.frag.out | 0 .../remap.similar_1a.none.frag.out | 0 .../remap.similar_1b.everything.frag.out | 0 .../remap.similar_1b.none.frag.out | 0 .../Test/baseResults/remap.specconst.comp.out | 0 .../remap.switch.everything.frag.out | 0 .../baseResults/remap.switch.none.frag.out | 0 .../remap.uniformarray.everything.frag.out | 0 .../remap.uniformarray.none.frag.out | 0 .../glslang/Test/baseResults/sample.frag.out | 0 .../glslang/Test/baseResults/sample.vert.out | 0 .../baseResults/simpleFunctionCall.frag.out | 0 .../Test/baseResults/specExamples.frag.out | 0 .../Test/baseResults/specExamples.vert.out | 0 .../glslang/Test/baseResults/spv.130.frag.out | 0 .../Test/baseResults/spv.300layout.vert.out | 0 .../glslang/Test/baseResults/spv.310.comp.out | 0 .../glslang/Test/baseResults/spv.330.geom.out | 0 .../glslang/Test/baseResults/spv.400.frag.out | 0 .../glslang/Test/baseResults/spv.400.tesc.out | 0 .../glslang/Test/baseResults/spv.420.geom.out | 0 .../Test/baseResults/spv.AofA.frag.out | 0 .../spv.GeometryShaderPassthrough.geom.out | 0 .../baseResults/spv.OVR_multiview.vert.out | 0 .../Test/baseResults/spv.aggOps.frag.out | 0 .../baseResults/spv.always-discard.frag.out | 0 .../spv.arbPostDepthCoverage.frag.out | 0 .../spv.arbPostDepthCoverage_Error.frag.out | 0 .../Test/baseResults/spv.atomicInt64.comp.out | 0 .../Test/baseResults/spv.bitCast.frag.out | 0 .../Test/baseResults/spv.bool.vert.out | 0 .../Test/baseResults/spv.boolInBlock.frag.out | 0 .../baseResults/spv.branch-return.vert.out | 0 .../spv.buffer.autoassign.frag.out | 0 .../baseResults/spv.debugInfo.1.1.frag.out | 0 .../Test/baseResults/spv.debugInfo.frag.out | 0 .../Test/baseResults/spv.deepRvalue.frag.out | 0 .../Test/baseResults/spv.deviceGroup.frag.out | 0 .../spv.do-while-continue-break.vert.out | 0 .../Test/baseResults/spv.drawParams.vert.out | 0 .../spv.extPostDepthCoverage.frag.out | 0 .../spv.extPostDepthCoverage_Error.frag.out | 0 .../Test/baseResults/spv.float16.frag.out | 0 .../baseResults/spv.float16Fetch.frag.out | 0 .../Test/baseResults/spv.float32.frag.out | 0 .../Test/baseResults/spv.float64.frag.out | 0 .../spv.for-complex-condition.vert.out | 0 .../spv.for-continue-break.vert.out | 0 .../Test/baseResults/spv.for-nobody.vert.out | 0 .../Test/baseResults/spv.for-notest.vert.out | 0 .../baseResults/spv.fullyCovered.frag.out | 0 .../spv.functionNestedOpaque.vert.out | 0 .../spv.glsl.register.autoassign.frag.out | 0 .../spv.glsl.register.noautoassign.frag.out | 0 .../baseResults/spv.hlslDebugInfo.frag.out | 0 .../Test/baseResults/spv.hlslOffsets.vert.out | 0 .../Test/baseResults/spv.image.frag.out | 0 .../spv.image.load-formatted.frag.out | 0 .../spv.imageLoadStoreLod.frag.out | 0 .../Test/baseResults/spv.int16.amd.frag.out | 0 .../Test/baseResults/spv.int16.frag.out | 0 .../Test/baseResults/spv.int32.frag.out | 0 .../Test/baseResults/spv.int64.frag.out | 0 .../Test/baseResults/spv.int8.frag.out | 0 .../Test/baseResults/spv.intOps.vert.out | 0 .../Test/baseResults/spv.interpOps.frag.out | 0 .../baseResults/spv.layoutNested.vert.out | 0 .../spv.looseUniformNoLoc.vert.out | 0 .../Test/baseResults/spv.matrix.frag.out | 0 .../Test/baseResults/spv.matrix2.frag.out | 0 .../baseResults/spv.memoryQualifier.frag.out | 0 .../spv.merge-unreachable.frag.out | 0 .../Test/baseResults/spv.multiView.frag.out | 0 .../spv.multiviewPerViewAttributes.tesc.out | 0 .../spv.multiviewPerViewAttributes.vert.out | 0 .../baseResults/spv.noBuiltInLoc.vert.out | 0 .../spv.noDeadDecorations.vert.out | 0 .../Test/baseResults/spv.noLocation.vert.out | 0 .../Test/baseResults/spv.precise.tesc.out | 0 .../Test/baseResults/spv.precise.tese.out | 0 .../baseResults/spv.pushConstant.vert.out | 0 .../spv.register.autoassign-2.frag.out | 0 .../spv.register.autoassign.frag.out | 0 ...spv.register.autoassign.rangetest.frag.out | 0 .../spv.register.noautoassign.frag.out | 0 .../baseResults/spv.register.subpass.frag.out | 0 .../baseResults/spv.rw.autoassign.frag.out | 0 .../spv.sampleMaskOverrideCoverage.frag.out | 0 .../Test/baseResults/spv.separate.frag.out | 0 .../baseResults/spv.shaderBallot.comp.out | 0 .../baseResults/spv.shaderBallotAMD.comp.out | 0 .../baseResults/spv.shaderDrawParams.vert.out | 0 .../spv.shaderFragMaskAMD.frag.out | 0 .../baseResults/spv.shaderGroupVote.comp.out | 0 .../spv.shaderStencilExport.frag.out | 0 .../Test/baseResults/spv.shiftOps.frag.out | 0 .../baseResults/spv.shortCircuit.frag.out | 0 .../baseResults/spv.sparseTexture.frag.out | 0 .../spv.sparseTextureClamp.frag.out | 0 .../baseResults/spv.specConstant.comp.out | 0 .../baseResults/spv.specConstant.vert.out | 0 .../spv.specConstantComposite.vert.out | 0 .../spv.specConstantOperations.vert.out | 0 .../baseResults/spv.ssbo.autoassign.frag.out | 0 .../spv.stereoViewRendering.tesc.out | 0 .../spv.stereoViewRendering.vert.out | 0 .../Test/baseResults/spv.subgroup.frag.out | 0 .../Test/baseResults/spv.subgroup.geom.out | 0 .../Test/baseResults/spv.subgroup.tesc.out | 0 .../Test/baseResults/spv.subgroup.tese.out | 0 .../Test/baseResults/spv.subgroup.vert.out | 0 .../spv.subgroupArithmetic.comp.out | 0 .../baseResults/spv.subgroupBallot.comp.out | 0 .../baseResults/spv.subgroupBasic.comp.out | 0 .../spv.subgroupClustered.comp.out | 0 .../baseResults/spv.subgroupQuad.comp.out | 0 .../baseResults/spv.subgroupShuffle.comp.out | 0 .../spv.subgroupShuffleRelative.comp.out | 0 .../baseResults/spv.subgroupVote.comp.out | 0 .../Test/baseResults/spv.subpass.frag.out | 0 .../Test/baseResults/spv.test.frag.out | 0 .../Test/baseResults/spv.test.vert.out | 0 .../spv.texture.sampler.transform.frag.out | 0 .../spv.textureGatherBiasLod.frag.out | 0 .../baseResults/spv.uniformArray.frag.out | 0 .../baseResults/spv.viewportArray2.tesc.out | 0 .../baseResults/spv.viewportArray2.vert.out | 0 .../spv.while-continue-break.vert.out | 0 .../Test/baseResults/stringToDouble.vert.out | 150 +- .../baseResults/structAssignment.frag.out | 0 .../Test/baseResults/structDeref.frag.out | 0 .../Test/baseResults/structure.frag.out | 0 .../glslang/Test/baseResults/switch.frag.out | 0 .../glslang/Test/baseResults/swizzle.frag.out | 0 .../Test/baseResults/syntaxError.frag.out | 0 .../glslang/Test/baseResults/test.conf | 0 .../glslang/Test/baseResults/test.frag.out | 0 .../glslang/Test/baseResults/texture.frag.out | 0 .../Test/baseResults/tokenLength.vert.out | 0 .../glslang/Test/baseResults/types.frag.out | 0 .../glslang/Test/baseResults/uint.frag.out | 0 .../Test/baseResults/uniformArray.frag.out | 0 .../baseResults/variableArrayIndex.frag.out | 0 .../Test/baseResults/varyingArray.frag.out | 0 .../baseResults/varyingArrayIndirect.frag.out | 0 .../Test/baseResults/versionsClean.frag.out | 0 .../Test/baseResults/versionsClean.vert.out | 0 .../Test/baseResults/versionsErrors.frag.out | 0 .../Test/baseResults/versionsErrors.vert.out | 0 .../Test/baseResults/voidFunction.frag.out | 0 .../glslang/Test/baseResults/vulkan.comp.out | 0 .../glslang/Test/baseResults/vulkan.frag.out | 3 +- .../glslang/Test/baseResults/vulkan.vert.out | 0 .../Test/baseResults/whileLoop.frag.out | 0 third_party/glslang/Test/comment.frag | 0 .../glslang/Test/conditionalDiscard.frag | 0 third_party/glslang/Test/constErrors.frag | 0 third_party/glslang/Test/constFoldIntMin.frag | 0 third_party/glslang/Test/conversion.frag | 0 third_party/glslang/Test/cppBad.vert | 0 third_party/glslang/Test/cppComplexExpr.vert | 0 third_party/glslang/Test/cppDeepNest.frag | 0 third_party/glslang/Test/cppIndent.vert | 0 .../Test/cppIntMinOverNegativeOne.frag | 0 third_party/glslang/Test/cppNest.vert | 0 .../Test/cppRelaxSkipTokensErrors.vert | 0 third_party/glslang/Test/cppSimple.vert | 0 third_party/glslang/Test/dataOut.frag | 0 third_party/glslang/Test/dataOutIndirect.frag | 0 third_party/glslang/Test/dce.frag | 0 third_party/glslang/Test/decls.frag | 0 third_party/glslang/Test/deepRvalue.frag | 0 third_party/glslang/Test/depthOut.frag | 0 third_party/glslang/Test/discard-dce.frag | 0 third_party/glslang/Test/doWhileLoop.frag | 0 .../glslang/Test/earlyReturnDiscard.frag | 0 third_party/glslang/Test/empty.frag | 0 third_party/glslang/Test/empty2.frag | 0 third_party/glslang/Test/empty3.frag | 0 third_party/glslang/Test/errors.frag | 0 third_party/glslang/Test/es-link1.frag | 0 third_party/glslang/Test/es-link2.frag | 0 third_party/glslang/Test/findFunction.frag | 0 third_party/glslang/Test/flowControl.frag | 0 third_party/glslang/Test/foo.h | 0 third_party/glslang/Test/forLoop.frag | 0 third_party/glslang/Test/forwardRef.frag | 0 third_party/glslang/Test/functionCall.frag | 0 .../glslang/Test/functionSemantics.frag | 0 third_party/glslang/Test/glsl.-D-U.frag | 0 .../glslang/Test/glsl.entryPointRename.vert | 0 .../glslang/Test/glsl.entryPointRename2.vert | 0 third_party/glslang/Test/glspv.esversion.vert | 0 third_party/glslang/Test/glspv.frag | 0 third_party/glslang/Test/glspv.version.frag | 0 third_party/glslang/Test/glspv.version.vert | 0 third_party/glslang/Test/glspv.vert | 0 third_party/glslang/Test/hlsl.-D-U.frag | 0 third_party/glslang/Test/hlsl.PointSize.geom | 0 third_party/glslang/Test/hlsl.PointSize.vert | 0 .../glslang/Test/hlsl.aliasOpaque.frag | 0 .../glslang/Test/hlsl.array.flatten.frag | 0 third_party/glslang/Test/hlsl.array.frag | 0 .../Test/hlsl.array.implicit-size.frag | 0 .../glslang/Test/hlsl.array.multidim.frag | 0 third_party/glslang/Test/hlsl.assoc.frag | 0 .../Test/hlsl.attribute.expression.comp | 0 third_party/glslang/Test/hlsl.attribute.frag | 0 .../glslang/Test/hlsl.attributeC11.frag | 0 .../Test/hlsl.attributeGlobalBuffer.frag | 0 third_party/glslang/Test/hlsl.automap.frag | 0 third_party/glslang/Test/hlsl.basic.comp | 0 third_party/glslang/Test/hlsl.basic.geom | 0 third_party/glslang/Test/hlsl.buffer.frag | 0 .../glslang/Test/hlsl.calculatelod.dx10.frag | 0 .../Test/hlsl.calculatelodunclamped.dx10.frag | 0 third_party/glslang/Test/hlsl.cast.frag | 0 .../glslang/Test/hlsl.cbuffer-identifier.vert | 0 third_party/glslang/Test/hlsl.clip.frag | 0 .../glslang/Test/hlsl.clipdistance-1.frag | 0 .../glslang/Test/hlsl.clipdistance-1.geom | 0 .../glslang/Test/hlsl.clipdistance-1.vert | 0 .../glslang/Test/hlsl.clipdistance-2.frag | 0 .../glslang/Test/hlsl.clipdistance-2.geom | 0 .../glslang/Test/hlsl.clipdistance-2.vert | 0 .../glslang/Test/hlsl.clipdistance-3.frag | 0 .../glslang/Test/hlsl.clipdistance-3.geom | 0 .../glslang/Test/hlsl.clipdistance-3.vert | 0 .../glslang/Test/hlsl.clipdistance-4.frag | 0 .../glslang/Test/hlsl.clipdistance-4.geom | 0 .../glslang/Test/hlsl.clipdistance-4.vert | 0 .../glslang/Test/hlsl.clipdistance-5.frag | 0 .../glslang/Test/hlsl.clipdistance-5.vert | 0 .../glslang/Test/hlsl.clipdistance-6.frag | 0 .../glslang/Test/hlsl.clipdistance-6.vert | 0 .../glslang/Test/hlsl.clipdistance-7.frag | 0 .../glslang/Test/hlsl.clipdistance-7.vert | 0 .../glslang/Test/hlsl.clipdistance-8.frag | 0 .../glslang/Test/hlsl.clipdistance-8.vert | 0 .../glslang/Test/hlsl.clipdistance-9.frag | 0 .../glslang/Test/hlsl.clipdistance-9.vert | 0 third_party/glslang/Test/hlsl.color.hull.tesc | 0 .../glslang/Test/hlsl.comparison.vec.frag | 0 .../glslang/Test/hlsl.conditional.frag | 0 .../glslang/Test/hlsl.constantbuffer.frag | 0 .../glslang/Test/hlsl.constructArray.vert | 0 .../glslang/Test/hlsl.constructexpr.frag | 0 .../glslang/Test/hlsl.constructimat.frag | 0 third_party/glslang/Test/hlsl.dashI.vert | 0 .../Test/hlsl.deadFunctionMissingBody.vert | 0 .../glslang/Test/hlsl.depthGreater.frag | 0 third_party/glslang/Test/hlsl.depthLess.frag | 0 third_party/glslang/Test/hlsl.discard.frag | 0 third_party/glslang/Test/hlsl.doLoop.frag | 0 third_party/glslang/Test/hlsl.domain.1.tese | 0 third_party/glslang/Test/hlsl.domain.2.tese | 0 third_party/glslang/Test/hlsl.domain.3.tese | 0 .../glslang/Test/hlsl.emptystruct.init.vert | 0 .../glslang/Test/hlsl.emptystructreturn.frag | 0 .../glslang/Test/hlsl.emptystructreturn.vert | 0 third_party/glslang/Test/hlsl.entry-in.frag | 0 third_party/glslang/Test/hlsl.entry-out.frag | 0 .../glslang/Test/hlsl.entry.rename.frag | 0 .../Test/hlsl.explicitDescriptorSet.frag | 0 .../glslang/Test/hlsl.flatten.return.frag | 0 .../glslang/Test/hlsl.flattenOpaque.frag | 0 .../glslang/Test/hlsl.flattenOpaqueInit.vert | 0 .../Test/hlsl.flattenOpaqueInitMix.vert | 0 third_party/glslang/Test/hlsl.float1.frag | 0 third_party/glslang/Test/hlsl.float4.frag | 0 third_party/glslang/Test/hlsl.forLoop.frag | 0 third_party/glslang/Test/hlsl.frag | 0 third_party/glslang/Test/hlsl.fraggeom.frag | 0 third_party/glslang/Test/hlsl.function.frag | 0 .../glslang/Test/hlsl.gather.array.dx10.frag | 0 .../glslang/Test/hlsl.gather.basic.dx10.frag | 0 .../glslang/Test/hlsl.gather.basic.dx10.vert | 0 .../glslang/Test/hlsl.gather.offset.dx10.frag | 0 .../Test/hlsl.gather.offsetarray.dx10.frag | 0 .../Test/hlsl.gatherRGBA.array.dx10.frag | 0 .../Test/hlsl.gatherRGBA.basic.dx10.frag | 0 .../Test/hlsl.gatherRGBA.offset.dx10.frag | 0 .../hlsl.gatherRGBA.offsetarray.dx10.frag | 0 .../Test/hlsl.gathercmpRGBA.array.dx10.frag | 0 .../Test/hlsl.gathercmpRGBA.basic.dx10.frag | 0 .../Test/hlsl.gathercmpRGBA.offset.dx10.frag | 0 .../hlsl.gathercmpRGBA.offsetarray.dx10.frag | 0 .../glslang/Test/hlsl.getdimensions.dx10.frag | 0 .../glslang/Test/hlsl.getdimensions.dx10.vert | 0 .../Test/hlsl.getdimensions.rw.dx10.frag | 0 .../Test/hlsl.getsampleposition.dx10.frag | 0 .../glslang/Test/hlsl.global-const-init.frag | 0 third_party/glslang/Test/hlsl.gs-hs-mix.tesc | 0 third_party/glslang/Test/hlsl.hull.1.tesc | 0 third_party/glslang/Test/hlsl.hull.2.tesc | 0 third_party/glslang/Test/hlsl.hull.3.tesc | 0 third_party/glslang/Test/hlsl.hull.4.tesc | 0 third_party/glslang/Test/hlsl.hull.5.tesc | 0 .../glslang/Test/hlsl.hull.ctrlpt-1.tesc | 0 .../glslang/Test/hlsl.hull.ctrlpt-2.tesc | 0 third_party/glslang/Test/hlsl.hull.void.tesc | 0 .../glslang/Test/hlsl.identifier.sample.frag | 0 third_party/glslang/Test/hlsl.if.frag | 0 .../glslang/Test/hlsl.imagefetch-subvec4.comp | 0 third_party/glslang/Test/hlsl.include.vert | 0 .../glslang/Test/hlsl.includeNegative.vert | 0 third_party/glslang/Test/hlsl.init.frag | 0 third_party/glslang/Test/hlsl.init2.frag | 0 third_party/glslang/Test/hlsl.inoutquals.frag | 0 .../glslang/Test/hlsl.intrinsic.frexp.frag | 0 .../glslang/Test/hlsl.intrinsic.frexp.vert | 0 .../Test/hlsl.intrinsics.barriers.comp | 0 third_party/glslang/Test/hlsl.intrinsics.comp | 0 .../hlsl.intrinsics.d3dcolortoubyte4.frag | 0 .../glslang/Test/hlsl.intrinsics.double.frag | 0 .../glslang/Test/hlsl.intrinsics.evalfns.frag | 0 .../glslang/Test/hlsl.intrinsics.f1632.frag | 0 .../glslang/Test/hlsl.intrinsics.f3216.frag | 0 .../glslang/Test/hlsl.intrinsics.lit.frag | 0 .../Test/hlsl.intrinsics.negative.comp | 0 .../Test/hlsl.intrinsics.negative.frag | 0 .../Test/hlsl.intrinsics.negative.vert | 0 .../Test/hlsl.intrinsics.promote.down.frag | 0 .../glslang/Test/hlsl.intrinsics.promote.frag | 0 .../Test/hlsl.intrinsics.promote.outputs.frag | 0 third_party/glslang/Test/hlsl.intrinsics.vert | 0 third_party/glslang/Test/hlsl.isfinite.frag | 0 third_party/glslang/Test/hlsl.layout.frag | 0 .../glslang/Test/hlsl.layoutOverride.vert | 0 .../glslang/Test/hlsl.load.2dms.dx10.frag | 0 .../glslang/Test/hlsl.load.array.dx10.frag | 0 .../glslang/Test/hlsl.load.basic.dx10.frag | 0 .../glslang/Test/hlsl.load.basic.dx10.vert | 0 .../glslang/Test/hlsl.load.buffer.dx10.frag | 0 .../Test/hlsl.load.buffer.float.dx10.frag | 0 .../glslang/Test/hlsl.load.offset.dx10.frag | 0 .../Test/hlsl.load.offsetarray.dx10.frag | 0 .../glslang/Test/hlsl.load.rwbuffer.dx10.frag | 0 .../Test/hlsl.load.rwtexture.array.dx10.frag | 0 .../Test/hlsl.load.rwtexture.dx10.frag | 0 .../Test/hlsl.localStructuredBuffer.comp | 0 .../glslang/Test/hlsl.logical.binary.frag | 0 .../glslang/Test/hlsl.logical.binary.vec.frag | 0 .../glslang/Test/hlsl.logical.unary.frag | 0 third_party/glslang/Test/hlsl.loopattr.frag | 0 third_party/glslang/Test/hlsl.matNx1.frag | 0 .../glslang/Test/hlsl.matType.bool.frag | 0 third_party/glslang/Test/hlsl.matType.frag | 0 .../glslang/Test/hlsl.matType.int.frag | 0 third_party/glslang/Test/hlsl.matpack-1.frag | 0 .../glslang/Test/hlsl.matpack-pragma.frag | 0 .../glslang/Test/hlsl.matrixSwizzle.vert | 0 .../glslang/Test/hlsl.matrixindex.frag | 0 third_party/glslang/Test/hlsl.max.frag | 0 .../glslang/Test/hlsl.memberFunCall.frag | 0 third_party/glslang/Test/hlsl.mintypes.frag | 0 .../glslang/Test/hlsl.mip.negative.frag | 0 .../glslang/Test/hlsl.mip.negative2.frag | 0 .../glslang/Test/hlsl.mip.operator.frag | 0 .../glslang/Test/hlsl.mul-truncate.frag | 0 .../glslang/Test/hlsl.multiDescriptorSet.frag | 0 .../glslang/Test/hlsl.nonint-index.frag | 0 .../glslang/Test/hlsl.numericsuffixes.frag | 0 third_party/glslang/Test/hlsl.numthreads.comp | 0 .../glslang/Test/hlsl.opaque-type-bug.frag | 0 third_party/glslang/Test/hlsl.overload.frag | 0 .../glslang/Test/hlsl.params.default.frag | 0 .../Test/hlsl.params.default.negative.frag | 0 .../Test/hlsl.partialFlattenLocal.vert | 0 .../Test/hlsl.partialFlattenMixed.vert | 0 third_party/glslang/Test/hlsl.pp.line.frag | 0 .../glslang/Test/hlsl.pp.tokenpasting.frag | 0 third_party/glslang/Test/hlsl.pp.vert | 0 third_party/glslang/Test/hlsl.precedence.frag | 0 .../glslang/Test/hlsl.precedence2.frag | 0 third_party/glslang/Test/hlsl.precise.frag | 0 .../glslang/Test/hlsl.preprocessor.frag | 0 .../glslang/Test/hlsl.promote.atomic.frag | 0 .../glslang/Test/hlsl.promote.binary.frag | 0 .../glslang/Test/hlsl.promote.vec1.frag | 0 third_party/glslang/Test/hlsl.promotions.frag | 0 .../glslang/Test/hlsl.reflection.binding.frag | 0 third_party/glslang/Test/hlsl.reflection.vert | 0 third_party/glslang/Test/hlsl.rw.atomics.frag | 0 third_party/glslang/Test/hlsl.rw.bracket.frag | 0 .../glslang/Test/hlsl.rw.register.frag | 0 .../glslang/Test/hlsl.rw.scalar.bracket.frag | 0 third_party/glslang/Test/hlsl.rw.swizzle.frag | 0 .../glslang/Test/hlsl.rw.vec2.bracket.frag | 0 .../glslang/Test/hlsl.sample.array.dx10.frag | 0 .../glslang/Test/hlsl.sample.basic.dx10.frag | 0 .../glslang/Test/hlsl.sample.offset.dx10.frag | 0 .../Test/hlsl.sample.offsetarray.dx10.frag | 0 .../Test/hlsl.sample.sub-vec4.dx10.frag | 0 .../Test/hlsl.samplebias.array.dx10.frag | 0 .../Test/hlsl.samplebias.basic.dx10.frag | 0 .../Test/hlsl.samplebias.offset.dx10.frag | 0 .../hlsl.samplebias.offsetarray.dx10.frag | 0 .../Test/hlsl.samplecmp.array.dx10.frag | 0 .../Test/hlsl.samplecmp.basic.dx10.frag | 0 .../glslang/Test/hlsl.samplecmp.dualmode.frag | 0 .../glslang/Test/hlsl.samplecmp.negative.frag | 0 .../Test/hlsl.samplecmp.negative2.frag | 0 .../Test/hlsl.samplecmp.offset.dx10.frag | 0 .../Test/hlsl.samplecmp.offsetarray.dx10.frag | 0 .../hlsl.samplecmplevelzero.array.dx10.frag | 0 .../hlsl.samplecmplevelzero.basic.dx10.frag | 0 .../hlsl.samplecmplevelzero.offset.dx10.frag | 0 ...l.samplecmplevelzero.offsetarray.dx10.frag | 0 .../Test/hlsl.samplegrad.array.dx10.frag | 0 .../Test/hlsl.samplegrad.basic.dx10.frag | 0 .../Test/hlsl.samplegrad.basic.dx10.vert | 0 .../Test/hlsl.samplegrad.offset.dx10.frag | 0 .../hlsl.samplegrad.offsetarray.dx10.frag | 0 .../Test/hlsl.samplelevel.array.dx10.frag | 0 .../Test/hlsl.samplelevel.basic.dx10.frag | 0 .../Test/hlsl.samplelevel.basic.dx10.vert | 0 .../Test/hlsl.samplelevel.offset.dx10.frag | 0 .../hlsl.samplelevel.offsetarray.dx10.frag | 0 .../glslang/Test/hlsl.scalar-length.frag | 0 .../glslang/Test/hlsl.scalar2matrix.frag | 0 third_party/glslang/Test/hlsl.scope.frag | 0 third_party/glslang/Test/hlsl.semantic-1.vert | 0 third_party/glslang/Test/hlsl.semantic.geom | 0 third_party/glslang/Test/hlsl.semantic.vert | 0 third_party/glslang/Test/hlsl.semicolons.frag | 0 third_party/glslang/Test/hlsl.shapeConv.frag | 0 .../glslang/Test/hlsl.shift.per-set.frag | 3 +- third_party/glslang/Test/hlsl.sin.frag | 0 third_party/glslang/Test/hlsl.snorm.uav.comp | 0 .../hlsl.store.rwbyteaddressbuffer.type.comp | 0 .../glslang/Test/hlsl.stringtoken.frag | 0 third_party/glslang/Test/hlsl.struct.frag | 0 .../glslang/Test/hlsl.struct.split-1.vert | 0 .../glslang/Test/hlsl.struct.split.array.geom | 0 .../Test/hlsl.struct.split.assign.frag | 0 .../glslang/Test/hlsl.struct.split.call.vert | 0 .../Test/hlsl.struct.split.nested.geom | 0 .../Test/hlsl.struct.split.trivial.geom | 0 .../Test/hlsl.struct.split.trivial.vert | 0 .../Test/hlsl.structarray.flatten.frag | 0 .../Test/hlsl.structarray.flatten.geom | 0 .../Test/hlsl.structbuffer.append.fn.frag | 0 .../Test/hlsl.structbuffer.append.frag | 0 .../Test/hlsl.structbuffer.atomics.frag | 0 .../glslang/Test/hlsl.structbuffer.byte.frag | 0 .../Test/hlsl.structbuffer.coherent.frag | 0 .../Test/hlsl.structbuffer.floatidx.comp | 0 .../glslang/Test/hlsl.structbuffer.fn.frag | 0 .../glslang/Test/hlsl.structbuffer.fn2.comp | 0 .../glslang/Test/hlsl.structbuffer.frag | 0 .../Test/hlsl.structbuffer.incdec.frag | 0 .../glslang/Test/hlsl.structbuffer.rw.frag | 0 .../Test/hlsl.structbuffer.rwbyte.frag | 0 third_party/glslang/Test/hlsl.structin.vert | 0 third_party/glslang/Test/hlsl.subpass.frag | 0 third_party/glslang/Test/hlsl.switch.frag | 0 third_party/glslang/Test/hlsl.swizzle.frag | 0 .../glslang/Test/hlsl.synthesizeInput.frag | 0 third_party/glslang/Test/hlsl.target.frag | 0 .../glslang/Test/hlsl.targetStruct1.frag | 0 .../glslang/Test/hlsl.targetStruct2.frag | 0 .../glslang/Test/hlsl.templatetypes.frag | 0 .../Test/hlsl.templatetypes.negative.frag | 0 .../glslang/Test/hlsl.texture.struct.frag | 0 .../glslang/Test/hlsl.texture.subvec4.frag | 0 .../glslang/Test/hlsl.texturebuffer.frag | 0 third_party/glslang/Test/hlsl.tx.bracket.frag | 0 .../glslang/Test/hlsl.tx.overload.frag | 0 third_party/glslang/Test/hlsl.type.half.frag | 0 .../glslang/Test/hlsl.type.identifier.frag | 0 .../glslang/Test/hlsl.typeGraphCopy.vert | 0 third_party/glslang/Test/hlsl.typedef.frag | 0 third_party/glslang/Test/hlsl.void.frag | 0 .../glslang/Test/hlsl.wavebroadcast.comp | 0 third_party/glslang/Test/hlsl.waveprefix.comp | 0 third_party/glslang/Test/hlsl.wavequad.comp | 0 third_party/glslang/Test/hlsl.wavequery.comp | 0 third_party/glslang/Test/hlsl.wavequery.frag | 0 .../glslang/Test/hlsl.wavereduction.comp | 0 third_party/glslang/Test/hlsl.wavevote.comp | 0 third_party/glslang/Test/hlsl.whileLoop.frag | 0 third_party/glslang/Test/hlsl.y-negate-1.vert | 0 third_party/glslang/Test/hlsl.y-negate-2.vert | 0 third_party/glslang/Test/hlsl.y-negate-3.vert | 0 .../glslang/Test/implicitInnerAtomicUint.frag | 0 third_party/glslang/Test/inc1/badInc.h | 0 third_party/glslang/Test/inc1/bar.h | 0 third_party/glslang/Test/inc1/foo.h | 0 third_party/glslang/Test/inc1/path1/bar.h | 0 third_party/glslang/Test/inc1/path1/local.h | 0 third_party/glslang/Test/inc1/path1/notHere.h | 0 third_party/glslang/Test/inc1/path2/bar.h | 0 third_party/glslang/Test/inc1/path2/notHere.h | 0 third_party/glslang/Test/inc1/path2/remote.h | 0 third_party/glslang/Test/inc2/bar.h | 0 third_party/glslang/Test/inc2/foo.h | 0 third_party/glslang/Test/include.vert | 0 third_party/glslang/Test/invalidSwizzle.vert | 0 third_party/glslang/Test/length.frag | 0 .../glslang/Test/lineContinuation.vert | 0 .../glslang/Test/lineContinuation100.vert | 0 third_party/glslang/Test/link1.frag | 0 third_party/glslang/Test/link1.vk.frag | 0 third_party/glslang/Test/link2.frag | 0 third_party/glslang/Test/link2.vk.frag | 0 third_party/glslang/Test/link3.frag | 0 third_party/glslang/Test/localAggregates.frag | 0 third_party/glslang/Test/loops.frag | 0 third_party/glslang/Test/loopsArtificial.frag | 0 third_party/glslang/Test/mains.frag | 0 third_party/glslang/Test/mains1.frag | 0 third_party/glslang/Test/mains2.frag | 0 third_party/glslang/Test/makeDoc | 0 third_party/glslang/Test/matrix.frag | 0 third_party/glslang/Test/matrix2.frag | 0 third_party/glslang/Test/matrixError.vert | 0 .../glslang/Test/maxClipDistances.vert | 0 third_party/glslang/Test/max_vertices_0.geom | 0 third_party/glslang/Test/missingBodies.vert | 0 third_party/glslang/Test/mixedArrayDecls.frag | 0 .../glslang/Test/negativeArraySize.comp | 0 third_party/glslang/Test/newTexture.frag | 0 third_party/glslang/Test/noMain.vert | 0 third_party/glslang/Test/noMain1.geom | 0 third_party/glslang/Test/noMain2.geom | 0 third_party/glslang/Test/nonSquare.vert | 0 third_party/glslang/Test/nonVulkan.frag | 0 third_party/glslang/Test/numeral.frag | 0 .../nvShaderNoperspectiveInterpolation.frag | 0 third_party/glslang/Test/overlongLiteral.frag | 0 third_party/glslang/Test/parent.h | 0 third_party/glslang/Test/parentBad | 0 third_party/glslang/Test/pointCoord.frag | 0 third_party/glslang/Test/precise.tesc | 0 .../glslang/Test/precise_struct_block.vert | 0 third_party/glslang/Test/precision.frag | 0 third_party/glslang/Test/precision.vert | 0 third_party/glslang/Test/prepost.frag | 0 .../Test/preprocessor.cpp_style___FILE__.vert | 0 ...preprocessor.cpp_style_line_directive.vert | 0 .../glslang/Test/preprocessor.defined.vert | 0 .../glslang/Test/preprocessor.edge_cases.vert | 0 .../Test/preprocessor.eof_missing.vert | 0 .../glslang/Test/preprocessor.errors.vert | 0 .../glslang/Test/preprocessor.extensions.vert | 0 .../Test/preprocessor.function_macro.vert | 0 .../Test/preprocessor.include.disabled.vert | 0 .../Test/preprocessor.include.enabled.vert | 0 .../glslang/Test/preprocessor.line.frag | 0 .../glslang/Test/preprocessor.line.vert | 0 .../glslang/Test/preprocessor.many.endif.vert | 0 .../glslang/Test/preprocessor.pragma.vert | 0 .../glslang/Test/preprocessor.simple.vert | 0 ...processor.success_if_parse_would_fail.vert | 0 third_party/glslang/Test/recurse1.frag | 0 third_party/glslang/Test/recurse1.vert | 0 third_party/glslang/Test/recurse2.frag | 0 third_party/glslang/Test/reflection.vert | 0 .../glslang/Test/remap.basic.dcefunc.frag | 0 .../glslang/Test/remap.basic.everything.frag | 0 .../glslang/Test/remap.basic.none.frag | 0 .../glslang/Test/remap.basic.strip.frag | 0 .../remap.hlsl.sample.basic.everything.frag | 0 .../Test/remap.hlsl.sample.basic.none.frag | 0 .../Test/remap.hlsl.sample.basic.strip.frag | 0 .../remap.hlsl.templatetypes.everything.frag | 0 .../Test/remap.hlsl.templatetypes.none.frag | 0 .../glslang/Test/remap.if.everything.frag | 0 third_party/glslang/Test/remap.if.none.frag | 0 .../glslang/Test/remap.invalid-spirv-1.spv | Bin .../glslang/Test/remap.invalid-spirv-2.spv | Bin .../Test/remap.literal64.everything.spv | Bin .../glslang/Test/remap.literal64.none.spv | Bin .../Test/remap.similar_1a.everything.frag | 0 .../glslang/Test/remap.similar_1a.none.frag | 0 .../Test/remap.similar_1b.everything.frag | 0 .../glslang/Test/remap.similar_1b.none.frag | 0 third_party/glslang/Test/remap.specconst.comp | 0 .../glslang/Test/remap.switch.everything.frag | 0 .../glslang/Test/remap.switch.none.frag | 0 .../Test/remap.uniformarray.everything.frag | 0 .../glslang/Test/remap.uniformarray.none.frag | 0 third_party/glslang/Test/runtests | 4 +- third_party/glslang/Test/sample.frag | 0 third_party/glslang/Test/sample.frag.out | 0 third_party/glslang/Test/sample.vert | 0 third_party/glslang/Test/sample.vert.out | 0 .../glslang/Test/simpleFunctionCall.frag | 0 third_party/glslang/Test/specExamples.frag | 0 third_party/glslang/Test/specExamples.vert | 0 third_party/glslang/Test/spv.100ops.frag | 0 third_party/glslang/Test/spv.130.frag | 0 third_party/glslang/Test/spv.140.frag | 0 third_party/glslang/Test/spv.150.geom | 0 third_party/glslang/Test/spv.150.vert | 0 third_party/glslang/Test/spv.300BuiltIns.vert | 0 third_party/glslang/Test/spv.300layout.frag | 0 third_party/glslang/Test/spv.300layout.vert | 0 third_party/glslang/Test/spv.300layoutp.vert | 0 third_party/glslang/Test/spv.310.bitcast.frag | 0 third_party/glslang/Test/spv.310.comp | 0 third_party/glslang/Test/spv.330.geom | 0 third_party/glslang/Test/spv.400.frag | 0 third_party/glslang/Test/spv.400.tesc | 0 third_party/glslang/Test/spv.400.tese | 0 third_party/glslang/Test/spv.420.geom | 0 third_party/glslang/Test/spv.430.frag | 0 third_party/glslang/Test/spv.430.vert | 0 third_party/glslang/Test/spv.450.geom | 0 .../glslang/Test/spv.450.noRedecl.tesc | 0 third_party/glslang/Test/spv.450.tesc | 0 third_party/glslang/Test/spv.460.comp | 0 third_party/glslang/Test/spv.460.frag | 0 third_party/glslang/Test/spv.460.vert | 0 third_party/glslang/Test/spv.AofA.frag | 0 .../Test/spv.GeometryShaderPassthrough.geom | 0 .../glslang/Test/spv.OVR_multiview.vert | 0 third_party/glslang/Test/spv.Operations.frag | 0 third_party/glslang/Test/spv.accessChain.frag | 0 third_party/glslang/Test/spv.aggOps.frag | 0 .../glslang/Test/spv.always-discard.frag | 0 .../glslang/Test/spv.always-discard2.frag | 0 .../Test/spv.arbPostDepthCoverage.frag | 0 .../Test/spv.arbPostDepthCoverage_Error.frag | 0 third_party/glslang/Test/spv.atomic.comp | 0 third_party/glslang/Test/spv.atomicInt64.comp | 0 third_party/glslang/Test/spv.barrier.vert | 0 third_party/glslang/Test/spv.bitCast.frag | 0 third_party/glslang/Test/spv.bool.vert | 0 third_party/glslang/Test/spv.boolInBlock.frag | 0 .../glslang/Test/spv.branch-return.vert | 0 .../glslang/Test/spv.buffer.autoassign.frag | 0 third_party/glslang/Test/spv.builtInXFB.vert | 0 .../glslang/Test/spv.conditionalDiscard.frag | 0 third_party/glslang/Test/spv.constStruct.vert | 0 .../Test/spv.controlFlowAttributes.frag | 0 third_party/glslang/Test/spv.conversion.frag | 0 third_party/glslang/Test/spv.dataOut.frag | 0 .../glslang/Test/spv.dataOutIndirect.frag | 0 .../glslang/Test/spv.dataOutIndirect.vert | 0 third_party/glslang/Test/spv.debugInfo.frag | 0 third_party/glslang/Test/spv.deepRvalue.frag | 0 third_party/glslang/Test/spv.depthOut.frag | 0 third_party/glslang/Test/spv.deviceGroup.frag | 0 third_party/glslang/Test/spv.discard-dce.frag | 0 third_party/glslang/Test/spv.do-simple.vert | 0 .../Test/spv.do-while-continue-break.vert | 0 third_party/glslang/Test/spv.doWhileLoop.frag | 0 third_party/glslang/Test/spv.double.comp | 0 third_party/glslang/Test/spv.drawParams.vert | 0 .../glslang/Test/spv.earlyReturnDiscard.frag | 0 .../glslang/Test/spv.explicittypes.frag | 0 .../Test/spv.extPostDepthCoverage.frag | 0 .../Test/spv.extPostDepthCoverage_Error.frag | 0 third_party/glslang/Test/spv.float16.frag | 0 .../glslang/Test/spv.float16Fetch.frag | 0 third_party/glslang/Test/spv.float32.frag | 0 third_party/glslang/Test/spv.float64.frag | 0 third_party/glslang/Test/spv.flowControl.frag | 0 .../Test/spv.for-complex-condition.vert | 0 .../glslang/Test/spv.for-continue-break.vert | 0 third_party/glslang/Test/spv.for-nobody.vert | 0 third_party/glslang/Test/spv.for-notest.vert | 0 third_party/glslang/Test/spv.for-simple.vert | 0 third_party/glslang/Test/spv.forLoop.frag | 0 third_party/glslang/Test/spv.forwardFun.frag | 0 .../glslang/Test/spv.fullyCovered.frag | 0 .../glslang/Test/spv.functionCall.frag | 0 .../glslang/Test/spv.functionSemantics.frag | 0 third_party/glslang/Test/spv.glFragColor.frag | 0 .../Test/spv.glsl.register.autoassign.frag | 0 .../Test/spv.glsl.register.noautoassign.frag | 0 .../glslang/Test/spv.hlslDebugInfo.vert | 0 third_party/glslang/Test/spv.image.frag | 0 .../Test/spv.image.load-formatted.frag | 0 .../glslang/Test/spv.imageLoadStoreLod.frag | 0 third_party/glslang/Test/spv.int16.amd.frag | 0 third_party/glslang/Test/spv.int16.frag | 0 third_party/glslang/Test/spv.int32.frag | 0 third_party/glslang/Test/spv.int64.frag | 0 third_party/glslang/Test/spv.int8.frag | 0 third_party/glslang/Test/spv.intOps.vert | 0 third_party/glslang/Test/spv.interpOps.frag | 0 .../glslang/Test/spv.layoutNested.vert | 0 third_party/glslang/Test/spv.length.frag | 0 .../glslang/Test/spv.localAggregates.frag | 0 third_party/glslang/Test/spv.loops.frag | 0 .../glslang/Test/spv.loopsArtificial.frag | 0 .../glslang/Test/spv.looseUniformNoLoc.vert | 0 third_party/glslang/Test/spv.matFun.vert | 0 third_party/glslang/Test/spv.matrix.frag | 0 third_party/glslang/Test/spv.matrix2.frag | 0 .../glslang/Test/spv.memoryQualifier.frag | 0 .../glslang/Test/spv.merge-unreachable.frag | 0 third_party/glslang/Test/spv.multiStruct.comp | 0 third_party/glslang/Test/spv.multiView.frag | 0 .../Test/spv.multiviewPerViewAttributes.tesc | 0 .../Test/spv.multiviewPerViewAttributes.vert | 0 third_party/glslang/Test/spv.newTexture.frag | 0 .../glslang/Test/spv.noBuiltInLoc.vert | 0 .../glslang/Test/spv.noDeadDecorations.vert | 0 third_party/glslang/Test/spv.noLocation.vert | 0 third_party/glslang/Test/spv.noWorkgroup.comp | 0 third_party/glslang/Test/spv.nonSquare.vert | 0 third_party/glslang/Test/spv.paramMemory.frag | 0 third_party/glslang/Test/spv.precise.tesc | 0 third_party/glslang/Test/spv.precise.tese | 0 third_party/glslang/Test/spv.precision.frag | 0 .../glslang/Test/spv.precisionNonESSamp.frag | 0 third_party/glslang/Test/spv.prepost.frag | 0 .../glslang/Test/spv.pushConstant.vert | 0 .../glslang/Test/spv.pushConstantAnon.vert | 0 third_party/glslang/Test/spv.qualifiers.vert | 0 third_party/glslang/Test/spv.queryL.frag | 0 third_party/glslang/Test/spv.rankShift.comp | 0 .../Test/spv.register.autoassign-2.frag | 0 .../glslang/Test/spv.register.autoassign.frag | 0 .../spv.register.autoassign.rangetest.frag | 0 .../Test/spv.register.noautoassign.frag | 0 .../glslang/Test/spv.register.subpass.frag | 0 .../glslang/Test/spv.rw.autoassign.frag | 0 third_party/glslang/Test/spv.sample.frag | 0 third_party/glslang/Test/spv.sampleId.frag | 0 .../Test/spv.sampleMaskOverrideCoverage.frag | 0 .../glslang/Test/spv.samplePosition.frag | 0 third_party/glslang/Test/spv.separate.frag | 0 third_party/glslang/Test/spv.set.vert | 0 .../glslang/Test/spv.shaderBallot.comp | 0 .../glslang/Test/spv.shaderBallotAMD.comp | 0 .../glslang/Test/spv.shaderDrawParams.vert | 0 .../glslang/Test/spv.shaderFragMaskAMD.frag | 0 .../glslang/Test/spv.shaderGroupVote.comp | 0 .../glslang/Test/spv.shaderStencilExport.frag | 0 third_party/glslang/Test/spv.shiftOps.frag | 0 .../glslang/Test/spv.simpleFunctionCall.frag | 0 third_party/glslang/Test/spv.simpleMat.vert | 0 .../glslang/Test/spv.sparseTexture.frag | 0 .../glslang/Test/spv.sparseTextureClamp.frag | 0 third_party/glslang/Test/spv.specConst.vert | 0 .../glslang/Test/spv.specConstant.comp | 0 .../glslang/Test/spv.specConstant.vert | 0 .../Test/spv.specConstantComposite.vert | 0 .../Test/spv.specConstantOperations.vert | 0 .../glslang/Test/spv.ssbo.autoassign.frag | 0 third_party/glslang/Test/spv.ssboAlias.frag | 0 .../glslang/Test/spv.stereoViewRendering.tesc | 0 .../glslang/Test/spv.stereoViewRendering.vert | 0 .../glslang/Test/spv.storageBuffer.vert | 0 .../glslang/Test/spv.structAssignment.frag | 0 third_party/glslang/Test/spv.structDeref.frag | 0 third_party/glslang/Test/spv.structure.frag | 0 third_party/glslang/Test/spv.subgroup.frag | 0 third_party/glslang/Test/spv.subgroup.geom | 0 third_party/glslang/Test/spv.subgroup.tesc | 0 third_party/glslang/Test/spv.subgroup.tese | 0 third_party/glslang/Test/spv.subgroup.vert | 0 .../glslang/Test/spv.subgroupArithmetic.comp | 0 .../glslang/Test/spv.subgroupBallot.comp | 0 .../glslang/Test/spv.subgroupBasic.comp | 0 .../glslang/Test/spv.subgroupClustered.comp | 0 .../Test/spv.subgroupClusteredNeg.comp | 0 .../glslang/Test/spv.subgroupQuad.comp | 0 .../glslang/Test/spv.subgroupShuffle.comp | 0 .../Test/spv.subgroupShuffleRelative.comp | 0 .../glslang/Test/spv.subgroupVote.comp | 0 third_party/glslang/Test/spv.subpass.frag | 0 third_party/glslang/Test/spv.switch.frag | 0 third_party/glslang/Test/spv.swizzle.frag | 0 .../glslang/Test/spv.swizzleInversion.frag | 0 third_party/glslang/Test/spv.test.frag | 0 third_party/glslang/Test/spv.test.vert | 0 third_party/glslang/Test/spv.texture.frag | 0 .../Test/spv.texture.sampler.transform.frag | 0 third_party/glslang/Test/spv.texture.vert | 0 .../glslang/Test/spv.textureBuffer.vert | 0 .../Test/spv.textureGatherBiasLod.frag | 0 third_party/glslang/Test/spv.types.frag | 0 third_party/glslang/Test/spv.uint.frag | 0 .../glslang/Test/spv.uniformArray.frag | 0 .../glslang/Test/spv.variableArrayIndex.frag | 0 .../glslang/Test/spv.varyingArray.frag | 0 .../Test/spv.varyingArrayIndirect.frag | 0 .../glslang/Test/spv.viewportArray2.tesc | 0 .../glslang/Test/spv.viewportArray2.vert | 0 .../glslang/Test/spv.voidFunction.frag | 0 .../spv.vulkan100.subgroupArithmetic.comp | 0 .../glslang/Test/spv.vulkan110.int16.frag | 0 .../Test/spv.vulkan110.storageBuffer.vert | 0 .../Test/spv.while-continue-break.vert | 0 .../glslang/Test/spv.while-simple.vert | 0 third_party/glslang/Test/spv.whileLoop.frag | 0 third_party/glslang/Test/spv.xfb.vert | 0 third_party/glslang/Test/spv.xfb2.vert | 0 third_party/glslang/Test/spv.xfb3.vert | 0 third_party/glslang/Test/stringToDouble.vert | 22 +- .../glslang/Test/structAssignment.frag | 0 third_party/glslang/Test/structDeref.frag | 0 third_party/glslang/Test/structure.frag | 0 third_party/glslang/Test/switch.frag | 0 third_party/glslang/Test/swizzle.frag | 0 third_party/glslang/Test/syntaxError.frag | 0 third_party/glslang/Test/test.frag | 0 third_party/glslang/Test/texture.frag | 0 third_party/glslang/Test/tokenPaste.vert | 0 third_party/glslang/Test/types.frag | 0 third_party/glslang/Test/uint.frag | 0 third_party/glslang/Test/uniformArray.frag | 0 .../glslang/Test/variableArrayIndex.frag | 0 third_party/glslang/Test/varyingArray.frag | 0 .../glslang/Test/varyingArrayIndirect.frag | 0 third_party/glslang/Test/versionsClean.frag | 0 third_party/glslang/Test/versionsClean.vert | 0 third_party/glslang/Test/versionsErrors.frag | 0 third_party/glslang/Test/versionsErrors.vert | 0 third_party/glslang/Test/voidFunction.frag | 0 third_party/glslang/Test/vulkan.ast.vert | 0 third_party/glslang/Test/vulkan.comp | 0 third_party/glslang/Test/vulkan.frag | 2 +- third_party/glslang/Test/vulkan.vert | 0 third_party/glslang/Test/whileLoop.frag | 0 .../glslang/GenericCodeGen/CodeGen.cpp | 0 .../glslang/glslang/GenericCodeGen/Link.cpp | 0 .../glslang/glslang/Include/BaseTypes.h | 0 third_party/glslang/glslang/Include/Common.h | 0 .../glslang/glslang/Include/ConstantUnion.h | 0 .../glslang/glslang/Include/InfoSink.h | 0 .../glslang/Include/InitializeGlobals.h | 0 .../glslang/glslang/Include/PoolAlloc.h | 0 .../glslang/glslang/Include/ResourceLimits.h | 0 .../glslang/glslang/Include/ShHandle.h | 0 third_party/glslang/glslang/Include/arrays.h | 0 .../glslang/glslang/Include/revision.h | 2 +- .../glslang/glslang/Include/revision.template | 0 .../glslang/MachineIndependent/Constant.cpp | 10 +- .../glslang/MachineIndependent/InfoSink.cpp | 0 .../glslang/MachineIndependent/Initialize.h | 0 .../MachineIndependent/IntermTraverse.cpp | 0 .../MachineIndependent/LiveTraverser.h | 0 .../MachineIndependent/ParseContextBase.cpp | 0 .../MachineIndependent/ParseHelper.cpp | 7 - .../glslang/MachineIndependent/PoolAlloc.cpp | 0 .../glslang/MachineIndependent/RemoveTree.cpp | 0 .../glslang/MachineIndependent/RemoveTree.h | 0 .../glslang/glslang/MachineIndependent/Scan.h | 0 .../glslang/MachineIndependent/ShaderLang.cpp | 0 .../MachineIndependent/SymbolTable.cpp | 0 .../glslang/MachineIndependent/SymbolTable.h | 0 .../glslang/MachineIndependent/attribute.cpp | 0 .../glslang/MachineIndependent/attribute.h | 0 .../glslang/MachineIndependent/gl_types.h | 0 .../MachineIndependent/glslang_tab.cpp.h | 0 .../glslang/MachineIndependent/iomapper.cpp | 10 +- .../glslang/MachineIndependent/iomapper.h | 0 .../glslang/MachineIndependent/limits.cpp | 0 .../glslang/MachineIndependent/parseConst.cpp | 0 .../preprocessor/PpAtom.cpp | 0 .../preprocessor/PpScanner.cpp | 24 +- .../preprocessor/PpTokens.h | 0 .../propagateNoContraction.cpp | 0 .../propagateNoContraction.h | 0 .../glslang/MachineIndependent/reflection.cpp | 0 .../glslang/MachineIndependent/reflection.h | 4 +- .../glslang/OSDependent/Unix/CMakeLists.txt | 0 .../glslang/OSDependent/Unix/ossource.cpp | 0 .../OSDependent/Windows/CMakeLists.txt | 0 .../glslang/OSDependent/Windows/main.cpp | 0 .../glslang/OSDependent/Windows/ossource.cpp | 0 .../glslang/glslang/OSDependent/osinclude.h | 0 third_party/glslang/glslang/tnt/TNTReadme.txt | 10 - .../gtests/BuiltInResource.FromFile.cpp | 0 third_party/glslang/gtests/CMakeLists.txt | 0 .../glslang/gtests/Config.FromFile.cpp | 0 third_party/glslang/gtests/HexFloat.cpp | 0 third_party/glslang/gtests/Initializer.h | 0 third_party/glslang/gtests/Link.FromFile.cpp | 0 third_party/glslang/gtests/README.md | 0 third_party/glslang/gtests/Remap.FromFile.cpp | 0 third_party/glslang/gtests/Settings.cpp | 0 third_party/glslang/gtests/Settings.h | 0 third_party/glslang/gtests/TestFixture.cpp | 0 third_party/glslang/gtests/TestFixture.h | 0 third_party/glslang/gtests/main.cpp | 0 third_party/glslang/hlsl/hlslAttributes.cpp | 0 third_party/glslang/hlsl/hlslAttributes.h | 0 third_party/glslang/known_good.json | 0 third_party/glslang/tnt/CMakeLists.txt | 17 +- third_party/spirv-cross/CMakeLists.txt | 2 +- .../asm/frag/pass-by-value.asm.frag | 24 + .../shaders-hlsl/frag/texel-fetch-offset.frag | 31 + .../asm/frag/pass-by-value.asm.frag | 22 + .../shaders-msl/frag/texel-fetch-offset.frag | 19 + .../opt/shaders-msl/vert/no_stage_out.vert | 20 + .../vert/no_stage_out.write_buff.vert | 37 + .../vert/no_stage_out.write_buff_atomic.vert | 30 + .../vert/no_stage_out.write_tex.vert | 27 + .../frag/for-loop-phi-only-continue.asm.frag | 17 + .../shaders/asm/frag/pass-by-value.asm.frag | 16 + .../opt/shaders/frag/texel-fetch-offset.frag | 15 + .../asm/frag/pass-by-value.asm.frag | 29 + .../shaders-hlsl/frag/texel-fetch-offset.frag | 30 + .../asm/frag/empty-struct.asm.frag | 2 +- .../asm/frag/pass-by-value.asm.frag | 29 + .../shaders-msl/frag/texel-fetch-offset.frag | 18 + .../shaders-msl/vert/no_stage_out.vert | 20 + .../vert/no_stage_out.write_buff.vert | 35 + .../vert/no_stage_out.write_buff_atomic.vert | 31 + .../vert/no_stage_out.write_tex.vert | 25 + .../frag/for-loop-phi-only-continue.asm.frag | 19 + .../shaders/asm/frag/pass-by-value.asm.frag | 21 + .../shaders/frag/texel-fetch-offset.frag | 14 + .../asm/frag/pass-by-value.asm.frag | 51 + .../shaders-hlsl/frag/texel-fetch-offset.frag | 10 + .../asm/frag/pass-by-value.asm.frag | 51 + .../shaders-msl/frag/texel-fetch-offset.frag | 10 + .../shaders-msl/vert/no_stage_out.vert | 14 + .../vert/no_stage_out.write_buff.vert | 23 + .../vert/no_stage_out.write_buff_atomic.vert | 15 + .../vert/no_stage_out.write_tex.vert | 16 + .../frag/for-loop-phi-only-continue.asm.frag | 48 + .../shaders/asm/frag/pass-by-value.asm.frag | 51 + .../shaders/frag/texel-fetch-offset.frag | 10 + third_party/spirv-cross/spirv_cross.cpp | 8 +- third_party/spirv-cross/spirv_glsl.cpp | 16 +- third_party/spirv-cross/spirv_glsl.hpp | 1 + third_party/spirv-cross/spirv_msl.cpp | 152 +- third_party/spirv-cross/spirv_msl.hpp | 11 + third_party/spirv-tools/Android.mk | 9 +- third_party/spirv-tools/BUILD.gn | 129 +- third_party/spirv-tools/CHANGES | 0 third_party/spirv-tools/CONTRIBUTING.md | 0 third_party/spirv-tools/DEPS | 8 +- third_party/spirv-tools/FILAMENT_README.md | 4 +- third_party/spirv-tools/LICENSE | 0 third_party/spirv-tools/PRESUBMIT.py | 7 - third_party/spirv-tools/README.md | 0 .../spirv-tools/android_test/Android.mk | 0 .../android_test/jni/Application.mk | 0 third_party/spirv-tools/android_test/test.cpp | 0 .../build_overrides/spirv_tools.gni | 25 + .../cmake/SPIRV-Tools-shared.pc.in | 0 .../spirv-tools/cmake/SPIRV-Tools.pc.in | 0 .../spirv-tools/cmake/write_pkg_config.cmake | 0 .../spirv-tools/examples/CMakeLists.txt | 0 .../examples/cpp-interface/CMakeLists.txt | 0 .../examples/cpp-interface/main.cpp | 0 .../spirv-tools/external/CMakeLists.txt | 0 .../include/spirv-tools/libspirv.h | 6 +- .../include/spirv-tools/libspirv.hpp | 6 +- .../include/spirv-tools/linker.hpp | 6 +- .../include/spirv-tools/optimizer.hpp | 21 +- third_party/spirv-tools/projects.md | 0 third_party/spirv-tools/source/CMakeLists.txt | 12 +- .../spirv-tools/source/assembly_grammar.cpp | 10 +- .../spirv-tools/source/assembly_grammar.h | 14 +- third_party/spirv-tools/source/binary.cpp | 19 +- third_party/spirv-tools/source/binary.h | 8 +- third_party/spirv-tools/source/cfa.h | 6 +- .../spirv-tools/source/comp/CMakeLists.txt | 16 +- .../source/{util => comp}/bit_stream.cpp | 96 +- .../source/{util => comp}/bit_stream.h | 195 +- .../source/{util => comp}/huffman_codec.h | 12 +- third_party/spirv-tools/source/comp/markv.cpp | 112 + third_party/spirv-tools/source/comp/markv.h | 14 +- .../spirv-tools/source/comp/markv_codec.cpp | 2223 +---------------- .../spirv-tools/source/comp/markv_codec.h | 337 +++ .../spirv-tools/source/comp/markv_decoder.cpp | 925 +++++++ .../spirv-tools/source/comp/markv_decoder.h | 175 ++ .../spirv-tools/source/comp/markv_encoder.cpp | 486 ++++ .../spirv-tools/source/comp/markv_encoder.h | 167 ++ .../spirv-tools/source/comp/markv_logger.h | 93 + .../spirv-tools/source/comp/markv_model.h | 36 +- .../spirv-tools/source/comp/move_to_front.cpp | 456 ++++ .../spirv-tools/source/comp/move_to_front.h | 384 +++ third_party/spirv-tools/source/diagnostic.cpp | 19 +- third_party/spirv-tools/source/diagnostic.h | 6 +- .../spirv-tools/source/disassemble.cpp | 34 +- third_party/spirv-tools/source/disassemble.h | 6 +- third_party/spirv-tools/source/enum_set.h | 11 +- .../source/enum_string_mapping.cpp | 4 +- .../spirv-tools/source/enum_string_mapping.h | 10 +- third_party/spirv-tools/source/ext_inst.cpp | 16 +- third_party/spirv-tools/source/ext_inst.h | 8 +- third_party/spirv-tools/source/extensions.cpp | 4 +- third_party/spirv-tools/source/extensions.h | 8 +- .../source/extinst.debuginfo.grammar.json | 0 .../extinst.spv-amd-gcn-shader.grammar.json | 0 ...extinst.spv-amd-shader-ballot.grammar.json | 0 ...der-explicit-vertex-parameter.grammar.json | 0 ...spv-amd-shader-trinary-minmax.grammar.json | 0 .../spirv-tools/source/id_descriptor.cpp | 6 +- .../spirv-tools/source/id_descriptor.h | 6 +- third_party/spirv-tools/source/instruction.h | 8 +- .../latest_version_glsl_std_450_header.h | 6 +- .../source/latest_version_opencl_std_header.h | 6 +- .../source/latest_version_spirv_header.h | 6 +- third_party/spirv-tools/source/libspirv.cpp | 19 +- .../spirv-tools/source/link/CMakeLists.txt | 0 .../spirv-tools/source/link/linker.cpp | 26 +- third_party/spirv-tools/source/macro.h | 6 +- .../spirv-tools/source/name_mapper.cpp | 6 +- third_party/spirv-tools/source/name_mapper.h | 8 +- third_party/spirv-tools/source/opcode.cpp | 14 +- third_party/spirv-tools/source/opcode.h | 12 +- third_party/spirv-tools/source/operand.cpp | 8 +- third_party/spirv-tools/source/operand.h | 9 +- .../spirv-tools/source/opt/CMakeLists.txt | 1 - .../opt/aggressive_dead_code_elim_pass.cpp | 13 +- .../opt/aggressive_dead_code_elim_pass.h | 19 +- .../spirv-tools/source/opt/basic_block.cpp | 14 +- .../spirv-tools/source/opt/basic_block.h | 13 +- .../source/opt/block_merge_pass.cpp | 8 +- .../spirv-tools/source/opt/block_merge_pass.h | 16 +- .../spirv-tools/source/opt/build_module.cpp | 13 +- .../spirv-tools/source/opt/build_module.h | 10 +- .../spirv-tools/source/opt/ccp_pass.cpp | 13 +- third_party/spirv-tools/source/opt/ccp_pass.h | 21 +- third_party/spirv-tools/source/opt/cfg.cpp | 14 +- third_party/spirv-tools/source/opt/cfg.h | 11 +- .../source/opt/cfg_cleanup_pass.cpp | 6 +- .../spirv-tools/source/opt/cfg_cleanup_pass.h | 12 +- .../source/opt/combine_access_chains.cpp | 10 +- .../source/opt/combine_access_chains.h | 10 +- .../source/opt/common_uniform_elim_pass.cpp | 8 +- .../source/opt/common_uniform_elim_pass.h | 22 +- .../source/opt/compact_ids_pass.cpp | 5 +- .../spirv-tools/source/opt/compact_ids_pass.h | 12 +- .../spirv-tools/source/opt/composite.cpp | 10 +- .../spirv-tools/source/opt/composite.h | 15 +- .../source/opt/const_folding_rules.cpp | 4 +- .../source/opt/const_folding_rules.h | 9 +- .../spirv-tools/source/opt/constants.cpp | 5 +- .../spirv-tools/source/opt/constants.h | 24 +- .../source/opt/copy_prop_arrays.cpp | 7 +- .../spirv-tools/source/opt/copy_prop_arrays.h | 11 +- .../source/opt/dead_branch_elim_pass.cpp | 14 +- .../source/opt/dead_branch_elim_pass.h | 15 +- .../source/opt/dead_insert_elim_pass.cpp | 10 +- .../source/opt/dead_insert_elim_pass.h | 17 +- .../source/opt/dead_variable_elimination.cpp | 8 +- .../source/opt/dead_variable_elimination.h | 10 +- .../source/opt/decoration_manager.cpp | 6 +- .../source/opt/decoration_manager.h | 10 +- .../source/opt/def_use_manager.cpp | 6 +- .../spirv-tools/source/opt/def_use_manager.h | 11 +- .../source/opt/dominator_analysis.cpp | 4 +- .../source/opt/dominator_analysis.h | 8 +- .../spirv-tools/source/opt/dominator_tree.cpp | 9 +- .../spirv-tools/source/opt/dominator_tree.h | 10 +- .../opt/eliminate_dead_constant_pass.cpp | 11 +- .../source/opt/eliminate_dead_constant_pass.h | 12 +- .../opt/eliminate_dead_functions_pass.cpp | 5 +- .../opt/eliminate_dead_functions_pass.h | 14 +- .../source/opt/feature_manager.cpp | 6 +- .../spirv-tools/source/opt/feature_manager.h | 12 +- .../source/opt/flatten_decoration_pass.cpp | 7 +- .../source/opt/flatten_decoration_pass.h | 12 +- third_party/spirv-tools/source/opt/fold.cpp | 12 +- third_party/spirv-tools/source/opt/fold.h | 14 +- ...ld_spec_constant_op_and_composite_pass.cpp | 14 +- ...fold_spec_constant_op_and_composite_pass.h | 18 +- .../spirv-tools/source/opt/folding_rules.cpp | 8 +- .../spirv-tools/source/opt/folding_rules.h | 9 +- .../opt/freeze_spec_constant_value_pass.cpp | 4 +- .../opt/freeze_spec_constant_value_pass.h | 12 +- .../spirv-tools/source/opt/function.cpp | 2 +- third_party/spirv-tools/source/opt/function.h | 13 +- .../spirv-tools/source/opt/if_conversion.cpp | 7 +- .../spirv-tools/source/opt/if_conversion.h | 14 +- .../source/opt/inline_exhaustive_pass.cpp | 4 +- .../source/opt/inline_exhaustive_pass.h | 12 +- .../source/opt/inline_opaque_pass.cpp | 5 +- .../source/opt/inline_opaque_pass.h | 12 +- .../spirv-tools/source/opt/inline_pass.cpp | 23 +- .../spirv-tools/source/opt/inline_pass.h | 13 +- .../spirv-tools/source/opt/instruction.cpp | 10 +- .../spirv-tools/source/opt/instruction.h | 22 +- .../source/opt/instruction_list.cpp | 2 +- .../spirv-tools/source/opt/instruction_list.h | 16 +- .../spirv-tools/source/opt/ir_builder.h | 19 +- .../spirv-tools/source/opt/ir_context.cpp | 13 +- .../spirv-tools/source/opt/ir_context.h | 66 +- .../spirv-tools/source/opt/ir_loader.cpp | 13 +- .../spirv-tools/source/opt/ir_loader.h | 14 +- third_party/spirv-tools/source/opt/iterator.h | 7 +- .../spirv-tools/source/opt/licm_pass.cpp | 7 +- .../spirv-tools/source/opt/licm_pass.h | 11 +- .../opt/local_access_chain_convert_pass.cpp | 42 +- .../opt/local_access_chain_convert_pass.h | 28 +- .../opt/local_redundancy_elimination.cpp | 4 +- .../source/opt/local_redundancy_elimination.h | 14 +- .../opt/local_single_block_elim_pass.cpp | 8 +- .../source/opt/local_single_block_elim_pass.h | 15 +- .../opt/local_single_store_elim_pass.cpp | 8 +- .../source/opt/local_single_store_elim_pass.h | 16 +- .../source/opt/local_ssa_elim_pass.cpp | 8 +- .../source/opt/local_ssa_elim_pass.h | 16 +- third_party/spirv-tools/source/opt/log.h | 6 +- .../source/opt/loop_dependence.cpp | 8 +- .../spirv-tools/source/opt/loop_dependence.h | 10 +- .../source/opt/loop_dependence_helpers.cpp | 10 +- .../source/opt/loop_descriptor.cpp | 21 +- .../spirv-tools/source/opt/loop_descriptor.h | 15 +- .../spirv-tools/source/opt/loop_fission.cpp | 7 +- .../spirv-tools/source/opt/loop_fission.h | 18 +- .../spirv-tools/source/opt/loop_fusion.cpp | 8 +- .../spirv-tools/source/opt/loop_fusion.h | 9 +- .../source/opt/loop_fusion_pass.cpp | 10 +- .../spirv-tools/source/opt/loop_fusion_pass.h | 2 +- .../spirv-tools/source/opt/loop_peeling.cpp | 14 +- .../spirv-tools/source/opt/loop_peeling.h | 11 +- .../spirv-tools/source/opt/loop_unroller.cpp | 11 +- .../spirv-tools/source/opt/loop_unroller.h | 3 +- .../source/opt/loop_unswitch_pass.cpp | 24 +- .../source/opt/loop_unswitch_pass.h | 10 +- .../spirv-tools/source/opt/loop_utils.cpp | 13 +- .../spirv-tools/source/opt/loop_utils.h | 7 +- .../spirv-tools/source/opt/mem_pass.cpp | 16 +- third_party/spirv-tools/source/opt/mem_pass.h | 16 +- .../source/opt/merge_return_pass.cpp | 16 +- .../source/opt/merge_return_pass.h | 15 +- third_party/spirv-tools/source/opt/module.cpp | 6 +- third_party/spirv-tools/source/opt/module.h | 12 +- .../spirv-tools/source/opt/null_pass.h | 10 +- .../spirv-tools/source/opt/optimizer.cpp | 36 +- third_party/spirv-tools/source/opt/pass.cpp | 4 +- third_party/spirv-tools/source/opt/pass.h | 14 +- .../spirv-tools/source/opt/pass_manager.cpp | 7 +- .../spirv-tools/source/opt/pass_manager.h | 15 +- third_party/spirv-tools/source/opt/passes.h | 99 +- .../source/opt/private_to_local_pass.cpp | 17 +- .../source/opt/private_to_local_pass.h | 10 +- .../spirv-tools/source/opt/propagator.cpp | 2 +- .../spirv-tools/source/opt/propagator.h | 11 +- .../source/opt/reduce_load_size.cpp | 15 +- .../spirv-tools/source/opt/reduce_load_size.h | 14 +- .../source/opt/redundancy_elimination.cpp | 4 +- .../source/opt/redundancy_elimination.h | 16 +- third_party/spirv-tools/source/opt/reflect.h | 8 +- .../source/opt/register_pressure.cpp | 15 +- .../source/opt/register_pressure.h | 10 +- .../source/opt/remove_duplicates_pass.cpp | 14 +- .../source/opt/remove_duplicates_pass.h | 17 +- .../source/opt/replace_invalid_opc.cpp | 3 +- .../source/opt/replace_invalid_opc.h | 10 +- .../source/opt/scalar_analysis.cpp | 4 +- .../spirv-tools/source/opt/scalar_analysis.h | 9 +- .../source/opt/scalar_analysis_nodes.h | 3 +- .../opt/scalar_analysis_simplification.cpp | 2 +- .../source/opt/scalar_replacement_pass.cpp | 16 +- .../source/opt/scalar_replacement_pass.h | 19 +- .../set_spec_constant_default_value_pass.cpp | 14 +- .../set_spec_constant_default_value_pass.h | 14 +- .../source/opt/simplification_pass.cpp | 4 +- .../source/opt/simplification_pass.h | 12 +- .../source/opt/ssa_rewrite_pass.cpp | 12 +- .../spirv-tools/source/opt/ssa_rewrite_pass.h | 19 +- .../source/opt/strength_reduction_pass.cpp | 13 +- .../source/opt/strength_reduction_pass.h | 14 +- .../source/opt/strip_debug_info_pass.cpp | 4 +- .../source/opt/strip_debug_info_pass.h | 12 +- .../source/opt/strip_reflect_info_pass.cpp | 7 +- .../source/opt/strip_reflect_info_pass.h | 12 +- .../spirv-tools/source/opt/tree_iterator.h | 6 +- .../spirv-tools/source/opt/type_manager.cpp | 135 +- .../spirv-tools/source/opt/type_manager.h | 11 +- third_party/spirv-tools/source/opt/types.cpp | 9 +- third_party/spirv-tools/source/opt/types.h | 9 +- .../source/opt/unify_const_pass.cpp | 10 +- .../spirv-tools/source/opt/unify_const_pass.h | 12 +- .../source/opt/value_number_table.cpp | 6 +- .../source/opt/value_number_table.h | 9 +- .../spirv-tools/source/opt/vector_dce.cpp | 15 +- .../spirv-tools/source/opt/vector_dce.h | 13 +- .../spirv-tools/source/opt/workaround1209.cpp | 4 +- .../spirv-tools/source/opt/workaround1209.h | 8 +- .../spirv-tools/source/parsed_operand.cpp | 21 +- .../spirv-tools/source/parsed_operand.h | 7 +- third_party/spirv-tools/source/print.cpp | 2 +- third_party/spirv-tools/source/print.h | 6 +- .../spirv-tools/source/software_version.cpp | 0 .../spirv-tools/source/spirv_constant.h | 8 +- .../spirv-tools/source/spirv_definition.h | 8 +- .../spirv-tools/source/spirv_endian.cpp | 2 +- third_party/spirv-tools/source/spirv_endian.h | 6 +- .../spirv-tools/source/spirv_target_env.cpp | 4 +- .../spirv-tools/source/spirv_target_env.h | 6 +- .../source/spirv_validator_options.cpp | 2 +- .../source/spirv_validator_options.h | 6 +- third_party/spirv-tools/source/table.cpp | 2 +- third_party/spirv-tools/source/table.h | 11 +- third_party/spirv-tools/source/text.cpp | 31 +- third_party/spirv-tools/source/text.h | 10 +- .../spirv-tools/source/text_handler.cpp | 24 +- third_party/spirv-tools/source/text_handler.h | 16 +- .../spirv-tools/source/util/bit_vector.cpp | 2 +- .../spirv-tools/source/util/bit_vector.h | 6 +- .../spirv-tools/source/util/bitutils.h | 6 +- .../spirv-tools/source/util/hex_float.h | 8 +- third_party/spirv-tools/source/util/ilist.h | 8 +- .../spirv-tools/source/util/ilist_node.h | 6 +- .../source/{opt => util}/make_unique.h | 6 +- .../spirv-tools/source/util/move_to_front.h | 827 ------ .../spirv-tools/source/util/parse_number.cpp | 7 +- .../spirv-tools/source/util/parse_number.h | 8 +- .../spirv-tools/source/util/small_vector.h | 20 +- .../spirv-tools/source/util/string_utils.cpp | 2 +- .../spirv-tools/source/util/string_utils.h | 8 +- third_party/spirv-tools/source/util/timer.cpp | 2 +- third_party/spirv-tools/source/util/timer.h | 6 +- .../spirv-tools/source/val/basic_block.cpp | 2 +- .../spirv-tools/source/val/basic_block.h | 11 +- .../spirv-tools/source/val/construct.cpp | 5 +- .../spirv-tools/source/val/construct.h | 10 +- .../spirv-tools/source/val/decoration.h | 8 +- .../spirv-tools/source/val/function.cpp | 10 +- third_party/spirv-tools/source/val/function.h | 14 +- .../spirv-tools/source/val/instruction.cpp | 35 +- .../spirv-tools/source/val/instruction.h | 31 +- .../spirv-tools/source/val/validate.cpp | 222 +- third_party/spirv-tools/source/val/validate.h | 31 +- .../source/val/validate_annotation.cpp | 158 ++ .../source/val/validate_arithmetics.cpp | 2 + .../source/val/validate_barriers.cpp | 38 +- .../source/val/validate_builtins.cpp | 1 + .../source/val/validate_capability.cpp | 1 + .../spirv-tools/source/val/validate_cfg.cpp | 172 ++ .../spirv-tools/source/val/validate_debug.cpp | 72 + .../source/val/validate_decorations.cpp | 22 +- .../source/val/validate_derivatives.cpp | 12 +- .../val/validate_execution_limitations.cpp | 61 + .../source/val/validate_ext_inst.cpp | 11 +- .../source/val/validate_function.cpp | 202 ++ .../spirv-tools/source/val/validate_id.cpp | 811 +----- .../spirv-tools/source/val/validate_image.cpp | 45 +- .../source/val/validate_instruction.cpp | 2 +- .../source/val/validate_interfaces.cpp | 1 + .../source/val/validate_memory.cpp | 155 +- .../source/val/validate_mode_setting.cpp | 91 + .../source/val/validate_primitives.cpp | 9 +- .../spirv-tools/source/val/validate_type.cpp | 305 +++ .../source/val/validate_type_unique.cpp | 57 - .../source/val/validation_state.cpp | 31 +- .../spirv-tools/source/val/validation_state.h | 28 +- third_party/spirv-tools/syntax.md | 0 third_party/spirv-tools/test/CMakeLists.txt | 7 + .../test/assembly_context_test.cpp | 6 +- .../spirv-tools/test/assembly_format_test.cpp | 2 +- .../spirv-tools/test/binary_destroy_test.cpp | 4 +- .../test/binary_endianness_test.cpp | 2 +- .../test/binary_header_get_test.cpp | 2 +- .../spirv-tools/test/binary_parse_test.cpp | 9 +- .../test/binary_strnlen_s_test.cpp | 2 +- .../test/binary_to_text.literal_test.cpp | 7 +- .../spirv-tools/test/binary_to_text_test.cpp | 9 +- third_party/spirv-tools/test/bit_stream.cpp | 536 +--- .../spirv-tools/test/c_interface_test.cpp | 6 +- third_party/spirv-tools/test/comment_test.cpp | 6 +- .../spirv-tools/test/comp/CMakeLists.txt | 0 .../test/comp/markv_codec_test.cpp | 5 +- .../spirv-tools/test/cpp_interface_test.cpp | 72 +- .../spirv-tools/test/diagnostic_test.cpp | 3 +- .../spirv-tools/test/enum_set_test.cpp | 8 +- .../test/enum_string_mapping_test.cpp | 6 +- .../test/ext_inst.debuginfo_test.cpp | 8 +- .../spirv-tools/test/ext_inst.glsl_test.cpp | 5 +- .../spirv-tools/test/ext_inst.opencl_test.cpp | 10 +- .../spirv-tools/test/fix_word_test.cpp | 2 +- .../{testing => test}/fuzzers/BUILD.gn | 40 +- .../fuzzers/corpora/spv/simple.spv | Bin .../spvtools_opt_legalization_fuzzer.cpp | 38 + .../spvtools_opt_performance_fuzzer.cpp} | 1 + .../test/fuzzers/spvtools_opt_size_fuzzer.cpp | 38 + .../fuzzers/spvtools_val_fuzzer.cpp | 1 + .../test/generator_magic_number_test.cpp | 9 +- .../spirv-tools/test/hex_float_test.cpp | 8 +- .../spirv-tools/test/huffman_codec.cpp | 13 +- .../spirv-tools/test/immediate_int_test.cpp | 5 +- .../spirv-tools/test/libspirv_macros_test.cpp | 2 +- .../spirv-tools/test/link/CMakeLists.txt | 0 .../test/link/binary_version_test.cpp | 4 +- .../test/link/entry_points_test.cpp | 4 +- .../test/link/global_values_amount_test.cpp | 8 +- .../spirv-tools/test/link/ids_limit_test.cpp | 4 +- .../spirv-tools/test/link/linker_fixture.h | 13 +- .../link/matching_imports_to_exports_test.cpp | 4 +- .../test/link/memory_model_test.cpp | 4 +- .../test/link/partial_linkage_test.cpp | 4 +- .../spirv-tools/test/link/unique_ids_test.cpp | 5 +- third_party/spirv-tools/test/log_test.cpp | 8 +- .../spirv-tools/test/move_to_front_test.cpp | 126 +- .../spirv-tools/test/name_mapper_test.cpp | 9 +- .../spirv-tools/test/named_id_test.cpp | 5 +- .../spirv-tools/test/opcode_make_test.cpp | 2 +- .../test/opcode_require_capabilities_test.cpp | 4 +- .../spirv-tools/test/opcode_split_test.cpp | 2 +- .../test/opcode_table_get_test.cpp | 5 +- .../test/operand-class-test-coverage.csv | 0 .../test/operand_capabilities_test.cpp | 6 +- .../spirv-tools/test/operand_pattern_test.cpp | 3 +- third_party/spirv-tools/test/operand_test.cpp | 4 +- .../spirv-tools/test/opt/CMakeLists.txt | 0 .../opt/aggressive_dead_code_elim_test.cpp | 9 +- .../spirv-tools/test/opt/assembly_builder.h | 6 +- .../test/opt/assembly_builder_test.cpp | 6 +- .../spirv-tools/test/opt/block_merge_test.cpp | 6 +- third_party/spirv-tools/test/opt/ccp_test.cpp | 9 +- .../spirv-tools/test/opt/cfg_cleanup_test.cpp | 6 +- .../test/opt/combine_access_chains_test.cpp | 8 +- .../test/opt/common_uniform_elim_test.cpp | 4 +- .../spirv-tools/test/opt/compact_ids_test.cpp | 18 +- .../test/opt/constant_manager_test.cpp | 12 +- .../test/opt/copy_prop_array_test.cpp | 8 +- .../test/opt/dead_branch_elim_test.cpp | 6 +- .../test/opt/dead_insert_elim_test.cpp | 6 +- .../test/opt/dead_variable_elim_test.cpp | 6 +- .../test/opt/decoration_manager_test.cpp | 10 +- .../spirv-tools/test/opt/def_use_test.cpp | 21 +- .../test/opt/dominator_tree/CMakeLists.txt | 0 .../opt/dominator_tree/common_dominators.cpp | 10 +- .../test/opt/dominator_tree/generated.cpp | 17 +- .../test/opt/dominator_tree/nested_ifs.cpp | 14 +- .../opt/dominator_tree/nested_ifs_post.cpp | 15 +- .../test/opt/dominator_tree/nested_loops.cpp | 15 +- .../nested_loops_with_unreachables.cpp | 16 +- .../test/opt/dominator_tree/post.cpp | 16 +- .../test/opt/dominator_tree/simple.cpp | 16 +- .../switch_case_fallthrough.cpp | 16 +- .../opt/dominator_tree/unreachable_for.cpp | 16 +- .../dominator_tree/unreachable_for_post.cpp | 16 +- .../test/opt/eliminate_dead_const_test.cpp | 10 +- .../opt/eliminate_dead_functions_test.cpp | 10 +- .../test/opt/feature_manager_test.cpp | 10 +- .../test/opt/flatten_decoration_test.cpp | 8 +- .../opt/fold_spec_const_op_composite_test.cpp | 9 +- .../spirv-tools/test/opt/fold_test.cpp | 24 +- .../test/opt/freeze_spec_const_test.cpp | 8 +- .../spirv-tools/test/opt/function_utils.h | 10 +- .../test/opt/if_conversion_test.cpp | 8 +- .../test/opt/inline_opaque_test.cpp | 6 +- .../spirv-tools/test/opt/inline_test.cpp | 8 +- .../test/opt/insert_extract_elim_test.cpp | 8 +- .../test/opt/instruction_list_test.cpp | 6 +- .../spirv-tools/test/opt/instruction_test.cpp | 14 +- .../spirv-tools/test/opt/ir_builder.cpp | 21 +- .../spirv-tools/test/opt/ir_context_test.cpp | 15 +- .../spirv-tools/test/opt/ir_loader_test.cpp | 46 +- .../spirv-tools/test/opt/iterator_test.cpp | 4 +- .../test/opt/line_debug_info_test.cpp | 4 +- .../opt/local_access_chain_convert_test.cpp | 389 +-- .../opt/local_redundancy_elimination_test.cpp | 11 +- .../test/opt/local_single_block_elim.cpp | 83 +- .../test/opt/local_single_store_elim_test.cpp | 80 +- .../test/opt/local_ssa_elim_test.cpp | 7 +- .../opt/loop_optimizations/CMakeLists.txt | 0 .../dependence_analysis.cpp | 22 +- .../dependence_analysis_helpers.cpp | 24 +- .../fusion_compatibility.cpp | 9 +- .../opt/loop_optimizations/fusion_illegal.cpp | 9 +- .../opt/loop_optimizations/fusion_legal.cpp | 11 +- .../opt/loop_optimizations/fusion_pass.cpp | 7 +- .../hoist_all_loop_types.cpp | 7 +- .../hoist_double_nested_loops.cpp | 7 +- .../hoist_from_independent_loops.cpp | 7 +- .../loop_optimizations/hoist_simple_case.cpp | 7 +- .../hoist_single_nested_loops.cpp | 8 +- .../hoist_without_preheader.cpp | 7 +- .../test/opt/loop_optimizations/lcssa.cpp | 18 +- .../loop_optimizations/loop_descriptions.cpp | 15 +- .../opt/loop_optimizations/loop_fission.cpp | 20 +- .../opt/loop_optimizations/nested_loops.cpp | 20 +- .../test/opt/loop_optimizations/peeling.cpp | 15 +- .../opt/loop_optimizations/peeling_pass.cpp | 13 +- .../loop_optimizations/unroll_assumptions.cpp | 18 +- .../opt/loop_optimizations/unroll_simple.cpp | 18 +- .../test/opt/loop_optimizations/unswitch.cpp | 7 +- .../spirv-tools/test/opt/module_test.cpp | 11 +- .../spirv-tools/test/opt/module_utils.h | 8 +- .../spirv-tools/test/opt/optimizer_test.cpp | 36 +- .../spirv-tools/test/opt/pass_fixture.h | 23 +- .../test/opt/pass_manager_test.cpp | 13 +- .../test/opt/pass_merge_return_test.cpp | 8 +- .../test/opt/pass_remove_duplicates_test.cpp | 10 +- .../spirv-tools/test/opt/pass_test.cpp | 12 +- .../spirv-tools/test/opt/pass_utils.cpp | 2 +- third_party/spirv-tools/test/opt/pass_utils.h | 7 +- .../test/opt/private_to_local_test.cpp | 11 +- .../spirv-tools/test/opt/propagator_test.cpp | 18 +- .../test/opt/reduce_load_size_test.cpp | 6 +- .../test/opt/redundancy_elimination_test.cpp | 11 +- .../test/opt/register_liveness.cpp | 14 +- .../test/opt/replace_invalid_opc_test.cpp | 10 +- .../spirv-tools/test/opt/scalar_analysis.cpp | 22 +- .../test/opt/scalar_replacement_test.cpp | 8 +- .../opt/set_spec_const_default_value_test.cpp | 5 +- .../test/opt/simplification_test.cpp | 7 +- .../test/opt/strength_reduction_test.cpp | 12 +- .../test/opt/strip_debug_info_test.cpp | 6 +- .../test/opt/strip_reflect_info_test.cpp | 6 +- .../test/opt/type_manager_test.cpp | 18 +- .../spirv-tools/test/opt/types_test.cpp | 23 +- .../spirv-tools/test/opt/unify_const_test.cpp | 10 +- .../spirv-tools/test/opt/utils_test.cpp | 6 +- .../spirv-tools/test/opt/value_table_test.cpp | 9 +- .../spirv-tools/test/opt/vector_dce_test.cpp | 6 +- .../test/opt/workaround1209_test.cpp | 11 +- .../spirv-tools/test/parse_number_test.cpp | 1 + .../test/preserve_numeric_ids_test.cpp | 2 +- .../test/scripts/test_compact_ids.py | 0 .../test/software_version_test.cpp | 4 +- .../spirv-tools/test/stats/CMakeLists.txt | 1 + .../test/stats/stats_aggregate_test.cpp | 58 +- .../test/stats/stats_analyzer_test.cpp | 6 +- .../spirv-tools/test/string_utils_test.cpp | 0 .../spirv-tools/test/target_env_test.cpp | 6 +- third_party/spirv-tools/test/test_fixture.h | 11 +- .../spirv-tools/test/text_advance_test.cpp | 4 +- .../spirv-tools/test/text_destroy_test.cpp | 2 +- .../spirv-tools/test/text_literal_test.cpp | 10 +- .../test/text_start_new_inst_test.cpp | 4 +- .../test/text_to_binary.annotation_test.cpp | 7 +- .../test/text_to_binary.barrier_test.cpp | 5 +- .../test/text_to_binary.constant_test.cpp | 7 +- .../test/text_to_binary.control_flow_test.cpp | 6 +- .../test/text_to_binary.debug_test.cpp | 6 +- ...ext_to_binary.device_side_enqueue_test.cpp | 6 +- .../test/text_to_binary.extension_test.cpp | 11 +- .../test/text_to_binary.function_test.cpp | 6 +- .../test/text_to_binary.group_test.cpp | 6 +- .../test/text_to_binary.image_test.cpp | 6 +- .../test/text_to_binary.literal_test.cpp | 4 +- .../test/text_to_binary.memory_test.cpp | 7 +- .../test/text_to_binary.misc_test.cpp | 4 +- .../test/text_to_binary.mode_setting_test.cpp | 7 +- .../test/text_to_binary.pipe_storage_test.cpp | 2 +- .../text_to_binary.reserved_sampling_test.cpp | 5 +- .../text_to_binary.subgroup_dispatch_test.cpp | 4 +- .../text_to_binary.type_declaration_test.cpp | 6 +- .../spirv-tools/test/text_to_binary_test.cpp | 6 +- .../spirv-tools/test/text_word_get_test.cpp | 4 +- third_party/spirv-tools/test/timer_test.cpp | 0 third_party/spirv-tools/test/unit_spirv.cpp | 4 +- third_party/spirv-tools/test/unit_spirv.h | 10 +- .../spirv-tools/test/util/CMakeLists.txt | 0 .../spirv-tools/test/util/bit_vector_test.cpp | 2 +- .../spirv-tools/test/util/ilist_test.cpp | 4 +- .../test/util/small_vector_test.cpp | 4 +- .../spirv-tools/test/val/CMakeLists.txt | 0 .../test/val/val_adjacency_test.cpp | 4 +- .../test/val/val_arithmetics_test.cpp | 4 +- .../spirv-tools/test/val/val_atomics_test.cpp | 4 +- .../test/val/val_barriers_test.cpp | 4 +- .../spirv-tools/test/val/val_bitwise_test.cpp | 4 +- .../test/val/val_builtins_test.cpp | 6 +- .../test/val/val_capability_test.cpp | 12 +- .../spirv-tools/test/val/val_cfg_test.cpp | 18 +- .../test/val/val_composites_test.cpp | 4 +- .../test/val/val_conversion_test.cpp | 4 +- .../spirv-tools/test/val/val_data_test.cpp | 15 +- .../test/val/val_decoration_test.cpp | 31 +- .../test/val/val_derivatives_test.cpp | 4 +- .../test/val/val_explicit_reserved_test.cpp | 5 +- .../test/val/val_ext_inst_test.cpp | 5 +- .../test/val/val_extensions_test.cpp | 13 +- .../spirv-tools/test/val/val_fixtures.h | 14 +- .../spirv-tools/test/val/val_id_test.cpp | 452 +++- .../spirv-tools/test/val/val_image_test.cpp | 50 +- .../test/val/val_interfaces_test.cpp | 6 +- .../spirv-tools/test/val/val_layout_test.cpp | 22 +- .../spirv-tools/test/val/val_limits_test.cpp | 4 +- .../test/val/val_literals_test.cpp | 2 +- .../test/val/val_logicals_test.cpp | 4 +- .../test/val/val_non_uniform_test.cpp | 5 +- .../test/val/val_primitives_test.cpp | 4 +- .../spirv-tools/test/val/val_ssa_test.cpp | 4 +- .../spirv-tools/test/val/val_state_test.cpp | 16 +- .../spirv-tools/test/val/val_storage_test.cpp | 2 +- .../test/val/val_type_unique_test.cpp | 4 +- .../test/val/val_validation_state_test.cpp | 6 +- .../spirv-tools/test/val/val_version_test.cpp | 5 +- .../spirv-tools/test/val/val_webgpu_test.cpp | 5 +- third_party/spirv-tools/testing/test.gni | 413 --- third_party/spirv-tools/tools/CMakeLists.txt | 9 +- third_party/spirv-tools/tools/as/as.cpp | 0 .../spirv-tools/tools/cfg/bin_to_dot.cpp | 6 +- .../spirv-tools/tools/cfg/bin_to_dot.h | 7 +- third_party/spirv-tools/tools/cfg/cfg.cpp | 3 +- third_party/spirv-tools/tools/comp/markv.cpp | 4 +- .../tools/comp/markv_model_factory.cpp | 11 +- .../tools/comp/markv_model_factory.h | 6 +- .../tools/comp/markv_model_shader.cpp | 35 +- .../tools/comp/markv_model_shader.h | 6 +- .../markv_model_shader_default_autogen.inc | 0 third_party/spirv-tools/tools/dis/dis.cpp | 0 .../spirv-tools/tools/emacs/50spirv-tools.el | 0 .../spirv-tools/tools/emacs/CMakeLists.txt | 0 third_party/spirv-tools/tools/io.h | 6 +- .../spirv-tools/tools/lesspipe/CMakeLists.txt | 0 .../tools/lesspipe/spirv-lesspipe.sh | 0 third_party/spirv-tools/tools/link/linker.cpp | 0 third_party/spirv-tools/tools/opt/opt.cpp | 105 +- .../{source => tools/stats}/spirv_stats.cpp | 123 +- .../{source => tools/stats}/spirv_stats.h | 49 +- third_party/spirv-tools/tools/stats/stats.cpp | 135 +- .../tools/stats/stats_analyzer.cpp | 665 +---- .../spirv-tools/tools/stats/stats_analyzer.h | 48 +- .../util/cli_consumer.cpp} | 37 +- .../message.h => tools/util/cli_consumer.h} | 24 +- third_party/spirv-tools/tools/val/val.cpp | 24 +- .../spirv-tools/utils/fixup_fuzz_result.py | 25 + tools/matc/src/matc/sca/GLSLPostProcessor.cpp | 3 +- tools/matinfo/CMakeLists.txt | 2 +- 2041 files changed, 10172 insertions(+), 9621 deletions(-) mode change 100755 => 100644 third_party/glslang/CMakeLists.txt mode change 100755 => 100644 third_party/glslang/ChooseMSVCCRT.cmake mode change 100755 => 100644 third_party/glslang/External/CMakeLists.txt mode change 100755 => 100644 third_party/glslang/OGLCompilersDLL/CMakeLists.txt mode change 100755 => 100644 third_party/glslang/OGLCompilersDLL/InitializeDll.cpp mode change 100755 => 100644 third_party/glslang/OGLCompilersDLL/InitializeDll.h mode change 100755 => 100644 third_party/glslang/README-spirv-remap.txt mode change 100755 => 100644 third_party/glslang/SPIRV/GLSL.ext.AMD.h mode change 100755 => 100644 third_party/glslang/SPIRV/GLSL.ext.EXT.h mode change 100755 => 100644 third_party/glslang/SPIRV/GLSL.ext.NV.h mode change 100755 => 100644 third_party/glslang/SPIRV/GlslangToSpv.h mode change 100755 => 100644 third_party/glslang/SPIRV/InReadableOrder.cpp mode change 100755 => 100644 third_party/glslang/SPIRV/Logger.cpp mode change 100755 => 100644 third_party/glslang/SPIRV/Logger.h create mode 100755 third_party/glslang/SPIRV/SpvPostProcess.cpp mode change 100755 => 100644 third_party/glslang/SPIRV/bitutils.h mode change 100755 => 100644 third_party/glslang/SPIRV/doc.h mode change 100755 => 100644 third_party/glslang/SPIRV/hex_float.h mode change 100755 => 100644 third_party/glslang/StandAlone/DirStackFileIncluder.h mode change 100755 => 100644 third_party/glslang/StandAlone/ResourceLimits.cpp mode change 100755 => 100644 third_party/glslang/StandAlone/ResourceLimits.h mode change 100755 => 100644 third_party/glslang/StandAlone/Worklist.h mode change 100755 => 100644 third_party/glslang/StandAlone/spirv-remap.cpp mode change 100755 => 100644 third_party/glslang/Test/100.conf mode change 100755 => 100644 third_party/glslang/Test/100.frag mode change 100755 => 100644 third_party/glslang/Test/100Limits.vert mode change 100755 => 100644 third_party/glslang/Test/100samplerExternal.frag mode change 100755 => 100644 third_party/glslang/Test/100scope.vert mode change 100755 => 100644 third_party/glslang/Test/120.frag mode change 100755 => 100644 third_party/glslang/Test/120.vert mode change 100755 => 100644 third_party/glslang/Test/130.frag mode change 100755 => 100644 third_party/glslang/Test/130.vert mode change 100755 => 100644 third_party/glslang/Test/140.frag mode change 100755 => 100644 third_party/glslang/Test/140.vert mode change 100755 => 100644 third_party/glslang/Test/150.frag mode change 100755 => 100644 third_party/glslang/Test/150.geom mode change 100755 => 100644 third_party/glslang/Test/150.tesc mode change 100755 => 100644 third_party/glslang/Test/150.tese mode change 100755 => 100644 third_party/glslang/Test/150.vert mode change 100755 => 100644 third_party/glslang/Test/300.frag mode change 100755 => 100644 third_party/glslang/Test/300.vert mode change 100755 => 100644 third_party/glslang/Test/300BuiltIns.frag mode change 100755 => 100644 third_party/glslang/Test/300block.frag mode change 100755 => 100644 third_party/glslang/Test/300layout.frag mode change 100755 => 100644 third_party/glslang/Test/300layout.vert mode change 100755 => 100644 third_party/glslang/Test/300link.frag mode change 100755 => 100644 third_party/glslang/Test/300link2.frag mode change 100755 => 100644 third_party/glslang/Test/300link3.frag mode change 100755 => 100644 third_party/glslang/Test/300operations.frag mode change 100755 => 100644 third_party/glslang/Test/300samplerExternal.frag mode change 100755 => 100644 third_party/glslang/Test/300scope.vert mode change 100755 => 100644 third_party/glslang/Test/310.comp mode change 100755 => 100644 third_party/glslang/Test/310.frag mode change 100755 => 100644 third_party/glslang/Test/310.geom mode change 100755 => 100644 third_party/glslang/Test/310.tesc mode change 100755 => 100644 third_party/glslang/Test/310.tese mode change 100755 => 100644 third_party/glslang/Test/310.vert mode change 100755 => 100644 third_party/glslang/Test/310AofA.vert mode change 100755 => 100644 third_party/glslang/Test/310implicitSizeArrayError.vert mode change 100755 => 100644 third_party/glslang/Test/320.comp mode change 100755 => 100644 third_party/glslang/Test/320.frag mode change 100755 => 100644 third_party/glslang/Test/320.geom mode change 100755 => 100644 third_party/glslang/Test/320.tesc mode change 100755 => 100644 third_party/glslang/Test/320.tese mode change 100755 => 100644 third_party/glslang/Test/320.vert mode change 100755 => 100644 third_party/glslang/Test/330.frag mode change 100755 => 100644 third_party/glslang/Test/330comp.frag mode change 100755 => 100644 third_party/glslang/Test/400.frag mode change 100755 => 100644 third_party/glslang/Test/400.tesc mode change 100755 => 100644 third_party/glslang/Test/400.tese mode change 100755 => 100644 third_party/glslang/Test/400.vert mode change 100755 => 100644 third_party/glslang/Test/410.geom mode change 100755 => 100644 third_party/glslang/Test/410.tesc mode change 100755 => 100644 third_party/glslang/Test/410.vert mode change 100755 => 100644 third_party/glslang/Test/420.frag mode change 100755 => 100644 third_party/glslang/Test/420.geom mode change 100755 => 100644 third_party/glslang/Test/420.tesc mode change 100755 => 100644 third_party/glslang/Test/420.tese mode change 100755 => 100644 third_party/glslang/Test/420.vert mode change 100755 => 100644 third_party/glslang/Test/420_size_gl_in.geom mode change 100755 => 100644 third_party/glslang/Test/430.comp mode change 100755 => 100644 third_party/glslang/Test/430.vert mode change 100755 => 100644 third_party/glslang/Test/430AofA.frag mode change 100755 => 100644 third_party/glslang/Test/430scope.vert mode change 100755 => 100644 third_party/glslang/Test/435.vert mode change 100755 => 100644 third_party/glslang/Test/440.frag mode change 100755 => 100644 third_party/glslang/Test/440.vert mode change 100755 => 100644 third_party/glslang/Test/450.comp mode change 100755 => 100644 third_party/glslang/Test/450.frag mode change 100755 => 100644 third_party/glslang/Test/450.geom mode change 100755 => 100644 third_party/glslang/Test/450.tesc mode change 100755 => 100644 third_party/glslang/Test/450.tese mode change 100755 => 100644 third_party/glslang/Test/450.vert mode change 100755 => 100644 third_party/glslang/Test/460.frag mode change 100755 => 100644 third_party/glslang/Test/460.vert mode change 100755 => 100644 third_party/glslang/Test/Operations.frag mode change 100755 => 100644 third_party/glslang/Test/aggOps.frag mode change 100755 => 100644 third_party/glslang/Test/always-discard.frag mode change 100755 => 100644 third_party/glslang/Test/always-discard2.frag mode change 100755 => 100644 third_party/glslang/Test/array.frag mode change 100755 => 100644 third_party/glslang/Test/array100.frag mode change 100755 => 100644 third_party/glslang/Test/atomic_uint.frag mode change 100755 => 100644 third_party/glslang/Test/badChars.frag mode change 100755 => 100644 third_party/glslang/Test/bar.h mode change 100755 => 100644 third_party/glslang/Test/baseLegalResults/hlsl.aliasOpaque.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseLegalResults/hlsl.flattenOpaque.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseLegalResults/hlsl.flattenOpaqueInit.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseLegalResults/hlsl.flattenOpaqueInitMix.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/100.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/100Limits.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/100LimitsConf.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/100samplerExternal.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/100scope.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/110scope.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/120.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/120.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/130.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/130.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/140.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/140.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/150.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/150.geom.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/150.tesc.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/150.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/300.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/300.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/300BuiltIns.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/300block.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/300layout.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/300layout.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/300link.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/300link2.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/300link3.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/300operations.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/300samplerExternal.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/300scope.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/310.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/310.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/310.geom.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/310.tesc.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/310.tese.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/310.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/310AofA.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/310implicitSizeArrayError.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/330.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/330comp.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/400.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/400.geom.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/400.tesc.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/400.tese.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/410.geom.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/410.tesc.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/420.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/420.geom.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/420.tesc.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/420.tese.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/420.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/420_size_gl_in.geom.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/430.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/430.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/430AofA.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/430scope.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/440.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/440.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/450.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/450.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/450.geom.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/450.tesc.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/450.tese.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/450.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/Operations.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/aggOps.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/always-discard.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/always-discard2.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/array.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/array100.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/atomic_uint.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/badChars.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/badMacroArgs.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/comment.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/conditionalDiscard.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/constErrors.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/constFold.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/constFoldIntMin.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/conversion.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/cppComplexExpr.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/cppIndent.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/cppIntMinOverNegativeOne.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/cppNest.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/cppSimple.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/dataOut.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/dataOutIndirect.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/dce.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/decls.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/deepRvalue.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/depthOut.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/discard-dce.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/doWhileLoop.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/earlyReturnDiscard.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/empty.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/errors.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/es-link1.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/findFunction.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/flowControl.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/forLoop.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/forwardRef.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/functionCall.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/functionSemantics.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/glsl.-D-U.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/glsl.entryPointRename.vert.bad.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/glsl.entryPointRename.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/glsl.entryPointRename2.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.-D-U.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.array.flatten.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.array.implicit-size.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.array.multidim.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.attribute.expression.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.automap.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.basic.geom.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.calculatelod.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.calculatelodunclamped.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.cbuffer-identifier.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.clip.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.clipdistance-1.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.clipdistance-1.geom.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.clipdistance-1.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.clipdistance-2.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.clipdistance-2.geom.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.clipdistance-2.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.clipdistance-3.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.clipdistance-3.geom.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.clipdistance-3.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.clipdistance-4.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.clipdistance-4.geom.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.clipdistance-4.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.clipdistance-5.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.clipdistance-5.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.clipdistance-6.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.clipdistance-6.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.clipdistance-7.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.clipdistance-7.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.clipdistance-8.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.clipdistance-8.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.clipdistance-9.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.clipdistance-9.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.color.hull.tesc.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.comparison.vec.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.constantbuffer.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.constructexpr.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.constructimat.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.dashI.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.deadFunctionMissingBody.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.domain.1.tese.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.domain.2.tese.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.domain.3.tese.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.emptystruct.init.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.emptystructreturn.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.emptystructreturn.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.entry.rename.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.explicitDescriptorSet-2.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.explicitDescriptorSet.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.flatten.return.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.fraggeom.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.gather.array.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.gather.basic.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.gather.basic.dx10.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.gather.offset.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.gather.offsetarray.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.gatherRGBA.array.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.gatherRGBA.basic.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.gatherRGBA.offset.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.gatherRGBA.offsetarray.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.gathercmpRGBA.offset.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.getdimensions.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.getdimensions.dx10.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.getdimensions.rw.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.getsampleposition.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.global-const-init.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.gs-hs-mix.tesc.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.hlslOffset.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.hull.1.tesc.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.hull.2.tesc.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.hull.4.tesc.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.hull.5.tesc.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.hull.ctrlpt-1.tesc.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.hull.ctrlpt-2.tesc.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.hull.void.tesc.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.identifier.sample.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.imagefetch-subvec4.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.init2.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.inoutquals.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.intrinsic.frexp.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.intrinsic.frexp.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.intrinsics.barriers.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.intrinsics.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.intrinsics.d3dcolortoubyte4.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.intrinsics.double.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.intrinsics.evalfns.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.intrinsics.f1632.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.intrinsics.f3216.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.intrinsics.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.intrinsics.lit.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.intrinsics.negative.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.intrinsics.negative.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.intrinsics.negative.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.intrinsics.promote.down.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.intrinsics.promote.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.intrinsics.promote.outputs.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.intrinsics.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.isfinite.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.load.2dms.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.load.array.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.load.basic.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.load.basic.dx10.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.load.buffer.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.load.buffer.float.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.load.offset.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.load.offsetarray.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.load.rwbuffer.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.load.rwtexture.array.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.load.rwtexture.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.localStructuredBuffer.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.logical.binary.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.logical.binary.vec.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.logical.unary.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.loopattr.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.matNx1.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.matType.bool.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.matType.int.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.matpack-1.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.matpack-pragma.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.matrixindex.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.mintypes.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.mip.negative.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.mip.negative2.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.mip.operator.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.mul-truncate.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.multiDescriptorSet.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.nonint-index.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.numericsuffixes.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.numthreads.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.opaque-type-bug.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.params.default.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.params.default.negative.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.pp.line.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.precise.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.preprocessor.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.promote.atomic.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.promote.binary.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.promote.vec1.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.promotions.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.reflection.binding.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.reflection.binding.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.reflection.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.rw.atomics.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.rw.bracket.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.rw.register.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.rw.scalar.bracket.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.rw.swizzle.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.rw.vec2.bracket.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.sample.array.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.sample.basic.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.sample.offset.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.sample.offsetarray.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.sample.sub-vec4.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.samplebias.array.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.samplebias.basic.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.samplebias.offset.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.samplebias.offsetarray.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.samplecmp.array.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.samplecmp.basic.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.samplecmp.dualmode.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.samplecmp.negative.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.samplecmp.negative2.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.samplecmp.offset.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.samplecmp.offsetarray.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.samplecmplevelzero.array.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.samplecmplevelzero.basic.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.samplecmplevelzero.offset.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.samplecmplevelzero.offsetarray.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.samplegrad.array.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.samplegrad.basic.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.samplegrad.basic.dx10.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.samplegrad.offset.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.samplegrad.offsetarray.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.samplelevel.array.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.samplelevel.basic.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.samplelevel.basic.dx10.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.samplelevel.offset.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.samplelevel.offsetarray.dx10.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.scalar-length.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.scalar2matrix.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.semantic-1.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.semicolons.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.shift.per-set.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.snorm.uav.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.store.rwbyteaddressbuffer.type.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.stringtoken.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.struct.split-1.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.struct.split.array.geom.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.struct.split.assign.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.struct.split.call.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.struct.split.nested.geom.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.struct.split.trivial.geom.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.struct.split.trivial.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.structarray.flatten.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.structarray.flatten.geom.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.structbuffer.append.fn.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.structbuffer.append.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.structbuffer.atomics.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.structbuffer.byte.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.structbuffer.coherent.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.structbuffer.floatidx.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.structbuffer.fn.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.structbuffer.fn2.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.structbuffer.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.structbuffer.incdec.frag.hlslfun1.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.structbuffer.incdec.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.structbuffer.rw.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.structbuffer.rwbyte.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.subpass.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.templatetypes.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.texture.struct.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.texture.subvec4.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.texturebuffer.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.tx.bracket.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.tx.overload.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.type.half.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.type.identifier.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.wavebroadcast.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.waveprefix.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.wavequad.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.wavequery.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.wavequery.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.wavereduction.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.wavevote.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.y-negate-1.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.y-negate-2.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/hlsl.y-negate-3.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/include.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/invalidSwizzle.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/length.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/lineContinuation.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/lineContinuation100.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/link1.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/link1.vk.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/localAggregates.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/loops.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/loopsArtificial.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/mains1.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/matrix.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/matrix2.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/matrixError.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/maxClipDistances.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/max_vertices_0.geom.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/negativeArraySize.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/newTexture.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/noMain.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/nonSquare.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/nonVulkan.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/nosuffix.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/numeral.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/nvShaderNoperspectiveInterpolation.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/overlongLiteral.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/pointCoord.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/precise.tesc.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/precise_struct_block.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/precision.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/precision.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/prepost.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.cpp_style___FILE__.vert.err mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.cpp_style___FILE__.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.cpp_style_line_directive.vert.err mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.cpp_style_line_directive.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.defined.vert.err mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.defined.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.edge_cases.vert.err mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.edge_cases.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.eof_missing.vert.err mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.eof_missing.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.errors.vert.err mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.errors.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.extensions.vert.err mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.extensions.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.function_macro.vert.err mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.function_macro.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.include.disabled.vert.err mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.include.disabled.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.include.enabled.vert.err mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.include.enabled.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.line.frag.err mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.line.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.line.vert.err mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.line.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.many.endif.vert.err mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.many.endif.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.pragma.vert.err mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.pragma.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.simple.vert.err mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.simple.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.success_if_parse_would_fail.vert.err mode change 100755 => 100644 third_party/glslang/Test/baseResults/preprocessor.success_if_parse_would_fail.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/recurse1.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/reflection.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/remap.basic.dcefunc.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/remap.basic.dcevartype.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/remap.basic.everything.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/remap.basic.none.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/remap.basic.strip.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/remap.hlsl.sample.basic.everything.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/remap.hlsl.sample.basic.none.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/remap.hlsl.sample.basic.strip.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/remap.hlsl.templatetypes.everything.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/remap.hlsl.templatetypes.none.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/remap.if.everything.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/remap.if.none.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/remap.invalid-spirv-1.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/remap.invalid-spirv-2.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/remap.literal64.everything.spv.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/remap.literal64.none.spv.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/remap.similar_1a.everything.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/remap.similar_1a.none.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/remap.similar_1b.everything.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/remap.similar_1b.none.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/remap.specconst.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/remap.switch.everything.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/remap.switch.none.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/remap.uniformarray.everything.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/remap.uniformarray.none.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/sample.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/sample.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/simpleFunctionCall.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/specExamples.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/specExamples.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.130.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.300layout.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.310.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.330.geom.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.400.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.400.tesc.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.420.geom.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.AofA.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.GeometryShaderPassthrough.geom.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.OVR_multiview.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.aggOps.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.always-discard.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.arbPostDepthCoverage.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.arbPostDepthCoverage_Error.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.atomicInt64.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.bitCast.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.bool.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.boolInBlock.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.branch-return.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.buffer.autoassign.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.debugInfo.1.1.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.debugInfo.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.deepRvalue.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.deviceGroup.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.do-while-continue-break.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.drawParams.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.extPostDepthCoverage.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.extPostDepthCoverage_Error.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.float16.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.float16Fetch.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.float32.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.float64.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.for-complex-condition.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.for-continue-break.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.for-nobody.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.for-notest.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.fullyCovered.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.functionNestedOpaque.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.glsl.register.autoassign.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.glsl.register.noautoassign.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.hlslDebugInfo.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.hlslOffsets.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.image.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.image.load-formatted.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.imageLoadStoreLod.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.int16.amd.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.int16.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.int32.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.int64.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.int8.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.intOps.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.interpOps.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.layoutNested.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.looseUniformNoLoc.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.matrix.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.matrix2.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.memoryQualifier.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.merge-unreachable.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.multiView.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.multiviewPerViewAttributes.tesc.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.multiviewPerViewAttributes.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.noBuiltInLoc.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.noDeadDecorations.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.noLocation.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.precise.tesc.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.precise.tese.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.pushConstant.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.register.autoassign-2.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.register.autoassign.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.register.autoassign.rangetest.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.register.noautoassign.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.register.subpass.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.rw.autoassign.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.sampleMaskOverrideCoverage.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.separate.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.shaderBallot.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.shaderBallotAMD.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.shaderDrawParams.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.shaderFragMaskAMD.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.shaderGroupVote.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.shaderStencilExport.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.shiftOps.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.shortCircuit.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.sparseTexture.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.sparseTextureClamp.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.specConstant.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.specConstant.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.specConstantComposite.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.specConstantOperations.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.ssbo.autoassign.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.stereoViewRendering.tesc.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.stereoViewRendering.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.subgroup.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.subgroup.geom.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.subgroup.tesc.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.subgroup.tese.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.subgroup.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.subgroupArithmetic.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.subgroupBallot.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.subgroupBasic.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.subgroupClustered.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.subgroupQuad.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.subgroupShuffle.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.subgroupShuffleRelative.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.subgroupVote.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.subpass.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.test.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.test.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.texture.sampler.transform.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.textureGatherBiasLod.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.uniformArray.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.viewportArray2.tesc.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.viewportArray2.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/spv.while-continue-break.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/structAssignment.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/structDeref.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/structure.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/switch.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/swizzle.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/syntaxError.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/test.conf mode change 100755 => 100644 third_party/glslang/Test/baseResults/test.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/texture.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/tokenLength.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/types.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/uint.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/uniformArray.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/variableArrayIndex.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/varyingArray.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/varyingArrayIndirect.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/versionsClean.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/versionsClean.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/versionsErrors.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/versionsErrors.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/voidFunction.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/vulkan.comp.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/vulkan.frag.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/vulkan.vert.out mode change 100755 => 100644 third_party/glslang/Test/baseResults/whileLoop.frag.out mode change 100755 => 100644 third_party/glslang/Test/comment.frag mode change 100755 => 100644 third_party/glslang/Test/conditionalDiscard.frag mode change 100755 => 100644 third_party/glslang/Test/constErrors.frag mode change 100755 => 100644 third_party/glslang/Test/constFoldIntMin.frag mode change 100755 => 100644 third_party/glslang/Test/conversion.frag mode change 100755 => 100644 third_party/glslang/Test/cppBad.vert mode change 100755 => 100644 third_party/glslang/Test/cppComplexExpr.vert mode change 100755 => 100644 third_party/glslang/Test/cppDeepNest.frag mode change 100755 => 100644 third_party/glslang/Test/cppIndent.vert mode change 100755 => 100644 third_party/glslang/Test/cppIntMinOverNegativeOne.frag mode change 100755 => 100644 third_party/glslang/Test/cppNest.vert mode change 100755 => 100644 third_party/glslang/Test/cppRelaxSkipTokensErrors.vert mode change 100755 => 100644 third_party/glslang/Test/cppSimple.vert mode change 100755 => 100644 third_party/glslang/Test/dataOut.frag mode change 100755 => 100644 third_party/glslang/Test/dataOutIndirect.frag mode change 100755 => 100644 third_party/glslang/Test/dce.frag mode change 100755 => 100644 third_party/glslang/Test/decls.frag mode change 100755 => 100644 third_party/glslang/Test/deepRvalue.frag mode change 100755 => 100644 third_party/glslang/Test/depthOut.frag mode change 100755 => 100644 third_party/glslang/Test/discard-dce.frag mode change 100755 => 100644 third_party/glslang/Test/doWhileLoop.frag mode change 100755 => 100644 third_party/glslang/Test/earlyReturnDiscard.frag mode change 100755 => 100644 third_party/glslang/Test/empty.frag mode change 100755 => 100644 third_party/glslang/Test/empty2.frag mode change 100755 => 100644 third_party/glslang/Test/empty3.frag mode change 100755 => 100644 third_party/glslang/Test/errors.frag mode change 100755 => 100644 third_party/glslang/Test/es-link1.frag mode change 100755 => 100644 third_party/glslang/Test/es-link2.frag mode change 100755 => 100644 third_party/glslang/Test/findFunction.frag mode change 100755 => 100644 third_party/glslang/Test/flowControl.frag mode change 100755 => 100644 third_party/glslang/Test/foo.h mode change 100755 => 100644 third_party/glslang/Test/forLoop.frag mode change 100755 => 100644 third_party/glslang/Test/forwardRef.frag mode change 100755 => 100644 third_party/glslang/Test/functionCall.frag mode change 100755 => 100644 third_party/glslang/Test/functionSemantics.frag mode change 100755 => 100644 third_party/glslang/Test/glsl.-D-U.frag mode change 100755 => 100644 third_party/glslang/Test/glsl.entryPointRename.vert mode change 100755 => 100644 third_party/glslang/Test/glsl.entryPointRename2.vert mode change 100755 => 100644 third_party/glslang/Test/glspv.esversion.vert mode change 100755 => 100644 third_party/glslang/Test/glspv.frag mode change 100755 => 100644 third_party/glslang/Test/glspv.version.frag mode change 100755 => 100644 third_party/glslang/Test/glspv.version.vert mode change 100755 => 100644 third_party/glslang/Test/glspv.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.-D-U.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.PointSize.geom mode change 100755 => 100644 third_party/glslang/Test/hlsl.PointSize.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.aliasOpaque.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.array.flatten.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.array.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.array.implicit-size.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.array.multidim.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.assoc.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.attribute.expression.comp mode change 100755 => 100644 third_party/glslang/Test/hlsl.attribute.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.attributeC11.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.attributeGlobalBuffer.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.automap.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.basic.comp mode change 100755 => 100644 third_party/glslang/Test/hlsl.basic.geom mode change 100755 => 100644 third_party/glslang/Test/hlsl.buffer.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.calculatelod.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.calculatelodunclamped.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.cast.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.cbuffer-identifier.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.clip.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.clipdistance-1.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.clipdistance-1.geom mode change 100755 => 100644 third_party/glslang/Test/hlsl.clipdistance-1.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.clipdistance-2.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.clipdistance-2.geom mode change 100755 => 100644 third_party/glslang/Test/hlsl.clipdistance-2.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.clipdistance-3.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.clipdistance-3.geom mode change 100755 => 100644 third_party/glslang/Test/hlsl.clipdistance-3.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.clipdistance-4.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.clipdistance-4.geom mode change 100755 => 100644 third_party/glslang/Test/hlsl.clipdistance-4.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.clipdistance-5.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.clipdistance-5.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.clipdistance-6.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.clipdistance-6.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.clipdistance-7.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.clipdistance-7.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.clipdistance-8.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.clipdistance-8.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.clipdistance-9.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.clipdistance-9.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.color.hull.tesc mode change 100755 => 100644 third_party/glslang/Test/hlsl.comparison.vec.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.conditional.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.constantbuffer.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.constructArray.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.constructexpr.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.constructimat.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.dashI.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.deadFunctionMissingBody.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.depthGreater.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.depthLess.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.discard.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.doLoop.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.domain.1.tese mode change 100755 => 100644 third_party/glslang/Test/hlsl.domain.2.tese mode change 100755 => 100644 third_party/glslang/Test/hlsl.domain.3.tese mode change 100755 => 100644 third_party/glslang/Test/hlsl.emptystruct.init.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.emptystructreturn.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.emptystructreturn.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.entry-in.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.entry-out.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.entry.rename.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.explicitDescriptorSet.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.flatten.return.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.flattenOpaque.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.flattenOpaqueInit.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.flattenOpaqueInitMix.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.float1.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.float4.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.forLoop.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.fraggeom.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.function.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.gather.array.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.gather.basic.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.gather.basic.dx10.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.gather.offset.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.gather.offsetarray.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.gatherRGBA.array.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.gatherRGBA.basic.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.gatherRGBA.offset.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.gatherRGBA.offsetarray.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.gathercmpRGBA.array.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.gathercmpRGBA.basic.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.gathercmpRGBA.offset.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.gathercmpRGBA.offsetarray.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.getdimensions.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.getdimensions.dx10.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.getdimensions.rw.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.getsampleposition.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.global-const-init.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.gs-hs-mix.tesc mode change 100755 => 100644 third_party/glslang/Test/hlsl.hull.1.tesc mode change 100755 => 100644 third_party/glslang/Test/hlsl.hull.2.tesc mode change 100755 => 100644 third_party/glslang/Test/hlsl.hull.3.tesc mode change 100755 => 100644 third_party/glslang/Test/hlsl.hull.4.tesc mode change 100755 => 100644 third_party/glslang/Test/hlsl.hull.5.tesc mode change 100755 => 100644 third_party/glslang/Test/hlsl.hull.ctrlpt-1.tesc mode change 100755 => 100644 third_party/glslang/Test/hlsl.hull.ctrlpt-2.tesc mode change 100755 => 100644 third_party/glslang/Test/hlsl.hull.void.tesc mode change 100755 => 100644 third_party/glslang/Test/hlsl.identifier.sample.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.if.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.imagefetch-subvec4.comp mode change 100755 => 100644 third_party/glslang/Test/hlsl.include.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.includeNegative.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.init.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.init2.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.inoutquals.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.intrinsic.frexp.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.intrinsic.frexp.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.intrinsics.barriers.comp mode change 100755 => 100644 third_party/glslang/Test/hlsl.intrinsics.comp mode change 100755 => 100644 third_party/glslang/Test/hlsl.intrinsics.d3dcolortoubyte4.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.intrinsics.double.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.intrinsics.evalfns.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.intrinsics.f1632.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.intrinsics.f3216.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.intrinsics.lit.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.intrinsics.negative.comp mode change 100755 => 100644 third_party/glslang/Test/hlsl.intrinsics.negative.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.intrinsics.negative.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.intrinsics.promote.down.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.intrinsics.promote.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.intrinsics.promote.outputs.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.intrinsics.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.isfinite.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.layout.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.layoutOverride.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.load.2dms.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.load.array.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.load.basic.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.load.basic.dx10.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.load.buffer.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.load.buffer.float.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.load.offset.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.load.offsetarray.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.load.rwbuffer.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.load.rwtexture.array.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.load.rwtexture.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.localStructuredBuffer.comp mode change 100755 => 100644 third_party/glslang/Test/hlsl.logical.binary.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.logical.binary.vec.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.logical.unary.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.loopattr.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.matNx1.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.matType.bool.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.matType.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.matType.int.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.matpack-1.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.matpack-pragma.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.matrixSwizzle.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.matrixindex.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.max.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.memberFunCall.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.mintypes.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.mip.negative.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.mip.negative2.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.mip.operator.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.mul-truncate.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.multiDescriptorSet.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.nonint-index.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.numericsuffixes.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.numthreads.comp mode change 100755 => 100644 third_party/glslang/Test/hlsl.opaque-type-bug.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.overload.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.params.default.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.params.default.negative.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.partialFlattenLocal.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.partialFlattenMixed.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.pp.line.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.pp.tokenpasting.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.pp.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.precedence.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.precedence2.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.precise.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.preprocessor.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.promote.atomic.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.promote.binary.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.promote.vec1.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.promotions.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.reflection.binding.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.reflection.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.rw.atomics.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.rw.bracket.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.rw.register.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.rw.scalar.bracket.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.rw.swizzle.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.rw.vec2.bracket.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.sample.array.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.sample.basic.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.sample.offset.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.sample.offsetarray.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.sample.sub-vec4.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.samplebias.array.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.samplebias.basic.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.samplebias.offset.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.samplebias.offsetarray.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.samplecmp.array.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.samplecmp.basic.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.samplecmp.dualmode.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.samplecmp.negative.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.samplecmp.negative2.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.samplecmp.offset.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.samplecmp.offsetarray.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.samplecmplevelzero.array.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.samplecmplevelzero.basic.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.samplecmplevelzero.offset.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.samplecmplevelzero.offsetarray.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.samplegrad.array.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.samplegrad.basic.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.samplegrad.basic.dx10.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.samplegrad.offset.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.samplegrad.offsetarray.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.samplelevel.array.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.samplelevel.basic.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.samplelevel.basic.dx10.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.samplelevel.offset.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.samplelevel.offsetarray.dx10.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.scalar-length.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.scalar2matrix.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.scope.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.semantic-1.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.semantic.geom mode change 100755 => 100644 third_party/glslang/Test/hlsl.semantic.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.semicolons.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.shapeConv.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.sin.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.snorm.uav.comp mode change 100755 => 100644 third_party/glslang/Test/hlsl.store.rwbyteaddressbuffer.type.comp mode change 100755 => 100644 third_party/glslang/Test/hlsl.stringtoken.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.struct.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.struct.split-1.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.struct.split.array.geom mode change 100755 => 100644 third_party/glslang/Test/hlsl.struct.split.assign.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.struct.split.call.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.struct.split.nested.geom mode change 100755 => 100644 third_party/glslang/Test/hlsl.struct.split.trivial.geom mode change 100755 => 100644 third_party/glslang/Test/hlsl.struct.split.trivial.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.structarray.flatten.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.structarray.flatten.geom mode change 100755 => 100644 third_party/glslang/Test/hlsl.structbuffer.append.fn.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.structbuffer.append.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.structbuffer.atomics.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.structbuffer.byte.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.structbuffer.coherent.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.structbuffer.floatidx.comp mode change 100755 => 100644 third_party/glslang/Test/hlsl.structbuffer.fn.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.structbuffer.fn2.comp mode change 100755 => 100644 third_party/glslang/Test/hlsl.structbuffer.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.structbuffer.incdec.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.structbuffer.rw.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.structbuffer.rwbyte.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.structin.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.subpass.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.switch.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.swizzle.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.synthesizeInput.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.target.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.targetStruct1.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.targetStruct2.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.templatetypes.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.templatetypes.negative.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.texture.struct.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.texture.subvec4.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.texturebuffer.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.tx.bracket.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.tx.overload.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.type.half.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.type.identifier.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.typeGraphCopy.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.typedef.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.void.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.wavebroadcast.comp mode change 100755 => 100644 third_party/glslang/Test/hlsl.waveprefix.comp mode change 100755 => 100644 third_party/glslang/Test/hlsl.wavequad.comp mode change 100755 => 100644 third_party/glslang/Test/hlsl.wavequery.comp mode change 100755 => 100644 third_party/glslang/Test/hlsl.wavequery.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.wavereduction.comp mode change 100755 => 100644 third_party/glslang/Test/hlsl.wavevote.comp mode change 100755 => 100644 third_party/glslang/Test/hlsl.whileLoop.frag mode change 100755 => 100644 third_party/glslang/Test/hlsl.y-negate-1.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.y-negate-2.vert mode change 100755 => 100644 third_party/glslang/Test/hlsl.y-negate-3.vert mode change 100755 => 100644 third_party/glslang/Test/implicitInnerAtomicUint.frag mode change 100755 => 100644 third_party/glslang/Test/inc1/badInc.h mode change 100755 => 100644 third_party/glslang/Test/inc1/bar.h mode change 100755 => 100644 third_party/glslang/Test/inc1/foo.h mode change 100755 => 100644 third_party/glslang/Test/inc1/path1/bar.h mode change 100755 => 100644 third_party/glslang/Test/inc1/path1/local.h mode change 100755 => 100644 third_party/glslang/Test/inc1/path1/notHere.h mode change 100755 => 100644 third_party/glslang/Test/inc1/path2/bar.h mode change 100755 => 100644 third_party/glslang/Test/inc1/path2/notHere.h mode change 100755 => 100644 third_party/glslang/Test/inc1/path2/remote.h mode change 100755 => 100644 third_party/glslang/Test/inc2/bar.h mode change 100755 => 100644 third_party/glslang/Test/inc2/foo.h mode change 100755 => 100644 third_party/glslang/Test/include.vert mode change 100755 => 100644 third_party/glslang/Test/invalidSwizzle.vert mode change 100755 => 100644 third_party/glslang/Test/length.frag mode change 100755 => 100644 third_party/glslang/Test/lineContinuation.vert mode change 100755 => 100644 third_party/glslang/Test/lineContinuation100.vert mode change 100755 => 100644 third_party/glslang/Test/link1.frag mode change 100755 => 100644 third_party/glslang/Test/link1.vk.frag mode change 100755 => 100644 third_party/glslang/Test/link2.frag mode change 100755 => 100644 third_party/glslang/Test/link2.vk.frag mode change 100755 => 100644 third_party/glslang/Test/link3.frag mode change 100755 => 100644 third_party/glslang/Test/localAggregates.frag mode change 100755 => 100644 third_party/glslang/Test/loops.frag mode change 100755 => 100644 third_party/glslang/Test/loopsArtificial.frag mode change 100755 => 100644 third_party/glslang/Test/mains.frag mode change 100755 => 100644 third_party/glslang/Test/mains1.frag mode change 100755 => 100644 third_party/glslang/Test/mains2.frag mode change 100755 => 100644 third_party/glslang/Test/makeDoc mode change 100755 => 100644 third_party/glslang/Test/matrix.frag mode change 100755 => 100644 third_party/glslang/Test/matrix2.frag mode change 100755 => 100644 third_party/glslang/Test/matrixError.vert mode change 100755 => 100644 third_party/glslang/Test/maxClipDistances.vert mode change 100755 => 100644 third_party/glslang/Test/max_vertices_0.geom mode change 100755 => 100644 third_party/glslang/Test/missingBodies.vert mode change 100755 => 100644 third_party/glslang/Test/mixedArrayDecls.frag mode change 100755 => 100644 third_party/glslang/Test/negativeArraySize.comp mode change 100755 => 100644 third_party/glslang/Test/newTexture.frag mode change 100755 => 100644 third_party/glslang/Test/noMain.vert mode change 100755 => 100644 third_party/glslang/Test/noMain1.geom mode change 100755 => 100644 third_party/glslang/Test/noMain2.geom mode change 100755 => 100644 third_party/glslang/Test/nonSquare.vert mode change 100755 => 100644 third_party/glslang/Test/nonVulkan.frag mode change 100755 => 100644 third_party/glslang/Test/numeral.frag mode change 100755 => 100644 third_party/glslang/Test/nvShaderNoperspectiveInterpolation.frag mode change 100755 => 100644 third_party/glslang/Test/overlongLiteral.frag mode change 100755 => 100644 third_party/glslang/Test/parent.h mode change 100755 => 100644 third_party/glslang/Test/parentBad mode change 100755 => 100644 third_party/glslang/Test/pointCoord.frag mode change 100755 => 100644 third_party/glslang/Test/precise.tesc mode change 100755 => 100644 third_party/glslang/Test/precise_struct_block.vert mode change 100755 => 100644 third_party/glslang/Test/precision.frag mode change 100755 => 100644 third_party/glslang/Test/precision.vert mode change 100755 => 100644 third_party/glslang/Test/prepost.frag mode change 100755 => 100644 third_party/glslang/Test/preprocessor.cpp_style___FILE__.vert mode change 100755 => 100644 third_party/glslang/Test/preprocessor.cpp_style_line_directive.vert mode change 100755 => 100644 third_party/glslang/Test/preprocessor.defined.vert mode change 100755 => 100644 third_party/glslang/Test/preprocessor.edge_cases.vert mode change 100755 => 100644 third_party/glslang/Test/preprocessor.eof_missing.vert mode change 100755 => 100644 third_party/glslang/Test/preprocessor.errors.vert mode change 100755 => 100644 third_party/glslang/Test/preprocessor.extensions.vert mode change 100755 => 100644 third_party/glslang/Test/preprocessor.function_macro.vert mode change 100755 => 100644 third_party/glslang/Test/preprocessor.include.disabled.vert mode change 100755 => 100644 third_party/glslang/Test/preprocessor.include.enabled.vert mode change 100755 => 100644 third_party/glslang/Test/preprocessor.line.frag mode change 100755 => 100644 third_party/glslang/Test/preprocessor.line.vert mode change 100755 => 100644 third_party/glslang/Test/preprocessor.many.endif.vert mode change 100755 => 100644 third_party/glslang/Test/preprocessor.pragma.vert mode change 100755 => 100644 third_party/glslang/Test/preprocessor.simple.vert mode change 100755 => 100644 third_party/glslang/Test/preprocessor.success_if_parse_would_fail.vert mode change 100755 => 100644 third_party/glslang/Test/recurse1.frag mode change 100755 => 100644 third_party/glslang/Test/recurse1.vert mode change 100755 => 100644 third_party/glslang/Test/recurse2.frag mode change 100755 => 100644 third_party/glslang/Test/reflection.vert mode change 100755 => 100644 third_party/glslang/Test/remap.basic.dcefunc.frag mode change 100755 => 100644 third_party/glslang/Test/remap.basic.everything.frag mode change 100755 => 100644 third_party/glslang/Test/remap.basic.none.frag mode change 100755 => 100644 third_party/glslang/Test/remap.basic.strip.frag mode change 100755 => 100644 third_party/glslang/Test/remap.hlsl.sample.basic.everything.frag mode change 100755 => 100644 third_party/glslang/Test/remap.hlsl.sample.basic.none.frag mode change 100755 => 100644 third_party/glslang/Test/remap.hlsl.sample.basic.strip.frag mode change 100755 => 100644 third_party/glslang/Test/remap.hlsl.templatetypes.everything.frag mode change 100755 => 100644 third_party/glslang/Test/remap.hlsl.templatetypes.none.frag mode change 100755 => 100644 third_party/glslang/Test/remap.if.everything.frag mode change 100755 => 100644 third_party/glslang/Test/remap.if.none.frag mode change 100755 => 100644 third_party/glslang/Test/remap.invalid-spirv-1.spv mode change 100755 => 100644 third_party/glslang/Test/remap.invalid-spirv-2.spv mode change 100755 => 100644 third_party/glslang/Test/remap.literal64.everything.spv mode change 100755 => 100644 third_party/glslang/Test/remap.literal64.none.spv mode change 100755 => 100644 third_party/glslang/Test/remap.similar_1a.everything.frag mode change 100755 => 100644 third_party/glslang/Test/remap.similar_1a.none.frag mode change 100755 => 100644 third_party/glslang/Test/remap.similar_1b.everything.frag mode change 100755 => 100644 third_party/glslang/Test/remap.similar_1b.none.frag mode change 100755 => 100644 third_party/glslang/Test/remap.specconst.comp mode change 100755 => 100644 third_party/glslang/Test/remap.switch.everything.frag mode change 100755 => 100644 third_party/glslang/Test/remap.switch.none.frag mode change 100755 => 100644 third_party/glslang/Test/remap.uniformarray.everything.frag mode change 100755 => 100644 third_party/glslang/Test/remap.uniformarray.none.frag mode change 100755 => 100644 third_party/glslang/Test/sample.frag mode change 100755 => 100644 third_party/glslang/Test/sample.frag.out mode change 100755 => 100644 third_party/glslang/Test/sample.vert mode change 100755 => 100644 third_party/glslang/Test/sample.vert.out mode change 100755 => 100644 third_party/glslang/Test/simpleFunctionCall.frag mode change 100755 => 100644 third_party/glslang/Test/specExamples.frag mode change 100755 => 100644 third_party/glslang/Test/specExamples.vert mode change 100755 => 100644 third_party/glslang/Test/spv.100ops.frag mode change 100755 => 100644 third_party/glslang/Test/spv.130.frag mode change 100755 => 100644 third_party/glslang/Test/spv.140.frag mode change 100755 => 100644 third_party/glslang/Test/spv.150.geom mode change 100755 => 100644 third_party/glslang/Test/spv.150.vert mode change 100755 => 100644 third_party/glslang/Test/spv.300BuiltIns.vert mode change 100755 => 100644 third_party/glslang/Test/spv.300layout.frag mode change 100755 => 100644 third_party/glslang/Test/spv.300layout.vert mode change 100755 => 100644 third_party/glslang/Test/spv.300layoutp.vert mode change 100755 => 100644 third_party/glslang/Test/spv.310.bitcast.frag mode change 100755 => 100644 third_party/glslang/Test/spv.310.comp mode change 100755 => 100644 third_party/glslang/Test/spv.330.geom mode change 100755 => 100644 third_party/glslang/Test/spv.400.frag mode change 100755 => 100644 third_party/glslang/Test/spv.400.tesc mode change 100755 => 100644 third_party/glslang/Test/spv.400.tese mode change 100755 => 100644 third_party/glslang/Test/spv.420.geom mode change 100755 => 100644 third_party/glslang/Test/spv.430.frag mode change 100755 => 100644 third_party/glslang/Test/spv.430.vert mode change 100755 => 100644 third_party/glslang/Test/spv.450.geom mode change 100755 => 100644 third_party/glslang/Test/spv.450.noRedecl.tesc mode change 100755 => 100644 third_party/glslang/Test/spv.450.tesc mode change 100755 => 100644 third_party/glslang/Test/spv.460.comp mode change 100755 => 100644 third_party/glslang/Test/spv.460.frag mode change 100755 => 100644 third_party/glslang/Test/spv.460.vert mode change 100755 => 100644 third_party/glslang/Test/spv.AofA.frag mode change 100755 => 100644 third_party/glslang/Test/spv.GeometryShaderPassthrough.geom mode change 100755 => 100644 third_party/glslang/Test/spv.OVR_multiview.vert mode change 100755 => 100644 third_party/glslang/Test/spv.Operations.frag mode change 100755 => 100644 third_party/glslang/Test/spv.accessChain.frag mode change 100755 => 100644 third_party/glslang/Test/spv.aggOps.frag mode change 100755 => 100644 third_party/glslang/Test/spv.always-discard.frag mode change 100755 => 100644 third_party/glslang/Test/spv.always-discard2.frag mode change 100755 => 100644 third_party/glslang/Test/spv.arbPostDepthCoverage.frag mode change 100755 => 100644 third_party/glslang/Test/spv.arbPostDepthCoverage_Error.frag mode change 100755 => 100644 third_party/glslang/Test/spv.atomic.comp mode change 100755 => 100644 third_party/glslang/Test/spv.atomicInt64.comp mode change 100755 => 100644 third_party/glslang/Test/spv.barrier.vert mode change 100755 => 100644 third_party/glslang/Test/spv.bitCast.frag mode change 100755 => 100644 third_party/glslang/Test/spv.bool.vert mode change 100755 => 100644 third_party/glslang/Test/spv.boolInBlock.frag mode change 100755 => 100644 third_party/glslang/Test/spv.branch-return.vert mode change 100755 => 100644 third_party/glslang/Test/spv.buffer.autoassign.frag mode change 100755 => 100644 third_party/glslang/Test/spv.builtInXFB.vert mode change 100755 => 100644 third_party/glslang/Test/spv.conditionalDiscard.frag mode change 100755 => 100644 third_party/glslang/Test/spv.constStruct.vert mode change 100755 => 100644 third_party/glslang/Test/spv.controlFlowAttributes.frag mode change 100755 => 100644 third_party/glslang/Test/spv.conversion.frag mode change 100755 => 100644 third_party/glslang/Test/spv.dataOut.frag mode change 100755 => 100644 third_party/glslang/Test/spv.dataOutIndirect.frag mode change 100755 => 100644 third_party/glslang/Test/spv.dataOutIndirect.vert mode change 100755 => 100644 third_party/glslang/Test/spv.debugInfo.frag mode change 100755 => 100644 third_party/glslang/Test/spv.deepRvalue.frag mode change 100755 => 100644 third_party/glslang/Test/spv.depthOut.frag mode change 100755 => 100644 third_party/glslang/Test/spv.deviceGroup.frag mode change 100755 => 100644 third_party/glslang/Test/spv.discard-dce.frag mode change 100755 => 100644 third_party/glslang/Test/spv.do-simple.vert mode change 100755 => 100644 third_party/glslang/Test/spv.do-while-continue-break.vert mode change 100755 => 100644 third_party/glslang/Test/spv.doWhileLoop.frag mode change 100755 => 100644 third_party/glslang/Test/spv.double.comp mode change 100755 => 100644 third_party/glslang/Test/spv.drawParams.vert mode change 100755 => 100644 third_party/glslang/Test/spv.earlyReturnDiscard.frag mode change 100755 => 100644 third_party/glslang/Test/spv.explicittypes.frag mode change 100755 => 100644 third_party/glslang/Test/spv.extPostDepthCoverage.frag mode change 100755 => 100644 third_party/glslang/Test/spv.extPostDepthCoverage_Error.frag mode change 100755 => 100644 third_party/glslang/Test/spv.float16.frag mode change 100755 => 100644 third_party/glslang/Test/spv.float16Fetch.frag mode change 100755 => 100644 third_party/glslang/Test/spv.float32.frag mode change 100755 => 100644 third_party/glslang/Test/spv.float64.frag mode change 100755 => 100644 third_party/glslang/Test/spv.flowControl.frag mode change 100755 => 100644 third_party/glslang/Test/spv.for-complex-condition.vert mode change 100755 => 100644 third_party/glslang/Test/spv.for-continue-break.vert mode change 100755 => 100644 third_party/glslang/Test/spv.for-nobody.vert mode change 100755 => 100644 third_party/glslang/Test/spv.for-notest.vert mode change 100755 => 100644 third_party/glslang/Test/spv.for-simple.vert mode change 100755 => 100644 third_party/glslang/Test/spv.forLoop.frag mode change 100755 => 100644 third_party/glslang/Test/spv.forwardFun.frag mode change 100755 => 100644 third_party/glslang/Test/spv.fullyCovered.frag mode change 100755 => 100644 third_party/glslang/Test/spv.functionCall.frag mode change 100755 => 100644 third_party/glslang/Test/spv.functionSemantics.frag mode change 100755 => 100644 third_party/glslang/Test/spv.glFragColor.frag mode change 100755 => 100644 third_party/glslang/Test/spv.glsl.register.autoassign.frag mode change 100755 => 100644 third_party/glslang/Test/spv.glsl.register.noautoassign.frag mode change 100755 => 100644 third_party/glslang/Test/spv.hlslDebugInfo.vert mode change 100755 => 100644 third_party/glslang/Test/spv.image.frag mode change 100755 => 100644 third_party/glslang/Test/spv.image.load-formatted.frag mode change 100755 => 100644 third_party/glslang/Test/spv.imageLoadStoreLod.frag mode change 100755 => 100644 third_party/glslang/Test/spv.int16.amd.frag mode change 100755 => 100644 third_party/glslang/Test/spv.int16.frag mode change 100755 => 100644 third_party/glslang/Test/spv.int32.frag mode change 100755 => 100644 third_party/glslang/Test/spv.int64.frag mode change 100755 => 100644 third_party/glslang/Test/spv.int8.frag mode change 100755 => 100644 third_party/glslang/Test/spv.intOps.vert mode change 100755 => 100644 third_party/glslang/Test/spv.interpOps.frag mode change 100755 => 100644 third_party/glslang/Test/spv.layoutNested.vert mode change 100755 => 100644 third_party/glslang/Test/spv.length.frag mode change 100755 => 100644 third_party/glslang/Test/spv.localAggregates.frag mode change 100755 => 100644 third_party/glslang/Test/spv.loops.frag mode change 100755 => 100644 third_party/glslang/Test/spv.loopsArtificial.frag mode change 100755 => 100644 third_party/glslang/Test/spv.looseUniformNoLoc.vert mode change 100755 => 100644 third_party/glslang/Test/spv.matFun.vert mode change 100755 => 100644 third_party/glslang/Test/spv.matrix.frag mode change 100755 => 100644 third_party/glslang/Test/spv.matrix2.frag mode change 100755 => 100644 third_party/glslang/Test/spv.memoryQualifier.frag mode change 100755 => 100644 third_party/glslang/Test/spv.merge-unreachable.frag mode change 100755 => 100644 third_party/glslang/Test/spv.multiStruct.comp mode change 100755 => 100644 third_party/glslang/Test/spv.multiView.frag mode change 100755 => 100644 third_party/glslang/Test/spv.multiviewPerViewAttributes.tesc mode change 100755 => 100644 third_party/glslang/Test/spv.multiviewPerViewAttributes.vert mode change 100755 => 100644 third_party/glslang/Test/spv.newTexture.frag mode change 100755 => 100644 third_party/glslang/Test/spv.noBuiltInLoc.vert mode change 100755 => 100644 third_party/glslang/Test/spv.noDeadDecorations.vert mode change 100755 => 100644 third_party/glslang/Test/spv.noLocation.vert mode change 100755 => 100644 third_party/glslang/Test/spv.noWorkgroup.comp mode change 100755 => 100644 third_party/glslang/Test/spv.nonSquare.vert mode change 100755 => 100644 third_party/glslang/Test/spv.paramMemory.frag mode change 100755 => 100644 third_party/glslang/Test/spv.precise.tesc mode change 100755 => 100644 third_party/glslang/Test/spv.precise.tese mode change 100755 => 100644 third_party/glslang/Test/spv.precision.frag mode change 100755 => 100644 third_party/glslang/Test/spv.precisionNonESSamp.frag mode change 100755 => 100644 third_party/glslang/Test/spv.prepost.frag mode change 100755 => 100644 third_party/glslang/Test/spv.pushConstant.vert mode change 100755 => 100644 third_party/glslang/Test/spv.pushConstantAnon.vert mode change 100755 => 100644 third_party/glslang/Test/spv.qualifiers.vert mode change 100755 => 100644 third_party/glslang/Test/spv.queryL.frag mode change 100755 => 100644 third_party/glslang/Test/spv.rankShift.comp mode change 100755 => 100644 third_party/glslang/Test/spv.register.autoassign-2.frag mode change 100755 => 100644 third_party/glslang/Test/spv.register.autoassign.frag mode change 100755 => 100644 third_party/glslang/Test/spv.register.autoassign.rangetest.frag mode change 100755 => 100644 third_party/glslang/Test/spv.register.noautoassign.frag mode change 100755 => 100644 third_party/glslang/Test/spv.register.subpass.frag mode change 100755 => 100644 third_party/glslang/Test/spv.rw.autoassign.frag mode change 100755 => 100644 third_party/glslang/Test/spv.sample.frag mode change 100755 => 100644 third_party/glslang/Test/spv.sampleId.frag mode change 100755 => 100644 third_party/glslang/Test/spv.sampleMaskOverrideCoverage.frag mode change 100755 => 100644 third_party/glslang/Test/spv.samplePosition.frag mode change 100755 => 100644 third_party/glslang/Test/spv.separate.frag mode change 100755 => 100644 third_party/glslang/Test/spv.set.vert mode change 100755 => 100644 third_party/glslang/Test/spv.shaderBallot.comp mode change 100755 => 100644 third_party/glslang/Test/spv.shaderBallotAMD.comp mode change 100755 => 100644 third_party/glslang/Test/spv.shaderDrawParams.vert mode change 100755 => 100644 third_party/glslang/Test/spv.shaderFragMaskAMD.frag mode change 100755 => 100644 third_party/glslang/Test/spv.shaderGroupVote.comp mode change 100755 => 100644 third_party/glslang/Test/spv.shaderStencilExport.frag mode change 100755 => 100644 third_party/glslang/Test/spv.shiftOps.frag mode change 100755 => 100644 third_party/glslang/Test/spv.simpleFunctionCall.frag mode change 100755 => 100644 third_party/glslang/Test/spv.simpleMat.vert mode change 100755 => 100644 third_party/glslang/Test/spv.sparseTexture.frag mode change 100755 => 100644 third_party/glslang/Test/spv.sparseTextureClamp.frag mode change 100755 => 100644 third_party/glslang/Test/spv.specConst.vert mode change 100755 => 100644 third_party/glslang/Test/spv.specConstant.comp mode change 100755 => 100644 third_party/glslang/Test/spv.specConstant.vert mode change 100755 => 100644 third_party/glslang/Test/spv.specConstantComposite.vert mode change 100755 => 100644 third_party/glslang/Test/spv.specConstantOperations.vert mode change 100755 => 100644 third_party/glslang/Test/spv.ssbo.autoassign.frag mode change 100755 => 100644 third_party/glslang/Test/spv.ssboAlias.frag mode change 100755 => 100644 third_party/glslang/Test/spv.stereoViewRendering.tesc mode change 100755 => 100644 third_party/glslang/Test/spv.stereoViewRendering.vert mode change 100755 => 100644 third_party/glslang/Test/spv.storageBuffer.vert mode change 100755 => 100644 third_party/glslang/Test/spv.structAssignment.frag mode change 100755 => 100644 third_party/glslang/Test/spv.structDeref.frag mode change 100755 => 100644 third_party/glslang/Test/spv.structure.frag mode change 100755 => 100644 third_party/glslang/Test/spv.subgroup.frag mode change 100755 => 100644 third_party/glslang/Test/spv.subgroup.geom mode change 100755 => 100644 third_party/glslang/Test/spv.subgroup.tesc mode change 100755 => 100644 third_party/glslang/Test/spv.subgroup.tese mode change 100755 => 100644 third_party/glslang/Test/spv.subgroup.vert mode change 100755 => 100644 third_party/glslang/Test/spv.subgroupArithmetic.comp mode change 100755 => 100644 third_party/glslang/Test/spv.subgroupBallot.comp mode change 100755 => 100644 third_party/glslang/Test/spv.subgroupBasic.comp mode change 100755 => 100644 third_party/glslang/Test/spv.subgroupClustered.comp mode change 100755 => 100644 third_party/glslang/Test/spv.subgroupClusteredNeg.comp mode change 100755 => 100644 third_party/glslang/Test/spv.subgroupQuad.comp mode change 100755 => 100644 third_party/glslang/Test/spv.subgroupShuffle.comp mode change 100755 => 100644 third_party/glslang/Test/spv.subgroupShuffleRelative.comp mode change 100755 => 100644 third_party/glslang/Test/spv.subgroupVote.comp mode change 100755 => 100644 third_party/glslang/Test/spv.subpass.frag mode change 100755 => 100644 third_party/glslang/Test/spv.switch.frag mode change 100755 => 100644 third_party/glslang/Test/spv.swizzle.frag mode change 100755 => 100644 third_party/glslang/Test/spv.swizzleInversion.frag mode change 100755 => 100644 third_party/glslang/Test/spv.test.frag mode change 100755 => 100644 third_party/glslang/Test/spv.test.vert mode change 100755 => 100644 third_party/glslang/Test/spv.texture.frag mode change 100755 => 100644 third_party/glslang/Test/spv.texture.sampler.transform.frag mode change 100755 => 100644 third_party/glslang/Test/spv.texture.vert mode change 100755 => 100644 third_party/glslang/Test/spv.textureBuffer.vert mode change 100755 => 100644 third_party/glslang/Test/spv.textureGatherBiasLod.frag mode change 100755 => 100644 third_party/glslang/Test/spv.types.frag mode change 100755 => 100644 third_party/glslang/Test/spv.uint.frag mode change 100755 => 100644 third_party/glslang/Test/spv.uniformArray.frag mode change 100755 => 100644 third_party/glslang/Test/spv.variableArrayIndex.frag mode change 100755 => 100644 third_party/glslang/Test/spv.varyingArray.frag mode change 100755 => 100644 third_party/glslang/Test/spv.varyingArrayIndirect.frag mode change 100755 => 100644 third_party/glslang/Test/spv.viewportArray2.tesc mode change 100755 => 100644 third_party/glslang/Test/spv.viewportArray2.vert mode change 100755 => 100644 third_party/glslang/Test/spv.voidFunction.frag mode change 100755 => 100644 third_party/glslang/Test/spv.vulkan100.subgroupArithmetic.comp mode change 100755 => 100644 third_party/glslang/Test/spv.vulkan110.int16.frag mode change 100755 => 100644 third_party/glslang/Test/spv.vulkan110.storageBuffer.vert mode change 100755 => 100644 third_party/glslang/Test/spv.while-continue-break.vert mode change 100755 => 100644 third_party/glslang/Test/spv.while-simple.vert mode change 100755 => 100644 third_party/glslang/Test/spv.whileLoop.frag mode change 100755 => 100644 third_party/glslang/Test/spv.xfb.vert mode change 100755 => 100644 third_party/glslang/Test/spv.xfb2.vert mode change 100755 => 100644 third_party/glslang/Test/spv.xfb3.vert mode change 100755 => 100644 third_party/glslang/Test/structAssignment.frag mode change 100755 => 100644 third_party/glslang/Test/structDeref.frag mode change 100755 => 100644 third_party/glslang/Test/structure.frag mode change 100755 => 100644 third_party/glslang/Test/switch.frag mode change 100755 => 100644 third_party/glslang/Test/swizzle.frag mode change 100755 => 100644 third_party/glslang/Test/syntaxError.frag mode change 100755 => 100644 third_party/glslang/Test/test.frag mode change 100755 => 100644 third_party/glslang/Test/texture.frag mode change 100755 => 100644 third_party/glslang/Test/tokenPaste.vert mode change 100755 => 100644 third_party/glslang/Test/types.frag mode change 100755 => 100644 third_party/glslang/Test/uint.frag mode change 100755 => 100644 third_party/glslang/Test/uniformArray.frag mode change 100755 => 100644 third_party/glslang/Test/variableArrayIndex.frag mode change 100755 => 100644 third_party/glslang/Test/varyingArray.frag mode change 100755 => 100644 third_party/glslang/Test/varyingArrayIndirect.frag mode change 100755 => 100644 third_party/glslang/Test/versionsClean.frag mode change 100755 => 100644 third_party/glslang/Test/versionsClean.vert mode change 100755 => 100644 third_party/glslang/Test/versionsErrors.frag mode change 100755 => 100644 third_party/glslang/Test/versionsErrors.vert mode change 100755 => 100644 third_party/glslang/Test/voidFunction.frag mode change 100755 => 100644 third_party/glslang/Test/vulkan.ast.vert mode change 100755 => 100644 third_party/glslang/Test/vulkan.comp mode change 100755 => 100644 third_party/glslang/Test/vulkan.vert mode change 100755 => 100644 third_party/glslang/Test/whileLoop.frag mode change 100755 => 100644 third_party/glslang/glslang/GenericCodeGen/CodeGen.cpp mode change 100755 => 100644 third_party/glslang/glslang/GenericCodeGen/Link.cpp mode change 100755 => 100644 third_party/glslang/glslang/Include/BaseTypes.h mode change 100755 => 100644 third_party/glslang/glslang/Include/Common.h mode change 100755 => 100644 third_party/glslang/glslang/Include/ConstantUnion.h mode change 100755 => 100644 third_party/glslang/glslang/Include/InfoSink.h mode change 100755 => 100644 third_party/glslang/glslang/Include/InitializeGlobals.h mode change 100755 => 100644 third_party/glslang/glslang/Include/PoolAlloc.h mode change 100755 => 100644 third_party/glslang/glslang/Include/ResourceLimits.h mode change 100755 => 100644 third_party/glslang/glslang/Include/ShHandle.h mode change 100755 => 100644 third_party/glslang/glslang/Include/arrays.h mode change 100755 => 100644 third_party/glslang/glslang/Include/revision.h mode change 100755 => 100644 third_party/glslang/glslang/Include/revision.template mode change 100755 => 100644 third_party/glslang/glslang/MachineIndependent/InfoSink.cpp mode change 100755 => 100644 third_party/glslang/glslang/MachineIndependent/Initialize.h mode change 100755 => 100644 third_party/glslang/glslang/MachineIndependent/IntermTraverse.cpp mode change 100755 => 100644 third_party/glslang/glslang/MachineIndependent/LiveTraverser.h mode change 100755 => 100644 third_party/glslang/glslang/MachineIndependent/ParseContextBase.cpp mode change 100755 => 100644 third_party/glslang/glslang/MachineIndependent/PoolAlloc.cpp mode change 100755 => 100644 third_party/glslang/glslang/MachineIndependent/RemoveTree.cpp mode change 100755 => 100644 third_party/glslang/glslang/MachineIndependent/RemoveTree.h mode change 100755 => 100644 third_party/glslang/glslang/MachineIndependent/Scan.h mode change 100755 => 100644 third_party/glslang/glslang/MachineIndependent/ShaderLang.cpp mode change 100755 => 100644 third_party/glslang/glslang/MachineIndependent/SymbolTable.cpp mode change 100755 => 100644 third_party/glslang/glslang/MachineIndependent/SymbolTable.h mode change 100755 => 100644 third_party/glslang/glslang/MachineIndependent/attribute.cpp mode change 100755 => 100644 third_party/glslang/glslang/MachineIndependent/attribute.h mode change 100755 => 100644 third_party/glslang/glslang/MachineIndependent/gl_types.h mode change 100755 => 100644 third_party/glslang/glslang/MachineIndependent/glslang_tab.cpp.h mode change 100755 => 100644 third_party/glslang/glslang/MachineIndependent/iomapper.h mode change 100755 => 100644 third_party/glslang/glslang/MachineIndependent/limits.cpp mode change 100755 => 100644 third_party/glslang/glslang/MachineIndependent/parseConst.cpp mode change 100755 => 100644 third_party/glslang/glslang/MachineIndependent/preprocessor/PpAtom.cpp mode change 100755 => 100644 third_party/glslang/glslang/MachineIndependent/preprocessor/PpTokens.h mode change 100755 => 100644 third_party/glslang/glslang/MachineIndependent/propagateNoContraction.cpp mode change 100755 => 100644 third_party/glslang/glslang/MachineIndependent/propagateNoContraction.h mode change 100755 => 100644 third_party/glslang/glslang/MachineIndependent/reflection.cpp mode change 100755 => 100644 third_party/glslang/glslang/MachineIndependent/reflection.h mode change 100755 => 100644 third_party/glslang/glslang/OSDependent/Unix/CMakeLists.txt mode change 100755 => 100644 third_party/glslang/glslang/OSDependent/Unix/ossource.cpp mode change 100755 => 100644 third_party/glslang/glslang/OSDependent/Windows/CMakeLists.txt mode change 100755 => 100644 third_party/glslang/glslang/OSDependent/Windows/main.cpp mode change 100755 => 100644 third_party/glslang/glslang/OSDependent/Windows/ossource.cpp mode change 100755 => 100644 third_party/glslang/glslang/OSDependent/osinclude.h delete mode 100644 third_party/glslang/glslang/tnt/TNTReadme.txt mode change 100755 => 100644 third_party/glslang/gtests/BuiltInResource.FromFile.cpp mode change 100755 => 100644 third_party/glslang/gtests/CMakeLists.txt mode change 100755 => 100644 third_party/glslang/gtests/Config.FromFile.cpp mode change 100755 => 100644 third_party/glslang/gtests/HexFloat.cpp mode change 100755 => 100644 third_party/glslang/gtests/Initializer.h mode change 100755 => 100644 third_party/glslang/gtests/Link.FromFile.cpp mode change 100755 => 100644 third_party/glslang/gtests/README.md mode change 100755 => 100644 third_party/glslang/gtests/Remap.FromFile.cpp mode change 100755 => 100644 third_party/glslang/gtests/Settings.cpp mode change 100755 => 100644 third_party/glslang/gtests/Settings.h mode change 100755 => 100644 third_party/glslang/gtests/TestFixture.cpp mode change 100755 => 100644 third_party/glslang/gtests/TestFixture.h mode change 100755 => 100644 third_party/glslang/gtests/main.cpp mode change 100755 => 100644 third_party/glslang/hlsl/hlslAttributes.cpp mode change 100755 => 100644 third_party/glslang/hlsl/hlslAttributes.h mode change 100755 => 100644 third_party/glslang/known_good.json create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/pass-by-value.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/texel-fetch-offset.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/pass-by-value.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/texel-fetch-offset.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.write_buff.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.write_buff_atomic.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.write_tex.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/for-loop-phi-only-continue.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/pass-by-value.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/texel-fetch-offset.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/frag/pass-by-value.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/texel-fetch-offset.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/pass-by-value.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/texel-fetch-offset.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.write_buff.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.write_buff_atomic.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.write_tex.vert create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/for-loop-phi-only-continue.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/pass-by-value.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/texel-fetch-offset.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/frag/pass-by-value.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/texel-fetch-offset.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/pass-by-value.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/texel-fetch-offset.frag create mode 100644 third_party/spirv-cross/shaders-msl/vert/no_stage_out.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/no_stage_out.write_buff.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/no_stage_out.write_buff_atomic.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/no_stage_out.write_tex.vert create mode 100644 third_party/spirv-cross/shaders/asm/frag/for-loop-phi-only-continue.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/pass-by-value.asm.frag create mode 100644 third_party/spirv-cross/shaders/frag/texel-fetch-offset.frag mode change 100755 => 100644 third_party/spirv-tools/Android.mk mode change 100755 => 100644 third_party/spirv-tools/CHANGES mode change 100755 => 100644 third_party/spirv-tools/CONTRIBUTING.md mode change 100755 => 100644 third_party/spirv-tools/LICENSE mode change 100755 => 100644 third_party/spirv-tools/README.md mode change 100755 => 100644 third_party/spirv-tools/android_test/Android.mk mode change 100755 => 100644 third_party/spirv-tools/android_test/jni/Application.mk mode change 100755 => 100644 third_party/spirv-tools/android_test/test.cpp create mode 100644 third_party/spirv-tools/build_overrides/spirv_tools.gni mode change 100755 => 100644 third_party/spirv-tools/cmake/SPIRV-Tools-shared.pc.in mode change 100755 => 100644 third_party/spirv-tools/cmake/SPIRV-Tools.pc.in mode change 100755 => 100644 third_party/spirv-tools/cmake/write_pkg_config.cmake mode change 100755 => 100644 third_party/spirv-tools/examples/CMakeLists.txt mode change 100755 => 100644 third_party/spirv-tools/examples/cpp-interface/CMakeLists.txt mode change 100755 => 100644 third_party/spirv-tools/examples/cpp-interface/main.cpp mode change 100755 => 100644 third_party/spirv-tools/external/CMakeLists.txt mode change 100755 => 100644 third_party/spirv-tools/include/spirv-tools/libspirv.h mode change 100755 => 100644 third_party/spirv-tools/include/spirv-tools/libspirv.hpp mode change 100755 => 100644 third_party/spirv-tools/include/spirv-tools/linker.hpp mode change 100755 => 100644 third_party/spirv-tools/include/spirv-tools/optimizer.hpp mode change 100755 => 100644 third_party/spirv-tools/projects.md mode change 100755 => 100644 third_party/spirv-tools/source/CMakeLists.txt mode change 100755 => 100644 third_party/spirv-tools/source/assembly_grammar.cpp mode change 100755 => 100644 third_party/spirv-tools/source/assembly_grammar.h mode change 100755 => 100644 third_party/spirv-tools/source/binary.cpp mode change 100755 => 100644 third_party/spirv-tools/source/binary.h mode change 100755 => 100644 third_party/spirv-tools/source/cfa.h mode change 100755 => 100644 third_party/spirv-tools/source/comp/CMakeLists.txt rename third_party/spirv-tools/source/{util => comp}/bit_stream.cpp (82%) mode change 100755 => 100644 rename third_party/spirv-tools/source/{util => comp}/bit_stream.h (60%) mode change 100755 => 100644 rename third_party/spirv-tools/source/{util => comp}/huffman_codec.h (98%) mode change 100755 => 100644 create mode 100644 third_party/spirv-tools/source/comp/markv.cpp mode change 100755 => 100644 third_party/spirv-tools/source/comp/markv.h mode change 100755 => 100644 third_party/spirv-tools/source/comp/markv_codec.cpp create mode 100644 third_party/spirv-tools/source/comp/markv_codec.h create mode 100644 third_party/spirv-tools/source/comp/markv_decoder.cpp create mode 100644 third_party/spirv-tools/source/comp/markv_decoder.h create mode 100644 third_party/spirv-tools/source/comp/markv_encoder.cpp create mode 100644 third_party/spirv-tools/source/comp/markv_encoder.h create mode 100644 third_party/spirv-tools/source/comp/markv_logger.h mode change 100755 => 100644 third_party/spirv-tools/source/comp/markv_model.h create mode 100644 third_party/spirv-tools/source/comp/move_to_front.cpp create mode 100644 third_party/spirv-tools/source/comp/move_to_front.h mode change 100755 => 100644 third_party/spirv-tools/source/diagnostic.cpp mode change 100755 => 100644 third_party/spirv-tools/source/diagnostic.h mode change 100755 => 100644 third_party/spirv-tools/source/disassemble.cpp mode change 100755 => 100644 third_party/spirv-tools/source/disassemble.h mode change 100755 => 100644 third_party/spirv-tools/source/enum_set.h mode change 100755 => 100644 third_party/spirv-tools/source/enum_string_mapping.cpp mode change 100755 => 100644 third_party/spirv-tools/source/enum_string_mapping.h mode change 100755 => 100644 third_party/spirv-tools/source/ext_inst.cpp mode change 100755 => 100644 third_party/spirv-tools/source/ext_inst.h mode change 100755 => 100644 third_party/spirv-tools/source/extensions.cpp mode change 100755 => 100644 third_party/spirv-tools/source/extensions.h mode change 100755 => 100644 third_party/spirv-tools/source/extinst.debuginfo.grammar.json mode change 100755 => 100644 third_party/spirv-tools/source/extinst.spv-amd-gcn-shader.grammar.json mode change 100755 => 100644 third_party/spirv-tools/source/extinst.spv-amd-shader-ballot.grammar.json mode change 100755 => 100644 third_party/spirv-tools/source/extinst.spv-amd-shader-explicit-vertex-parameter.grammar.json mode change 100755 => 100644 third_party/spirv-tools/source/extinst.spv-amd-shader-trinary-minmax.grammar.json mode change 100755 => 100644 third_party/spirv-tools/source/id_descriptor.cpp mode change 100755 => 100644 third_party/spirv-tools/source/id_descriptor.h mode change 100755 => 100644 third_party/spirv-tools/source/instruction.h mode change 100755 => 100644 third_party/spirv-tools/source/latest_version_glsl_std_450_header.h mode change 100755 => 100644 third_party/spirv-tools/source/latest_version_opencl_std_header.h mode change 100755 => 100644 third_party/spirv-tools/source/latest_version_spirv_header.h mode change 100755 => 100644 third_party/spirv-tools/source/libspirv.cpp mode change 100755 => 100644 third_party/spirv-tools/source/link/CMakeLists.txt mode change 100755 => 100644 third_party/spirv-tools/source/link/linker.cpp mode change 100755 => 100644 third_party/spirv-tools/source/macro.h mode change 100755 => 100644 third_party/spirv-tools/source/name_mapper.cpp mode change 100755 => 100644 third_party/spirv-tools/source/name_mapper.h mode change 100755 => 100644 third_party/spirv-tools/source/opcode.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opcode.h mode change 100755 => 100644 third_party/spirv-tools/source/operand.cpp mode change 100755 => 100644 third_party/spirv-tools/source/operand.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/CMakeLists.txt mode change 100755 => 100644 third_party/spirv-tools/source/opt/aggressive_dead_code_elim_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/aggressive_dead_code_elim_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/basic_block.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/basic_block.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/block_merge_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/block_merge_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/build_module.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/build_module.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/ccp_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/ccp_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/cfg.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/cfg.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/cfg_cleanup_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/cfg_cleanup_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/common_uniform_elim_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/common_uniform_elim_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/compact_ids_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/compact_ids_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/composite.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/composite.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/const_folding_rules.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/const_folding_rules.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/constants.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/constants.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/copy_prop_arrays.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/copy_prop_arrays.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/dead_branch_elim_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/dead_branch_elim_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/dead_insert_elim_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/dead_insert_elim_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/dead_variable_elimination.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/dead_variable_elimination.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/decoration_manager.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/decoration_manager.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/def_use_manager.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/def_use_manager.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/dominator_analysis.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/dominator_analysis.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/dominator_tree.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/dominator_tree.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/eliminate_dead_constant_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/eliminate_dead_constant_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/eliminate_dead_functions_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/eliminate_dead_functions_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/feature_manager.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/feature_manager.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/flatten_decoration_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/flatten_decoration_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/fold.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/fold.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/folding_rules.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/folding_rules.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/freeze_spec_constant_value_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/freeze_spec_constant_value_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/function.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/function.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/if_conversion.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/if_conversion.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/inline_exhaustive_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/inline_exhaustive_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/inline_opaque_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/inline_opaque_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/inline_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/inline_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/instruction.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/instruction.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/instruction_list.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/instruction_list.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/ir_builder.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/ir_context.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/ir_context.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/ir_loader.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/ir_loader.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/iterator.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/licm_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/licm_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/local_access_chain_convert_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/local_access_chain_convert_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/local_redundancy_elimination.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/local_redundancy_elimination.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/local_single_block_elim_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/local_single_block_elim_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/local_single_store_elim_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/local_single_store_elim_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/local_ssa_elim_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/local_ssa_elim_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/log.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/loop_descriptor.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/loop_descriptor.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/loop_peeling.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/loop_peeling.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/loop_unroller.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/loop_unroller.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/loop_unswitch_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/loop_unswitch_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/loop_utils.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/loop_utils.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/mem_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/mem_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/merge_return_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/merge_return_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/module.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/module.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/null_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/optimizer.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/pass_manager.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/pass_manager.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/passes.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/private_to_local_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/private_to_local_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/propagator.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/propagator.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/redundancy_elimination.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/redundancy_elimination.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/reflect.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/remove_duplicates_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/remove_duplicates_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/replace_invalid_opc.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/replace_invalid_opc.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/scalar_analysis.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/scalar_analysis.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/scalar_analysis_nodes.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/scalar_analysis_simplification.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/scalar_replacement_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/scalar_replacement_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/set_spec_constant_default_value_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/set_spec_constant_default_value_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/simplification_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/simplification_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/ssa_rewrite_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/ssa_rewrite_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/strength_reduction_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/strength_reduction_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/strip_debug_info_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/strip_debug_info_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/strip_reflect_info_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/strip_reflect_info_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/tree_iterator.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/type_manager.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/type_manager.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/types.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/types.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/unify_const_pass.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/unify_const_pass.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/value_number_table.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/value_number_table.h mode change 100755 => 100644 third_party/spirv-tools/source/opt/workaround1209.cpp mode change 100755 => 100644 third_party/spirv-tools/source/opt/workaround1209.h mode change 100755 => 100644 third_party/spirv-tools/source/parsed_operand.cpp mode change 100755 => 100644 third_party/spirv-tools/source/parsed_operand.h mode change 100755 => 100644 third_party/spirv-tools/source/print.cpp mode change 100755 => 100644 third_party/spirv-tools/source/print.h mode change 100755 => 100644 third_party/spirv-tools/source/software_version.cpp mode change 100755 => 100644 third_party/spirv-tools/source/spirv_constant.h mode change 100755 => 100644 third_party/spirv-tools/source/spirv_definition.h mode change 100755 => 100644 third_party/spirv-tools/source/spirv_endian.cpp mode change 100755 => 100644 third_party/spirv-tools/source/spirv_endian.h mode change 100755 => 100644 third_party/spirv-tools/source/spirv_target_env.cpp mode change 100755 => 100644 third_party/spirv-tools/source/spirv_target_env.h mode change 100755 => 100644 third_party/spirv-tools/source/spirv_validator_options.cpp mode change 100755 => 100644 third_party/spirv-tools/source/spirv_validator_options.h mode change 100755 => 100644 third_party/spirv-tools/source/table.cpp mode change 100755 => 100644 third_party/spirv-tools/source/table.h mode change 100755 => 100644 third_party/spirv-tools/source/text.cpp mode change 100755 => 100644 third_party/spirv-tools/source/text.h mode change 100755 => 100644 third_party/spirv-tools/source/text_handler.cpp mode change 100755 => 100644 third_party/spirv-tools/source/text_handler.h mode change 100755 => 100644 third_party/spirv-tools/source/util/bitutils.h mode change 100755 => 100644 third_party/spirv-tools/source/util/hex_float.h mode change 100755 => 100644 third_party/spirv-tools/source/util/ilist.h mode change 100755 => 100644 third_party/spirv-tools/source/util/ilist_node.h rename third_party/spirv-tools/source/{opt => util}/make_unique.h (88%) mode change 100755 => 100644 delete mode 100755 third_party/spirv-tools/source/util/move_to_front.h mode change 100755 => 100644 third_party/spirv-tools/source/util/parse_number.cpp mode change 100755 => 100644 third_party/spirv-tools/source/util/parse_number.h mode change 100755 => 100644 third_party/spirv-tools/source/util/string_utils.cpp mode change 100755 => 100644 third_party/spirv-tools/source/util/string_utils.h mode change 100755 => 100644 third_party/spirv-tools/source/util/timer.cpp mode change 100755 => 100644 third_party/spirv-tools/source/util/timer.h mode change 100755 => 100644 third_party/spirv-tools/source/val/basic_block.cpp mode change 100755 => 100644 third_party/spirv-tools/source/val/basic_block.h mode change 100755 => 100644 third_party/spirv-tools/source/val/construct.cpp mode change 100755 => 100644 third_party/spirv-tools/source/val/construct.h mode change 100755 => 100644 third_party/spirv-tools/source/val/decoration.h mode change 100755 => 100644 third_party/spirv-tools/source/val/function.cpp mode change 100755 => 100644 third_party/spirv-tools/source/val/function.h mode change 100755 => 100644 third_party/spirv-tools/source/val/instruction.cpp mode change 100755 => 100644 third_party/spirv-tools/source/val/instruction.h create mode 100644 third_party/spirv-tools/source/val/validate_annotation.cpp create mode 100644 third_party/spirv-tools/source/val/validate_debug.cpp create mode 100644 third_party/spirv-tools/source/val/validate_execution_limitations.cpp create mode 100644 third_party/spirv-tools/source/val/validate_function.cpp create mode 100644 third_party/spirv-tools/source/val/validate_mode_setting.cpp create mode 100644 third_party/spirv-tools/source/val/validate_type.cpp delete mode 100644 third_party/spirv-tools/source/val/validate_type_unique.cpp mode change 100755 => 100644 third_party/spirv-tools/source/val/validation_state.cpp mode change 100755 => 100644 third_party/spirv-tools/source/val/validation_state.h mode change 100755 => 100644 third_party/spirv-tools/syntax.md mode change 100755 => 100644 third_party/spirv-tools/test/CMakeLists.txt mode change 100755 => 100644 third_party/spirv-tools/test/assembly_context_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/assembly_format_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/binary_destroy_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/binary_endianness_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/binary_header_get_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/binary_parse_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/binary_strnlen_s_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/binary_to_text.literal_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/binary_to_text_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/bit_stream.cpp mode change 100755 => 100644 third_party/spirv-tools/test/c_interface_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/comment_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/comp/CMakeLists.txt mode change 100755 => 100644 third_party/spirv-tools/test/comp/markv_codec_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/cpp_interface_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/diagnostic_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/enum_set_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/enum_string_mapping_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/ext_inst.debuginfo_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/ext_inst.glsl_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/ext_inst.opencl_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/fix_word_test.cpp rename third_party/spirv-tools/{testing => test}/fuzzers/BUILD.gn (67%) rename third_party/spirv-tools/{testing => test}/fuzzers/corpora/spv/simple.spv (100%) create mode 100644 third_party/spirv-tools/test/fuzzers/spvtools_opt_legalization_fuzzer.cpp rename third_party/spirv-tools/{testing/fuzzers/spvtools_opt_fuzzer.cpp => test/fuzzers/spvtools_opt_performance_fuzzer.cpp} (98%) create mode 100644 third_party/spirv-tools/test/fuzzers/spvtools_opt_size_fuzzer.cpp rename third_party/spirv-tools/{testing => test}/fuzzers/spvtools_val_fuzzer.cpp (98%) mode change 100755 => 100644 third_party/spirv-tools/test/generator_magic_number_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/hex_float_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/huffman_codec.cpp mode change 100755 => 100644 third_party/spirv-tools/test/immediate_int_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/libspirv_macros_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/link/CMakeLists.txt mode change 100755 => 100644 third_party/spirv-tools/test/link/binary_version_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/link/entry_points_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/link/global_values_amount_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/link/ids_limit_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/link/linker_fixture.h mode change 100755 => 100644 third_party/spirv-tools/test/link/matching_imports_to_exports_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/link/memory_model_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/link/partial_linkage_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/link/unique_ids_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/log_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/move_to_front_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/name_mapper_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/named_id_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opcode_make_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opcode_require_capabilities_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opcode_split_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opcode_table_get_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/operand-class-test-coverage.csv mode change 100755 => 100644 third_party/spirv-tools/test/operand_capabilities_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/operand_pattern_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/operand_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/CMakeLists.txt mode change 100755 => 100644 third_party/spirv-tools/test/opt/aggressive_dead_code_elim_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/assembly_builder.h mode change 100755 => 100644 third_party/spirv-tools/test/opt/assembly_builder_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/block_merge_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/ccp_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/cfg_cleanup_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/common_uniform_elim_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/compact_ids_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/copy_prop_array_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/dead_branch_elim_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/dead_insert_elim_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/dead_variable_elim_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/decoration_manager_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/def_use_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/dominator_tree/CMakeLists.txt mode change 100755 => 100644 third_party/spirv-tools/test/opt/dominator_tree/common_dominators.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/dominator_tree/generated.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/dominator_tree/nested_ifs.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/dominator_tree/nested_ifs_post.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/dominator_tree/nested_loops.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/dominator_tree/nested_loops_with_unreachables.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/dominator_tree/post.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/dominator_tree/simple.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/dominator_tree/switch_case_fallthrough.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/dominator_tree/unreachable_for.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/dominator_tree/unreachable_for_post.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/eliminate_dead_const_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/eliminate_dead_functions_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/feature_manager_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/flatten_decoration_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/fold_spec_const_op_composite_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/fold_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/freeze_spec_const_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/function_utils.h mode change 100755 => 100644 third_party/spirv-tools/test/opt/if_conversion_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/inline_opaque_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/inline_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/insert_extract_elim_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/instruction_list_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/instruction_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/ir_builder.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/ir_context_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/ir_loader_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/iterator_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/line_debug_info_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/local_access_chain_convert_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/local_redundancy_elimination_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/local_single_block_elim.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/local_single_store_elim_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/local_ssa_elim_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/loop_optimizations/CMakeLists.txt mode change 100755 => 100644 third_party/spirv-tools/test/opt/loop_optimizations/hoist_all_loop_types.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/loop_optimizations/hoist_double_nested_loops.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/loop_optimizations/hoist_from_independent_loops.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/loop_optimizations/hoist_simple_case.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/loop_optimizations/hoist_single_nested_loops.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/loop_optimizations/hoist_without_preheader.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/loop_optimizations/lcssa.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/loop_optimizations/loop_descriptions.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/loop_optimizations/nested_loops.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/loop_optimizations/peeling.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/loop_optimizations/unroll_assumptions.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/loop_optimizations/unroll_simple.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/loop_optimizations/unswitch.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/module_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/module_utils.h mode change 100755 => 100644 third_party/spirv-tools/test/opt/optimizer_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/pass_fixture.h mode change 100755 => 100644 third_party/spirv-tools/test/opt/pass_manager_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/pass_merge_return_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/pass_remove_duplicates_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/pass_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/pass_utils.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/pass_utils.h mode change 100755 => 100644 third_party/spirv-tools/test/opt/private_to_local_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/propagator_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/redundancy_elimination_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/replace_invalid_opc_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/scalar_analysis.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/scalar_replacement_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/set_spec_const_default_value_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/simplification_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/strength_reduction_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/strip_debug_info_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/strip_reflect_info_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/type_manager_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/types_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/unify_const_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/utils_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/value_table_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/opt/workaround1209_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/parse_number_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/preserve_numeric_ids_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/scripts/test_compact_ids.py mode change 100755 => 100644 third_party/spirv-tools/test/software_version_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/stats/CMakeLists.txt mode change 100755 => 100644 third_party/spirv-tools/test/stats/stats_aggregate_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/stats/stats_analyzer_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/string_utils_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/target_env_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/test_fixture.h mode change 100755 => 100644 third_party/spirv-tools/test/text_advance_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/text_destroy_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/text_literal_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/text_start_new_inst_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/text_to_binary.annotation_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/text_to_binary.barrier_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/text_to_binary.constant_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/text_to_binary.control_flow_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/text_to_binary.debug_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/text_to_binary.device_side_enqueue_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/text_to_binary.extension_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/text_to_binary.function_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/text_to_binary.group_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/text_to_binary.image_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/text_to_binary.literal_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/text_to_binary.memory_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/text_to_binary.misc_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/text_to_binary.mode_setting_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/text_to_binary.pipe_storage_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/text_to_binary.reserved_sampling_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/text_to_binary.subgroup_dispatch_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/text_to_binary.type_declaration_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/text_to_binary_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/text_word_get_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/timer_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/unit_spirv.cpp mode change 100755 => 100644 third_party/spirv-tools/test/unit_spirv.h mode change 100755 => 100644 third_party/spirv-tools/test/util/CMakeLists.txt mode change 100755 => 100644 third_party/spirv-tools/test/util/ilist_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/val/CMakeLists.txt mode change 100755 => 100644 third_party/spirv-tools/test/val/val_adjacency_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/val/val_arithmetics_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/val/val_atomics_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/val/val_barriers_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/val/val_bitwise_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/val/val_builtins_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/val/val_capability_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/val/val_cfg_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/val/val_composites_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/val/val_conversion_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/val/val_data_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/val/val_decoration_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/val/val_derivatives_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/val/val_ext_inst_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/val/val_extensions_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/val/val_fixtures.h mode change 100755 => 100644 third_party/spirv-tools/test/val/val_id_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/val/val_image_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/val/val_layout_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/val/val_limits_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/val/val_literals_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/val/val_logicals_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/val/val_primitives_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/val/val_ssa_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/val/val_state_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/val/val_storage_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/val/val_type_unique_test.cpp mode change 100755 => 100644 third_party/spirv-tools/test/val/val_validation_state_test.cpp delete mode 100644 third_party/spirv-tools/testing/test.gni mode change 100755 => 100644 third_party/spirv-tools/tools/CMakeLists.txt mode change 100755 => 100644 third_party/spirv-tools/tools/as/as.cpp mode change 100755 => 100644 third_party/spirv-tools/tools/cfg/bin_to_dot.cpp mode change 100755 => 100644 third_party/spirv-tools/tools/cfg/bin_to_dot.h mode change 100755 => 100644 third_party/spirv-tools/tools/cfg/cfg.cpp mode change 100755 => 100644 third_party/spirv-tools/tools/comp/markv.cpp mode change 100755 => 100644 third_party/spirv-tools/tools/comp/markv_model_factory.cpp mode change 100755 => 100644 third_party/spirv-tools/tools/comp/markv_model_factory.h mode change 100755 => 100644 third_party/spirv-tools/tools/comp/markv_model_shader.cpp mode change 100755 => 100644 third_party/spirv-tools/tools/comp/markv_model_shader.h mode change 100755 => 100644 third_party/spirv-tools/tools/comp/markv_model_shader_default_autogen.inc mode change 100755 => 100644 third_party/spirv-tools/tools/dis/dis.cpp mode change 100755 => 100644 third_party/spirv-tools/tools/emacs/50spirv-tools.el mode change 100755 => 100644 third_party/spirv-tools/tools/emacs/CMakeLists.txt mode change 100755 => 100644 third_party/spirv-tools/tools/io.h mode change 100755 => 100644 third_party/spirv-tools/tools/lesspipe/CMakeLists.txt mode change 100755 => 100644 third_party/spirv-tools/tools/lesspipe/spirv-lesspipe.sh mode change 100755 => 100644 third_party/spirv-tools/tools/link/linker.cpp mode change 100755 => 100644 third_party/spirv-tools/tools/opt/opt.cpp rename third_party/spirv-tools/{source => tools/stats}/spirv_stats.cpp (55%) mode change 100755 => 100644 rename third_party/spirv-tools/{source => tools/stats}/spirv_stats.h (63%) mode change 100755 => 100644 mode change 100755 => 100644 third_party/spirv-tools/tools/stats/stats.cpp mode change 100755 => 100644 third_party/spirv-tools/tools/stats/stats_analyzer.cpp mode change 100755 => 100644 third_party/spirv-tools/tools/stats/stats_analyzer.h rename third_party/spirv-tools/{source/message.cpp => tools/util/cli_consumer.cpp} (51%) mode change 100755 => 100644 rename third_party/spirv-tools/{source/message.h => tools/util/cli_consumer.h} (53%) mode change 100755 => 100644 mode change 100755 => 100644 third_party/spirv-tools/tools/val/val.cpp create mode 100755 third_party/spirv-tools/utils/fixup_fuzz_result.py diff --git a/third_party/glslang/CMakeLists.txt b/third_party/glslang/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/third_party/glslang/ChooseMSVCCRT.cmake b/third_party/glslang/ChooseMSVCCRT.cmake old mode 100755 new mode 100644 diff --git a/third_party/glslang/External/CMakeLists.txt b/third_party/glslang/External/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/third_party/glslang/OGLCompilersDLL/CMakeLists.txt b/third_party/glslang/OGLCompilersDLL/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/third_party/glslang/OGLCompilersDLL/InitializeDll.cpp b/third_party/glslang/OGLCompilersDLL/InitializeDll.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/OGLCompilersDLL/InitializeDll.h b/third_party/glslang/OGLCompilersDLL/InitializeDll.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/README-spirv-remap.txt b/third_party/glslang/README-spirv-remap.txt old mode 100755 new mode 100644 diff --git a/third_party/glslang/README.md b/third_party/glslang/README.md index 402b4d6005..544081dcde 100755 --- a/third_party/glslang/README.md +++ b/third_party/glslang/README.md @@ -105,8 +105,8 @@ cd $BUILD_DIR For building on Linux: ```bash -cmake -DCMAKE_BUILD_TYPE={Debug|Release|RelWithDebInfo} \ - -DCMAKE_INSTALL_PREFIX="$(pwd)/install" $SOURCE_DIR +cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$(pwd)/install" $SOURCE_DIR +# "Release" (for CMAKE_BUILD_TYPE) could also be "Debug" or "RelWithDebInfo" ``` For building on Windows: @@ -125,8 +125,8 @@ The CMake GUI also works for Windows (version 3.4.1 tested). make -j4 install # for Windows: -cmake --build . --config {Release|Debug|MinSizeRel|RelWithDebInfo} \ - --target install +cmake --build . --config Release --target install +# "Release" (for --config) could also be "Debug", "MinSizeRel", or "RelWithDebInfo" ``` If using MSVC, after running CMake to configure, use the diff --git a/third_party/glslang/SPIRV/CMakeLists.txt b/third_party/glslang/SPIRV/CMakeLists.txt index be58d021bc..48ca779532 100755 --- a/third_party/glslang/SPIRV/CMakeLists.txt +++ b/third_party/glslang/SPIRV/CMakeLists.txt @@ -3,6 +3,7 @@ set(SOURCES InReadableOrder.cpp Logger.cpp SpvBuilder.cpp + SpvPostProcess.cpp doc.cpp disassemble.cpp) diff --git a/third_party/glslang/SPIRV/GLSL.ext.AMD.h b/third_party/glslang/SPIRV/GLSL.ext.AMD.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/SPIRV/GLSL.ext.EXT.h b/third_party/glslang/SPIRV/GLSL.ext.EXT.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/SPIRV/GLSL.ext.NV.h b/third_party/glslang/SPIRV/GLSL.ext.NV.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/SPIRV/GlslangToSpv.cpp b/third_party/glslang/SPIRV/GlslangToSpv.cpp index c3e794011e..d8369d2006 100755 --- a/third_party/glslang/SPIRV/GlslangToSpv.cpp +++ b/third_party/glslang/SPIRV/GlslangToSpv.cpp @@ -1191,6 +1191,7 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, const gl // Finish creating SPV, after the traversal is complete. void TGlslangToSpvTraverser::finishSpv() { + // Finish the entry point function if (! entryPointTerminated) { builder.setBuildPoint(shaderEntry->getLastBlock()); builder.leaveFunction(); @@ -1200,7 +1201,9 @@ void TGlslangToSpvTraverser::finishSpv() for (auto it = iOSet.cbegin(); it != iOSet.cend(); ++it) entryPoint->addIdOperand(*it); - builder.eliminateDeadDecorations(); + // Add capabilities, extensions, remove unneeded decorations, etc., + // based on the resulting SPIR-V. + builder.postProcess(); } // Write the SPV into 'out'. @@ -3627,9 +3630,10 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO // Check for image functions other than queries if (node->isImage()) { - std::vector operands; + std::vector operands; auto opIt = arguments.begin(); - operands.push_back(*(opIt++)); + spv::IdImmediate image = { true, *(opIt++) }; + operands.push_back(image); // Handle subpass operations // TODO: GLSL should change to have the "MS" only on the type rather than the @@ -3640,38 +3644,47 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO std::vector comps; comps.push_back(zero); comps.push_back(zero); - operands.push_back(builder.makeCompositeConstant(builder.makeVectorType(builder.makeIntType(32), 2), comps)); + spv::IdImmediate coord = { true, + builder.makeCompositeConstant(builder.makeVectorType(builder.makeIntType(32), 2), comps) }; + operands.push_back(coord); if (sampler.ms) { - operands.push_back(spv::ImageOperandsSampleMask); - operands.push_back(*(opIt++)); + spv::IdImmediate imageOperands = { false, spv::ImageOperandsSampleMask }; + operands.push_back(imageOperands); + spv::IdImmediate imageOperand = { true, *(opIt++) }; + operands.push_back(imageOperand); } spv::Id result = builder.createOp(spv::OpImageRead, resultType(), operands); builder.setPrecision(result, precision); return result; } - operands.push_back(*(opIt++)); + spv::IdImmediate coord = { true, *(opIt++) }; + operands.push_back(coord); #ifdef AMD_EXTENSIONS if (node->getOp() == glslang::EOpImageLoad || node->getOp() == glslang::EOpImageLoadLod) { #else if (node->getOp() == glslang::EOpImageLoad) { #endif if (sampler.ms) { - operands.push_back(spv::ImageOperandsSampleMask); - operands.push_back(*opIt); + spv::IdImmediate imageOperands = { false, spv::ImageOperandsSampleMask }; + operands.push_back(imageOperands); + spv::IdImmediate imageOperand = { true, *opIt }; + operands.push_back(imageOperand); #ifdef AMD_EXTENSIONS } else if (cracked.lod) { builder.addExtension(spv::E_SPV_AMD_shader_image_load_store_lod); builder.addCapability(spv::CapabilityImageReadWriteLodAMD); - operands.push_back(spv::ImageOperandsLodMask); - operands.push_back(*opIt); + spv::IdImmediate imageOperands = { false, spv::ImageOperandsLodMask }; + operands.push_back(imageOperands); + spv::IdImmediate imageOperand = { true, *opIt }; + operands.push_back(imageOperand); #endif } - if (builder.getImageTypeFormat(builder.getImageType(operands.front())) == spv::ImageFormatUnknown) + if (builder.getImageTypeFormat(builder.getImageType(operands.front().word)) == spv::ImageFormatUnknown) builder.addCapability(spv::CapabilityStorageImageReadWithoutFormat); - std::vector result( 1, builder.createOp(spv::OpImageRead, resultType(), operands) ); + std::vector result(1, builder.createOp(spv::OpImageRead, resultType(), operands)); builder.setPrecision(result[0], precision); // If needed, add a conversion constructor to the proper size. @@ -3685,22 +3698,30 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO } else if (node->getOp() == glslang::EOpImageStore) { #endif if (sampler.ms) { - operands.push_back(*(opIt + 1)); - operands.push_back(spv::ImageOperandsSampleMask); - operands.push_back(*opIt); + spv::IdImmediate texel = { true, *(opIt + 1) }; + operands.push_back(texel); + spv::IdImmediate imageOperands = { false, spv::ImageOperandsSampleMask }; + operands.push_back(imageOperands); + spv::IdImmediate imageOperand = { true, *opIt }; + operands.push_back(imageOperand); #ifdef AMD_EXTENSIONS } else if (cracked.lod) { builder.addExtension(spv::E_SPV_AMD_shader_image_load_store_lod); builder.addCapability(spv::CapabilityImageReadWriteLodAMD); - operands.push_back(*(opIt + 1)); - operands.push_back(spv::ImageOperandsLodMask); - operands.push_back(*opIt); + spv::IdImmediate texel = { true, *(opIt + 1) }; + operands.push_back(texel); + spv::IdImmediate imageOperands = { false, spv::ImageOperandsLodMask }; + operands.push_back(imageOperands); + spv::IdImmediate imageOperand = { true, *opIt }; + operands.push_back(imageOperand); #endif - } else - operands.push_back(*opIt); + } else { + spv::IdImmediate texel = { true, *opIt }; + operands.push_back(texel); + } builder.createNoResultOp(spv::OpImageWrite, operands); - if (builder.getImageTypeFormat(builder.getImageType(operands.front())) == spv::ImageFormatUnknown) + if (builder.getImageTypeFormat(builder.getImageType(operands.front().word)) == spv::ImageFormatUnknown) builder.addCapability(spv::CapabilityStorageImageWriteWithoutFormat); return spv::NoResult; #ifdef AMD_EXTENSIONS @@ -3709,19 +3730,23 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO } else if (node->getOp() == glslang::EOpSparseImageLoad) { #endif builder.addCapability(spv::CapabilitySparseResidency); - if (builder.getImageTypeFormat(builder.getImageType(operands.front())) == spv::ImageFormatUnknown) + if (builder.getImageTypeFormat(builder.getImageType(operands.front().word)) == spv::ImageFormatUnknown) builder.addCapability(spv::CapabilityStorageImageReadWithoutFormat); if (sampler.ms) { - operands.push_back(spv::ImageOperandsSampleMask); - operands.push_back(*opIt++); + spv::IdImmediate imageOperands = { false, spv::ImageOperandsSampleMask }; + operands.push_back(imageOperands); + spv::IdImmediate imageOperand = { true, *opIt++ }; + operands.push_back(imageOperand); #ifdef AMD_EXTENSIONS } else if (cracked.lod) { builder.addExtension(spv::E_SPV_AMD_shader_image_load_store_lod); builder.addCapability(spv::CapabilityImageReadWriteLodAMD); - operands.push_back(spv::ImageOperandsLodMask); - operands.push_back(*opIt++); + spv::IdImmediate imageOperands = { false, spv::ImageOperandsLodMask }; + operands.push_back(imageOperands); + spv::IdImmediate imageOperand = { true, *opIt++ }; + operands.push_back(imageOperand); #endif } @@ -3741,7 +3766,9 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO // GLSL "IMAGE_PARAMS" will involve in constructing an image texel pointer and this pointer, // as the first source operand, is required by SPIR-V atomic operations. - operands.push_back(sampler.ms ? *(opIt++) : builder.makeUintConstant(0)); // For non-MS, the value should be 0 + // For non-MS, the sample value should be 0 + spv::IdImmediate sample = { true, sampler.ms ? *(opIt++) : builder.makeUintConstant(0) }; + operands.push_back(sample); spv::Id resultTypeId = builder.makePointer(spv::StorageClassImage, resultType()); spv::Id pointer = builder.createOp(spv::OpImageTexelPointer, resultTypeId, operands); @@ -4627,27 +4654,21 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe unaryOp = spv::OpFwidth; break; case glslang::EOpDPdxFine: - builder.addCapability(spv::CapabilityDerivativeControl); unaryOp = spv::OpDPdxFine; break; case glslang::EOpDPdyFine: - builder.addCapability(spv::CapabilityDerivativeControl); unaryOp = spv::OpDPdyFine; break; case glslang::EOpFwidthFine: - builder.addCapability(spv::CapabilityDerivativeControl); unaryOp = spv::OpFwidthFine; break; case glslang::EOpDPdxCoarse: - builder.addCapability(spv::CapabilityDerivativeControl); unaryOp = spv::OpDPdxCoarse; break; case glslang::EOpDPdyCoarse: - builder.addCapability(spv::CapabilityDerivativeControl); unaryOp = spv::OpDPdyCoarse; break; case glslang::EOpFwidthCoarse: - builder.addCapability(spv::CapabilityDerivativeControl); unaryOp = spv::OpFwidthCoarse; break; case glslang::EOpInterpolateAtCentroid: @@ -4655,7 +4676,6 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe if (typeProxy == glslang::EbtFloat16) builder.addExtension(spv::E_SPV_AMD_gpu_shader_half_float); #endif - builder.addCapability(spv::CapabilityInterpolationFunction); libCall = spv::GLSLstd450InterpolateAtCentroid; break; case glslang::EOpAny: @@ -4791,8 +4811,6 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe #endif #ifdef NV_EXTENSIONS case glslang::EOpSubgroupPartition: - builder.addExtension(spv::E_SPV_NV_shader_subgroup_partitioned); - builder.addCapability(spv::CapabilityGroupNonUniformPartitionedNV); unaryOp = spv::OpGroupNonUniformPartitionNV; break; #endif @@ -5383,11 +5401,13 @@ spv::Id TGlslangToSpvTraverser::createAtomicOperation(glslang::TOperator op, spv // Create group invocation operations. spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op, spv::Id typeId, std::vector& operands, glslang::TBasicType typeProxy) { +#ifdef AMD_EXTENSIONS bool isUnsigned = isTypeUnsignedInt(typeProxy); bool isFloat = isTypeFloat(typeProxy); +#endif spv::Op opCode = spv::OpNop; - std::vector spvGroupOperands; + std::vector spvGroupOperands; spv::GroupOperation groupOperation = spv::GroupOperationMax; if (op == glslang::EOpBallot || op == glslang::EOpReadFirstInvocation || @@ -5414,7 +5434,6 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op builder.addExtension(spv::E_SPV_AMD_shader_ballot); #endif - spvGroupOperands.push_back(builder.makeUintConstant(spv::ScopeSubgroup)); #ifdef AMD_EXTENSIONS switch (op) { case glslang::EOpMinInvocations: @@ -5424,7 +5443,6 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op case glslang::EOpMaxInvocationsNonUniform: case glslang::EOpAddInvocationsNonUniform: groupOperation = spv::GroupOperationReduce; - spvGroupOperands.push_back(groupOperation); break; case glslang::EOpMinInvocationsInclusiveScan: case glslang::EOpMaxInvocationsInclusiveScan: @@ -5433,7 +5451,6 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op case glslang::EOpMaxInvocationsInclusiveScanNonUniform: case glslang::EOpAddInvocationsInclusiveScanNonUniform: groupOperation = spv::GroupOperationInclusiveScan; - spvGroupOperands.push_back(groupOperation); break; case glslang::EOpMinInvocationsExclusiveScan: case glslang::EOpMaxInvocationsExclusiveScan: @@ -5442,16 +5459,23 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op case glslang::EOpMaxInvocationsExclusiveScanNonUniform: case glslang::EOpAddInvocationsExclusiveScanNonUniform: groupOperation = spv::GroupOperationExclusiveScan; - spvGroupOperands.push_back(groupOperation); break; default: break; } + spv::IdImmediate scope = { true, builder.makeUintConstant(spv::ScopeSubgroup) }; + spvGroupOperands.push_back(scope); + if (groupOperation != spv::GroupOperationMax) { + spv::IdImmediate groupOp = { false, groupOperation }; + spvGroupOperands.push_back(groupOp); + } #endif } - for (auto opIt = operands.begin(); opIt != operands.end(); ++opIt) - spvGroupOperands.push_back(*opIt); + for (auto opIt = operands.begin(); opIt != operands.end(); ++opIt) { + spv::IdImmediate op = { true, *opIt }; + spvGroupOperands.push_back(op); + } switch (op) { case glslang::EOpAnyInvocation: @@ -5590,7 +5614,8 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op } // Create group invocation operations on a vector -spv::Id TGlslangToSpvTraverser::CreateInvocationsVectorOperation(spv::Op op, spv::GroupOperation groupOperation, spv::Id typeId, std::vector& operands) +spv::Id TGlslangToSpvTraverser::CreateInvocationsVectorOperation(spv::Op op, spv::GroupOperation groupOperation, + spv::Id typeId, std::vector& operands) { #ifdef AMD_EXTENSIONS assert(op == spv::OpGroupFMin || op == spv::OpGroupUMin || op == spv::OpGroupSMin || @@ -5623,18 +5648,23 @@ spv::Id TGlslangToSpvTraverser::CreateInvocationsVectorOperation(spv::Op op, spv for (int comp = 0; comp < numComponents; ++comp) { std::vector indexes; indexes.push_back(comp); - spv::Id scalar = builder.createCompositeExtract(operands[0], scalarType, indexes); - std::vector spvGroupOperands; + spv::IdImmediate scalar = { true, builder.createCompositeExtract(operands[0], scalarType, indexes) }; + std::vector spvGroupOperands; if (op == spv::OpSubgroupReadInvocationKHR) { spvGroupOperands.push_back(scalar); - spvGroupOperands.push_back(operands[1]); + spv::IdImmediate operand = { true, operands[1] }; + spvGroupOperands.push_back(operand); } else if (op == spv::OpGroupBroadcast) { - spvGroupOperands.push_back(builder.makeUintConstant(spv::ScopeSubgroup)); + spv::IdImmediate scope = { true, builder.makeUintConstant(spv::ScopeSubgroup) }; + spvGroupOperands.push_back(scope); spvGroupOperands.push_back(scalar); - spvGroupOperands.push_back(operands[1]); + spv::IdImmediate operand = { true, operands[1] }; + spvGroupOperands.push_back(operand); } else { - spvGroupOperands.push_back(builder.makeUintConstant(spv::ScopeSubgroup)); - spvGroupOperands.push_back(groupOperation); + spv::IdImmediate scope = { true, builder.makeUintConstant(spv::ScopeSubgroup) }; + spvGroupOperands.push_back(scope); + spv::IdImmediate groupOp = { false, groupOperation }; + spvGroupOperands.push_back(groupOp); spvGroupOperands.push_back(scalar); } @@ -5646,7 +5676,8 @@ spv::Id TGlslangToSpvTraverser::CreateInvocationsVectorOperation(spv::Op op, spv } // Create subgroup invocation operations. -spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, spv::Id typeId, std::vector& operands, glslang::TBasicType typeProxy) +spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, spv::Id typeId, + std::vector& operands, glslang::TBasicType typeProxy) { // Add the required capabilities. switch (op) { @@ -5894,14 +5925,11 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s default: assert(0 && "Unhandled subgroup operation!"); } - std::vector spvGroupOperands; - - // Every operation begins with the Execution Scope operand. - spvGroupOperands.push_back(builder.makeUintConstant(spv::ScopeSubgroup)); - - // Next, for all operations that use a Group Operation, push that as an operand. + // get the right Group Operation + spv::GroupOperation groupOperation = spv::GroupOperationMax; switch (op) { - default: break; + default: + break; case glslang::EOpSubgroupBallotBitCount: case glslang::EOpSubgroupAdd: case glslang::EOpSubgroupMul: @@ -5910,7 +5938,7 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s case glslang::EOpSubgroupAnd: case glslang::EOpSubgroupOr: case glslang::EOpSubgroupXor: - spvGroupOperands.push_back(spv::GroupOperationReduce); + groupOperation = spv::GroupOperationReduce; break; case glslang::EOpSubgroupBallotInclusiveBitCount: case glslang::EOpSubgroupInclusiveAdd: @@ -5920,7 +5948,7 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s case glslang::EOpSubgroupInclusiveAnd: case glslang::EOpSubgroupInclusiveOr: case glslang::EOpSubgroupInclusiveXor: - spvGroupOperands.push_back(spv::GroupOperationInclusiveScan); + groupOperation = spv::GroupOperationInclusiveScan; break; case glslang::EOpSubgroupBallotExclusiveBitCount: case glslang::EOpSubgroupExclusiveAdd: @@ -5930,7 +5958,7 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s case glslang::EOpSubgroupExclusiveAnd: case glslang::EOpSubgroupExclusiveOr: case glslang::EOpSubgroupExclusiveXor: - spvGroupOperands.push_back(spv::GroupOperationExclusiveScan); + groupOperation = spv::GroupOperationExclusiveScan; break; case glslang::EOpSubgroupClusteredAdd: case glslang::EOpSubgroupClusteredMul: @@ -5939,7 +5967,7 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s case glslang::EOpSubgroupClusteredAnd: case glslang::EOpSubgroupClusteredOr: case glslang::EOpSubgroupClusteredXor: - spvGroupOperands.push_back(spv::GroupOperationClusteredReduce); + groupOperation = spv::GroupOperationClusteredReduce; break; #ifdef NV_EXTENSIONS case glslang::EOpSubgroupPartitionedAdd: @@ -5949,7 +5977,7 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s case glslang::EOpSubgroupPartitionedAnd: case glslang::EOpSubgroupPartitionedOr: case glslang::EOpSubgroupPartitionedXor: - spvGroupOperands.push_back(spv::GroupOperationPartitionedReduceNV); + groupOperation = spv::GroupOperationPartitionedReduceNV; break; case glslang::EOpSubgroupPartitionedInclusiveAdd: case glslang::EOpSubgroupPartitionedInclusiveMul: @@ -5958,7 +5986,7 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s case glslang::EOpSubgroupPartitionedInclusiveAnd: case glslang::EOpSubgroupPartitionedInclusiveOr: case glslang::EOpSubgroupPartitionedInclusiveXor: - spvGroupOperands.push_back(spv::GroupOperationPartitionedInclusiveScanNV); + groupOperation = spv::GroupOperationPartitionedInclusiveScanNV; break; case glslang::EOpSubgroupPartitionedExclusiveAdd: case glslang::EOpSubgroupPartitionedExclusiveMul: @@ -5967,22 +5995,41 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s case glslang::EOpSubgroupPartitionedExclusiveAnd: case glslang::EOpSubgroupPartitionedExclusiveOr: case glslang::EOpSubgroupPartitionedExclusiveXor: - spvGroupOperands.push_back(spv::GroupOperationPartitionedExclusiveScanNV); + groupOperation = spv::GroupOperationPartitionedExclusiveScanNV; break; #endif } + // build the instruction + std::vector spvGroupOperands; + + // Every operation begins with the Execution Scope operand. + spv::IdImmediate executionScope = { true, builder.makeUintConstant(spv::ScopeSubgroup) }; + spvGroupOperands.push_back(executionScope); + + // Next, for all operations that use a Group Operation, push that as an operand. + if (groupOperation != spv::GroupOperationMax) { + spv::IdImmediate groupOperand = { false, groupOperation }; + spvGroupOperands.push_back(groupOperand); + } + // Push back the operands next. - for (auto opIt : operands) { - spvGroupOperands.push_back(opIt); + for (auto opIt = operands.cbegin(); opIt != operands.cend(); ++opIt) { + spv::IdImmediate operand = { true, *opIt }; + spvGroupOperands.push_back(operand); } // Some opcodes have additional operands. + spv::Id directionId = spv::NoResult; switch (op) { default: break; - case glslang::EOpSubgroupQuadSwapHorizontal: spvGroupOperands.push_back(builder.makeUintConstant(0)); break; - case glslang::EOpSubgroupQuadSwapVertical: spvGroupOperands.push_back(builder.makeUintConstant(1)); break; - case glslang::EOpSubgroupQuadSwapDiagonal: spvGroupOperands.push_back(builder.makeUintConstant(2)); break; + case glslang::EOpSubgroupQuadSwapHorizontal: directionId = builder.makeUintConstant(0); break; + case glslang::EOpSubgroupQuadSwapVertical: directionId = builder.makeUintConstant(1); break; + case glslang::EOpSubgroupQuadSwapDiagonal: directionId = builder.makeUintConstant(2); break; + } + if (directionId != spv::NoResult) { + spv::IdImmediate direction = { true, directionId }; + spvGroupOperands.push_back(direction); } return builder.createOp(opCode, typeId, spvGroupOperands); @@ -6087,7 +6134,6 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: if (typeProxy == glslang::EbtFloat16) builder.addExtension(spv::E_SPV_AMD_gpu_shader_half_float); #endif - builder.addCapability(spv::CapabilityInterpolationFunction); libCall = spv::GLSLstd450InterpolateAtSample; break; case glslang::EOpInterpolateAtOffset: @@ -6095,7 +6141,6 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: if (typeProxy == glslang::EbtFloat16) builder.addExtension(spv::E_SPV_AMD_gpu_shader_half_float); #endif - builder.addCapability(spv::CapabilityInterpolationFunction); libCall = spv::GLSLstd450InterpolateAtOffset; break; case glslang::EOpAddCarry: diff --git a/third_party/glslang/SPIRV/GlslangToSpv.h b/third_party/glslang/SPIRV/GlslangToSpv.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/SPIRV/InReadableOrder.cpp b/third_party/glslang/SPIRV/InReadableOrder.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/SPIRV/Logger.cpp b/third_party/glslang/SPIRV/Logger.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/SPIRV/Logger.h b/third_party/glslang/SPIRV/Logger.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/SPIRV/SpvBuilder.cpp b/third_party/glslang/SPIRV/SpvBuilder.cpp index 6fd0ee8547..5a7bb5ce2c 100755 --- a/third_party/glslang/SPIRV/SpvBuilder.cpp +++ b/third_party/glslang/SPIRV/SpvBuilder.cpp @@ -81,6 +81,7 @@ Id Builder::import(const char* name) { Instruction* import = new Instruction(getUniqueId(), NoType, OpExtInstImport); import->addStringOperand(name); + module.mapInstruction(import); imports.push_back(std::unique_ptr(import)); return import->getResultId(); @@ -509,7 +510,7 @@ Id Builder::getDerefTypeId(Id resultId) const Id typeId = getTypeId(resultId); assert(isPointerType(typeId)); - return module.getInstruction(typeId)->getImmediateOperand(1); + return module.getInstruction(typeId)->getIdOperand(1); } Op Builder::getMostBasicTypeClass(Id typeId) const @@ -553,7 +554,7 @@ int Builder::getNumTypeConstituents(Id typeId) const return instr->getImmediateOperand(1); case OpTypeArray: { - Id lengthId = instr->getImmediateOperand(1); + Id lengthId = instr->getIdOperand(1); return module.getInstruction(lengthId)->getImmediateOperand(0); } case OpTypeStruct: @@ -1331,7 +1332,7 @@ void Builder::createNoResultOp(Op opCode) buildPoint->addInstruction(std::unique_ptr(op)); } -// An opcode that has one operand, no result id, and no type +// An opcode that has one id operand, no result id, and no type void Builder::createNoResultOp(Op opCode, Id operand) { Instruction* op = new Instruction(opCode); @@ -1339,29 +1340,33 @@ void Builder::createNoResultOp(Op opCode, Id operand) buildPoint->addInstruction(std::unique_ptr(op)); } -// An opcode that has one operand, no result id, and no type -void Builder::createNoResultOp(Op opCode, const std::vector& operands) +// An opcode that has multiple operands, no result id, and no type +void Builder::createNoResultOp(Op opCode, const std::vector& operands) { Instruction* op = new Instruction(opCode); - for (auto it = operands.cbegin(); it != operands.cend(); ++it) - op->addIdOperand(*it); + for (auto it = operands.cbegin(); it != operands.cend(); ++it) { + if (it->isId) + op->addIdOperand(it->word); + else + op->addImmediateOperand(it->word); + } buildPoint->addInstruction(std::unique_ptr(op)); } void Builder::createControlBarrier(Scope execution, Scope memory, MemorySemanticsMask semantics) { Instruction* op = new Instruction(OpControlBarrier); - op->addImmediateOperand(makeUintConstant(execution)); - op->addImmediateOperand(makeUintConstant(memory)); - op->addImmediateOperand(makeUintConstant(semantics)); + op->addIdOperand(makeUintConstant(execution)); + op->addIdOperand(makeUintConstant(memory)); + op->addIdOperand(makeUintConstant(semantics)); buildPoint->addInstruction(std::unique_ptr(op)); } void Builder::createMemoryBarrier(unsigned executionScope, unsigned memorySemantics) { Instruction* op = new Instruction(OpMemoryBarrier); - op->addImmediateOperand(makeUintConstant(executionScope)); - op->addImmediateOperand(makeUintConstant(memorySemantics)); + op->addIdOperand(makeUintConstant(executionScope)); + op->addIdOperand(makeUintConstant(memorySemantics)); buildPoint->addInstruction(std::unique_ptr(op)); } @@ -1428,6 +1433,20 @@ Id Builder::createOp(Op opCode, Id typeId, const std::vector& operands) return op->getResultId(); } +Id Builder::createOp(Op opCode, Id typeId, const std::vector& operands) +{ + Instruction* op = new Instruction(getUniqueId(), typeId, opCode); + for (auto it = operands.cbegin(); it != operands.cend(); ++it) { + if (it->isId) + op->addIdOperand(it->word); + else + op->addImmediateOperand(it->word); + } + buildPoint->addInstruction(std::unique_ptr(op)); + + return op->getResultId(); +} + Id Builder::createSpecConstantOp(Op opCode, Id typeId, const std::vector& operands, const std::vector& literals) { Instruction* op = new Instruction(getUniqueId(), typeId, OpSpecConstantOp); @@ -1774,9 +1793,6 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, // Comments in header Id Builder::createTextureQueryCall(Op opCode, const TextureParameters& parameters, bool isUnsignedResult) { - // All these need a capability - addCapability(CapabilityImageQuery); - // Figure out the result type Id resultType = 0; switch (opCode) { @@ -2029,7 +2045,7 @@ Id Builder::createMatrixConstructor(Decoration precision, const std::vector& int numRows = getTypeNumRows(resultTypeId); Instruction* instr = module.getInstruction(componentTypeId); - Id bitCount = instr->getIdOperand(0); + unsigned bitCount = instr->getImmediateOperand(0); // Optimize matrix constructed from a bigger matrix if (isMatrix(sources[0]) && getNumColumns(sources[0]) >= numCols && getNumRows(sources[0]) >= numRows) { @@ -2483,42 +2499,6 @@ Id Builder::accessChainGetInferredType() return type; } -// comment in header -void Builder::eliminateDeadDecorations() { - std::unordered_set reachable_blocks; - std::unordered_set unreachable_definitions; - // Collect IDs defined in unreachable blocks. For each function, label the - // reachable blocks first. Then for each unreachable block, collect the - // result IDs of the instructions in it. - for (std::vector::const_iterator fi = module.getFunctions().cbegin(); - fi != module.getFunctions().cend(); fi++) { - Function* f = *fi; - Block* entry = f->getEntryBlock(); - inReadableOrder(entry, [&reachable_blocks](const Block* b) { - reachable_blocks.insert(b); - }); - for (std::vector::const_iterator bi = f->getBlocks().cbegin(); - bi != f->getBlocks().cend(); bi++) { - Block* b = *bi; - if (!reachable_blocks.count(b)) { - for (std::vector >::const_iterator - ii = b->getInstructions().cbegin(); - ii != b->getInstructions().cend(); ii++) { - Instruction* i = ii->get(); - unreachable_definitions.insert(i->getResultId()); - } - } - } - } - decorations.erase(std::remove_if(decorations.begin(), decorations.end(), - [&unreachable_definitions](std::unique_ptr& I) -> bool { - Instruction* inst = I.get(); - Id decoration_id = inst->getIdOperand(0); - return unreachable_definitions.count(decoration_id) != 0; - }), - decorations.end()); -} - void Builder::dump(std::vector& out) const { // Header, before first instructions: diff --git a/third_party/glslang/SPIRV/SpvBuilder.h b/third_party/glslang/SPIRV/SpvBuilder.h index 099b1d957f..01698b3537 100755 --- a/third_party/glslang/SPIRV/SpvBuilder.h +++ b/third_party/glslang/SPIRV/SpvBuilder.h @@ -295,13 +295,14 @@ public: void createNoResultOp(Op); void createNoResultOp(Op, Id operand); - void createNoResultOp(Op, const std::vector& operands); + void createNoResultOp(Op, const std::vector& operands); void createControlBarrier(Scope execution, Scope memory, MemorySemanticsMask); void createMemoryBarrier(unsigned executionScope, unsigned memorySemantics); Id createUnaryOp(Op, Id typeId, Id operand); Id createBinOp(Op, Id typeId, Id operand1, Id operand2); Id createTriOp(Op, Id typeId, Id operand1, Id operand2, Id operand3); Id createOp(Op, Id typeId, const std::vector& operands); + Id createOp(Op, Id typeId, const std::vector& operands); Id createFunctionCall(spv::Function*, const std::vector&); Id createSpecConstantOp(Op, Id typeId, const std::vector& operands, const std::vector& literals); @@ -563,9 +564,15 @@ public: // based on the type of the base and the chain of dereferences. Id accessChainGetInferredType(); - // Remove OpDecorate instructions whose operands are defined in unreachable - // blocks. - void eliminateDeadDecorations(); + // Add capabilities, extensions, remove unneeded decorations, etc., + // based on the resulting SPIR-V. + void postProcess(); + + // Hook to visit each instruction in a block in a function + void postProcess(Instruction& inst); + // Hook to visit each instruction in a reachable block in a function. + void postProcessReachable(Instruction& inst); + void dump(std::vector&) const; void createBranch(Block* block); diff --git a/third_party/glslang/SPIRV/SpvPostProcess.cpp b/third_party/glslang/SPIRV/SpvPostProcess.cpp new file mode 100755 index 0000000000..df6ba81729 --- /dev/null +++ b/third_party/glslang/SPIRV/SpvPostProcess.cpp @@ -0,0 +1,164 @@ +// +// Copyright (C) 2016-2018 Google, Inc. +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// +// Neither the name of 3Dlabs Inc. Ltd. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// +// Post-processing for SPIR-V IR, in internal form, not standard binary form. +// + +#include +#include + +#include +#include + +#include "SpvBuilder.h" + +#include "spirv.hpp" +#include "GlslangToSpv.h" +#include "SpvBuilder.h" +namespace spv { + #include "GLSL.std.450.h" + #include "GLSL.ext.KHR.h" + #include "GLSL.ext.EXT.h" +#ifdef AMD_EXTENSIONS + #include "GLSL.ext.AMD.h" +#endif +#ifdef NV_EXTENSIONS + #include "GLSL.ext.NV.h" +#endif +} + +namespace spv { + +// Called for each instruction that resides in a block. +void Builder::postProcess(Instruction& inst) +{ + // Add capabilities based simply on the opcode. + switch (inst.getOpCode()) { + case OpExtInst: + switch (inst.getImmediateOperand(1)) { + case GLSLstd450InterpolateAtCentroid: + case GLSLstd450InterpolateAtSample: + case GLSLstd450InterpolateAtOffset: + addCapability(CapabilityInterpolationFunction); + break; + default: + break; + } + break; + case OpDPdxFine: + case OpDPdyFine: + case OpFwidthFine: + case OpDPdxCoarse: + case OpDPdyCoarse: + case OpFwidthCoarse: + addCapability(CapabilityDerivativeControl); + break; + + case OpImageQueryLod: + case OpImageQuerySize: + case OpImageQuerySizeLod: + case OpImageQuerySamples: + case OpImageQueryLevels: + addCapability(CapabilityImageQuery); + break; + +#ifdef NV_EXTENSIONS + case OpGroupNonUniformPartitionNV: + addExtension(E_SPV_NV_shader_subgroup_partitioned); + addCapability(CapabilityGroupNonUniformPartitionedNV); + break; +#endif + + default: + break; + } +} + +// Called for each instruction in a reachable block. +void Builder::postProcessReachable(Instruction& inst) +{ + // did have code here, but questionable to do so without deleting the instructions +} + +// comment in header +void Builder::postProcess() +{ + std::unordered_set reachableBlocks; + std::unordered_set unreachableDefinitions; + // Collect IDs defined in unreachable blocks. For each function, label the + // reachable blocks first. Then for each unreachable block, collect the + // result IDs of the instructions in it. + for (auto fi = module.getFunctions().cbegin(); fi != module.getFunctions().cend(); fi++) { + Function* f = *fi; + Block* entry = f->getEntryBlock(); + inReadableOrder(entry, [&reachableBlocks](const Block* b) { reachableBlocks.insert(b); }); + for (auto bi = f->getBlocks().cbegin(); bi != f->getBlocks().cend(); bi++) { + Block* b = *bi; + if (reachableBlocks.count(b) == 0) { + for (auto ii = b->getInstructions().cbegin(); ii != b->getInstructions().cend(); ii++) + unreachableDefinitions.insert(ii->get()->getResultId()); + } + } + } + + // Remove unneeded decorations, for unreachable instructions + decorations.erase(std::remove_if(decorations.begin(), decorations.end(), + [&unreachableDefinitions](std::unique_ptr& I) -> bool { + Id decoration_id = I.get()->getIdOperand(0); + return unreachableDefinitions.count(decoration_id) != 0; + }), + decorations.end()); + + // Add per-instruction capabilities, extensions, etc., + + // process all reachable instructions... + for (auto bi = reachableBlocks.cbegin(); bi != reachableBlocks.cend(); ++bi) { + const Block* block = *bi; + const auto function = [this](const std::unique_ptr& inst) { postProcessReachable(*inst.get()); }; + std::for_each(block->getInstructions().begin(), block->getInstructions().end(), function); + } + + // process all block-contained instructions + for (auto fi = module.getFunctions().cbegin(); fi != module.getFunctions().cend(); fi++) { + Function* f = *fi; + for (auto bi = f->getBlocks().cbegin(); bi != f->getBlocks().cend(); bi++) { + Block* b = *bi; + for (auto ii = b->getInstructions().cbegin(); ii != b->getInstructions().cend(); ii++) + postProcess(*ii->get()); + } + } +} + +}; // end spv namespace diff --git a/third_party/glslang/SPIRV/bitutils.h b/third_party/glslang/SPIRV/bitutils.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/SPIRV/doc.h b/third_party/glslang/SPIRV/doc.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/SPIRV/hex_float.h b/third_party/glslang/SPIRV/hex_float.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/SPIRV/spvIR.h b/third_party/glslang/SPIRV/spvIR.h index 8b6c6447f4..14d997dd8a 100755 --- a/third_party/glslang/SPIRV/spvIR.h +++ b/third_party/glslang/SPIRV/spvIR.h @@ -79,6 +79,11 @@ const MemorySemanticsMask MemorySemanticsAllMemory = MemorySemanticsAtomicCounterMemoryMask | MemorySemanticsImageMemoryMask); +struct IdImmediate { + bool isId; // true if word is an Id, false if word is an immediate + unsigned word; +}; + // // SPIR-V IR instruction. // @@ -88,8 +93,14 @@ public: Instruction(Id resultId, Id typeId, Op opCode) : resultId(resultId), typeId(typeId), opCode(opCode), block(nullptr) { } explicit Instruction(Op opCode) : resultId(NoResult), typeId(NoType), opCode(opCode), block(nullptr) { } virtual ~Instruction() {} - void addIdOperand(Id id) { operands.push_back(id); } - void addImmediateOperand(unsigned int immediate) { operands.push_back(immediate); } + void addIdOperand(Id id) { + operands.push_back(id); + idOperand.push_back(true); + } + void addImmediateOperand(unsigned int immediate) { + operands.push_back(immediate); + idOperand.push_back(false); + } void addStringOperand(const char* str) { unsigned int word; @@ -116,14 +127,25 @@ public: addImmediateOperand(word); } } + bool isIdOperand(int op) { return idOperand[op]; } void setBlock(Block* b) { block = b; } Block* getBlock() const { return block; } Op getOpCode() const { return opCode; } - int getNumOperands() const { return (int)operands.size(); } + int getNumOperands() const + { + assert(operands.size() == idOperand.size()); + return (int)operands.size(); + } Id getResultId() const { return resultId; } Id getTypeId() const { return typeId; } - Id getIdOperand(int op) const { return operands[op]; } - unsigned int getImmediateOperand(int op) const { return operands[op]; } + Id getIdOperand(int op) const { + assert(idOperand[op]); + return operands[op]; + } + unsigned int getImmediateOperand(int op) const { + assert(!idOperand[op]); + return operands[op]; + } // Write out the binary form. void dump(std::vector& out) const @@ -153,7 +175,8 @@ protected: Id resultId; Id typeId; Op opCode; - std::vector operands; + std::vector operands; // operands, both and immediates (both are unsigned int) + std::vector idOperand; // true for operands that are , false for immediates Block* block; }; @@ -331,7 +354,9 @@ public: Instruction* getInstruction(Id id) const { return idToInstruction[id]; } const std::vector& getFunctions() const { return functions; } - spv::Id getTypeId(Id resultId) const { return idToInstruction[resultId]->getTypeId(); } + spv::Id getTypeId(Id resultId) const { + return idToInstruction[resultId] == nullptr ? NoType : idToInstruction[resultId]->getTypeId(); + } StorageClass getStorageClass(Id typeId) const { assert(idToInstruction[typeId]->getOpCode() == spv::OpTypePointer); diff --git a/third_party/glslang/SPIRV/tnt/CMakeLists.txt b/third_party/glslang/SPIRV/tnt/CMakeLists.txt index 20664f3dca..fd3a53e1bb 100644 --- a/third_party/glslang/SPIRV/tnt/CMakeLists.txt +++ b/third_party/glslang/SPIRV/tnt/CMakeLists.txt @@ -3,6 +3,7 @@ set(SOURCES ../InReadableOrder.cpp ../Logger.cpp ../SpvBuilder.cpp + ../SpvPostProcess.cpp ../doc.cpp ../disassemble.cpp) diff --git a/third_party/glslang/StandAlone/DirStackFileIncluder.h b/third_party/glslang/StandAlone/DirStackFileIncluder.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/StandAlone/ResourceLimits.cpp b/third_party/glslang/StandAlone/ResourceLimits.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/StandAlone/ResourceLimits.h b/third_party/glslang/StandAlone/ResourceLimits.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/StandAlone/StandAlone.cpp b/third_party/glslang/StandAlone/StandAlone.cpp index a159bc8401..e49b26e5a2 100755 --- a/third_party/glslang/StandAlone/StandAlone.cpp +++ b/third_party/glslang/StandAlone/StandAlone.cpp @@ -322,7 +322,7 @@ void ProcessBindingBase(int& argc, char**& argv, glslang::TResourceType res) for (int lang = langMin; lang < langMax; ++lang) { if (!perSetBase.empty()) - baseBindingForSet[res][lang] = perSetBase; + baseBindingForSet[res][lang].insert(perSetBase.begin(), perSetBase.end()); else baseBinding[res][lang] = singleBase; } @@ -446,6 +446,11 @@ void ProcessArguments(std::vector>& workItem Error("--client expects vulkan100 or opengl100"); } bumpArg(); + } else if (lowerword == "entry-point") { + entryPointName = argv[1]; + if (argc <= 1) + Error("no provided for --entry-point"); + bumpArg(); } else if (lowerword == "flatten-uniform-arrays" || // synonyms lowerword == "flatten-uniform-array" || lowerword == "fua") { @@ -478,8 +483,8 @@ void ProcessArguments(std::vector>& workItem lowerword == "sib") { ProcessBindingBase(argc, argv, glslang::EResImage); } else if (lowerword == "shift-sampler-bindings" || // synonyms - lowerword == "shift-sampler-binding" || - lowerword == "ssb") { + lowerword == "shift-sampler-binding" || + lowerword == "ssb") { ProcessBindingBase(argc, argv, glslang::EResSampler); } else if (lowerword == "shift-uav-bindings" || // synonyms lowerword == "shift-uav-binding" || @@ -610,8 +615,6 @@ void ProcessArguments(std::vector>& workItem Options |= EOptionDefaultDesktop; break; case 'e': - // HLSL todo: entry point handle needs much more sophistication. - // This is okay for one compilation unit with one entry point. entryPointName = argv[1]; if (argc <= 1) Error("no provided for -e"); @@ -840,7 +843,7 @@ void CompileAndLinkShaderUnits(std::vector compUnits) const auto &compUnit = *it; glslang::TShader* shader = new glslang::TShader(compUnit.stage); shader->setStringsWithLengthsAndNames(compUnit.text, NULL, compUnit.fileNameList, compUnit.count); - if (entryPointName) // HLSL todo: this needs to be tracked per compUnits + if (entryPointName) shader->setEntryPoint(entryPointName); if (sourceEntryPointName) { if (entryPointName == nullptr) @@ -1323,22 +1326,22 @@ void usage() "\n" "Options:\n" " -C cascading errors; risk crash from accumulation of error recoveries\n" - " -D input is HLSL (default when any suffix is .hlsl)\n" + " -D input is HLSL (this is the default when any suffix is .hlsl)\n" " -D\n" " -D define a pre-processor macro\n" " -E print pre-processed GLSL; cannot be used with -l;\n" - " errors will appear on stderr.\n" + " errors will appear on stderr\n" " -G[ver] create SPIR-V binary, under OpenGL semantics; turns on -l;\n" - " default file name is .spv (-o overrides this)\n" + " default file name is .spv (-o overrides this);\n" " 'ver', when present, is the version of the input semantics,\n" - " which will appear in #define GL_SPIRV ver\n" - " '--client opengl100' is the same as -G100\n" + " which will appear in #define GL_SPIRV ver;\n" + " '--client opengl100' is the same as -G100;\n" " a '--target-env' for OpenGL will also imply '-G'\n" " -H print human readable form of SPIR-V; turns on -V\n" " -I add dir to the include search path; includer's directory\n" " is searched first, followed by left-to-right order of -I\n" - " -Od disables optimization. May cause illegal SPIR-V for HLSL.\n" - " -Os optimizes SPIR-V to minimize size.\n" + " -Od disables optimization; may cause illegal SPIR-V for HLSL\n" + " -Os optimizes SPIR-V to minimize size\n" " -S uses specified stage rather than parsing the file extension\n" " choices for are vert, tesc, tese, geom, frag, or comp\n" " -U undefine a pre-processor macro\n" @@ -1352,10 +1355,11 @@ void usage() " creates the default configuration file (redirect to a .conf file)\n" " -d default to desktop (#version 110) when there is no shader #version\n" " (default is ES version 100)\n" - " -e specify as the entry-point name\n" + " -e | --entry-point \n" + " specify as the entry-point function name\n" " -f{hlsl_functionality1}\n" " 'hlsl_functionality1' enables use of the\n" - " SPV_GOOGLE_hlsl_functionality1 extension\n" + " SPV_GOOGLE_hlsl_functionality1 extension\n" " -g generate debug information\n" " -h print this usage message\n" " -i intermediate tree (glslang AST) is printed out\n" @@ -1363,80 +1367,81 @@ void usage() " -m memory leak mode\n" " -o save binary to , requires a binary option (e.g., -V)\n" " -q dump reflection query database\n" - " -r synonym for --relaxed-errors\n" + " -r | --relaxed-errors" + " relaxed GLSL semantic error-checking mode\n" " -s silence syntax and semantic error reporting\n" " -t multi-threaded mode\n" - " -v print version strings\n" - " -w synonym for --suppress-warnings\n" + " -v | --version\n" + " print version strings\n" + " -w | --suppress-warnings\n" + " suppress GLSL warnings, except as required by \"#extension : warn\"\n" " -x save binary output as text-based 32-bit hexadecimal numbers\n" - " --auto-map-bindings automatically bind uniform variables\n" - " without explicit bindings.\n" - " --amb synonym for --auto-map-bindings\n" - " --auto-map-locations automatically locate input/output lacking\n" - " 'location' (fragile, not cross stage)\n" - " --aml synonym for --auto-map-locations\n" - " --client {vulkan|opengl} see -V and -G\n" - " -dumpfullversion print bare major.minor.patchlevel\n" - " -dumpversion same as -dumpfullversion\n" - " --flatten-uniform-arrays flatten uniform texture/sampler arrays to\n" - " scalars\n" - " --fua synonym for --flatten-uniform-arrays\n" - " --hlsl-offsets Allow block offsets to follow HLSL rules\n" - " Works independently of source language\n" - " --hlsl-iomap Perform IO mapping in HLSL register space\n" - " --hlsl-enable-16bit-types Allow use of 16-bit types in SPIR-V for HLSL\n" - " --invert-y | --iy invert position.Y output in vertex shader\n" - " --keep-uncalled don't eliminate uncalled functions\n" - " --ku synonym for --keep-uncalled\n" - " --no-storage-format use Unknown image format\n" - " --nsf synonym for --no-storage-format\n" - " --relaxed-errors relaxed GLSL semantic error-checking mode\n" + " --auto-map-bindings | --amb automatically bind uniform variables\n" + " without explicit bindings\n" + " --auto-map-locations | --aml automatically locate input/output lacking\n" + " 'location' (fragile, not cross stage)\n" + " --client {vulkan|opengl} see -V and -G\n" + " -dumpfullversion | -dumpversion print bare major.minor.patchlevel\n" + " --flatten-uniform-arrays | --fua flatten uniform texture/sampler arrays to\n" + " scalars\n" + " --hlsl-offsets allow block offsets to follow HLSL rules\n" + " works independently of source language\n" + " --hlsl-iomap perform IO mapping in HLSL register space\n" + " --hlsl-enable-16bit-types allow 16-bit types in SPIR-V for HLSL\n" + " --invert-y | --iy invert position.Y output in vertex shader\n" + " --keep-uncalled | --ku don't eliminate uncalled functions\n" + " --no-storage-format | --nsf use Unknown image format\n" " --resource-set-binding [stage] name set binding\n" - " Set descriptor set and binding for individual resources\n" + " set descriptor set and binding for\n" + " individual resources\n" " --resource-set-binding [stage] set\n" - " Set descriptor set for all resources\n" - " --rsb [stage] type set binding synonym for --resource-set-binding\n" - " --shift-image-binding [stage] num base binding number for images (uav)\n" - " --shift-image-binding [stage] [num set]... per-descriptor-set shift values\n" - " --sib [stage] num synonym for --shift-image-binding\n" - " --shift-sampler-binding [stage] num base binding number for samplers\n" - " --shift-sampler-binding [stage] [num set]... per-descriptor-set shift values\n" - " --ssb [stage] num synonym for --shift-sampler-binding\n" - " --shift-ssbo-binding [stage] num base binding number for SSBOs\n" - " --shift-ssbo-binding [stage] [num set]... per-descriptor-set shift values\n" - " --sbb [stage] num synonym for --shift-ssbo-binding\n" - " --shift-texture-binding [stage] num base binding number for textures\n" - " --shift-texture-binding [stage] [num set]... per-descriptor-set shift values\n" - " --stb [stage] num synonym for --shift-texture-binding\n" - " --shift-uav-binding [stage] num base binding number for UAVs\n" - " --shift-uav-binding [stage] [num set]... per-descriptor-set shift values\n" - " --suavb [stage] num synonym for --shift-uav-binding\n" - " --shift-UBO-binding [stage] num base binding number for UBOs\n" - " --shift-UBO-binding [stage] [num set]... per-descriptor-set shift values\n" - " --shift-cbuffer-binding [stage] num synonym for --shift-UBO-binding\n" - " --shift-cbuffer-binding [stage] [num set]... per-descriptor-set shift values\n" - " --spirv-dis output standard form disassembly; works only\n" - " when a SPIR-V generation option is also used\n" - " --sub [stage] num synonym for --shift-UBO-binding\n" - " --source-entrypoint the given shader source function is\n" - " renamed to be the given in -e\n" - " --sep synonym for --source-entrypoint\n" - " --stdin Read from stdin instead of from a file.\n" - " You'll have to provide the shader stage\n" - " using -S.\n" - " --suppress-warnings suppress GLSL warnings\n" - " (except as required by #extension : warn)\n" + " set descriptor set for all resources\n" + " --rsb synonym for --resource-set-binding\n" + " --shift-image-binding [stage] num\n" + " base binding number for images (uav)\n" + " --shift-image-binding [stage] [num set]...\n" + " per-descriptor-set shift values\n" + " --sib synonym for --shift-image-binding\n" + " --shift-sampler-binding [stage] num\n" + " base binding number for samplers\n" + " --shift-sampler-binding [stage] [num set]...\n" + " per-descriptor-set shift values\n" + " --ssb synonym for --shift-sampler-binding\n" + " --shift-ssbo-binding [stage] num base binding number for SSBOs\n" + " --shift-ssbo-binding [stage] [num set]...\n" + " per-descriptor-set shift values\n" + " --sbb synonym for --shift-ssbo-binding\n" + " --shift-texture-binding [stage] num\n" + " base binding number for textures\n" + " --shift-texture-binding [stage] [num set]...\n" + " per-descriptor-set shift values\n" + " --stb synonym for --shift-texture-binding\n" + " --shift-uav-binding [stage] num base binding number for UAVs\n" + " --shift-uav-binding [stage] [num set]...\n" + " per-descriptor-set shift values\n" + " --suavb synonym for --shift-uav-binding\n" + " --shift-UBO-binding [stage] num base binding number for UBOs\n" + " --shift-UBO-binding [stage] [num set]...\n" + " per-descriptor-set shift values\n" + " --sub synonym for --shift-UBO-binding\n" + " --shift-cbuffer-binding | --scb synonyms for --shift-UBO-binding\n" + " --spirv-dis output standard-form disassembly; works only\n" + " when a SPIR-V generation option is also used\n" + " --source-entrypoint the given shader source function is\n" + " renamed to be the given in -e\n" + " --sep synonym for --source-entrypoint\n" + " --stdin read from stdin instead of from a file;\n" + " requires providing the shader stage using -S\n" " --target-env {vulkan1.0 | vulkan1.1 | opengl} \n" - " set execution environment that emitted code\n" - " will execute in (as opposed to the language\n" - " semantics selected by --client) defaults:\n" - " 'vulkan1.0' under '--client vulkan'\n" - " 'opengl' under '--client opengl'\n" - " --variable-name Creates a C header file that contains a\n" - " uint32_t array named \n" - " initialized with the shader binary code.\n" - " --version synonym for -v\n" - " --vn synonym for --variable-name \n" + " set execution environment that emitted code\n" + " will execute in (as opposed to the language\n" + " semantics selected by --client) defaults:\n" + " * 'vulkan1.0' under '--client vulkan'\n" + " * 'opengl' under '--client opengl'\n" + " --variable-name \n" + " --vn creates a C header file that contains a\n" + " uint32_t array named \n" + " initialized with the shader binary code\n" ); exit(EFailUsage); diff --git a/third_party/glslang/StandAlone/Worklist.h b/third_party/glslang/StandAlone/Worklist.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/StandAlone/spirv-remap.cpp b/third_party/glslang/StandAlone/spirv-remap.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/100.conf b/third_party/glslang/Test/100.conf old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/100.frag b/third_party/glslang/Test/100.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/100Limits.vert b/third_party/glslang/Test/100Limits.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/100samplerExternal.frag b/third_party/glslang/Test/100samplerExternal.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/100scope.vert b/third_party/glslang/Test/100scope.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/120.frag b/third_party/glslang/Test/120.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/120.vert b/third_party/glslang/Test/120.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/130.frag b/third_party/glslang/Test/130.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/130.vert b/third_party/glslang/Test/130.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/140.frag b/third_party/glslang/Test/140.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/140.vert b/third_party/glslang/Test/140.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/150.frag b/third_party/glslang/Test/150.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/150.geom b/third_party/glslang/Test/150.geom old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/150.tesc b/third_party/glslang/Test/150.tesc old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/150.tese b/third_party/glslang/Test/150.tese old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/150.vert b/third_party/glslang/Test/150.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/300.frag b/third_party/glslang/Test/300.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/300.vert b/third_party/glslang/Test/300.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/300BuiltIns.frag b/third_party/glslang/Test/300BuiltIns.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/300block.frag b/third_party/glslang/Test/300block.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/300layout.frag b/third_party/glslang/Test/300layout.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/300layout.vert b/third_party/glslang/Test/300layout.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/300link.frag b/third_party/glslang/Test/300link.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/300link2.frag b/third_party/glslang/Test/300link2.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/300link3.frag b/third_party/glslang/Test/300link3.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/300operations.frag b/third_party/glslang/Test/300operations.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/300samplerExternal.frag b/third_party/glslang/Test/300samplerExternal.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/300scope.vert b/third_party/glslang/Test/300scope.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/310.comp b/third_party/glslang/Test/310.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/310.frag b/third_party/glslang/Test/310.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/310.geom b/third_party/glslang/Test/310.geom old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/310.tesc b/third_party/glslang/Test/310.tesc old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/310.tese b/third_party/glslang/Test/310.tese old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/310.vert b/third_party/glslang/Test/310.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/310AofA.vert b/third_party/glslang/Test/310AofA.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/310implicitSizeArrayError.vert b/third_party/glslang/Test/310implicitSizeArrayError.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/320.comp b/third_party/glslang/Test/320.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/320.frag b/third_party/glslang/Test/320.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/320.geom b/third_party/glslang/Test/320.geom old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/320.tesc b/third_party/glslang/Test/320.tesc old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/320.tese b/third_party/glslang/Test/320.tese old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/320.vert b/third_party/glslang/Test/320.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/330.frag b/third_party/glslang/Test/330.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/330comp.frag b/third_party/glslang/Test/330comp.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/400.frag b/third_party/glslang/Test/400.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/400.tesc b/third_party/glslang/Test/400.tesc old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/400.tese b/third_party/glslang/Test/400.tese old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/400.vert b/third_party/glslang/Test/400.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/410.geom b/third_party/glslang/Test/410.geom old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/410.tesc b/third_party/glslang/Test/410.tesc old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/410.vert b/third_party/glslang/Test/410.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/420.frag b/third_party/glslang/Test/420.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/420.geom b/third_party/glslang/Test/420.geom old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/420.tesc b/third_party/glslang/Test/420.tesc old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/420.tese b/third_party/glslang/Test/420.tese old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/420.vert b/third_party/glslang/Test/420.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/420_size_gl_in.geom b/third_party/glslang/Test/420_size_gl_in.geom old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/430.comp b/third_party/glslang/Test/430.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/430.vert b/third_party/glslang/Test/430.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/430AofA.frag b/third_party/glslang/Test/430AofA.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/430scope.vert b/third_party/glslang/Test/430scope.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/435.vert b/third_party/glslang/Test/435.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/440.frag b/third_party/glslang/Test/440.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/440.vert b/third_party/glslang/Test/440.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/450.comp b/third_party/glslang/Test/450.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/450.frag b/third_party/glslang/Test/450.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/450.geom b/third_party/glslang/Test/450.geom old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/450.tesc b/third_party/glslang/Test/450.tesc old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/450.tese b/third_party/glslang/Test/450.tese old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/450.vert b/third_party/glslang/Test/450.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/460.frag b/third_party/glslang/Test/460.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/460.vert b/third_party/glslang/Test/460.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/Operations.frag b/third_party/glslang/Test/Operations.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/aggOps.frag b/third_party/glslang/Test/aggOps.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/always-discard.frag b/third_party/glslang/Test/always-discard.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/always-discard2.frag b/third_party/glslang/Test/always-discard2.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/array.frag b/third_party/glslang/Test/array.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/array100.frag b/third_party/glslang/Test/array100.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/atomic_uint.frag b/third_party/glslang/Test/atomic_uint.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/badChars.frag b/third_party/glslang/Test/badChars.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/bar.h b/third_party/glslang/Test/bar.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseLegalResults/hlsl.aliasOpaque.frag.out b/third_party/glslang/Test/baseLegalResults/hlsl.aliasOpaque.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseLegalResults/hlsl.flattenOpaque.frag.out b/third_party/glslang/Test/baseLegalResults/hlsl.flattenOpaque.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseLegalResults/hlsl.flattenOpaqueInit.vert.out b/third_party/glslang/Test/baseLegalResults/hlsl.flattenOpaqueInit.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseLegalResults/hlsl.flattenOpaqueInitMix.vert.out b/third_party/glslang/Test/baseLegalResults/hlsl.flattenOpaqueInitMix.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/100.frag.out b/third_party/glslang/Test/baseResults/100.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/100Limits.vert.out b/third_party/glslang/Test/baseResults/100Limits.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/100LimitsConf.vert.out b/third_party/glslang/Test/baseResults/100LimitsConf.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/100samplerExternal.frag.out b/third_party/glslang/Test/baseResults/100samplerExternal.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/100scope.vert.out b/third_party/glslang/Test/baseResults/100scope.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/110scope.vert.out b/third_party/glslang/Test/baseResults/110scope.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/120.frag.out b/third_party/glslang/Test/baseResults/120.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/120.vert.out b/third_party/glslang/Test/baseResults/120.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/130.frag.out b/third_party/glslang/Test/baseResults/130.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/130.vert.out b/third_party/glslang/Test/baseResults/130.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/140.frag.out b/third_party/glslang/Test/baseResults/140.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/140.vert.out b/third_party/glslang/Test/baseResults/140.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/150.frag.out b/third_party/glslang/Test/baseResults/150.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/150.geom.out b/third_party/glslang/Test/baseResults/150.geom.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/150.tesc.out b/third_party/glslang/Test/baseResults/150.tesc.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/150.vert.out b/third_party/glslang/Test/baseResults/150.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/300.frag.out b/third_party/glslang/Test/baseResults/300.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/300.vert.out b/third_party/glslang/Test/baseResults/300.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/300BuiltIns.frag.out b/third_party/glslang/Test/baseResults/300BuiltIns.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/300block.frag.out b/third_party/glslang/Test/baseResults/300block.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/300layout.frag.out b/third_party/glslang/Test/baseResults/300layout.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/300layout.vert.out b/third_party/glslang/Test/baseResults/300layout.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/300link.frag.out b/third_party/glslang/Test/baseResults/300link.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/300link2.frag.out b/third_party/glslang/Test/baseResults/300link2.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/300link3.frag.out b/third_party/glslang/Test/baseResults/300link3.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/300operations.frag.out b/third_party/glslang/Test/baseResults/300operations.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/300samplerExternal.frag.out b/third_party/glslang/Test/baseResults/300samplerExternal.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/300scope.vert.out b/third_party/glslang/Test/baseResults/300scope.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/310.comp.out b/third_party/glslang/Test/baseResults/310.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/310.frag.out b/third_party/glslang/Test/baseResults/310.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/310.geom.out b/third_party/glslang/Test/baseResults/310.geom.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/310.tesc.out b/third_party/glslang/Test/baseResults/310.tesc.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/310.tese.out b/third_party/glslang/Test/baseResults/310.tese.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/310.vert.out b/third_party/glslang/Test/baseResults/310.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/310AofA.vert.out b/third_party/glslang/Test/baseResults/310AofA.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/310implicitSizeArrayError.vert.out b/third_party/glslang/Test/baseResults/310implicitSizeArrayError.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/330.frag.out b/third_party/glslang/Test/baseResults/330.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/330comp.frag.out b/third_party/glslang/Test/baseResults/330comp.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/400.frag.out b/third_party/glslang/Test/baseResults/400.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/400.geom.out b/third_party/glslang/Test/baseResults/400.geom.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/400.tesc.out b/third_party/glslang/Test/baseResults/400.tesc.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/400.tese.out b/third_party/glslang/Test/baseResults/400.tese.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/410.geom.out b/third_party/glslang/Test/baseResults/410.geom.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/410.tesc.out b/third_party/glslang/Test/baseResults/410.tesc.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/420.frag.out b/third_party/glslang/Test/baseResults/420.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/420.geom.out b/third_party/glslang/Test/baseResults/420.geom.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/420.tesc.out b/third_party/glslang/Test/baseResults/420.tesc.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/420.tese.out b/third_party/glslang/Test/baseResults/420.tese.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/420.vert.out b/third_party/glslang/Test/baseResults/420.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/420_size_gl_in.geom.out b/third_party/glslang/Test/baseResults/420_size_gl_in.geom.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/430.comp.out b/third_party/glslang/Test/baseResults/430.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/430.vert.out b/third_party/glslang/Test/baseResults/430.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/430AofA.frag.out b/third_party/glslang/Test/baseResults/430AofA.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/430scope.vert.out b/third_party/glslang/Test/baseResults/430scope.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/440.frag.out b/third_party/glslang/Test/baseResults/440.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/440.vert.out b/third_party/glslang/Test/baseResults/440.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/450.comp.out b/third_party/glslang/Test/baseResults/450.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/450.frag.out b/third_party/glslang/Test/baseResults/450.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/450.geom.out b/third_party/glslang/Test/baseResults/450.geom.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/450.tesc.out b/third_party/glslang/Test/baseResults/450.tesc.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/450.tese.out b/third_party/glslang/Test/baseResults/450.tese.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/450.vert.out b/third_party/glslang/Test/baseResults/450.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/Operations.frag.out b/third_party/glslang/Test/baseResults/Operations.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/aggOps.frag.out b/third_party/glslang/Test/baseResults/aggOps.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/always-discard.frag.out b/third_party/glslang/Test/baseResults/always-discard.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/always-discard2.frag.out b/third_party/glslang/Test/baseResults/always-discard2.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/array.frag.out b/third_party/glslang/Test/baseResults/array.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/array100.frag.out b/third_party/glslang/Test/baseResults/array100.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/atomic_uint.frag.out b/third_party/glslang/Test/baseResults/atomic_uint.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/badChars.frag.out b/third_party/glslang/Test/baseResults/badChars.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/badMacroArgs.frag.out b/third_party/glslang/Test/baseResults/badMacroArgs.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/comment.frag.out b/third_party/glslang/Test/baseResults/comment.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/conditionalDiscard.frag.out b/third_party/glslang/Test/baseResults/conditionalDiscard.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/constErrors.frag.out b/third_party/glslang/Test/baseResults/constErrors.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/constFold.frag.out b/third_party/glslang/Test/baseResults/constFold.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/constFoldIntMin.frag.out b/third_party/glslang/Test/baseResults/constFoldIntMin.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/conversion.frag.out b/third_party/glslang/Test/baseResults/conversion.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/cppComplexExpr.vert.out b/third_party/glslang/Test/baseResults/cppComplexExpr.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/cppIndent.vert.out b/third_party/glslang/Test/baseResults/cppIndent.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/cppIntMinOverNegativeOne.frag.out b/third_party/glslang/Test/baseResults/cppIntMinOverNegativeOne.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/cppNest.vert.out b/third_party/glslang/Test/baseResults/cppNest.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/cppSimple.vert.out b/third_party/glslang/Test/baseResults/cppSimple.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/dataOut.frag.out b/third_party/glslang/Test/baseResults/dataOut.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/dataOutIndirect.frag.out b/third_party/glslang/Test/baseResults/dataOutIndirect.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/dce.frag.out b/third_party/glslang/Test/baseResults/dce.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/decls.frag.out b/third_party/glslang/Test/baseResults/decls.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/deepRvalue.frag.out b/third_party/glslang/Test/baseResults/deepRvalue.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/depthOut.frag.out b/third_party/glslang/Test/baseResults/depthOut.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/discard-dce.frag.out b/third_party/glslang/Test/baseResults/discard-dce.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/doWhileLoop.frag.out b/third_party/glslang/Test/baseResults/doWhileLoop.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/earlyReturnDiscard.frag.out b/third_party/glslang/Test/baseResults/earlyReturnDiscard.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/empty.frag.out b/third_party/glslang/Test/baseResults/empty.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/errors.frag.out b/third_party/glslang/Test/baseResults/errors.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/es-link1.frag.out b/third_party/glslang/Test/baseResults/es-link1.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/findFunction.frag.out b/third_party/glslang/Test/baseResults/findFunction.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/flowControl.frag.out b/third_party/glslang/Test/baseResults/flowControl.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/forLoop.frag.out b/third_party/glslang/Test/baseResults/forLoop.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/forwardRef.frag.out b/third_party/glslang/Test/baseResults/forwardRef.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/functionCall.frag.out b/third_party/glslang/Test/baseResults/functionCall.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/functionSemantics.frag.out b/third_party/glslang/Test/baseResults/functionSemantics.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/glsl.-D-U.frag.out b/third_party/glslang/Test/baseResults/glsl.-D-U.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/glsl.entryPointRename.vert.bad.out b/third_party/glslang/Test/baseResults/glsl.entryPointRename.vert.bad.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/glsl.entryPointRename.vert.out b/third_party/glslang/Test/baseResults/glsl.entryPointRename.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/glsl.entryPointRename2.vert.out b/third_party/glslang/Test/baseResults/glsl.entryPointRename2.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.-D-U.frag.out b/third_party/glslang/Test/baseResults/hlsl.-D-U.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.array.flatten.frag.out b/third_party/glslang/Test/baseResults/hlsl.array.flatten.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.array.implicit-size.frag.out b/third_party/glslang/Test/baseResults/hlsl.array.implicit-size.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.array.multidim.frag.out b/third_party/glslang/Test/baseResults/hlsl.array.multidim.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.attribute.expression.comp.out b/third_party/glslang/Test/baseResults/hlsl.attribute.expression.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.automap.frag.out b/third_party/glslang/Test/baseResults/hlsl.automap.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.basic.geom.out b/third_party/glslang/Test/baseResults/hlsl.basic.geom.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.calculatelod.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.calculatelod.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.calculatelodunclamped.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.calculatelodunclamped.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.cbuffer-identifier.vert.out b/third_party/glslang/Test/baseResults/hlsl.cbuffer-identifier.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.clip.frag.out b/third_party/glslang/Test/baseResults/hlsl.clip.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.clipdistance-1.frag.out b/third_party/glslang/Test/baseResults/hlsl.clipdistance-1.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.clipdistance-1.geom.out b/third_party/glslang/Test/baseResults/hlsl.clipdistance-1.geom.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.clipdistance-1.vert.out b/third_party/glslang/Test/baseResults/hlsl.clipdistance-1.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.clipdistance-2.frag.out b/third_party/glslang/Test/baseResults/hlsl.clipdistance-2.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.clipdistance-2.geom.out b/third_party/glslang/Test/baseResults/hlsl.clipdistance-2.geom.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.clipdistance-2.vert.out b/third_party/glslang/Test/baseResults/hlsl.clipdistance-2.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.clipdistance-3.frag.out b/third_party/glslang/Test/baseResults/hlsl.clipdistance-3.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.clipdistance-3.geom.out b/third_party/glslang/Test/baseResults/hlsl.clipdistance-3.geom.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.clipdistance-3.vert.out b/third_party/glslang/Test/baseResults/hlsl.clipdistance-3.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.clipdistance-4.frag.out b/third_party/glslang/Test/baseResults/hlsl.clipdistance-4.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.clipdistance-4.geom.out b/third_party/glslang/Test/baseResults/hlsl.clipdistance-4.geom.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.clipdistance-4.vert.out b/third_party/glslang/Test/baseResults/hlsl.clipdistance-4.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.clipdistance-5.frag.out b/third_party/glslang/Test/baseResults/hlsl.clipdistance-5.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.clipdistance-5.vert.out b/third_party/glslang/Test/baseResults/hlsl.clipdistance-5.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.clipdistance-6.frag.out b/third_party/glslang/Test/baseResults/hlsl.clipdistance-6.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.clipdistance-6.vert.out b/third_party/glslang/Test/baseResults/hlsl.clipdistance-6.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.clipdistance-7.frag.out b/third_party/glslang/Test/baseResults/hlsl.clipdistance-7.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.clipdistance-7.vert.out b/third_party/glslang/Test/baseResults/hlsl.clipdistance-7.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.clipdistance-8.frag.out b/third_party/glslang/Test/baseResults/hlsl.clipdistance-8.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.clipdistance-8.vert.out b/third_party/glslang/Test/baseResults/hlsl.clipdistance-8.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.clipdistance-9.frag.out b/third_party/glslang/Test/baseResults/hlsl.clipdistance-9.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.clipdistance-9.vert.out b/third_party/glslang/Test/baseResults/hlsl.clipdistance-9.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.color.hull.tesc.out b/third_party/glslang/Test/baseResults/hlsl.color.hull.tesc.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.comparison.vec.frag.out b/third_party/glslang/Test/baseResults/hlsl.comparison.vec.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.constantbuffer.frag.out b/third_party/glslang/Test/baseResults/hlsl.constantbuffer.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.constructexpr.frag.out b/third_party/glslang/Test/baseResults/hlsl.constructexpr.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.constructimat.frag.out b/third_party/glslang/Test/baseResults/hlsl.constructimat.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.dashI.vert.out b/third_party/glslang/Test/baseResults/hlsl.dashI.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.deadFunctionMissingBody.vert.out b/third_party/glslang/Test/baseResults/hlsl.deadFunctionMissingBody.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.domain.1.tese.out b/third_party/glslang/Test/baseResults/hlsl.domain.1.tese.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.domain.2.tese.out b/third_party/glslang/Test/baseResults/hlsl.domain.2.tese.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.domain.3.tese.out b/third_party/glslang/Test/baseResults/hlsl.domain.3.tese.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.emptystruct.init.vert.out b/third_party/glslang/Test/baseResults/hlsl.emptystruct.init.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.emptystructreturn.frag.out b/third_party/glslang/Test/baseResults/hlsl.emptystructreturn.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.emptystructreturn.vert.out b/third_party/glslang/Test/baseResults/hlsl.emptystructreturn.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.entry.rename.frag.out b/third_party/glslang/Test/baseResults/hlsl.entry.rename.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.explicitDescriptorSet-2.frag.out b/third_party/glslang/Test/baseResults/hlsl.explicitDescriptorSet-2.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.explicitDescriptorSet.frag.out b/third_party/glslang/Test/baseResults/hlsl.explicitDescriptorSet.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.flatten.return.frag.out b/third_party/glslang/Test/baseResults/hlsl.flatten.return.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.frag.out b/third_party/glslang/Test/baseResults/hlsl.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.fraggeom.frag.out b/third_party/glslang/Test/baseResults/hlsl.fraggeom.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.gather.array.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.gather.array.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.gather.basic.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.gather.basic.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.gather.basic.dx10.vert.out b/third_party/glslang/Test/baseResults/hlsl.gather.basic.dx10.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.gather.offset.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.gather.offset.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.gather.offsetarray.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.gather.offsetarray.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.gatherRGBA.array.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.gatherRGBA.array.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.gatherRGBA.basic.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.gatherRGBA.basic.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.gatherRGBA.offset.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.gatherRGBA.offset.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.gatherRGBA.offsetarray.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.gatherRGBA.offsetarray.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.gathercmpRGBA.offset.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.gathercmpRGBA.offset.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.getdimensions.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.getdimensions.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.getdimensions.dx10.vert.out b/third_party/glslang/Test/baseResults/hlsl.getdimensions.dx10.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.getdimensions.rw.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.getdimensions.rw.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.getsampleposition.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.getsampleposition.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.global-const-init.frag.out b/third_party/glslang/Test/baseResults/hlsl.global-const-init.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.gs-hs-mix.tesc.out b/third_party/glslang/Test/baseResults/hlsl.gs-hs-mix.tesc.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.hlslOffset.vert.out b/third_party/glslang/Test/baseResults/hlsl.hlslOffset.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.hull.1.tesc.out b/third_party/glslang/Test/baseResults/hlsl.hull.1.tesc.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.hull.2.tesc.out b/third_party/glslang/Test/baseResults/hlsl.hull.2.tesc.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.hull.4.tesc.out b/third_party/glslang/Test/baseResults/hlsl.hull.4.tesc.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.hull.5.tesc.out b/third_party/glslang/Test/baseResults/hlsl.hull.5.tesc.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.hull.ctrlpt-1.tesc.out b/third_party/glslang/Test/baseResults/hlsl.hull.ctrlpt-1.tesc.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.hull.ctrlpt-2.tesc.out b/third_party/glslang/Test/baseResults/hlsl.hull.ctrlpt-2.tesc.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.hull.void.tesc.out b/third_party/glslang/Test/baseResults/hlsl.hull.void.tesc.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.identifier.sample.frag.out b/third_party/glslang/Test/baseResults/hlsl.identifier.sample.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.imagefetch-subvec4.comp.out b/third_party/glslang/Test/baseResults/hlsl.imagefetch-subvec4.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.init2.frag.out b/third_party/glslang/Test/baseResults/hlsl.init2.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.inoutquals.frag.out b/third_party/glslang/Test/baseResults/hlsl.inoutquals.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.intrinsic.frexp.frag.out b/third_party/glslang/Test/baseResults/hlsl.intrinsic.frexp.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.intrinsic.frexp.vert.out b/third_party/glslang/Test/baseResults/hlsl.intrinsic.frexp.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.intrinsics.barriers.comp.out b/third_party/glslang/Test/baseResults/hlsl.intrinsics.barriers.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.intrinsics.comp.out b/third_party/glslang/Test/baseResults/hlsl.intrinsics.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.intrinsics.d3dcolortoubyte4.frag.out b/third_party/glslang/Test/baseResults/hlsl.intrinsics.d3dcolortoubyte4.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.intrinsics.double.frag.out b/third_party/glslang/Test/baseResults/hlsl.intrinsics.double.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.intrinsics.evalfns.frag.out b/third_party/glslang/Test/baseResults/hlsl.intrinsics.evalfns.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.intrinsics.f1632.frag.out b/third_party/glslang/Test/baseResults/hlsl.intrinsics.f1632.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.intrinsics.f3216.frag.out b/third_party/glslang/Test/baseResults/hlsl.intrinsics.f3216.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.intrinsics.frag.out b/third_party/glslang/Test/baseResults/hlsl.intrinsics.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.intrinsics.lit.frag.out b/third_party/glslang/Test/baseResults/hlsl.intrinsics.lit.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.intrinsics.negative.comp.out b/third_party/glslang/Test/baseResults/hlsl.intrinsics.negative.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.intrinsics.negative.frag.out b/third_party/glslang/Test/baseResults/hlsl.intrinsics.negative.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.intrinsics.negative.vert.out b/third_party/glslang/Test/baseResults/hlsl.intrinsics.negative.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.intrinsics.promote.down.frag.out b/third_party/glslang/Test/baseResults/hlsl.intrinsics.promote.down.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.intrinsics.promote.frag.out b/third_party/glslang/Test/baseResults/hlsl.intrinsics.promote.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.intrinsics.promote.outputs.frag.out b/third_party/glslang/Test/baseResults/hlsl.intrinsics.promote.outputs.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.intrinsics.vert.out b/third_party/glslang/Test/baseResults/hlsl.intrinsics.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.isfinite.frag.out b/third_party/glslang/Test/baseResults/hlsl.isfinite.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.load.2dms.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.load.2dms.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.load.array.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.load.array.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.load.basic.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.load.basic.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.load.basic.dx10.vert.out b/third_party/glslang/Test/baseResults/hlsl.load.basic.dx10.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.load.buffer.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.load.buffer.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.load.buffer.float.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.load.buffer.float.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.load.offset.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.load.offset.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.load.offsetarray.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.load.offsetarray.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.load.rwbuffer.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.load.rwbuffer.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.load.rwtexture.array.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.load.rwtexture.array.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.load.rwtexture.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.load.rwtexture.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.localStructuredBuffer.comp.out b/third_party/glslang/Test/baseResults/hlsl.localStructuredBuffer.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.logical.binary.frag.out b/third_party/glslang/Test/baseResults/hlsl.logical.binary.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.logical.binary.vec.frag.out b/third_party/glslang/Test/baseResults/hlsl.logical.binary.vec.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.logical.unary.frag.out b/third_party/glslang/Test/baseResults/hlsl.logical.unary.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.loopattr.frag.out b/third_party/glslang/Test/baseResults/hlsl.loopattr.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.matNx1.frag.out b/third_party/glslang/Test/baseResults/hlsl.matNx1.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.matType.bool.frag.out b/third_party/glslang/Test/baseResults/hlsl.matType.bool.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.matType.int.frag.out b/third_party/glslang/Test/baseResults/hlsl.matType.int.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.matpack-1.frag.out b/third_party/glslang/Test/baseResults/hlsl.matpack-1.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.matpack-pragma.frag.out b/third_party/glslang/Test/baseResults/hlsl.matpack-pragma.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.matrixindex.frag.out b/third_party/glslang/Test/baseResults/hlsl.matrixindex.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.mintypes.frag.out b/third_party/glslang/Test/baseResults/hlsl.mintypes.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.mip.negative.frag.out b/third_party/glslang/Test/baseResults/hlsl.mip.negative.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.mip.negative2.frag.out b/third_party/glslang/Test/baseResults/hlsl.mip.negative2.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.mip.operator.frag.out b/third_party/glslang/Test/baseResults/hlsl.mip.operator.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.mul-truncate.frag.out b/third_party/glslang/Test/baseResults/hlsl.mul-truncate.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.multiDescriptorSet.frag.out b/third_party/glslang/Test/baseResults/hlsl.multiDescriptorSet.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.nonint-index.frag.out b/third_party/glslang/Test/baseResults/hlsl.nonint-index.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.numericsuffixes.frag.out b/third_party/glslang/Test/baseResults/hlsl.numericsuffixes.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.numthreads.comp.out b/third_party/glslang/Test/baseResults/hlsl.numthreads.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.opaque-type-bug.frag.out b/third_party/glslang/Test/baseResults/hlsl.opaque-type-bug.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.params.default.frag.out b/third_party/glslang/Test/baseResults/hlsl.params.default.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.params.default.negative.frag.out b/third_party/glslang/Test/baseResults/hlsl.params.default.negative.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.pp.line.frag.out b/third_party/glslang/Test/baseResults/hlsl.pp.line.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.precise.frag.out b/third_party/glslang/Test/baseResults/hlsl.precise.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.preprocessor.frag.out b/third_party/glslang/Test/baseResults/hlsl.preprocessor.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.promote.atomic.frag.out b/third_party/glslang/Test/baseResults/hlsl.promote.atomic.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.promote.binary.frag.out b/third_party/glslang/Test/baseResults/hlsl.promote.binary.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.promote.vec1.frag.out b/third_party/glslang/Test/baseResults/hlsl.promote.vec1.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.promotions.frag.out b/third_party/glslang/Test/baseResults/hlsl.promotions.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.reflection.binding.frag.out b/third_party/glslang/Test/baseResults/hlsl.reflection.binding.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.reflection.binding.vert.out b/third_party/glslang/Test/baseResults/hlsl.reflection.binding.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.reflection.vert.out b/third_party/glslang/Test/baseResults/hlsl.reflection.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.rw.atomics.frag.out b/third_party/glslang/Test/baseResults/hlsl.rw.atomics.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.rw.bracket.frag.out b/third_party/glslang/Test/baseResults/hlsl.rw.bracket.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.rw.register.frag.out b/third_party/glslang/Test/baseResults/hlsl.rw.register.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.rw.scalar.bracket.frag.out b/third_party/glslang/Test/baseResults/hlsl.rw.scalar.bracket.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.rw.swizzle.frag.out b/third_party/glslang/Test/baseResults/hlsl.rw.swizzle.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.rw.vec2.bracket.frag.out b/third_party/glslang/Test/baseResults/hlsl.rw.vec2.bracket.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.sample.array.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.sample.array.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.sample.basic.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.sample.basic.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.sample.offset.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.sample.offset.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.sample.offsetarray.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.sample.offsetarray.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.sample.sub-vec4.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.sample.sub-vec4.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.samplebias.array.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.samplebias.array.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.samplebias.basic.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.samplebias.basic.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.samplebias.offset.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.samplebias.offset.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.samplebias.offsetarray.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.samplebias.offsetarray.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.samplecmp.array.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.samplecmp.array.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.samplecmp.basic.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.samplecmp.basic.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.samplecmp.dualmode.frag.out b/third_party/glslang/Test/baseResults/hlsl.samplecmp.dualmode.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.samplecmp.negative.frag.out b/third_party/glslang/Test/baseResults/hlsl.samplecmp.negative.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.samplecmp.negative2.frag.out b/third_party/glslang/Test/baseResults/hlsl.samplecmp.negative2.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.samplecmp.offset.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.samplecmp.offset.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.samplecmp.offsetarray.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.samplecmp.offsetarray.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.samplecmplevelzero.array.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.samplecmplevelzero.array.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.samplecmplevelzero.basic.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.samplecmplevelzero.basic.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.samplecmplevelzero.offset.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.samplecmplevelzero.offset.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.samplecmplevelzero.offsetarray.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.samplecmplevelzero.offsetarray.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.samplegrad.array.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.samplegrad.array.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.samplegrad.basic.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.samplegrad.basic.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.samplegrad.basic.dx10.vert.out b/third_party/glslang/Test/baseResults/hlsl.samplegrad.basic.dx10.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.samplegrad.offset.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.samplegrad.offset.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.samplegrad.offsetarray.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.samplegrad.offsetarray.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.samplelevel.array.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.samplelevel.array.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.samplelevel.basic.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.samplelevel.basic.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.samplelevel.basic.dx10.vert.out b/third_party/glslang/Test/baseResults/hlsl.samplelevel.basic.dx10.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.samplelevel.offset.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.samplelevel.offset.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.samplelevel.offsetarray.dx10.frag.out b/third_party/glslang/Test/baseResults/hlsl.samplelevel.offsetarray.dx10.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.scalar-length.frag.out b/third_party/glslang/Test/baseResults/hlsl.scalar-length.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.scalar2matrix.frag.out b/third_party/glslang/Test/baseResults/hlsl.scalar2matrix.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.semantic-1.vert.out b/third_party/glslang/Test/baseResults/hlsl.semantic-1.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.semicolons.frag.out b/third_party/glslang/Test/baseResults/hlsl.semicolons.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.shift.per-set.frag.out b/third_party/glslang/Test/baseResults/hlsl.shift.per-set.frag.out old mode 100755 new mode 100644 index f7ae02e359..7c7d38304c --- a/third_party/glslang/Test/baseResults/hlsl.shift.per-set.frag.out +++ b/third_party/glslang/Test/baseResults/hlsl.shift.per-set.frag.out @@ -62,12 +62,13 @@ gl_FragCoord origin is upper left 0:56 'anon@1' (layout( binding=7 row_major std430) readonly buffer block{layout( row_major std430) buffer int tb1}) 0:56 Constant: 0:56 0 (const uint) -0:58 Branch: Return with expression -0:58 Constant: -0:58 0.000000 -0:58 0.000000 -0:58 0.000000 -0:58 0.000000 +0:57 'ts6' (layout( set=6 binding=1) uniform texture3D) +0:59 Branch: Return with expression +0:59 Constant: +0:59 0.000000 +0:59 0.000000 +0:59 0.000000 +0:59 0.000000 0:34 Function Definition: main( ( temp void) 0:34 Function Parameters: 0:? Sequence @@ -80,6 +81,7 @@ gl_FragCoord origin is upper left 0:? 't1' (layout( set=1 binding=1) uniform texture1D) 0:? 't2' (layout( set=1 binding=2) uniform texture2D) 0:? 't3' (layout( set=2 binding=1) uniform texture3D) +0:? 'ts6' (layout( set=6 binding=1) uniform texture3D) 0:? 't4' (layout( set=3 binding=1 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) 0:? 't5' (layout( set=3 binding=2 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:? 't6' (layout( set=3 binding=3 rgba32f) uniform textureBuffer) @@ -162,12 +164,13 @@ gl_FragCoord origin is upper left 0:56 'anon@1' (layout( binding=7 row_major std430) readonly buffer block{layout( row_major std430) buffer int tb1}) 0:56 Constant: 0:56 0 (const uint) -0:58 Branch: Return with expression -0:58 Constant: -0:58 0.000000 -0:58 0.000000 -0:58 0.000000 -0:58 0.000000 +0:57 'ts6' (layout( set=6 binding=1) uniform texture3D) +0:59 Branch: Return with expression +0:59 Constant: +0:59 0.000000 +0:59 0.000000 +0:59 0.000000 +0:59 0.000000 0:34 Function Definition: main( ( temp void) 0:34 Function Parameters: 0:? Sequence @@ -180,6 +183,7 @@ gl_FragCoord origin is upper left 0:? 't1' (layout( set=1 binding=1) uniform texture1D) 0:? 't2' (layout( set=1 binding=2) uniform texture2D) 0:? 't3' (layout( set=2 binding=1) uniform texture3D) +0:? 'ts6' (layout( set=6 binding=1) uniform texture3D) 0:? 't4' (layout( set=3 binding=1 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) 0:? 't5' (layout( set=3 binding=2 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:? 't6' (layout( set=3 binding=3 rgba32f) uniform textureBuffer) @@ -212,6 +216,7 @@ u5.@data: offset 0, type 1405, size 0, index 2, binding -1, stages 16 u6.@data: offset 0, type 1406, size 1, index 3, binding -1, stages 16 cb1: offset 0, type 1404, size 1, index 4, binding -1, stages 16 tb1: offset 0, type 1404, size 1, index 5, binding -1, stages 16 +ts6: offset -1, type 8b5f, size 1, index -1, binding 71, stages 16 Uniform block reflection: t4: offset -1, type ffffffff, size 0, index -1, binding 21, stages 0 diff --git a/third_party/glslang/Test/baseResults/hlsl.snorm.uav.comp.out b/third_party/glslang/Test/baseResults/hlsl.snorm.uav.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.store.rwbyteaddressbuffer.type.comp.out b/third_party/glslang/Test/baseResults/hlsl.store.rwbyteaddressbuffer.type.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.stringtoken.frag.out b/third_party/glslang/Test/baseResults/hlsl.stringtoken.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.struct.split-1.vert.out b/third_party/glslang/Test/baseResults/hlsl.struct.split-1.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.struct.split.array.geom.out b/third_party/glslang/Test/baseResults/hlsl.struct.split.array.geom.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.struct.split.assign.frag.out b/third_party/glslang/Test/baseResults/hlsl.struct.split.assign.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.struct.split.call.vert.out b/third_party/glslang/Test/baseResults/hlsl.struct.split.call.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.struct.split.nested.geom.out b/third_party/glslang/Test/baseResults/hlsl.struct.split.nested.geom.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.struct.split.trivial.geom.out b/third_party/glslang/Test/baseResults/hlsl.struct.split.trivial.geom.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.struct.split.trivial.vert.out b/third_party/glslang/Test/baseResults/hlsl.struct.split.trivial.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.structarray.flatten.frag.out b/third_party/glslang/Test/baseResults/hlsl.structarray.flatten.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.structarray.flatten.geom.out b/third_party/glslang/Test/baseResults/hlsl.structarray.flatten.geom.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.structbuffer.append.fn.frag.out b/third_party/glslang/Test/baseResults/hlsl.structbuffer.append.fn.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.structbuffer.append.frag.out b/third_party/glslang/Test/baseResults/hlsl.structbuffer.append.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.structbuffer.atomics.frag.out b/third_party/glslang/Test/baseResults/hlsl.structbuffer.atomics.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.structbuffer.byte.frag.out b/third_party/glslang/Test/baseResults/hlsl.structbuffer.byte.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.structbuffer.coherent.frag.out b/third_party/glslang/Test/baseResults/hlsl.structbuffer.coherent.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.structbuffer.floatidx.comp.out b/third_party/glslang/Test/baseResults/hlsl.structbuffer.floatidx.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.structbuffer.fn.frag.out b/third_party/glslang/Test/baseResults/hlsl.structbuffer.fn.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.structbuffer.fn2.comp.out b/third_party/glslang/Test/baseResults/hlsl.structbuffer.fn2.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.structbuffer.frag.out b/third_party/glslang/Test/baseResults/hlsl.structbuffer.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.structbuffer.incdec.frag.hlslfun1.out b/third_party/glslang/Test/baseResults/hlsl.structbuffer.incdec.frag.hlslfun1.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.structbuffer.incdec.frag.out b/third_party/glslang/Test/baseResults/hlsl.structbuffer.incdec.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.structbuffer.rw.frag.out b/third_party/glslang/Test/baseResults/hlsl.structbuffer.rw.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.structbuffer.rwbyte.frag.out b/third_party/glslang/Test/baseResults/hlsl.structbuffer.rwbyte.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.subpass.frag.out b/third_party/glslang/Test/baseResults/hlsl.subpass.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.templatetypes.frag.out b/third_party/glslang/Test/baseResults/hlsl.templatetypes.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.texture.struct.frag.out b/third_party/glslang/Test/baseResults/hlsl.texture.struct.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.texture.subvec4.frag.out b/third_party/glslang/Test/baseResults/hlsl.texture.subvec4.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.texturebuffer.frag.out b/third_party/glslang/Test/baseResults/hlsl.texturebuffer.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.tx.bracket.frag.out b/third_party/glslang/Test/baseResults/hlsl.tx.bracket.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.tx.overload.frag.out b/third_party/glslang/Test/baseResults/hlsl.tx.overload.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.type.half.frag.out b/third_party/glslang/Test/baseResults/hlsl.type.half.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.type.identifier.frag.out b/third_party/glslang/Test/baseResults/hlsl.type.identifier.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.wavebroadcast.comp.out b/third_party/glslang/Test/baseResults/hlsl.wavebroadcast.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.waveprefix.comp.out b/third_party/glslang/Test/baseResults/hlsl.waveprefix.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.wavequad.comp.out b/third_party/glslang/Test/baseResults/hlsl.wavequad.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.wavequery.comp.out b/third_party/glslang/Test/baseResults/hlsl.wavequery.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.wavequery.frag.out b/third_party/glslang/Test/baseResults/hlsl.wavequery.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.wavereduction.comp.out b/third_party/glslang/Test/baseResults/hlsl.wavereduction.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.wavevote.comp.out b/third_party/glslang/Test/baseResults/hlsl.wavevote.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.y-negate-1.vert.out b/third_party/glslang/Test/baseResults/hlsl.y-negate-1.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.y-negate-2.vert.out b/third_party/glslang/Test/baseResults/hlsl.y-negate-2.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/hlsl.y-negate-3.vert.out b/third_party/glslang/Test/baseResults/hlsl.y-negate-3.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/include.vert.out b/third_party/glslang/Test/baseResults/include.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/invalidSwizzle.vert.out b/third_party/glslang/Test/baseResults/invalidSwizzle.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/length.frag.out b/third_party/glslang/Test/baseResults/length.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/lineContinuation.vert.out b/third_party/glslang/Test/baseResults/lineContinuation.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/lineContinuation100.vert.out b/third_party/glslang/Test/baseResults/lineContinuation100.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/link1.frag.out b/third_party/glslang/Test/baseResults/link1.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/link1.vk.frag.out b/third_party/glslang/Test/baseResults/link1.vk.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/localAggregates.frag.out b/third_party/glslang/Test/baseResults/localAggregates.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/loops.frag.out b/third_party/glslang/Test/baseResults/loops.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/loopsArtificial.frag.out b/third_party/glslang/Test/baseResults/loopsArtificial.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/mains1.frag.out b/third_party/glslang/Test/baseResults/mains1.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/matrix.frag.out b/third_party/glslang/Test/baseResults/matrix.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/matrix2.frag.out b/third_party/glslang/Test/baseResults/matrix2.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/matrixError.vert.out b/third_party/glslang/Test/baseResults/matrixError.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/maxClipDistances.vert.out b/third_party/glslang/Test/baseResults/maxClipDistances.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/max_vertices_0.geom.out b/third_party/glslang/Test/baseResults/max_vertices_0.geom.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/negativeArraySize.comp.out b/third_party/glslang/Test/baseResults/negativeArraySize.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/newTexture.frag.out b/third_party/glslang/Test/baseResults/newTexture.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/noMain.vert.out b/third_party/glslang/Test/baseResults/noMain.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/nonSquare.vert.out b/third_party/glslang/Test/baseResults/nonSquare.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/nonVulkan.frag.out b/third_party/glslang/Test/baseResults/nonVulkan.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/nosuffix.out b/third_party/glslang/Test/baseResults/nosuffix.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/numeral.frag.out b/third_party/glslang/Test/baseResults/numeral.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/nvShaderNoperspectiveInterpolation.frag.out b/third_party/glslang/Test/baseResults/nvShaderNoperspectiveInterpolation.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/overlongLiteral.frag.out b/third_party/glslang/Test/baseResults/overlongLiteral.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/pointCoord.frag.out b/third_party/glslang/Test/baseResults/pointCoord.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/precise.tesc.out b/third_party/glslang/Test/baseResults/precise.tesc.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/precise_struct_block.vert.out b/third_party/glslang/Test/baseResults/precise_struct_block.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/precision.frag.out b/third_party/glslang/Test/baseResults/precision.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/precision.vert.out b/third_party/glslang/Test/baseResults/precision.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/prepost.frag.out b/third_party/glslang/Test/baseResults/prepost.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.cpp_style___FILE__.vert.err b/third_party/glslang/Test/baseResults/preprocessor.cpp_style___FILE__.vert.err old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.cpp_style___FILE__.vert.out b/third_party/glslang/Test/baseResults/preprocessor.cpp_style___FILE__.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.cpp_style_line_directive.vert.err b/third_party/glslang/Test/baseResults/preprocessor.cpp_style_line_directive.vert.err old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.cpp_style_line_directive.vert.out b/third_party/glslang/Test/baseResults/preprocessor.cpp_style_line_directive.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.defined.vert.err b/third_party/glslang/Test/baseResults/preprocessor.defined.vert.err old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.defined.vert.out b/third_party/glslang/Test/baseResults/preprocessor.defined.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.edge_cases.vert.err b/third_party/glslang/Test/baseResults/preprocessor.edge_cases.vert.err old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.edge_cases.vert.out b/third_party/glslang/Test/baseResults/preprocessor.edge_cases.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.eof_missing.vert.err b/third_party/glslang/Test/baseResults/preprocessor.eof_missing.vert.err old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.eof_missing.vert.out b/third_party/glslang/Test/baseResults/preprocessor.eof_missing.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.errors.vert.err b/third_party/glslang/Test/baseResults/preprocessor.errors.vert.err old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.errors.vert.out b/third_party/glslang/Test/baseResults/preprocessor.errors.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.extensions.vert.err b/third_party/glslang/Test/baseResults/preprocessor.extensions.vert.err old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.extensions.vert.out b/third_party/glslang/Test/baseResults/preprocessor.extensions.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.function_macro.vert.err b/third_party/glslang/Test/baseResults/preprocessor.function_macro.vert.err old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.function_macro.vert.out b/third_party/glslang/Test/baseResults/preprocessor.function_macro.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.include.disabled.vert.err b/third_party/glslang/Test/baseResults/preprocessor.include.disabled.vert.err old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.include.disabled.vert.out b/third_party/glslang/Test/baseResults/preprocessor.include.disabled.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.include.enabled.vert.err b/third_party/glslang/Test/baseResults/preprocessor.include.enabled.vert.err old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.include.enabled.vert.out b/third_party/glslang/Test/baseResults/preprocessor.include.enabled.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.line.frag.err b/third_party/glslang/Test/baseResults/preprocessor.line.frag.err old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.line.frag.out b/third_party/glslang/Test/baseResults/preprocessor.line.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.line.vert.err b/third_party/glslang/Test/baseResults/preprocessor.line.vert.err old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.line.vert.out b/third_party/glslang/Test/baseResults/preprocessor.line.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.many.endif.vert.err b/third_party/glslang/Test/baseResults/preprocessor.many.endif.vert.err old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.many.endif.vert.out b/third_party/glslang/Test/baseResults/preprocessor.many.endif.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.pragma.vert.err b/third_party/glslang/Test/baseResults/preprocessor.pragma.vert.err old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.pragma.vert.out b/third_party/glslang/Test/baseResults/preprocessor.pragma.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.simple.vert.err b/third_party/glslang/Test/baseResults/preprocessor.simple.vert.err old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.simple.vert.out b/third_party/glslang/Test/baseResults/preprocessor.simple.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.success_if_parse_would_fail.vert.err b/third_party/glslang/Test/baseResults/preprocessor.success_if_parse_would_fail.vert.err old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/preprocessor.success_if_parse_would_fail.vert.out b/third_party/glslang/Test/baseResults/preprocessor.success_if_parse_would_fail.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/recurse1.vert.out b/third_party/glslang/Test/baseResults/recurse1.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/reflection.vert.out b/third_party/glslang/Test/baseResults/reflection.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/remap.basic.dcefunc.frag.out b/third_party/glslang/Test/baseResults/remap.basic.dcefunc.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/remap.basic.dcevartype.frag.out b/third_party/glslang/Test/baseResults/remap.basic.dcevartype.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/remap.basic.everything.frag.out b/third_party/glslang/Test/baseResults/remap.basic.everything.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/remap.basic.none.frag.out b/third_party/glslang/Test/baseResults/remap.basic.none.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/remap.basic.strip.frag.out b/third_party/glslang/Test/baseResults/remap.basic.strip.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/remap.hlsl.sample.basic.everything.frag.out b/third_party/glslang/Test/baseResults/remap.hlsl.sample.basic.everything.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/remap.hlsl.sample.basic.none.frag.out b/third_party/glslang/Test/baseResults/remap.hlsl.sample.basic.none.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/remap.hlsl.sample.basic.strip.frag.out b/third_party/glslang/Test/baseResults/remap.hlsl.sample.basic.strip.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/remap.hlsl.templatetypes.everything.frag.out b/third_party/glslang/Test/baseResults/remap.hlsl.templatetypes.everything.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/remap.hlsl.templatetypes.none.frag.out b/third_party/glslang/Test/baseResults/remap.hlsl.templatetypes.none.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/remap.if.everything.frag.out b/third_party/glslang/Test/baseResults/remap.if.everything.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/remap.if.none.frag.out b/third_party/glslang/Test/baseResults/remap.if.none.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/remap.invalid-spirv-1.out b/third_party/glslang/Test/baseResults/remap.invalid-spirv-1.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/remap.invalid-spirv-2.out b/third_party/glslang/Test/baseResults/remap.invalid-spirv-2.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/remap.literal64.everything.spv.out b/third_party/glslang/Test/baseResults/remap.literal64.everything.spv.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/remap.literal64.none.spv.out b/third_party/glslang/Test/baseResults/remap.literal64.none.spv.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/remap.similar_1a.everything.frag.out b/third_party/glslang/Test/baseResults/remap.similar_1a.everything.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/remap.similar_1a.none.frag.out b/third_party/glslang/Test/baseResults/remap.similar_1a.none.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/remap.similar_1b.everything.frag.out b/third_party/glslang/Test/baseResults/remap.similar_1b.everything.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/remap.similar_1b.none.frag.out b/third_party/glslang/Test/baseResults/remap.similar_1b.none.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/remap.specconst.comp.out b/third_party/glslang/Test/baseResults/remap.specconst.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/remap.switch.everything.frag.out b/third_party/glslang/Test/baseResults/remap.switch.everything.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/remap.switch.none.frag.out b/third_party/glslang/Test/baseResults/remap.switch.none.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/remap.uniformarray.everything.frag.out b/third_party/glslang/Test/baseResults/remap.uniformarray.everything.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/remap.uniformarray.none.frag.out b/third_party/glslang/Test/baseResults/remap.uniformarray.none.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/sample.frag.out b/third_party/glslang/Test/baseResults/sample.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/sample.vert.out b/third_party/glslang/Test/baseResults/sample.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/simpleFunctionCall.frag.out b/third_party/glslang/Test/baseResults/simpleFunctionCall.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/specExamples.frag.out b/third_party/glslang/Test/baseResults/specExamples.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/specExamples.vert.out b/third_party/glslang/Test/baseResults/specExamples.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.130.frag.out b/third_party/glslang/Test/baseResults/spv.130.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.300layout.vert.out b/third_party/glslang/Test/baseResults/spv.300layout.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.310.comp.out b/third_party/glslang/Test/baseResults/spv.310.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.330.geom.out b/third_party/glslang/Test/baseResults/spv.330.geom.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.400.frag.out b/third_party/glslang/Test/baseResults/spv.400.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.400.tesc.out b/third_party/glslang/Test/baseResults/spv.400.tesc.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.420.geom.out b/third_party/glslang/Test/baseResults/spv.420.geom.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.AofA.frag.out b/third_party/glslang/Test/baseResults/spv.AofA.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.GeometryShaderPassthrough.geom.out b/third_party/glslang/Test/baseResults/spv.GeometryShaderPassthrough.geom.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.OVR_multiview.vert.out b/third_party/glslang/Test/baseResults/spv.OVR_multiview.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.aggOps.frag.out b/third_party/glslang/Test/baseResults/spv.aggOps.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.always-discard.frag.out b/third_party/glslang/Test/baseResults/spv.always-discard.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.arbPostDepthCoverage.frag.out b/third_party/glslang/Test/baseResults/spv.arbPostDepthCoverage.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.arbPostDepthCoverage_Error.frag.out b/third_party/glslang/Test/baseResults/spv.arbPostDepthCoverage_Error.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.atomicInt64.comp.out b/third_party/glslang/Test/baseResults/spv.atomicInt64.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.bitCast.frag.out b/third_party/glslang/Test/baseResults/spv.bitCast.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.bool.vert.out b/third_party/glslang/Test/baseResults/spv.bool.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.boolInBlock.frag.out b/third_party/glslang/Test/baseResults/spv.boolInBlock.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.branch-return.vert.out b/third_party/glslang/Test/baseResults/spv.branch-return.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.buffer.autoassign.frag.out b/third_party/glslang/Test/baseResults/spv.buffer.autoassign.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.debugInfo.1.1.frag.out b/third_party/glslang/Test/baseResults/spv.debugInfo.1.1.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.debugInfo.frag.out b/third_party/glslang/Test/baseResults/spv.debugInfo.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.deepRvalue.frag.out b/third_party/glslang/Test/baseResults/spv.deepRvalue.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.deviceGroup.frag.out b/third_party/glslang/Test/baseResults/spv.deviceGroup.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.do-while-continue-break.vert.out b/third_party/glslang/Test/baseResults/spv.do-while-continue-break.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.drawParams.vert.out b/third_party/glslang/Test/baseResults/spv.drawParams.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.extPostDepthCoverage.frag.out b/third_party/glslang/Test/baseResults/spv.extPostDepthCoverage.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.extPostDepthCoverage_Error.frag.out b/third_party/glslang/Test/baseResults/spv.extPostDepthCoverage_Error.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.float16.frag.out b/third_party/glslang/Test/baseResults/spv.float16.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.float16Fetch.frag.out b/third_party/glslang/Test/baseResults/spv.float16Fetch.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.float32.frag.out b/third_party/glslang/Test/baseResults/spv.float32.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.float64.frag.out b/third_party/glslang/Test/baseResults/spv.float64.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.for-complex-condition.vert.out b/third_party/glslang/Test/baseResults/spv.for-complex-condition.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.for-continue-break.vert.out b/third_party/glslang/Test/baseResults/spv.for-continue-break.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.for-nobody.vert.out b/third_party/glslang/Test/baseResults/spv.for-nobody.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.for-notest.vert.out b/third_party/glslang/Test/baseResults/spv.for-notest.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.fullyCovered.frag.out b/third_party/glslang/Test/baseResults/spv.fullyCovered.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.functionNestedOpaque.vert.out b/third_party/glslang/Test/baseResults/spv.functionNestedOpaque.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.glsl.register.autoassign.frag.out b/third_party/glslang/Test/baseResults/spv.glsl.register.autoassign.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.glsl.register.noautoassign.frag.out b/third_party/glslang/Test/baseResults/spv.glsl.register.noautoassign.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.hlslDebugInfo.frag.out b/third_party/glslang/Test/baseResults/spv.hlslDebugInfo.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.hlslOffsets.vert.out b/third_party/glslang/Test/baseResults/spv.hlslOffsets.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.image.frag.out b/third_party/glslang/Test/baseResults/spv.image.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.image.load-formatted.frag.out b/third_party/glslang/Test/baseResults/spv.image.load-formatted.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.imageLoadStoreLod.frag.out b/third_party/glslang/Test/baseResults/spv.imageLoadStoreLod.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.int16.amd.frag.out b/third_party/glslang/Test/baseResults/spv.int16.amd.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.int16.frag.out b/third_party/glslang/Test/baseResults/spv.int16.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.int32.frag.out b/third_party/glslang/Test/baseResults/spv.int32.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.int64.frag.out b/third_party/glslang/Test/baseResults/spv.int64.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.int8.frag.out b/third_party/glslang/Test/baseResults/spv.int8.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.intOps.vert.out b/third_party/glslang/Test/baseResults/spv.intOps.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.interpOps.frag.out b/third_party/glslang/Test/baseResults/spv.interpOps.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.layoutNested.vert.out b/third_party/glslang/Test/baseResults/spv.layoutNested.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.looseUniformNoLoc.vert.out b/third_party/glslang/Test/baseResults/spv.looseUniformNoLoc.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.matrix.frag.out b/third_party/glslang/Test/baseResults/spv.matrix.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.matrix2.frag.out b/third_party/glslang/Test/baseResults/spv.matrix2.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.memoryQualifier.frag.out b/third_party/glslang/Test/baseResults/spv.memoryQualifier.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.merge-unreachable.frag.out b/third_party/glslang/Test/baseResults/spv.merge-unreachable.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.multiView.frag.out b/third_party/glslang/Test/baseResults/spv.multiView.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.multiviewPerViewAttributes.tesc.out b/third_party/glslang/Test/baseResults/spv.multiviewPerViewAttributes.tesc.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.multiviewPerViewAttributes.vert.out b/third_party/glslang/Test/baseResults/spv.multiviewPerViewAttributes.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.noBuiltInLoc.vert.out b/third_party/glslang/Test/baseResults/spv.noBuiltInLoc.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.noDeadDecorations.vert.out b/third_party/glslang/Test/baseResults/spv.noDeadDecorations.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.noLocation.vert.out b/third_party/glslang/Test/baseResults/spv.noLocation.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.precise.tesc.out b/third_party/glslang/Test/baseResults/spv.precise.tesc.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.precise.tese.out b/third_party/glslang/Test/baseResults/spv.precise.tese.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.pushConstant.vert.out b/third_party/glslang/Test/baseResults/spv.pushConstant.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.register.autoassign-2.frag.out b/third_party/glslang/Test/baseResults/spv.register.autoassign-2.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.register.autoassign.frag.out b/third_party/glslang/Test/baseResults/spv.register.autoassign.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.register.autoassign.rangetest.frag.out b/third_party/glslang/Test/baseResults/spv.register.autoassign.rangetest.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.register.noautoassign.frag.out b/third_party/glslang/Test/baseResults/spv.register.noautoassign.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.register.subpass.frag.out b/third_party/glslang/Test/baseResults/spv.register.subpass.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.rw.autoassign.frag.out b/third_party/glslang/Test/baseResults/spv.rw.autoassign.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.sampleMaskOverrideCoverage.frag.out b/third_party/glslang/Test/baseResults/spv.sampleMaskOverrideCoverage.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.separate.frag.out b/third_party/glslang/Test/baseResults/spv.separate.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.shaderBallot.comp.out b/third_party/glslang/Test/baseResults/spv.shaderBallot.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.shaderBallotAMD.comp.out b/third_party/glslang/Test/baseResults/spv.shaderBallotAMD.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.shaderDrawParams.vert.out b/third_party/glslang/Test/baseResults/spv.shaderDrawParams.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.shaderFragMaskAMD.frag.out b/third_party/glslang/Test/baseResults/spv.shaderFragMaskAMD.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.shaderGroupVote.comp.out b/third_party/glslang/Test/baseResults/spv.shaderGroupVote.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.shaderStencilExport.frag.out b/third_party/glslang/Test/baseResults/spv.shaderStencilExport.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.shiftOps.frag.out b/third_party/glslang/Test/baseResults/spv.shiftOps.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.shortCircuit.frag.out b/third_party/glslang/Test/baseResults/spv.shortCircuit.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.sparseTexture.frag.out b/third_party/glslang/Test/baseResults/spv.sparseTexture.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.sparseTextureClamp.frag.out b/third_party/glslang/Test/baseResults/spv.sparseTextureClamp.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.specConstant.comp.out b/third_party/glslang/Test/baseResults/spv.specConstant.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.specConstant.vert.out b/third_party/glslang/Test/baseResults/spv.specConstant.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.specConstantComposite.vert.out b/third_party/glslang/Test/baseResults/spv.specConstantComposite.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.specConstantOperations.vert.out b/third_party/glslang/Test/baseResults/spv.specConstantOperations.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.ssbo.autoassign.frag.out b/third_party/glslang/Test/baseResults/spv.ssbo.autoassign.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.stereoViewRendering.tesc.out b/third_party/glslang/Test/baseResults/spv.stereoViewRendering.tesc.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.stereoViewRendering.vert.out b/third_party/glslang/Test/baseResults/spv.stereoViewRendering.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.subgroup.frag.out b/third_party/glslang/Test/baseResults/spv.subgroup.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.subgroup.geom.out b/third_party/glslang/Test/baseResults/spv.subgroup.geom.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.subgroup.tesc.out b/third_party/glslang/Test/baseResults/spv.subgroup.tesc.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.subgroup.tese.out b/third_party/glslang/Test/baseResults/spv.subgroup.tese.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.subgroup.vert.out b/third_party/glslang/Test/baseResults/spv.subgroup.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.subgroupArithmetic.comp.out b/third_party/glslang/Test/baseResults/spv.subgroupArithmetic.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.subgroupBallot.comp.out b/third_party/glslang/Test/baseResults/spv.subgroupBallot.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.subgroupBasic.comp.out b/third_party/glslang/Test/baseResults/spv.subgroupBasic.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.subgroupClustered.comp.out b/third_party/glslang/Test/baseResults/spv.subgroupClustered.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.subgroupQuad.comp.out b/third_party/glslang/Test/baseResults/spv.subgroupQuad.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.subgroupShuffle.comp.out b/third_party/glslang/Test/baseResults/spv.subgroupShuffle.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.subgroupShuffleRelative.comp.out b/third_party/glslang/Test/baseResults/spv.subgroupShuffleRelative.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.subgroupVote.comp.out b/third_party/glslang/Test/baseResults/spv.subgroupVote.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.subpass.frag.out b/third_party/glslang/Test/baseResults/spv.subpass.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.test.frag.out b/third_party/glslang/Test/baseResults/spv.test.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.test.vert.out b/third_party/glslang/Test/baseResults/spv.test.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.texture.sampler.transform.frag.out b/third_party/glslang/Test/baseResults/spv.texture.sampler.transform.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.textureGatherBiasLod.frag.out b/third_party/glslang/Test/baseResults/spv.textureGatherBiasLod.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.uniformArray.frag.out b/third_party/glslang/Test/baseResults/spv.uniformArray.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.viewportArray2.tesc.out b/third_party/glslang/Test/baseResults/spv.viewportArray2.tesc.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.viewportArray2.vert.out b/third_party/glslang/Test/baseResults/spv.viewportArray2.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/spv.while-continue-break.vert.out b/third_party/glslang/Test/baseResults/spv.while-continue-break.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/stringToDouble.vert.out b/third_party/glslang/Test/baseResults/stringToDouble.vert.out index b4c073cbe5..a799d0a42f 100755 --- a/third_party/glslang/Test/baseResults/stringToDouble.vert.out +++ b/third_party/glslang/Test/baseResults/stringToDouble.vert.out @@ -1,5 +1,6 @@ stringToDouble.vert Shader version: 460 +Requested GL_KHX_shader_explicit_arithmetic_types_float16 0:? Sequence 0:3 Function Definition: main( ( global void) 0:3 Function Parameters: @@ -440,10 +441,80 @@ Shader version: 460 0:95 Constant: 0:95 5.7089907708238e+45 0:97 Sequence -0:97 move second child to first child ( temp double) -0:97 'pi' ( temp double) +0:97 move second child to first child ( temp float) +0:97 'pi1' ( temp float) 0:97 Constant: 0:97 3.141593 +0:98 Sequence +0:98 move second child to first child ( temp float) +0:98 'pi2' ( temp float) +0:98 Constant: +0:98 3.141593 +0:99 Sequence +0:99 move second child to first child ( temp float) +0:99 'pi3' ( temp float) +0:99 Constant: +0:99 3.141593 +0:101 Sequence +0:101 move second child to first child ( temp double) +0:101 'dpi1' ( temp double) +0:101 Constant: +0:101 3.141593 +0:102 Sequence +0:102 move second child to first child ( temp double) +0:102 'dpi2' ( temp double) +0:102 Constant: +0:102 3.141593 +0:103 Sequence +0:103 move second child to first child ( temp double) +0:103 'dpi3' ( temp double) +0:103 Constant: +0:103 3.141593 +0:105 Sequence +0:105 move second child to first child ( temp float) +0:105 'dfpi1' ( temp float) +0:105 Constant: +0:105 3.141593 +0:106 Sequence +0:106 move second child to first child ( temp float) +0:106 'dfpi2' ( temp float) +0:106 Constant: +0:106 3.141593 +0:107 Sequence +0:107 move second child to first child ( temp float) +0:107 'dfpi3' ( temp float) +0:107 Constant: +0:107 3.141593 +0:109 Sequence +0:109 move second child to first child ( temp double) +0:109 'lfpi1' ( temp double) +0:109 Constant: +0:109 3.141593 +0:110 Sequence +0:110 move second child to first child ( temp double) +0:110 'lfpi2' ( temp double) +0:110 Constant: +0:110 3.141593 +0:111 Sequence +0:111 move second child to first child ( temp double) +0:111 'lfpi3' ( temp double) +0:111 Constant: +0:111 3.141593 +0:113 Sequence +0:113 move second child to first child ( temp double) +0:113 'hfpi1' ( temp double) +0:113 Constant: +0:113 3.141593 +0:114 Sequence +0:114 move second child to first child ( temp double) +0:114 'hfpi2' ( temp double) +0:114 Constant: +0:114 3.141593 +0:115 Sequence +0:115 move second child to first child ( temp double) +0:115 'hfpi3' ( temp double) +0:115 Constant: +0:115 3.141593 0:? Linker Objects 0:? 'gl_VertexID' ( gl_VertexId int VertexId) 0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) @@ -453,6 +524,7 @@ Linked vertex stage: Shader version: 460 +Requested GL_KHX_shader_explicit_arithmetic_types_float16 0:? Sequence 0:3 Function Definition: main( ( global void) 0:3 Function Parameters: @@ -893,10 +965,80 @@ Shader version: 460 0:95 Constant: 0:95 5.7089907708238e+45 0:97 Sequence -0:97 move second child to first child ( temp double) -0:97 'pi' ( temp double) +0:97 move second child to first child ( temp float) +0:97 'pi1' ( temp float) 0:97 Constant: 0:97 3.141593 +0:98 Sequence +0:98 move second child to first child ( temp float) +0:98 'pi2' ( temp float) +0:98 Constant: +0:98 3.141593 +0:99 Sequence +0:99 move second child to first child ( temp float) +0:99 'pi3' ( temp float) +0:99 Constant: +0:99 3.141593 +0:101 Sequence +0:101 move second child to first child ( temp double) +0:101 'dpi1' ( temp double) +0:101 Constant: +0:101 3.141593 +0:102 Sequence +0:102 move second child to first child ( temp double) +0:102 'dpi2' ( temp double) +0:102 Constant: +0:102 3.141593 +0:103 Sequence +0:103 move second child to first child ( temp double) +0:103 'dpi3' ( temp double) +0:103 Constant: +0:103 3.141593 +0:105 Sequence +0:105 move second child to first child ( temp float) +0:105 'dfpi1' ( temp float) +0:105 Constant: +0:105 3.141593 +0:106 Sequence +0:106 move second child to first child ( temp float) +0:106 'dfpi2' ( temp float) +0:106 Constant: +0:106 3.141593 +0:107 Sequence +0:107 move second child to first child ( temp float) +0:107 'dfpi3' ( temp float) +0:107 Constant: +0:107 3.141593 +0:109 Sequence +0:109 move second child to first child ( temp double) +0:109 'lfpi1' ( temp double) +0:109 Constant: +0:109 3.141593 +0:110 Sequence +0:110 move second child to first child ( temp double) +0:110 'lfpi2' ( temp double) +0:110 Constant: +0:110 3.141593 +0:111 Sequence +0:111 move second child to first child ( temp double) +0:111 'lfpi3' ( temp double) +0:111 Constant: +0:111 3.141593 +0:113 Sequence +0:113 move second child to first child ( temp double) +0:113 'hfpi1' ( temp double) +0:113 Constant: +0:113 3.141593 +0:114 Sequence +0:114 move second child to first child ( temp double) +0:114 'hfpi2' ( temp double) +0:114 Constant: +0:114 3.141593 +0:115 Sequence +0:115 move second child to first child ( temp double) +0:115 'hfpi3' ( temp double) +0:115 Constant: +0:115 3.141593 0:? Linker Objects 0:? 'gl_VertexID' ( gl_VertexId int VertexId) 0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) diff --git a/third_party/glslang/Test/baseResults/structAssignment.frag.out b/third_party/glslang/Test/baseResults/structAssignment.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/structDeref.frag.out b/third_party/glslang/Test/baseResults/structDeref.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/structure.frag.out b/third_party/glslang/Test/baseResults/structure.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/switch.frag.out b/third_party/glslang/Test/baseResults/switch.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/swizzle.frag.out b/third_party/glslang/Test/baseResults/swizzle.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/syntaxError.frag.out b/third_party/glslang/Test/baseResults/syntaxError.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/test.conf b/third_party/glslang/Test/baseResults/test.conf old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/test.frag.out b/third_party/glslang/Test/baseResults/test.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/texture.frag.out b/third_party/glslang/Test/baseResults/texture.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/tokenLength.vert.out b/third_party/glslang/Test/baseResults/tokenLength.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/types.frag.out b/third_party/glslang/Test/baseResults/types.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/uint.frag.out b/third_party/glslang/Test/baseResults/uint.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/uniformArray.frag.out b/third_party/glslang/Test/baseResults/uniformArray.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/variableArrayIndex.frag.out b/third_party/glslang/Test/baseResults/variableArrayIndex.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/varyingArray.frag.out b/third_party/glslang/Test/baseResults/varyingArray.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/varyingArrayIndirect.frag.out b/third_party/glslang/Test/baseResults/varyingArrayIndirect.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/versionsClean.frag.out b/third_party/glslang/Test/baseResults/versionsClean.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/versionsClean.vert.out b/third_party/glslang/Test/baseResults/versionsClean.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/versionsErrors.frag.out b/third_party/glslang/Test/baseResults/versionsErrors.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/versionsErrors.vert.out b/third_party/glslang/Test/baseResults/versionsErrors.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/voidFunction.frag.out b/third_party/glslang/Test/baseResults/voidFunction.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/vulkan.comp.out b/third_party/glslang/Test/baseResults/vulkan.comp.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/vulkan.frag.out b/third_party/glslang/Test/baseResults/vulkan.frag.out old mode 100755 new mode 100644 index 735084ce91..c81ed25a61 --- a/third_party/glslang/Test/baseResults/vulkan.frag.out +++ b/third_party/glslang/Test/baseResults/vulkan.frag.out @@ -15,7 +15,6 @@ ERROR: 0:19: 'sampler2D' : sampler-constructor second argument must be a scalar ERROR: 0:21: 'sampler3D' : sampler-constructor cannot make an array of samplers ERROR: 0:22: 'sampler2D' : sampler-constructor first argument must be a scalar textureXXX type ERROR: 0:23: 'sampler2D' : sampler-constructor first argument must match type and dimensionality of constructor type -ERROR: 0:24: 'sampler2D' : sampler-constructor second argument presence of shadow must match constructor presence of shadow ERROR: 0:28: 'sampler2D' : sampler/image types can only be used in uniform variables or function parameters: s2D ERROR: 0:29: 'sampler3D' : sampler-constructor cannot make an array of samplers ERROR: 0:29: 'sampler3D' : sampler/image types can only be used in uniform variables or function parameters: s3d @@ -55,7 +54,7 @@ ERROR: 0:101: 'noise1' : no matching overloaded function found ERROR: 0:102: 'noise2' : no matching overloaded function found ERROR: 0:103: 'noise3' : no matching overloaded function found ERROR: 0:104: 'noise4' : no matching overloaded function found -ERROR: 54 compilation errors. No code generated. +ERROR: 53 compilation errors. No code generated. ERROR: Linking fragment stage: Only one push_constant block is allowed per stage diff --git a/third_party/glslang/Test/baseResults/vulkan.vert.out b/third_party/glslang/Test/baseResults/vulkan.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/baseResults/whileLoop.frag.out b/third_party/glslang/Test/baseResults/whileLoop.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/comment.frag b/third_party/glslang/Test/comment.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/conditionalDiscard.frag b/third_party/glslang/Test/conditionalDiscard.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/constErrors.frag b/third_party/glslang/Test/constErrors.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/constFoldIntMin.frag b/third_party/glslang/Test/constFoldIntMin.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/conversion.frag b/third_party/glslang/Test/conversion.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/cppBad.vert b/third_party/glslang/Test/cppBad.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/cppComplexExpr.vert b/third_party/glslang/Test/cppComplexExpr.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/cppDeepNest.frag b/third_party/glslang/Test/cppDeepNest.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/cppIndent.vert b/third_party/glslang/Test/cppIndent.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/cppIntMinOverNegativeOne.frag b/third_party/glslang/Test/cppIntMinOverNegativeOne.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/cppNest.vert b/third_party/glslang/Test/cppNest.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/cppRelaxSkipTokensErrors.vert b/third_party/glslang/Test/cppRelaxSkipTokensErrors.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/cppSimple.vert b/third_party/glslang/Test/cppSimple.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/dataOut.frag b/third_party/glslang/Test/dataOut.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/dataOutIndirect.frag b/third_party/glslang/Test/dataOutIndirect.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/dce.frag b/third_party/glslang/Test/dce.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/decls.frag b/third_party/glslang/Test/decls.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/deepRvalue.frag b/third_party/glslang/Test/deepRvalue.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/depthOut.frag b/third_party/glslang/Test/depthOut.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/discard-dce.frag b/third_party/glslang/Test/discard-dce.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/doWhileLoop.frag b/third_party/glslang/Test/doWhileLoop.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/earlyReturnDiscard.frag b/third_party/glslang/Test/earlyReturnDiscard.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/empty.frag b/third_party/glslang/Test/empty.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/empty2.frag b/third_party/glslang/Test/empty2.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/empty3.frag b/third_party/glslang/Test/empty3.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/errors.frag b/third_party/glslang/Test/errors.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/es-link1.frag b/third_party/glslang/Test/es-link1.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/es-link2.frag b/third_party/glslang/Test/es-link2.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/findFunction.frag b/third_party/glslang/Test/findFunction.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/flowControl.frag b/third_party/glslang/Test/flowControl.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/foo.h b/third_party/glslang/Test/foo.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/forLoop.frag b/third_party/glslang/Test/forLoop.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/forwardRef.frag b/third_party/glslang/Test/forwardRef.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/functionCall.frag b/third_party/glslang/Test/functionCall.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/functionSemantics.frag b/third_party/glslang/Test/functionSemantics.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/glsl.-D-U.frag b/third_party/glslang/Test/glsl.-D-U.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/glsl.entryPointRename.vert b/third_party/glslang/Test/glsl.entryPointRename.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/glsl.entryPointRename2.vert b/third_party/glslang/Test/glsl.entryPointRename2.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/glspv.esversion.vert b/third_party/glslang/Test/glspv.esversion.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/glspv.frag b/third_party/glslang/Test/glspv.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/glspv.version.frag b/third_party/glslang/Test/glspv.version.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/glspv.version.vert b/third_party/glslang/Test/glspv.version.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/glspv.vert b/third_party/glslang/Test/glspv.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.-D-U.frag b/third_party/glslang/Test/hlsl.-D-U.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.PointSize.geom b/third_party/glslang/Test/hlsl.PointSize.geom old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.PointSize.vert b/third_party/glslang/Test/hlsl.PointSize.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.aliasOpaque.frag b/third_party/glslang/Test/hlsl.aliasOpaque.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.array.flatten.frag b/third_party/glslang/Test/hlsl.array.flatten.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.array.frag b/third_party/glslang/Test/hlsl.array.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.array.implicit-size.frag b/third_party/glslang/Test/hlsl.array.implicit-size.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.array.multidim.frag b/third_party/glslang/Test/hlsl.array.multidim.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.assoc.frag b/third_party/glslang/Test/hlsl.assoc.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.attribute.expression.comp b/third_party/glslang/Test/hlsl.attribute.expression.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.attribute.frag b/third_party/glslang/Test/hlsl.attribute.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.attributeC11.frag b/third_party/glslang/Test/hlsl.attributeC11.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.attributeGlobalBuffer.frag b/third_party/glslang/Test/hlsl.attributeGlobalBuffer.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.automap.frag b/third_party/glslang/Test/hlsl.automap.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.basic.comp b/third_party/glslang/Test/hlsl.basic.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.basic.geom b/third_party/glslang/Test/hlsl.basic.geom old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.buffer.frag b/third_party/glslang/Test/hlsl.buffer.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.calculatelod.dx10.frag b/third_party/glslang/Test/hlsl.calculatelod.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.calculatelodunclamped.dx10.frag b/third_party/glslang/Test/hlsl.calculatelodunclamped.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.cast.frag b/third_party/glslang/Test/hlsl.cast.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.cbuffer-identifier.vert b/third_party/glslang/Test/hlsl.cbuffer-identifier.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.clip.frag b/third_party/glslang/Test/hlsl.clip.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.clipdistance-1.frag b/third_party/glslang/Test/hlsl.clipdistance-1.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.clipdistance-1.geom b/third_party/glslang/Test/hlsl.clipdistance-1.geom old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.clipdistance-1.vert b/third_party/glslang/Test/hlsl.clipdistance-1.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.clipdistance-2.frag b/third_party/glslang/Test/hlsl.clipdistance-2.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.clipdistance-2.geom b/third_party/glslang/Test/hlsl.clipdistance-2.geom old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.clipdistance-2.vert b/third_party/glslang/Test/hlsl.clipdistance-2.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.clipdistance-3.frag b/third_party/glslang/Test/hlsl.clipdistance-3.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.clipdistance-3.geom b/third_party/glslang/Test/hlsl.clipdistance-3.geom old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.clipdistance-3.vert b/third_party/glslang/Test/hlsl.clipdistance-3.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.clipdistance-4.frag b/third_party/glslang/Test/hlsl.clipdistance-4.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.clipdistance-4.geom b/third_party/glslang/Test/hlsl.clipdistance-4.geom old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.clipdistance-4.vert b/third_party/glslang/Test/hlsl.clipdistance-4.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.clipdistance-5.frag b/third_party/glslang/Test/hlsl.clipdistance-5.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.clipdistance-5.vert b/third_party/glslang/Test/hlsl.clipdistance-5.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.clipdistance-6.frag b/third_party/glslang/Test/hlsl.clipdistance-6.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.clipdistance-6.vert b/third_party/glslang/Test/hlsl.clipdistance-6.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.clipdistance-7.frag b/third_party/glslang/Test/hlsl.clipdistance-7.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.clipdistance-7.vert b/third_party/glslang/Test/hlsl.clipdistance-7.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.clipdistance-8.frag b/third_party/glslang/Test/hlsl.clipdistance-8.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.clipdistance-8.vert b/third_party/glslang/Test/hlsl.clipdistance-8.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.clipdistance-9.frag b/third_party/glslang/Test/hlsl.clipdistance-9.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.clipdistance-9.vert b/third_party/glslang/Test/hlsl.clipdistance-9.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.color.hull.tesc b/third_party/glslang/Test/hlsl.color.hull.tesc old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.comparison.vec.frag b/third_party/glslang/Test/hlsl.comparison.vec.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.conditional.frag b/third_party/glslang/Test/hlsl.conditional.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.constantbuffer.frag b/third_party/glslang/Test/hlsl.constantbuffer.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.constructArray.vert b/third_party/glslang/Test/hlsl.constructArray.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.constructexpr.frag b/third_party/glslang/Test/hlsl.constructexpr.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.constructimat.frag b/third_party/glslang/Test/hlsl.constructimat.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.dashI.vert b/third_party/glslang/Test/hlsl.dashI.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.deadFunctionMissingBody.vert b/third_party/glslang/Test/hlsl.deadFunctionMissingBody.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.depthGreater.frag b/third_party/glslang/Test/hlsl.depthGreater.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.depthLess.frag b/third_party/glslang/Test/hlsl.depthLess.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.discard.frag b/third_party/glslang/Test/hlsl.discard.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.doLoop.frag b/third_party/glslang/Test/hlsl.doLoop.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.domain.1.tese b/third_party/glslang/Test/hlsl.domain.1.tese old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.domain.2.tese b/third_party/glslang/Test/hlsl.domain.2.tese old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.domain.3.tese b/third_party/glslang/Test/hlsl.domain.3.tese old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.emptystruct.init.vert b/third_party/glslang/Test/hlsl.emptystruct.init.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.emptystructreturn.frag b/third_party/glslang/Test/hlsl.emptystructreturn.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.emptystructreturn.vert b/third_party/glslang/Test/hlsl.emptystructreturn.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.entry-in.frag b/third_party/glslang/Test/hlsl.entry-in.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.entry-out.frag b/third_party/glslang/Test/hlsl.entry-out.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.entry.rename.frag b/third_party/glslang/Test/hlsl.entry.rename.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.explicitDescriptorSet.frag b/third_party/glslang/Test/hlsl.explicitDescriptorSet.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.flatten.return.frag b/third_party/glslang/Test/hlsl.flatten.return.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.flattenOpaque.frag b/third_party/glslang/Test/hlsl.flattenOpaque.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.flattenOpaqueInit.vert b/third_party/glslang/Test/hlsl.flattenOpaqueInit.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.flattenOpaqueInitMix.vert b/third_party/glslang/Test/hlsl.flattenOpaqueInitMix.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.float1.frag b/third_party/glslang/Test/hlsl.float1.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.float4.frag b/third_party/glslang/Test/hlsl.float4.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.forLoop.frag b/third_party/glslang/Test/hlsl.forLoop.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.frag b/third_party/glslang/Test/hlsl.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.fraggeom.frag b/third_party/glslang/Test/hlsl.fraggeom.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.function.frag b/third_party/glslang/Test/hlsl.function.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.gather.array.dx10.frag b/third_party/glslang/Test/hlsl.gather.array.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.gather.basic.dx10.frag b/third_party/glslang/Test/hlsl.gather.basic.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.gather.basic.dx10.vert b/third_party/glslang/Test/hlsl.gather.basic.dx10.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.gather.offset.dx10.frag b/third_party/glslang/Test/hlsl.gather.offset.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.gather.offsetarray.dx10.frag b/third_party/glslang/Test/hlsl.gather.offsetarray.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.gatherRGBA.array.dx10.frag b/third_party/glslang/Test/hlsl.gatherRGBA.array.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.gatherRGBA.basic.dx10.frag b/third_party/glslang/Test/hlsl.gatherRGBA.basic.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.gatherRGBA.offset.dx10.frag b/third_party/glslang/Test/hlsl.gatherRGBA.offset.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.gatherRGBA.offsetarray.dx10.frag b/third_party/glslang/Test/hlsl.gatherRGBA.offsetarray.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.gathercmpRGBA.array.dx10.frag b/third_party/glslang/Test/hlsl.gathercmpRGBA.array.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.gathercmpRGBA.basic.dx10.frag b/third_party/glslang/Test/hlsl.gathercmpRGBA.basic.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.gathercmpRGBA.offset.dx10.frag b/third_party/glslang/Test/hlsl.gathercmpRGBA.offset.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.gathercmpRGBA.offsetarray.dx10.frag b/third_party/glslang/Test/hlsl.gathercmpRGBA.offsetarray.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.getdimensions.dx10.frag b/third_party/glslang/Test/hlsl.getdimensions.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.getdimensions.dx10.vert b/third_party/glslang/Test/hlsl.getdimensions.dx10.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.getdimensions.rw.dx10.frag b/third_party/glslang/Test/hlsl.getdimensions.rw.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.getsampleposition.dx10.frag b/third_party/glslang/Test/hlsl.getsampleposition.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.global-const-init.frag b/third_party/glslang/Test/hlsl.global-const-init.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.gs-hs-mix.tesc b/third_party/glslang/Test/hlsl.gs-hs-mix.tesc old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.hull.1.tesc b/third_party/glslang/Test/hlsl.hull.1.tesc old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.hull.2.tesc b/third_party/glslang/Test/hlsl.hull.2.tesc old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.hull.3.tesc b/third_party/glslang/Test/hlsl.hull.3.tesc old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.hull.4.tesc b/third_party/glslang/Test/hlsl.hull.4.tesc old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.hull.5.tesc b/third_party/glslang/Test/hlsl.hull.5.tesc old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.hull.ctrlpt-1.tesc b/third_party/glslang/Test/hlsl.hull.ctrlpt-1.tesc old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.hull.ctrlpt-2.tesc b/third_party/glslang/Test/hlsl.hull.ctrlpt-2.tesc old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.hull.void.tesc b/third_party/glslang/Test/hlsl.hull.void.tesc old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.identifier.sample.frag b/third_party/glslang/Test/hlsl.identifier.sample.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.if.frag b/third_party/glslang/Test/hlsl.if.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.imagefetch-subvec4.comp b/third_party/glslang/Test/hlsl.imagefetch-subvec4.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.include.vert b/third_party/glslang/Test/hlsl.include.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.includeNegative.vert b/third_party/glslang/Test/hlsl.includeNegative.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.init.frag b/third_party/glslang/Test/hlsl.init.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.init2.frag b/third_party/glslang/Test/hlsl.init2.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.inoutquals.frag b/third_party/glslang/Test/hlsl.inoutquals.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.intrinsic.frexp.frag b/third_party/glslang/Test/hlsl.intrinsic.frexp.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.intrinsic.frexp.vert b/third_party/glslang/Test/hlsl.intrinsic.frexp.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.intrinsics.barriers.comp b/third_party/glslang/Test/hlsl.intrinsics.barriers.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.intrinsics.comp b/third_party/glslang/Test/hlsl.intrinsics.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.intrinsics.d3dcolortoubyte4.frag b/third_party/glslang/Test/hlsl.intrinsics.d3dcolortoubyte4.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.intrinsics.double.frag b/third_party/glslang/Test/hlsl.intrinsics.double.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.intrinsics.evalfns.frag b/third_party/glslang/Test/hlsl.intrinsics.evalfns.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.intrinsics.f1632.frag b/third_party/glslang/Test/hlsl.intrinsics.f1632.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.intrinsics.f3216.frag b/third_party/glslang/Test/hlsl.intrinsics.f3216.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.intrinsics.lit.frag b/third_party/glslang/Test/hlsl.intrinsics.lit.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.intrinsics.negative.comp b/third_party/glslang/Test/hlsl.intrinsics.negative.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.intrinsics.negative.frag b/third_party/glslang/Test/hlsl.intrinsics.negative.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.intrinsics.negative.vert b/third_party/glslang/Test/hlsl.intrinsics.negative.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.intrinsics.promote.down.frag b/third_party/glslang/Test/hlsl.intrinsics.promote.down.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.intrinsics.promote.frag b/third_party/glslang/Test/hlsl.intrinsics.promote.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.intrinsics.promote.outputs.frag b/third_party/glslang/Test/hlsl.intrinsics.promote.outputs.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.intrinsics.vert b/third_party/glslang/Test/hlsl.intrinsics.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.isfinite.frag b/third_party/glslang/Test/hlsl.isfinite.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.layout.frag b/third_party/glslang/Test/hlsl.layout.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.layoutOverride.vert b/third_party/glslang/Test/hlsl.layoutOverride.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.load.2dms.dx10.frag b/third_party/glslang/Test/hlsl.load.2dms.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.load.array.dx10.frag b/third_party/glslang/Test/hlsl.load.array.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.load.basic.dx10.frag b/third_party/glslang/Test/hlsl.load.basic.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.load.basic.dx10.vert b/third_party/glslang/Test/hlsl.load.basic.dx10.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.load.buffer.dx10.frag b/third_party/glslang/Test/hlsl.load.buffer.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.load.buffer.float.dx10.frag b/third_party/glslang/Test/hlsl.load.buffer.float.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.load.offset.dx10.frag b/third_party/glslang/Test/hlsl.load.offset.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.load.offsetarray.dx10.frag b/third_party/glslang/Test/hlsl.load.offsetarray.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.load.rwbuffer.dx10.frag b/third_party/glslang/Test/hlsl.load.rwbuffer.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.load.rwtexture.array.dx10.frag b/third_party/glslang/Test/hlsl.load.rwtexture.array.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.load.rwtexture.dx10.frag b/third_party/glslang/Test/hlsl.load.rwtexture.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.localStructuredBuffer.comp b/third_party/glslang/Test/hlsl.localStructuredBuffer.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.logical.binary.frag b/third_party/glslang/Test/hlsl.logical.binary.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.logical.binary.vec.frag b/third_party/glslang/Test/hlsl.logical.binary.vec.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.logical.unary.frag b/third_party/glslang/Test/hlsl.logical.unary.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.loopattr.frag b/third_party/glslang/Test/hlsl.loopattr.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.matNx1.frag b/third_party/glslang/Test/hlsl.matNx1.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.matType.bool.frag b/third_party/glslang/Test/hlsl.matType.bool.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.matType.frag b/third_party/glslang/Test/hlsl.matType.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.matType.int.frag b/third_party/glslang/Test/hlsl.matType.int.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.matpack-1.frag b/third_party/glslang/Test/hlsl.matpack-1.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.matpack-pragma.frag b/third_party/glslang/Test/hlsl.matpack-pragma.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.matrixSwizzle.vert b/third_party/glslang/Test/hlsl.matrixSwizzle.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.matrixindex.frag b/third_party/glslang/Test/hlsl.matrixindex.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.max.frag b/third_party/glslang/Test/hlsl.max.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.memberFunCall.frag b/third_party/glslang/Test/hlsl.memberFunCall.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.mintypes.frag b/third_party/glslang/Test/hlsl.mintypes.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.mip.negative.frag b/third_party/glslang/Test/hlsl.mip.negative.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.mip.negative2.frag b/third_party/glslang/Test/hlsl.mip.negative2.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.mip.operator.frag b/third_party/glslang/Test/hlsl.mip.operator.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.mul-truncate.frag b/third_party/glslang/Test/hlsl.mul-truncate.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.multiDescriptorSet.frag b/third_party/glslang/Test/hlsl.multiDescriptorSet.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.nonint-index.frag b/third_party/glslang/Test/hlsl.nonint-index.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.numericsuffixes.frag b/third_party/glslang/Test/hlsl.numericsuffixes.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.numthreads.comp b/third_party/glslang/Test/hlsl.numthreads.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.opaque-type-bug.frag b/third_party/glslang/Test/hlsl.opaque-type-bug.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.overload.frag b/third_party/glslang/Test/hlsl.overload.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.params.default.frag b/third_party/glslang/Test/hlsl.params.default.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.params.default.negative.frag b/third_party/glslang/Test/hlsl.params.default.negative.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.partialFlattenLocal.vert b/third_party/glslang/Test/hlsl.partialFlattenLocal.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.partialFlattenMixed.vert b/third_party/glslang/Test/hlsl.partialFlattenMixed.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.pp.line.frag b/third_party/glslang/Test/hlsl.pp.line.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.pp.tokenpasting.frag b/third_party/glslang/Test/hlsl.pp.tokenpasting.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.pp.vert b/third_party/glslang/Test/hlsl.pp.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.precedence.frag b/third_party/glslang/Test/hlsl.precedence.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.precedence2.frag b/third_party/glslang/Test/hlsl.precedence2.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.precise.frag b/third_party/glslang/Test/hlsl.precise.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.preprocessor.frag b/third_party/glslang/Test/hlsl.preprocessor.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.promote.atomic.frag b/third_party/glslang/Test/hlsl.promote.atomic.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.promote.binary.frag b/third_party/glslang/Test/hlsl.promote.binary.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.promote.vec1.frag b/third_party/glslang/Test/hlsl.promote.vec1.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.promotions.frag b/third_party/glslang/Test/hlsl.promotions.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.reflection.binding.frag b/third_party/glslang/Test/hlsl.reflection.binding.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.reflection.vert b/third_party/glslang/Test/hlsl.reflection.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.rw.atomics.frag b/third_party/glslang/Test/hlsl.rw.atomics.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.rw.bracket.frag b/third_party/glslang/Test/hlsl.rw.bracket.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.rw.register.frag b/third_party/glslang/Test/hlsl.rw.register.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.rw.scalar.bracket.frag b/third_party/glslang/Test/hlsl.rw.scalar.bracket.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.rw.swizzle.frag b/third_party/glslang/Test/hlsl.rw.swizzle.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.rw.vec2.bracket.frag b/third_party/glslang/Test/hlsl.rw.vec2.bracket.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.sample.array.dx10.frag b/third_party/glslang/Test/hlsl.sample.array.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.sample.basic.dx10.frag b/third_party/glslang/Test/hlsl.sample.basic.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.sample.offset.dx10.frag b/third_party/glslang/Test/hlsl.sample.offset.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.sample.offsetarray.dx10.frag b/third_party/glslang/Test/hlsl.sample.offsetarray.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.sample.sub-vec4.dx10.frag b/third_party/glslang/Test/hlsl.sample.sub-vec4.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.samplebias.array.dx10.frag b/third_party/glslang/Test/hlsl.samplebias.array.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.samplebias.basic.dx10.frag b/third_party/glslang/Test/hlsl.samplebias.basic.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.samplebias.offset.dx10.frag b/third_party/glslang/Test/hlsl.samplebias.offset.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.samplebias.offsetarray.dx10.frag b/third_party/glslang/Test/hlsl.samplebias.offsetarray.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.samplecmp.array.dx10.frag b/third_party/glslang/Test/hlsl.samplecmp.array.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.samplecmp.basic.dx10.frag b/third_party/glslang/Test/hlsl.samplecmp.basic.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.samplecmp.dualmode.frag b/third_party/glslang/Test/hlsl.samplecmp.dualmode.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.samplecmp.negative.frag b/third_party/glslang/Test/hlsl.samplecmp.negative.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.samplecmp.negative2.frag b/third_party/glslang/Test/hlsl.samplecmp.negative2.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.samplecmp.offset.dx10.frag b/third_party/glslang/Test/hlsl.samplecmp.offset.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.samplecmp.offsetarray.dx10.frag b/third_party/glslang/Test/hlsl.samplecmp.offsetarray.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.samplecmplevelzero.array.dx10.frag b/third_party/glslang/Test/hlsl.samplecmplevelzero.array.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.samplecmplevelzero.basic.dx10.frag b/third_party/glslang/Test/hlsl.samplecmplevelzero.basic.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.samplecmplevelzero.offset.dx10.frag b/third_party/glslang/Test/hlsl.samplecmplevelzero.offset.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.samplecmplevelzero.offsetarray.dx10.frag b/third_party/glslang/Test/hlsl.samplecmplevelzero.offsetarray.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.samplegrad.array.dx10.frag b/third_party/glslang/Test/hlsl.samplegrad.array.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.samplegrad.basic.dx10.frag b/third_party/glslang/Test/hlsl.samplegrad.basic.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.samplegrad.basic.dx10.vert b/third_party/glslang/Test/hlsl.samplegrad.basic.dx10.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.samplegrad.offset.dx10.frag b/third_party/glslang/Test/hlsl.samplegrad.offset.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.samplegrad.offsetarray.dx10.frag b/third_party/glslang/Test/hlsl.samplegrad.offsetarray.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.samplelevel.array.dx10.frag b/third_party/glslang/Test/hlsl.samplelevel.array.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.samplelevel.basic.dx10.frag b/third_party/glslang/Test/hlsl.samplelevel.basic.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.samplelevel.basic.dx10.vert b/third_party/glslang/Test/hlsl.samplelevel.basic.dx10.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.samplelevel.offset.dx10.frag b/third_party/glslang/Test/hlsl.samplelevel.offset.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.samplelevel.offsetarray.dx10.frag b/third_party/glslang/Test/hlsl.samplelevel.offsetarray.dx10.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.scalar-length.frag b/third_party/glslang/Test/hlsl.scalar-length.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.scalar2matrix.frag b/third_party/glslang/Test/hlsl.scalar2matrix.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.scope.frag b/third_party/glslang/Test/hlsl.scope.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.semantic-1.vert b/third_party/glslang/Test/hlsl.semantic-1.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.semantic.geom b/third_party/glslang/Test/hlsl.semantic.geom old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.semantic.vert b/third_party/glslang/Test/hlsl.semantic.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.semicolons.frag b/third_party/glslang/Test/hlsl.semicolons.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.shapeConv.frag b/third_party/glslang/Test/hlsl.shapeConv.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.shift.per-set.frag b/third_party/glslang/Test/hlsl.shift.per-set.frag index 9c29f9d96c..d7c0243e81 100755 --- a/third_party/glslang/Test/hlsl.shift.per-set.frag +++ b/third_party/glslang/Test/hlsl.shift.per-set.frag @@ -6,7 +6,7 @@ SamplerComparisonState s2 : register(s2, space2); Texture1D t1 : register(t1, space1); Texture2D t2 : register(t2, space1); Texture3D t3 : register(t1, space2); - +Texture3D ts6 : register(t1, space6); StructuredBuffer t4 : register(t1, space3); ByteAddressBuffer t5 : register(t2, space3); @@ -54,6 +54,7 @@ float4 main() : SV_Target0 cb1; tb1; + ts6; return 0; } diff --git a/third_party/glslang/Test/hlsl.sin.frag b/third_party/glslang/Test/hlsl.sin.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.snorm.uav.comp b/third_party/glslang/Test/hlsl.snorm.uav.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.store.rwbyteaddressbuffer.type.comp b/third_party/glslang/Test/hlsl.store.rwbyteaddressbuffer.type.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.stringtoken.frag b/third_party/glslang/Test/hlsl.stringtoken.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.struct.frag b/third_party/glslang/Test/hlsl.struct.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.struct.split-1.vert b/third_party/glslang/Test/hlsl.struct.split-1.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.struct.split.array.geom b/third_party/glslang/Test/hlsl.struct.split.array.geom old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.struct.split.assign.frag b/third_party/glslang/Test/hlsl.struct.split.assign.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.struct.split.call.vert b/third_party/glslang/Test/hlsl.struct.split.call.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.struct.split.nested.geom b/third_party/glslang/Test/hlsl.struct.split.nested.geom old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.struct.split.trivial.geom b/third_party/glslang/Test/hlsl.struct.split.trivial.geom old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.struct.split.trivial.vert b/third_party/glslang/Test/hlsl.struct.split.trivial.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.structarray.flatten.frag b/third_party/glslang/Test/hlsl.structarray.flatten.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.structarray.flatten.geom b/third_party/glslang/Test/hlsl.structarray.flatten.geom old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.structbuffer.append.fn.frag b/third_party/glslang/Test/hlsl.structbuffer.append.fn.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.structbuffer.append.frag b/third_party/glslang/Test/hlsl.structbuffer.append.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.structbuffer.atomics.frag b/third_party/glslang/Test/hlsl.structbuffer.atomics.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.structbuffer.byte.frag b/third_party/glslang/Test/hlsl.structbuffer.byte.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.structbuffer.coherent.frag b/third_party/glslang/Test/hlsl.structbuffer.coherent.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.structbuffer.floatidx.comp b/third_party/glslang/Test/hlsl.structbuffer.floatidx.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.structbuffer.fn.frag b/third_party/glslang/Test/hlsl.structbuffer.fn.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.structbuffer.fn2.comp b/third_party/glslang/Test/hlsl.structbuffer.fn2.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.structbuffer.frag b/third_party/glslang/Test/hlsl.structbuffer.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.structbuffer.incdec.frag b/third_party/glslang/Test/hlsl.structbuffer.incdec.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.structbuffer.rw.frag b/third_party/glslang/Test/hlsl.structbuffer.rw.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.structbuffer.rwbyte.frag b/third_party/glslang/Test/hlsl.structbuffer.rwbyte.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.structin.vert b/third_party/glslang/Test/hlsl.structin.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.subpass.frag b/third_party/glslang/Test/hlsl.subpass.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.switch.frag b/third_party/glslang/Test/hlsl.switch.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.swizzle.frag b/third_party/glslang/Test/hlsl.swizzle.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.synthesizeInput.frag b/third_party/glslang/Test/hlsl.synthesizeInput.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.target.frag b/third_party/glslang/Test/hlsl.target.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.targetStruct1.frag b/third_party/glslang/Test/hlsl.targetStruct1.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.targetStruct2.frag b/third_party/glslang/Test/hlsl.targetStruct2.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.templatetypes.frag b/third_party/glslang/Test/hlsl.templatetypes.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.templatetypes.negative.frag b/third_party/glslang/Test/hlsl.templatetypes.negative.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.texture.struct.frag b/third_party/glslang/Test/hlsl.texture.struct.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.texture.subvec4.frag b/third_party/glslang/Test/hlsl.texture.subvec4.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.texturebuffer.frag b/third_party/glslang/Test/hlsl.texturebuffer.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.tx.bracket.frag b/third_party/glslang/Test/hlsl.tx.bracket.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.tx.overload.frag b/third_party/glslang/Test/hlsl.tx.overload.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.type.half.frag b/third_party/glslang/Test/hlsl.type.half.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.type.identifier.frag b/third_party/glslang/Test/hlsl.type.identifier.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.typeGraphCopy.vert b/third_party/glslang/Test/hlsl.typeGraphCopy.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.typedef.frag b/third_party/glslang/Test/hlsl.typedef.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.void.frag b/third_party/glslang/Test/hlsl.void.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.wavebroadcast.comp b/third_party/glslang/Test/hlsl.wavebroadcast.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.waveprefix.comp b/third_party/glslang/Test/hlsl.waveprefix.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.wavequad.comp b/third_party/glslang/Test/hlsl.wavequad.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.wavequery.comp b/third_party/glslang/Test/hlsl.wavequery.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.wavequery.frag b/third_party/glslang/Test/hlsl.wavequery.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.wavereduction.comp b/third_party/glslang/Test/hlsl.wavereduction.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.wavevote.comp b/third_party/glslang/Test/hlsl.wavevote.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.whileLoop.frag b/third_party/glslang/Test/hlsl.whileLoop.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.y-negate-1.vert b/third_party/glslang/Test/hlsl.y-negate-1.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.y-negate-2.vert b/third_party/glslang/Test/hlsl.y-negate-2.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/hlsl.y-negate-3.vert b/third_party/glslang/Test/hlsl.y-negate-3.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/implicitInnerAtomicUint.frag b/third_party/glslang/Test/implicitInnerAtomicUint.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/inc1/badInc.h b/third_party/glslang/Test/inc1/badInc.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/inc1/bar.h b/third_party/glslang/Test/inc1/bar.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/inc1/foo.h b/third_party/glslang/Test/inc1/foo.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/inc1/path1/bar.h b/third_party/glslang/Test/inc1/path1/bar.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/inc1/path1/local.h b/third_party/glslang/Test/inc1/path1/local.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/inc1/path1/notHere.h b/third_party/glslang/Test/inc1/path1/notHere.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/inc1/path2/bar.h b/third_party/glslang/Test/inc1/path2/bar.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/inc1/path2/notHere.h b/third_party/glslang/Test/inc1/path2/notHere.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/inc1/path2/remote.h b/third_party/glslang/Test/inc1/path2/remote.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/inc2/bar.h b/third_party/glslang/Test/inc2/bar.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/inc2/foo.h b/third_party/glslang/Test/inc2/foo.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/include.vert b/third_party/glslang/Test/include.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/invalidSwizzle.vert b/third_party/glslang/Test/invalidSwizzle.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/length.frag b/third_party/glslang/Test/length.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/lineContinuation.vert b/third_party/glslang/Test/lineContinuation.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/lineContinuation100.vert b/third_party/glslang/Test/lineContinuation100.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/link1.frag b/third_party/glslang/Test/link1.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/link1.vk.frag b/third_party/glslang/Test/link1.vk.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/link2.frag b/third_party/glslang/Test/link2.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/link2.vk.frag b/third_party/glslang/Test/link2.vk.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/link3.frag b/third_party/glslang/Test/link3.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/localAggregates.frag b/third_party/glslang/Test/localAggregates.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/loops.frag b/third_party/glslang/Test/loops.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/loopsArtificial.frag b/third_party/glslang/Test/loopsArtificial.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/mains.frag b/third_party/glslang/Test/mains.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/mains1.frag b/third_party/glslang/Test/mains1.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/mains2.frag b/third_party/glslang/Test/mains2.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/makeDoc b/third_party/glslang/Test/makeDoc old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/matrix.frag b/third_party/glslang/Test/matrix.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/matrix2.frag b/third_party/glslang/Test/matrix2.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/matrixError.vert b/third_party/glslang/Test/matrixError.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/maxClipDistances.vert b/third_party/glslang/Test/maxClipDistances.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/max_vertices_0.geom b/third_party/glslang/Test/max_vertices_0.geom old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/missingBodies.vert b/third_party/glslang/Test/missingBodies.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/mixedArrayDecls.frag b/third_party/glslang/Test/mixedArrayDecls.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/negativeArraySize.comp b/third_party/glslang/Test/negativeArraySize.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/newTexture.frag b/third_party/glslang/Test/newTexture.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/noMain.vert b/third_party/glslang/Test/noMain.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/noMain1.geom b/third_party/glslang/Test/noMain1.geom old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/noMain2.geom b/third_party/glslang/Test/noMain2.geom old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/nonSquare.vert b/third_party/glslang/Test/nonSquare.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/nonVulkan.frag b/third_party/glslang/Test/nonVulkan.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/numeral.frag b/third_party/glslang/Test/numeral.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/nvShaderNoperspectiveInterpolation.frag b/third_party/glslang/Test/nvShaderNoperspectiveInterpolation.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/overlongLiteral.frag b/third_party/glslang/Test/overlongLiteral.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/parent.h b/third_party/glslang/Test/parent.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/parentBad b/third_party/glslang/Test/parentBad old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/pointCoord.frag b/third_party/glslang/Test/pointCoord.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/precise.tesc b/third_party/glslang/Test/precise.tesc old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/precise_struct_block.vert b/third_party/glslang/Test/precise_struct_block.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/precision.frag b/third_party/glslang/Test/precision.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/precision.vert b/third_party/glslang/Test/precision.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/prepost.frag b/third_party/glslang/Test/prepost.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/preprocessor.cpp_style___FILE__.vert b/third_party/glslang/Test/preprocessor.cpp_style___FILE__.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/preprocessor.cpp_style_line_directive.vert b/third_party/glslang/Test/preprocessor.cpp_style_line_directive.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/preprocessor.defined.vert b/third_party/glslang/Test/preprocessor.defined.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/preprocessor.edge_cases.vert b/third_party/glslang/Test/preprocessor.edge_cases.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/preprocessor.eof_missing.vert b/third_party/glslang/Test/preprocessor.eof_missing.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/preprocessor.errors.vert b/third_party/glslang/Test/preprocessor.errors.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/preprocessor.extensions.vert b/third_party/glslang/Test/preprocessor.extensions.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/preprocessor.function_macro.vert b/third_party/glslang/Test/preprocessor.function_macro.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/preprocessor.include.disabled.vert b/third_party/glslang/Test/preprocessor.include.disabled.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/preprocessor.include.enabled.vert b/third_party/glslang/Test/preprocessor.include.enabled.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/preprocessor.line.frag b/third_party/glslang/Test/preprocessor.line.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/preprocessor.line.vert b/third_party/glslang/Test/preprocessor.line.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/preprocessor.many.endif.vert b/third_party/glslang/Test/preprocessor.many.endif.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/preprocessor.pragma.vert b/third_party/glslang/Test/preprocessor.pragma.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/preprocessor.simple.vert b/third_party/glslang/Test/preprocessor.simple.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/preprocessor.success_if_parse_would_fail.vert b/third_party/glslang/Test/preprocessor.success_if_parse_would_fail.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/recurse1.frag b/third_party/glslang/Test/recurse1.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/recurse1.vert b/third_party/glslang/Test/recurse1.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/recurse2.frag b/third_party/glslang/Test/recurse2.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/reflection.vert b/third_party/glslang/Test/reflection.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/remap.basic.dcefunc.frag b/third_party/glslang/Test/remap.basic.dcefunc.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/remap.basic.everything.frag b/third_party/glslang/Test/remap.basic.everything.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/remap.basic.none.frag b/third_party/glslang/Test/remap.basic.none.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/remap.basic.strip.frag b/third_party/glslang/Test/remap.basic.strip.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/remap.hlsl.sample.basic.everything.frag b/third_party/glslang/Test/remap.hlsl.sample.basic.everything.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/remap.hlsl.sample.basic.none.frag b/third_party/glslang/Test/remap.hlsl.sample.basic.none.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/remap.hlsl.sample.basic.strip.frag b/third_party/glslang/Test/remap.hlsl.sample.basic.strip.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/remap.hlsl.templatetypes.everything.frag b/third_party/glslang/Test/remap.hlsl.templatetypes.everything.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/remap.hlsl.templatetypes.none.frag b/third_party/glslang/Test/remap.hlsl.templatetypes.none.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/remap.if.everything.frag b/third_party/glslang/Test/remap.if.everything.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/remap.if.none.frag b/third_party/glslang/Test/remap.if.none.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/remap.invalid-spirv-1.spv b/third_party/glslang/Test/remap.invalid-spirv-1.spv old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/remap.invalid-spirv-2.spv b/third_party/glslang/Test/remap.invalid-spirv-2.spv old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/remap.literal64.everything.spv b/third_party/glslang/Test/remap.literal64.everything.spv old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/remap.literal64.none.spv b/third_party/glslang/Test/remap.literal64.none.spv old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/remap.similar_1a.everything.frag b/third_party/glslang/Test/remap.similar_1a.everything.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/remap.similar_1a.none.frag b/third_party/glslang/Test/remap.similar_1a.none.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/remap.similar_1b.everything.frag b/third_party/glslang/Test/remap.similar_1b.everything.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/remap.similar_1b.none.frag b/third_party/glslang/Test/remap.similar_1b.none.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/remap.specconst.comp b/third_party/glslang/Test/remap.specconst.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/remap.switch.everything.frag b/third_party/glslang/Test/remap.switch.everything.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/remap.switch.none.frag b/third_party/glslang/Test/remap.switch.none.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/remap.uniformarray.everything.frag b/third_party/glslang/Test/remap.uniformarray.everything.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/remap.uniformarray.none.frag b/third_party/glslang/Test/remap.uniformarray.none.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/runtests b/third_party/glslang/Test/runtests index 390acfc343..ddd77ce8e8 100755 --- a/third_party/glslang/Test/runtests +++ b/third_party/glslang/Test/runtests @@ -56,7 +56,7 @@ fi # entry point renaming tests # echo Running entry-point renaming tests -$EXE -i -H -V -D -Od -e main_in_spv --ku --source-entrypoint main -Od hlsl.entry.rename.frag > $TARGETDIR/hlsl.entry.rename.frag.out +$EXE -i -H -V -D -Od --entry-point main_in_spv --ku --source-entrypoint main -Od hlsl.entry.rename.frag > $TARGETDIR/hlsl.entry.rename.frag.out diff -b $BASEDIR/hlsl.entry.rename.frag.out $TARGETDIR/hlsl.entry.rename.frag.out || HASERROR=1 # @@ -112,7 +112,7 @@ diff -b $BASEDIR/hlsl.explicitDescriptorSet-2.frag.out $TARGETDIR/hlsl.explicitD # Testing per-descriptor-set IO map shift # echo 'Testing per-descriptor-set IO map shift' -$EXE -e main --hlsl-iomap --ssb 10 1 15 2 --stb 20 --stb 25 2 --suavb 30 --suavb 40 2 --sub 50 6 -i -q -D -Od -V hlsl.shift.per-set.frag > $TARGETDIR/hlsl.shift.per-set.frag.out || HASERROR=1 +$EXE -e main --hlsl-iomap --ssb 10 1 15 2 --stb 20 --stb 25 2 --stb 70 6 --suavb 30 --suavb 40 2 --sub 50 6 -i -q -D -Od -V hlsl.shift.per-set.frag > $TARGETDIR/hlsl.shift.per-set.frag.out || HASERROR=1 diff -b $BASEDIR/hlsl.shift.per-set.frag.out $TARGETDIR/hlsl.shift.per-set.frag.out || HASERROR=1 # diff --git a/third_party/glslang/Test/sample.frag b/third_party/glslang/Test/sample.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/sample.frag.out b/third_party/glslang/Test/sample.frag.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/sample.vert b/third_party/glslang/Test/sample.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/sample.vert.out b/third_party/glslang/Test/sample.vert.out old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/simpleFunctionCall.frag b/third_party/glslang/Test/simpleFunctionCall.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/specExamples.frag b/third_party/glslang/Test/specExamples.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/specExamples.vert b/third_party/glslang/Test/specExamples.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.100ops.frag b/third_party/glslang/Test/spv.100ops.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.130.frag b/third_party/glslang/Test/spv.130.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.140.frag b/third_party/glslang/Test/spv.140.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.150.geom b/third_party/glslang/Test/spv.150.geom old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.150.vert b/third_party/glslang/Test/spv.150.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.300BuiltIns.vert b/third_party/glslang/Test/spv.300BuiltIns.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.300layout.frag b/third_party/glslang/Test/spv.300layout.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.300layout.vert b/third_party/glslang/Test/spv.300layout.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.300layoutp.vert b/third_party/glslang/Test/spv.300layoutp.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.310.bitcast.frag b/third_party/glslang/Test/spv.310.bitcast.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.310.comp b/third_party/glslang/Test/spv.310.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.330.geom b/third_party/glslang/Test/spv.330.geom old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.400.frag b/third_party/glslang/Test/spv.400.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.400.tesc b/third_party/glslang/Test/spv.400.tesc old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.400.tese b/third_party/glslang/Test/spv.400.tese old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.420.geom b/third_party/glslang/Test/spv.420.geom old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.430.frag b/third_party/glslang/Test/spv.430.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.430.vert b/third_party/glslang/Test/spv.430.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.450.geom b/third_party/glslang/Test/spv.450.geom old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.450.noRedecl.tesc b/third_party/glslang/Test/spv.450.noRedecl.tesc old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.450.tesc b/third_party/glslang/Test/spv.450.tesc old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.460.comp b/third_party/glslang/Test/spv.460.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.460.frag b/third_party/glslang/Test/spv.460.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.460.vert b/third_party/glslang/Test/spv.460.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.AofA.frag b/third_party/glslang/Test/spv.AofA.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.GeometryShaderPassthrough.geom b/third_party/glslang/Test/spv.GeometryShaderPassthrough.geom old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.OVR_multiview.vert b/third_party/glslang/Test/spv.OVR_multiview.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.Operations.frag b/third_party/glslang/Test/spv.Operations.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.accessChain.frag b/third_party/glslang/Test/spv.accessChain.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.aggOps.frag b/third_party/glslang/Test/spv.aggOps.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.always-discard.frag b/third_party/glslang/Test/spv.always-discard.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.always-discard2.frag b/third_party/glslang/Test/spv.always-discard2.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.arbPostDepthCoverage.frag b/third_party/glslang/Test/spv.arbPostDepthCoverage.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.arbPostDepthCoverage_Error.frag b/third_party/glslang/Test/spv.arbPostDepthCoverage_Error.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.atomic.comp b/third_party/glslang/Test/spv.atomic.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.atomicInt64.comp b/third_party/glslang/Test/spv.atomicInt64.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.barrier.vert b/third_party/glslang/Test/spv.barrier.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.bitCast.frag b/third_party/glslang/Test/spv.bitCast.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.bool.vert b/third_party/glslang/Test/spv.bool.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.boolInBlock.frag b/third_party/glslang/Test/spv.boolInBlock.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.branch-return.vert b/third_party/glslang/Test/spv.branch-return.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.buffer.autoassign.frag b/third_party/glslang/Test/spv.buffer.autoassign.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.builtInXFB.vert b/third_party/glslang/Test/spv.builtInXFB.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.conditionalDiscard.frag b/third_party/glslang/Test/spv.conditionalDiscard.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.constStruct.vert b/third_party/glslang/Test/spv.constStruct.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.controlFlowAttributes.frag b/third_party/glslang/Test/spv.controlFlowAttributes.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.conversion.frag b/third_party/glslang/Test/spv.conversion.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.dataOut.frag b/third_party/glslang/Test/spv.dataOut.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.dataOutIndirect.frag b/third_party/glslang/Test/spv.dataOutIndirect.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.dataOutIndirect.vert b/third_party/glslang/Test/spv.dataOutIndirect.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.debugInfo.frag b/third_party/glslang/Test/spv.debugInfo.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.deepRvalue.frag b/third_party/glslang/Test/spv.deepRvalue.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.depthOut.frag b/third_party/glslang/Test/spv.depthOut.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.deviceGroup.frag b/third_party/glslang/Test/spv.deviceGroup.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.discard-dce.frag b/third_party/glslang/Test/spv.discard-dce.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.do-simple.vert b/third_party/glslang/Test/spv.do-simple.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.do-while-continue-break.vert b/third_party/glslang/Test/spv.do-while-continue-break.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.doWhileLoop.frag b/third_party/glslang/Test/spv.doWhileLoop.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.double.comp b/third_party/glslang/Test/spv.double.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.drawParams.vert b/third_party/glslang/Test/spv.drawParams.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.earlyReturnDiscard.frag b/third_party/glslang/Test/spv.earlyReturnDiscard.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.explicittypes.frag b/third_party/glslang/Test/spv.explicittypes.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.extPostDepthCoverage.frag b/third_party/glslang/Test/spv.extPostDepthCoverage.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.extPostDepthCoverage_Error.frag b/third_party/glslang/Test/spv.extPostDepthCoverage_Error.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.float16.frag b/third_party/glslang/Test/spv.float16.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.float16Fetch.frag b/third_party/glslang/Test/spv.float16Fetch.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.float32.frag b/third_party/glslang/Test/spv.float32.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.float64.frag b/third_party/glslang/Test/spv.float64.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.flowControl.frag b/third_party/glslang/Test/spv.flowControl.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.for-complex-condition.vert b/third_party/glslang/Test/spv.for-complex-condition.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.for-continue-break.vert b/third_party/glslang/Test/spv.for-continue-break.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.for-nobody.vert b/third_party/glslang/Test/spv.for-nobody.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.for-notest.vert b/third_party/glslang/Test/spv.for-notest.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.for-simple.vert b/third_party/glslang/Test/spv.for-simple.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.forLoop.frag b/third_party/glslang/Test/spv.forLoop.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.forwardFun.frag b/third_party/glslang/Test/spv.forwardFun.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.fullyCovered.frag b/third_party/glslang/Test/spv.fullyCovered.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.functionCall.frag b/third_party/glslang/Test/spv.functionCall.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.functionSemantics.frag b/third_party/glslang/Test/spv.functionSemantics.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.glFragColor.frag b/third_party/glslang/Test/spv.glFragColor.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.glsl.register.autoassign.frag b/third_party/glslang/Test/spv.glsl.register.autoassign.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.glsl.register.noautoassign.frag b/third_party/glslang/Test/spv.glsl.register.noautoassign.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.hlslDebugInfo.vert b/third_party/glslang/Test/spv.hlslDebugInfo.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.image.frag b/third_party/glslang/Test/spv.image.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.image.load-formatted.frag b/third_party/glslang/Test/spv.image.load-formatted.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.imageLoadStoreLod.frag b/third_party/glslang/Test/spv.imageLoadStoreLod.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.int16.amd.frag b/third_party/glslang/Test/spv.int16.amd.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.int16.frag b/third_party/glslang/Test/spv.int16.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.int32.frag b/third_party/glslang/Test/spv.int32.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.int64.frag b/third_party/glslang/Test/spv.int64.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.int8.frag b/third_party/glslang/Test/spv.int8.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.intOps.vert b/third_party/glslang/Test/spv.intOps.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.interpOps.frag b/third_party/glslang/Test/spv.interpOps.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.layoutNested.vert b/third_party/glslang/Test/spv.layoutNested.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.length.frag b/third_party/glslang/Test/spv.length.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.localAggregates.frag b/third_party/glslang/Test/spv.localAggregates.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.loops.frag b/third_party/glslang/Test/spv.loops.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.loopsArtificial.frag b/third_party/glslang/Test/spv.loopsArtificial.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.looseUniformNoLoc.vert b/third_party/glslang/Test/spv.looseUniformNoLoc.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.matFun.vert b/third_party/glslang/Test/spv.matFun.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.matrix.frag b/third_party/glslang/Test/spv.matrix.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.matrix2.frag b/third_party/glslang/Test/spv.matrix2.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.memoryQualifier.frag b/third_party/glslang/Test/spv.memoryQualifier.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.merge-unreachable.frag b/third_party/glslang/Test/spv.merge-unreachable.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.multiStruct.comp b/third_party/glslang/Test/spv.multiStruct.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.multiView.frag b/third_party/glslang/Test/spv.multiView.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.multiviewPerViewAttributes.tesc b/third_party/glslang/Test/spv.multiviewPerViewAttributes.tesc old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.multiviewPerViewAttributes.vert b/third_party/glslang/Test/spv.multiviewPerViewAttributes.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.newTexture.frag b/third_party/glslang/Test/spv.newTexture.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.noBuiltInLoc.vert b/third_party/glslang/Test/spv.noBuiltInLoc.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.noDeadDecorations.vert b/third_party/glslang/Test/spv.noDeadDecorations.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.noLocation.vert b/third_party/glslang/Test/spv.noLocation.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.noWorkgroup.comp b/third_party/glslang/Test/spv.noWorkgroup.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.nonSquare.vert b/third_party/glslang/Test/spv.nonSquare.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.paramMemory.frag b/third_party/glslang/Test/spv.paramMemory.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.precise.tesc b/third_party/glslang/Test/spv.precise.tesc old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.precise.tese b/third_party/glslang/Test/spv.precise.tese old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.precision.frag b/third_party/glslang/Test/spv.precision.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.precisionNonESSamp.frag b/third_party/glslang/Test/spv.precisionNonESSamp.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.prepost.frag b/third_party/glslang/Test/spv.prepost.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.pushConstant.vert b/third_party/glslang/Test/spv.pushConstant.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.pushConstantAnon.vert b/third_party/glslang/Test/spv.pushConstantAnon.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.qualifiers.vert b/third_party/glslang/Test/spv.qualifiers.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.queryL.frag b/third_party/glslang/Test/spv.queryL.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.rankShift.comp b/third_party/glslang/Test/spv.rankShift.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.register.autoassign-2.frag b/third_party/glslang/Test/spv.register.autoassign-2.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.register.autoassign.frag b/third_party/glslang/Test/spv.register.autoassign.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.register.autoassign.rangetest.frag b/third_party/glslang/Test/spv.register.autoassign.rangetest.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.register.noautoassign.frag b/third_party/glslang/Test/spv.register.noautoassign.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.register.subpass.frag b/third_party/glslang/Test/spv.register.subpass.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.rw.autoassign.frag b/third_party/glslang/Test/spv.rw.autoassign.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.sample.frag b/third_party/glslang/Test/spv.sample.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.sampleId.frag b/third_party/glslang/Test/spv.sampleId.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.sampleMaskOverrideCoverage.frag b/third_party/glslang/Test/spv.sampleMaskOverrideCoverage.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.samplePosition.frag b/third_party/glslang/Test/spv.samplePosition.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.separate.frag b/third_party/glslang/Test/spv.separate.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.set.vert b/third_party/glslang/Test/spv.set.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.shaderBallot.comp b/third_party/glslang/Test/spv.shaderBallot.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.shaderBallotAMD.comp b/third_party/glslang/Test/spv.shaderBallotAMD.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.shaderDrawParams.vert b/third_party/glslang/Test/spv.shaderDrawParams.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.shaderFragMaskAMD.frag b/third_party/glslang/Test/spv.shaderFragMaskAMD.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.shaderGroupVote.comp b/third_party/glslang/Test/spv.shaderGroupVote.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.shaderStencilExport.frag b/third_party/glslang/Test/spv.shaderStencilExport.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.shiftOps.frag b/third_party/glslang/Test/spv.shiftOps.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.simpleFunctionCall.frag b/third_party/glslang/Test/spv.simpleFunctionCall.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.simpleMat.vert b/third_party/glslang/Test/spv.simpleMat.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.sparseTexture.frag b/third_party/glslang/Test/spv.sparseTexture.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.sparseTextureClamp.frag b/third_party/glslang/Test/spv.sparseTextureClamp.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.specConst.vert b/third_party/glslang/Test/spv.specConst.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.specConstant.comp b/third_party/glslang/Test/spv.specConstant.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.specConstant.vert b/third_party/glslang/Test/spv.specConstant.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.specConstantComposite.vert b/third_party/glslang/Test/spv.specConstantComposite.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.specConstantOperations.vert b/third_party/glslang/Test/spv.specConstantOperations.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.ssbo.autoassign.frag b/third_party/glslang/Test/spv.ssbo.autoassign.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.ssboAlias.frag b/third_party/glslang/Test/spv.ssboAlias.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.stereoViewRendering.tesc b/third_party/glslang/Test/spv.stereoViewRendering.tesc old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.stereoViewRendering.vert b/third_party/glslang/Test/spv.stereoViewRendering.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.storageBuffer.vert b/third_party/glslang/Test/spv.storageBuffer.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.structAssignment.frag b/third_party/glslang/Test/spv.structAssignment.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.structDeref.frag b/third_party/glslang/Test/spv.structDeref.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.structure.frag b/third_party/glslang/Test/spv.structure.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.subgroup.frag b/third_party/glslang/Test/spv.subgroup.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.subgroup.geom b/third_party/glslang/Test/spv.subgroup.geom old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.subgroup.tesc b/third_party/glslang/Test/spv.subgroup.tesc old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.subgroup.tese b/third_party/glslang/Test/spv.subgroup.tese old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.subgroup.vert b/third_party/glslang/Test/spv.subgroup.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.subgroupArithmetic.comp b/third_party/glslang/Test/spv.subgroupArithmetic.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.subgroupBallot.comp b/third_party/glslang/Test/spv.subgroupBallot.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.subgroupBasic.comp b/third_party/glslang/Test/spv.subgroupBasic.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.subgroupClustered.comp b/third_party/glslang/Test/spv.subgroupClustered.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.subgroupClusteredNeg.comp b/third_party/glslang/Test/spv.subgroupClusteredNeg.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.subgroupQuad.comp b/third_party/glslang/Test/spv.subgroupQuad.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.subgroupShuffle.comp b/third_party/glslang/Test/spv.subgroupShuffle.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.subgroupShuffleRelative.comp b/third_party/glslang/Test/spv.subgroupShuffleRelative.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.subgroupVote.comp b/third_party/glslang/Test/spv.subgroupVote.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.subpass.frag b/third_party/glslang/Test/spv.subpass.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.switch.frag b/third_party/glslang/Test/spv.switch.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.swizzle.frag b/third_party/glslang/Test/spv.swizzle.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.swizzleInversion.frag b/third_party/glslang/Test/spv.swizzleInversion.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.test.frag b/third_party/glslang/Test/spv.test.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.test.vert b/third_party/glslang/Test/spv.test.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.texture.frag b/third_party/glslang/Test/spv.texture.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.texture.sampler.transform.frag b/third_party/glslang/Test/spv.texture.sampler.transform.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.texture.vert b/third_party/glslang/Test/spv.texture.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.textureBuffer.vert b/third_party/glslang/Test/spv.textureBuffer.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.textureGatherBiasLod.frag b/third_party/glslang/Test/spv.textureGatherBiasLod.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.types.frag b/third_party/glslang/Test/spv.types.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.uint.frag b/third_party/glslang/Test/spv.uint.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.uniformArray.frag b/third_party/glslang/Test/spv.uniformArray.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.variableArrayIndex.frag b/third_party/glslang/Test/spv.variableArrayIndex.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.varyingArray.frag b/third_party/glslang/Test/spv.varyingArray.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.varyingArrayIndirect.frag b/third_party/glslang/Test/spv.varyingArrayIndirect.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.viewportArray2.tesc b/third_party/glslang/Test/spv.viewportArray2.tesc old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.viewportArray2.vert b/third_party/glslang/Test/spv.viewportArray2.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.voidFunction.frag b/third_party/glslang/Test/spv.voidFunction.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.vulkan100.subgroupArithmetic.comp b/third_party/glslang/Test/spv.vulkan100.subgroupArithmetic.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.vulkan110.int16.frag b/third_party/glslang/Test/spv.vulkan110.int16.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.vulkan110.storageBuffer.vert b/third_party/glslang/Test/spv.vulkan110.storageBuffer.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.while-continue-break.vert b/third_party/glslang/Test/spv.while-continue-break.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.while-simple.vert b/third_party/glslang/Test/spv.while-simple.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.whileLoop.frag b/third_party/glslang/Test/spv.whileLoop.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.xfb.vert b/third_party/glslang/Test/spv.xfb.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.xfb2.vert b/third_party/glslang/Test/spv.xfb2.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/spv.xfb3.vert b/third_party/glslang/Test/spv.xfb3.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/stringToDouble.vert b/third_party/glslang/Test/stringToDouble.vert index 2f213021f5..5a7024dafd 100755 --- a/third_party/glslang/Test/stringToDouble.vert +++ b/third_party/glslang/Test/stringToDouble.vert @@ -1,5 +1,5 @@ #version 460 -//#pragma glslang_binary_double_output +#extension GL_KHX_shader_explicit_arithmetic_types_float16 : enable void main() { float w1 = 00000.000; @@ -94,5 +94,23 @@ void main() double b44 = 5708990770823839207320493820740630171355185151999e-3; double b45 = 5708990770823839207320493820740630171355185152001e-3; - double pi = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679; + float pi1 = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679f; + float pi2 = 3.14159265358979f; + float pi3 = 3.141592653589793f; + + double dpi1 = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679; + double dpi2 = 3.14159265358979; + double dpi3 = 3.141592653589793; + + float dfpi1 = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679f; + float dfpi2 = 3.14159265358979f; + float dfpi3 = 3.141592653589793f; + + double lfpi1 = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679LF; + double lfpi2 = 3.14159265358979Lf; + double lfpi3 = 3.141592653589793lF; + + double hfpi1 = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679hF; + double hfpi2 = 3.14159265358979hF; + double hfpi3 = 3.141592653589793hf; } diff --git a/third_party/glslang/Test/structAssignment.frag b/third_party/glslang/Test/structAssignment.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/structDeref.frag b/third_party/glslang/Test/structDeref.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/structure.frag b/third_party/glslang/Test/structure.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/switch.frag b/third_party/glslang/Test/switch.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/swizzle.frag b/third_party/glslang/Test/swizzle.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/syntaxError.frag b/third_party/glslang/Test/syntaxError.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/test.frag b/third_party/glslang/Test/test.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/texture.frag b/third_party/glslang/Test/texture.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/tokenPaste.vert b/third_party/glslang/Test/tokenPaste.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/types.frag b/third_party/glslang/Test/types.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/uint.frag b/third_party/glslang/Test/uint.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/uniformArray.frag b/third_party/glslang/Test/uniformArray.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/variableArrayIndex.frag b/third_party/glslang/Test/variableArrayIndex.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/varyingArray.frag b/third_party/glslang/Test/varyingArray.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/varyingArrayIndirect.frag b/third_party/glslang/Test/varyingArrayIndirect.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/versionsClean.frag b/third_party/glslang/Test/versionsClean.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/versionsClean.vert b/third_party/glslang/Test/versionsClean.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/versionsErrors.frag b/third_party/glslang/Test/versionsErrors.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/versionsErrors.vert b/third_party/glslang/Test/versionsErrors.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/voidFunction.frag b/third_party/glslang/Test/voidFunction.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/vulkan.ast.vert b/third_party/glslang/Test/vulkan.ast.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/vulkan.comp b/third_party/glslang/Test/vulkan.comp old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/vulkan.frag b/third_party/glslang/Test/vulkan.frag index 3cfbb82cb6..46c14f314c 100755 --- a/third_party/glslang/Test/vulkan.frag +++ b/third_party/glslang/Test/vulkan.frag @@ -21,7 +21,7 @@ void badConst() sampler3D[4](t3d5, sA[2]); // ERROR, can't make array sampler2D(i2d, s); // ERROR, image instead of texture sampler2D(t3d[1], s); // ERROR, 3D not 2D - sampler2D(t2d, sShadow); // ERROR, shadow mismatch + sampler2D(t2d, sShadow); sampler2DShadow(t2d, s); } diff --git a/third_party/glslang/Test/vulkan.vert b/third_party/glslang/Test/vulkan.vert old mode 100755 new mode 100644 diff --git a/third_party/glslang/Test/whileLoop.frag b/third_party/glslang/Test/whileLoop.frag old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/GenericCodeGen/CodeGen.cpp b/third_party/glslang/glslang/GenericCodeGen/CodeGen.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/GenericCodeGen/Link.cpp b/third_party/glslang/glslang/GenericCodeGen/Link.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/Include/BaseTypes.h b/third_party/glslang/glslang/Include/BaseTypes.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/Include/Common.h b/third_party/glslang/glslang/Include/Common.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/Include/ConstantUnion.h b/third_party/glslang/glslang/Include/ConstantUnion.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/Include/InfoSink.h b/third_party/glslang/glslang/Include/InfoSink.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/Include/InitializeGlobals.h b/third_party/glslang/glslang/Include/InitializeGlobals.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/Include/PoolAlloc.h b/third_party/glslang/glslang/Include/PoolAlloc.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/Include/ResourceLimits.h b/third_party/glslang/glslang/Include/ResourceLimits.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/Include/ShHandle.h b/third_party/glslang/glslang/Include/ShHandle.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/Include/arrays.h b/third_party/glslang/glslang/Include/arrays.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/Include/revision.h b/third_party/glslang/glslang/Include/revision.h old mode 100755 new mode 100644 index 99c1d4f397..2ff52ded3d --- a/third_party/glslang/glslang/Include/revision.h +++ b/third_party/glslang/glslang/Include/revision.h @@ -1,3 +1,3 @@ // This header is generated by the make-revision script. -#define GLSLANG_PATCH_LEVEL 2801 +#define GLSLANG_PATCH_LEVEL 2853 diff --git a/third_party/glslang/glslang/Include/revision.template b/third_party/glslang/glslang/Include/revision.template old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/MachineIndependent/Constant.cpp b/third_party/glslang/glslang/MachineIndependent/Constant.cpp index 26bdced9a0..b33af84d4f 100755 --- a/third_party/glslang/glslang/MachineIndependent/Constant.cpp +++ b/third_party/glslang/glslang/MachineIndependent/Constant.cpp @@ -184,7 +184,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right else if (leftUnionArray[i].getDConst() > 0.0) newConstArray[i].setDConst((double)INFINITY); else if (leftUnionArray[i].getDConst() < 0.0) - newConstArray[i].setDConst((double)-INFINITY); + newConstArray[i].setDConst(-(double)INFINITY); else newConstArray[i].setDConst((double)NAN); break; @@ -223,8 +223,8 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right case EbtInt: if (rightUnionArray[i] == 0) newConstArray[i].setIConst(0x7FFFFFFF); - else if (rightUnionArray[i].getIConst() == -1 && leftUnionArray[i].getIConst() == -(int)0x80000000) - newConstArray[i].setIConst(-(int)0x80000000); + else if (rightUnionArray[i].getIConst() == -1 && leftUnionArray[i].getIConst() == (int)-0x80000000ll) + newConstArray[i].setIConst((int)-0x80000000ll); else newConstArray[i].setIConst(leftUnionArray[i].getIConst() / rightUnionArray[i].getIConst()); break; @@ -239,8 +239,8 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right case EbtInt64: if (rightUnionArray[i] == 0ll) newConstArray[i].setI64Const(0x7FFFFFFFFFFFFFFFll); - else if (rightUnionArray[i].getI64Const() == -1 && leftUnionArray[i].getI64Const() == -0x8000000000000000ll) - newConstArray[i].setI64Const(-0x8000000000000000ll); + else if (rightUnionArray[i].getI64Const() == -1 && leftUnionArray[i].getI64Const() == (long long)-0x8000000000000000ll) + newConstArray[i].setI64Const((long long)-0x8000000000000000ll); else newConstArray[i].setI64Const(leftUnionArray[i].getI64Const() / rightUnionArray[i].getI64Const()); break; diff --git a/third_party/glslang/glslang/MachineIndependent/InfoSink.cpp b/third_party/glslang/glslang/MachineIndependent/InfoSink.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/MachineIndependent/Initialize.h b/third_party/glslang/glslang/MachineIndependent/Initialize.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/MachineIndependent/IntermTraverse.cpp b/third_party/glslang/glslang/MachineIndependent/IntermTraverse.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/MachineIndependent/LiveTraverser.h b/third_party/glslang/glslang/MachineIndependent/LiveTraverser.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/MachineIndependent/ParseContextBase.cpp b/third_party/glslang/glslang/MachineIndependent/ParseContextBase.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/MachineIndependent/ParseHelper.cpp b/third_party/glslang/glslang/MachineIndependent/ParseHelper.cpp index ce4e475d18..5f4edfe240 100755 --- a/third_party/glslang/glslang/MachineIndependent/ParseHelper.cpp +++ b/third_party/glslang/glslang/MachineIndependent/ParseHelper.cpp @@ -2655,19 +2655,12 @@ bool TParseContext::constructorTextureSamplerError(const TSourceLoc& loc, const // second argument // * the constructor's second argument must be a scalar of type // *sampler* or *samplerShadow* - // * if the second argument is *samplerShadow* the constructor must be a - // shadow constructor (however, shadow constructors are allowed to have - // a second argument of *sampler*) if ( function[1].type->getBasicType() != EbtSampler || ! function[1].type->getSampler().isPureSampler() || function[1].type->isArray()) { error(loc, "sampler-constructor second argument must be a scalar type 'sampler'", token, ""); return true; } - if (!function.getType().getSampler().shadow && function[1].type->getSampler().shadow) { - error(loc, "sampler-constructor second argument presence of shadow must match constructor presence of shadow", token, ""); - return true; - } return false; } diff --git a/third_party/glslang/glslang/MachineIndependent/PoolAlloc.cpp b/third_party/glslang/glslang/MachineIndependent/PoolAlloc.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/MachineIndependent/RemoveTree.cpp b/third_party/glslang/glslang/MachineIndependent/RemoveTree.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/MachineIndependent/RemoveTree.h b/third_party/glslang/glslang/MachineIndependent/RemoveTree.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/MachineIndependent/Scan.h b/third_party/glslang/glslang/MachineIndependent/Scan.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/MachineIndependent/ShaderLang.cpp b/third_party/glslang/glslang/MachineIndependent/ShaderLang.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/MachineIndependent/SymbolTable.cpp b/third_party/glslang/glslang/MachineIndependent/SymbolTable.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/MachineIndependent/SymbolTable.h b/third_party/glslang/glslang/MachineIndependent/SymbolTable.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/MachineIndependent/attribute.cpp b/third_party/glslang/glslang/MachineIndependent/attribute.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/MachineIndependent/attribute.h b/third_party/glslang/glslang/MachineIndependent/attribute.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/MachineIndependent/gl_types.h b/third_party/glslang/glslang/MachineIndependent/gl_types.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/MachineIndependent/glslang_tab.cpp.h b/third_party/glslang/glslang/MachineIndependent/glslang_tab.cpp.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/MachineIndependent/iomapper.cpp b/third_party/glslang/glslang/MachineIndependent/iomapper.cpp index 9248214b65..66f6f30817 100755 --- a/third_party/glslang/glslang/MachineIndependent/iomapper.cpp +++ b/third_party/glslang/glslang/MachineIndependent/iomapper.cpp @@ -331,8 +331,14 @@ struct TResolverInOutAdaptor ent.symbol->getType(), ent.live); } else { - TString errorMsg = "Invalid shader In/Out variable semantic: "; - errorMsg += ent.symbol->getType().getQualifier().semanticName; + TString errorMsg; + if (ent.symbol->getType().getQualifier().semanticName != nullptr) { + errorMsg = "Invalid shader In/Out variable semantic: "; + errorMsg += ent.symbol->getType().getQualifier().semanticName; + } else { + errorMsg = "Invalid shader In/Out variable: "; + errorMsg += ent.symbol->getName(); + } infoSink.info.message(EPrefixInternalError, errorMsg.c_str()); error = true; } diff --git a/third_party/glslang/glslang/MachineIndependent/iomapper.h b/third_party/glslang/glslang/MachineIndependent/iomapper.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/MachineIndependent/limits.cpp b/third_party/glslang/glslang/MachineIndependent/limits.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/MachineIndependent/parseConst.cpp b/third_party/glslang/glslang/MachineIndependent/parseConst.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/MachineIndependent/preprocessor/PpAtom.cpp b/third_party/glslang/glslang/MachineIndependent/preprocessor/PpAtom.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp b/third_party/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp index 02b93f95d2..1faa01803a 100755 --- a/third_party/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp +++ b/third_party/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp @@ -316,16 +316,32 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken) ppToken->dval = (double)wholeNumber * exponentValue; } else { // slow path + ppToken->dval = 0.0; + + // remove suffix + TString numstr(ppToken->name); + if (numstr.back() == 'f' || numstr.back() == 'F') + numstr.pop_back(); + if (numstr.back() == 'h' || numstr.back() == 'H') + numstr.pop_back(); + if (numstr.back() == 'l' || numstr.back() == 'L') + numstr.pop_back(); + + // use platform library strtodStream.clear(); - strtodStream.str(ppToken->name); + strtodStream.str(numstr.c_str()); strtodStream >> ppToken->dval; - // Assume failure combined with a large exponent was overflow, in - // an attempt to set INF. Otherwise, assume underflow, and set 0.0. if (strtodStream.fail()) { + // Assume failure combined with a large exponent was overflow, in + // an attempt to set INF. if (!negativeExponent && exponent + numWholeNumberDigits > 300) ppToken->i64val = 0x7ff0000000000000; // +Infinity - else + // Assume failure combined with a small exponent was overflow. + if (negativeExponent && exponent + numWholeNumberDigits > 300) ppToken->dval = 0.0; + // Unknown reason for failure. Theory is that either + // - the 0.0 is still there, or + // - something reasonable was written that is better than 0.0 } } diff --git a/third_party/glslang/glslang/MachineIndependent/preprocessor/PpTokens.h b/third_party/glslang/glslang/MachineIndependent/preprocessor/PpTokens.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/MachineIndependent/propagateNoContraction.cpp b/third_party/glslang/glslang/MachineIndependent/propagateNoContraction.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/MachineIndependent/propagateNoContraction.h b/third_party/glslang/glslang/MachineIndependent/propagateNoContraction.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/MachineIndependent/reflection.cpp b/third_party/glslang/glslang/MachineIndependent/reflection.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/MachineIndependent/reflection.h b/third_party/glslang/glslang/MachineIndependent/reflection.h old mode 100755 new mode 100644 index 689d656b3c..49282c30e3 --- a/third_party/glslang/glslang/MachineIndependent/reflection.h +++ b/third_party/glslang/glslang/MachineIndependent/reflection.h @@ -57,9 +57,9 @@ class TObjectReflection { public: TObjectReflection(const TString& pName, const TType& pType, int pOffset, int pGLDefineType, int pSize, int pIndex) : name(pName), offset(pOffset), - glDefineType(pGLDefineType), size(pSize), index(pIndex), counterIndex(-1), type(pType.clone()), stages(EShLanguageMask(0)) { } + glDefineType(pGLDefineType), size(pSize), index(pIndex), counterIndex(-1), stages(EShLanguageMask(0)), type(pType.clone()) { } - const TType* const getType() const { return type; } + const TType* getType() const { return type; } int getBinding() const { if (type == nullptr || !type->getQualifier().hasBinding()) diff --git a/third_party/glslang/glslang/OSDependent/Unix/CMakeLists.txt b/third_party/glslang/glslang/OSDependent/Unix/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/OSDependent/Unix/ossource.cpp b/third_party/glslang/glslang/OSDependent/Unix/ossource.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/OSDependent/Windows/CMakeLists.txt b/third_party/glslang/glslang/OSDependent/Windows/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/OSDependent/Windows/main.cpp b/third_party/glslang/glslang/OSDependent/Windows/main.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/OSDependent/Windows/ossource.cpp b/third_party/glslang/glslang/OSDependent/Windows/ossource.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/OSDependent/osinclude.h b/third_party/glslang/glslang/OSDependent/osinclude.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/glslang/tnt/TNTReadme.txt b/third_party/glslang/glslang/tnt/TNTReadme.txt deleted file mode 100644 index 91c4601553..0000000000 --- a/third_party/glslang/glslang/tnt/TNTReadme.txt +++ /dev/null @@ -1,10 +0,0 @@ -In order to work around an issue with Clang 3.8, a line of MachineIndependent/TShader.cpp had to be -changed: - -line 992 had to me changed from: - -SourceLineSynchronizer lineSync(std::bind(&TInputScanner::getLastValidSourceIndex, &input), &outputStream); - -to: - -SourceLineSynchronizer lineSync([&input](){return input.getLastValidSourceIndex();}, &outputStream); \ No newline at end of file diff --git a/third_party/glslang/gtests/BuiltInResource.FromFile.cpp b/third_party/glslang/gtests/BuiltInResource.FromFile.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/gtests/CMakeLists.txt b/third_party/glslang/gtests/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/third_party/glslang/gtests/Config.FromFile.cpp b/third_party/glslang/gtests/Config.FromFile.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/gtests/HexFloat.cpp b/third_party/glslang/gtests/HexFloat.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/gtests/Initializer.h b/third_party/glslang/gtests/Initializer.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/gtests/Link.FromFile.cpp b/third_party/glslang/gtests/Link.FromFile.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/gtests/README.md b/third_party/glslang/gtests/README.md old mode 100755 new mode 100644 diff --git a/third_party/glslang/gtests/Remap.FromFile.cpp b/third_party/glslang/gtests/Remap.FromFile.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/gtests/Settings.cpp b/third_party/glslang/gtests/Settings.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/gtests/Settings.h b/third_party/glslang/gtests/Settings.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/gtests/TestFixture.cpp b/third_party/glslang/gtests/TestFixture.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/gtests/TestFixture.h b/third_party/glslang/gtests/TestFixture.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/gtests/main.cpp b/third_party/glslang/gtests/main.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/hlsl/hlslAttributes.cpp b/third_party/glslang/hlsl/hlslAttributes.cpp old mode 100755 new mode 100644 diff --git a/third_party/glslang/hlsl/hlslAttributes.h b/third_party/glslang/hlsl/hlslAttributes.h old mode 100755 new mode 100644 diff --git a/third_party/glslang/known_good.json b/third_party/glslang/known_good.json old mode 100755 new mode 100644 diff --git a/third_party/glslang/tnt/CMakeLists.txt b/third_party/glslang/tnt/CMakeLists.txt index cb8e7f5a46..a289322468 100644 --- a/third_party/glslang/tnt/CMakeLists.txt +++ b/third_party/glslang/tnt/CMakeLists.txt @@ -6,7 +6,7 @@ include(GNUInstallDirs) option(ENABLE_AMD_EXTENSIONS "Enables support of AMD-specific extensions" ON) option(ENABLE_NV_EXTENSIONS "Enables support of Nvidia-specific extensions" ON) -option(ENABLE_OPT "Enables spirv-opt capability if present" ON) +option(ENABLE_OPT "Enables spirv-opt capability if present" OFFENABLE_OPT) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND WIN32) set(CMAKE_INSTALL_PREFIX "install" CACHE STRING "..." FORCE) @@ -44,18 +44,19 @@ endif(WIN32) function(glslang_set_link_args TARGET) # For MinGW compiles, statically link against the GCC and C++ runtimes. # This avoids the need to ship those runtimes as DLLs. - if(WIN32 AND ${CMAKE_CXX_COMPILER_ID} MATCHES "GNU") + if (WIN32 AND ${CMAKE_CXX_COMPILER_ID} MATCHES "GNU") set_target_properties(${TARGET} PROPERTIES LINK_FLAGS "-static -static-libgcc -static-libstdc++") endif() endfunction(glslang_set_link_args) -if(ENABLE_OPT) - message(STATUS "SPIR-V optimizer enabled") - add_definitions(-DENABLE_OPT) -elseif(ENABLE_HLSL) - message(STATUS "spirv-tools not linked - illegal SPIRV may be generated for HLSL") -endif() +# We keep the optimizer disabled, we call it ourselves +# if(ENABLE_OPT) +# message(STATUS "SPIR-V optimizer enabled") +# add_definitions(-DENABLE_OPT) +# elseif(ENABLE_HLSL) +# message(STATUS "spirv-tools not linked - illegal SPIRV may be generated for HLSL") +# endif() add_subdirectory(../glslang/tnt "${CMAKE_CURRENT_BINARY_DIR}/glslang") add_subdirectory(../OGLCompilersDLL/tnt "${CMAKE_CURRENT_BINARY_DIR}/OGLCompilersDLL") diff --git a/third_party/spirv-cross/CMakeLists.txt b/third_party/spirv-cross/CMakeLists.txt index 2849b6957d..1f5eaec304 100644 --- a/third_party/spirv-cross/CMakeLists.txt +++ b/third_party/spirv-cross/CMakeLists.txt @@ -72,7 +72,7 @@ macro(spirv_cross_add_library name config_name) PUBLIC_HEADER DESTINATION include/spirv_cross) install(FILES ${hdrs} DESTINATION include/spirv_cross) install(EXPORT ${config_name}Config DESTINATION share/${config_name}/cmake) - export(TARGETS ${targets} FILE ${config_name}Config.cmake) + export(TARGETS ${name} FILE ${config_name}Config.cmake) endmacro() diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/pass-by-value.asm.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/pass-by-value.asm.frag new file mode 100644 index 0000000000..4fe2a197af --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/pass-by-value.asm.frag @@ -0,0 +1,24 @@ +cbuffer registers +{ + float registers_foo : packoffset(c0); +}; + +static float FragColor; + +struct SPIRV_Cross_Output +{ + float FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = 10.0f + registers_foo; +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/texel-fetch-offset.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/texel-fetch-offset.frag new file mode 100644 index 0000000000..d7aa73d526 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/texel-fetch-offset.frag @@ -0,0 +1,31 @@ +Texture2D uTexture : register(t0); +SamplerState _uTexture_sampler : register(s0); + +static float4 gl_FragCoord; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float4 gl_FragCoord : SV_Position; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + int2 _22 = int2(gl_FragCoord.xy); + FragColor = uTexture.Load(int3(_22, 0), int2(1, 1)); + FragColor += uTexture.Load(int3(_22, 0), int2(-1, 1)); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_FragCoord = stage_input.gl_FragCoord; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/pass-by-value.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/pass-by-value.asm.frag new file mode 100644 index 0000000000..3858f6dac7 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/pass-by-value.asm.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct Registers +{ + float foo; +}; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +fragment main0_out main0(constant Registers& registers [[buffer(0)]]) +{ + main0_out out = {}; + out.FragColor = 10.0 + registers.foo; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/texel-fetch-offset.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/texel-fetch-offset.frag new file mode 100644 index 0000000000..d4db1ae1c9 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/texel-fetch-offset.frag @@ -0,0 +1,19 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture2d uTexture [[texture(0)]], sampler uTextureSmplr [[sampler(0)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + int2 _22 = int2(gl_FragCoord.xy); + out.FragColor = uTexture.read(uint2(_22) + uint2(int2(1)), 0); + out.FragColor += uTexture.read(uint2(_22) + uint2(int2(-1, 1)), 0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.vert new file mode 100644 index 0000000000..28098ee88e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.vert @@ -0,0 +1,20 @@ +#include +#include + +using namespace metal; + +struct _10 +{ + uint4 _m0[1024]; +}; + +struct main0_in +{ + uint4 m_19 [[attribute(0)]]; +}; + +vertex void main0(main0_in in [[stage_in]], device _10& _12 [[buffer(0)]], uint gl_VertexIndex [[vertex_id]]) +{ + _12._m0[gl_VertexIndex] = in.m_19; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.write_buff.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.write_buff.vert new file mode 100644 index 0000000000..458e1f1b70 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.write_buff.vert @@ -0,0 +1,37 @@ +#include +#include + +using namespace metal; + +struct _35 +{ + uint4 _m0[1024]; +}; + +struct _40 +{ + uint4 _m0[1024]; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 m_17 [[attribute(0)]]; +}; + +vertex void main0(main0_in in [[stage_in]], constant _40& _42 [[buffer(0)]], device _35& _37 [[buffer(1)]]) +{ + main0_out out = {}; + out.gl_Position = in.m_17; + for (int _51 = 0; _51 < 1024; ) + { + _37._m0[_51] = _42._m0[_51]; + _51++; + continue; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.write_buff_atomic.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.write_buff_atomic.vert new file mode 100644 index 0000000000..ca4d6a5b92 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.write_buff_atomic.vert @@ -0,0 +1,30 @@ +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +struct _23 +{ + uint _m0; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 m_17 [[attribute(0)]]; +}; + +vertex void main0(main0_in in [[stage_in]], device _23& _25 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = in.m_17; + uint _29 = atomic_fetch_add_explicit((volatile device atomic_uint*)&_25._m0, 1u, memory_order_relaxed); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.write_tex.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.write_tex.vert new file mode 100644 index 0000000000..c2af1e2e61 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.write_tex.vert @@ -0,0 +1,27 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 m_17 [[attribute(0)]]; +}; + +vertex void main0(main0_in in [[stage_in]], texture1d _37 [[texture(0)]], texture1d _34 [[texture(1)]]) +{ + main0_out out = {}; + out.gl_Position = in.m_17; + for (int _45 = 0; _45 < 128; ) + { + _34.write(_37.read(uint(_45)), uint(_45)); + _45++; + continue; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/for-loop-phi-only-continue.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/for-loop-phi-only-continue.asm.frag new file mode 100644 index 0000000000..7a78d00b1c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/for-loop-phi-only-continue.asm.frag @@ -0,0 +1,17 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; + +void main() +{ + float _19; + _19 = 0.0; + for (int _22 = 0; _22 < 16; ) + { + _19 += 1.0; + _22++; + continue; + } + FragColor = vec4(_19); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/pass-by-value.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/pass-by-value.asm.frag new file mode 100644 index 0000000000..fbbfe18bfa --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/pass-by-value.asm.frag @@ -0,0 +1,16 @@ +#version 450 + +struct Registers +{ + float foo; +}; + +uniform Registers registers; + +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = 10.0 + registers.foo; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/texel-fetch-offset.frag b/third_party/spirv-cross/reference/opt/shaders/frag/texel-fetch-offset.frag new file mode 100644 index 0000000000..416f764d43 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/texel-fetch-offset.frag @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 0) uniform mediump sampler2D uTexture; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + mediump ivec2 _22 = ivec2(gl_FragCoord.xy); + FragColor = texelFetchOffset(uTexture, _22, 0, ivec2(1)); + FragColor += texelFetchOffset(uTexture, _22, 0, ivec2(-1, 1)); +} + diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/pass-by-value.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/pass-by-value.asm.frag new file mode 100644 index 0000000000..4bc02d5b90 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/pass-by-value.asm.frag @@ -0,0 +1,29 @@ +cbuffer registers +{ + float registers_foo : packoffset(c0); +}; + +static float FragColor; + +struct SPIRV_Cross_Output +{ + float FragColor : SV_Target0; +}; + +float add_value(float v, float w) +{ + return v + w; +} + +void frag_main() +{ + FragColor = add_value(10.0f, registers_foo); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/texel-fetch-offset.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/texel-fetch-offset.frag new file mode 100644 index 0000000000..f2a02e1629 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/texel-fetch-offset.frag @@ -0,0 +1,30 @@ +Texture2D uTexture : register(t0); +SamplerState _uTexture_sampler : register(s0); + +static float4 gl_FragCoord; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float4 gl_FragCoord : SV_Position; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = uTexture.Load(int3(int2(gl_FragCoord.xy), 0), int2(1, 1)); + FragColor += uTexture.Load(int3(int2(gl_FragCoord.xy), 0), int2(-1, 1)); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_FragCoord = stage_input.gl_FragCoord; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/empty-struct.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/empty-struct.asm.frag index 366ab16577..0a56f1f153 100644 --- a/third_party/spirv-cross/reference/shaders-msl/asm/frag/empty-struct.asm.frag +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/empty-struct.asm.frag @@ -15,7 +15,7 @@ float GetValue(thread const EmptyStructTest& self) return 0.0; } -float GetValue_1(thread const EmptyStructTest& self) +float GetValue_1(EmptyStructTest self) { return 0.0; } diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/pass-by-value.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/pass-by-value.asm.frag new file mode 100644 index 0000000000..6ed945ecff --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/pass-by-value.asm.frag @@ -0,0 +1,29 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct Registers +{ + float foo; +}; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +float add_value(float v, float w) +{ + return v + w; +} + +fragment main0_out main0(constant Registers& registers [[buffer(0)]]) +{ + main0_out out = {}; + out.FragColor = add_value(10.0, registers.foo); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/texel-fetch-offset.frag b/third_party/spirv-cross/reference/shaders-msl/frag/texel-fetch-offset.frag new file mode 100644 index 0000000000..4d4301e1ca --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/texel-fetch-offset.frag @@ -0,0 +1,18 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture2d uTexture [[texture(0)]], sampler uTextureSmplr [[sampler(0)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + out.FragColor = uTexture.read(uint2(int2(gl_FragCoord.xy)) + uint2(int2(1)), 0); + out.FragColor += uTexture.read(uint2(int2(gl_FragCoord.xy)) + uint2(int2(-1, 1)), 0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.vert b/third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.vert new file mode 100644 index 0000000000..28098ee88e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.vert @@ -0,0 +1,20 @@ +#include +#include + +using namespace metal; + +struct _10 +{ + uint4 _m0[1024]; +}; + +struct main0_in +{ + uint4 m_19 [[attribute(0)]]; +}; + +vertex void main0(main0_in in [[stage_in]], device _10& _12 [[buffer(0)]], uint gl_VertexIndex [[vertex_id]]) +{ + _12._m0[gl_VertexIndex] = in.m_19; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.write_buff.vert b/third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.write_buff.vert new file mode 100644 index 0000000000..2ac15cfa6b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.write_buff.vert @@ -0,0 +1,35 @@ +#include +#include + +using namespace metal; + +struct _35 +{ + uint4 _m0[1024]; +}; + +struct _40 +{ + uint4 _m0[1024]; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 m_17 [[attribute(0)]]; +}; + +vertex void main0(main0_in in [[stage_in]], constant _40& _42 [[buffer(0)]], device _35& _37 [[buffer(1)]]) +{ + main0_out out = {}; + out.gl_Position = in.m_17; + for (int _22 = 0; _22 < 1024; _22++) + { + _37._m0[_22] = _42._m0[_22]; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.write_buff_atomic.vert b/third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.write_buff_atomic.vert new file mode 100644 index 0000000000..9fe99e29fe --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.write_buff_atomic.vert @@ -0,0 +1,31 @@ +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +struct _23 +{ + uint _m0; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 m_17 [[attribute(0)]]; +}; + +vertex void main0(main0_in in [[stage_in]], device _23& _25 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = in.m_17; + uint _29 = atomic_fetch_add_explicit((volatile device atomic_uint*)&_25._m0, 1u, memory_order_relaxed); + uint _22 = _29; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.write_tex.vert b/third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.write_tex.vert new file mode 100644 index 0000000000..533986b95f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.write_tex.vert @@ -0,0 +1,25 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 m_17 [[attribute(0)]]; +}; + +vertex void main0(main0_in in [[stage_in]], texture1d _37 [[texture(0)]], texture1d _34 [[texture(1)]]) +{ + main0_out out = {}; + out.gl_Position = in.m_17; + for (int _22 = 0; _22 < 128; _22++) + { + _34.write(_37.read(uint(_22)), uint(_22)); + } +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/for-loop-phi-only-continue.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/for-loop-phi-only-continue.asm.frag new file mode 100644 index 0000000000..feb45db440 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/for-loop-phi-only-continue.asm.frag @@ -0,0 +1,19 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; + +void main() +{ + float _19; + _19 = 0.0; + float _20; + int _23; + for (int _22 = 0; _22 < 16; _19 = _20, _22 = _23) + { + _20 = _19 + 1.0; + _23 = _22 + 1; + continue; + } + FragColor = vec4(_19); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/pass-by-value.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/pass-by-value.asm.frag new file mode 100644 index 0000000000..35ba2e1535 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/pass-by-value.asm.frag @@ -0,0 +1,21 @@ +#version 450 + +struct Registers +{ + float foo; +}; + +uniform Registers registers; + +layout(location = 0) out float FragColor; + +float add_value(float v, float w) +{ + return v + w; +} + +void main() +{ + FragColor = add_value(10.0, registers.foo); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/texel-fetch-offset.frag b/third_party/spirv-cross/reference/shaders/frag/texel-fetch-offset.frag new file mode 100644 index 0000000000..658468aa41 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/texel-fetch-offset.frag @@ -0,0 +1,14 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 0) uniform mediump sampler2D uTexture; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = texelFetchOffset(uTexture, ivec2(gl_FragCoord.xy), 0, ivec2(1)); + FragColor += texelFetchOffset(uTexture, ivec2(gl_FragCoord.xy), 0, ivec2(-1, 1)); +} + diff --git a/third_party/spirv-cross/shaders-hlsl/asm/frag/pass-by-value.asm.frag b/third_party/spirv-cross/shaders-hlsl/asm/frag/pass-by-value.asm.frag new file mode 100644 index 0000000000..083c85d9b0 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/frag/pass-by-value.asm.frag @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %add_value_f1_f1_ "add_value(f1;f1;" + OpName %v "v" + OpName %w "w" + OpName %FragColor "FragColor" + OpName %Registers "Registers" + OpMemberName %Registers 0 "foo" + OpName %registers "registers" + OpDecorate %FragColor Location 0 + OpMemberDecorate %Registers 0 Offset 0 + OpDecorate %Registers Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %8 = OpTypeFunction %float %float %float +%_ptr_Output_float = OpTypePointer Output %float + %FragColor = OpVariable %_ptr_Output_float Output + %float_10 = OpConstant %float 10 + %Registers = OpTypeStruct %float +%_ptr_PushConstant_Registers = OpTypePointer PushConstant %Registers + %registers = OpVariable %_ptr_PushConstant_Registers PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_float = OpTypePointer PushConstant %float + %main = OpFunction %void None %3 + %5 = OpLabel + %29 = OpAccessChain %_ptr_PushConstant_float %registers %int_0 + %30 = OpLoad %float %29 + %31 = OpFunctionCall %float %add_value_f1_f1_ %float_10 %30 + OpStore %FragColor %31 + OpReturn + OpFunctionEnd +%add_value_f1_f1_ = OpFunction %float None %8 + %v = OpFunctionParameter %float + %w = OpFunctionParameter %float + %12 = OpLabel + %15 = OpFAdd %float %v %w + OpReturnValue %15 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/frag/texel-fetch-offset.frag b/third_party/spirv-cross/shaders-hlsl/frag/texel-fetch-offset.frag new file mode 100644 index 0000000000..e98748b8bc --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/texel-fetch-offset.frag @@ -0,0 +1,10 @@ +#version 310 es +precision mediump float; +layout(location = 0) out vec4 FragColor; +layout(binding = 0) uniform sampler2D uTexture; + +void main() +{ + FragColor = texelFetchOffset(uTexture, ivec2(gl_FragCoord.xy), 0, ivec2(1, 1)); + FragColor += texelFetchOffset(uTexture, ivec2(gl_FragCoord.xy), 0, ivec2(-1, 1)); +} diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/pass-by-value.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/pass-by-value.asm.frag new file mode 100644 index 0000000000..083c85d9b0 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/pass-by-value.asm.frag @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %add_value_f1_f1_ "add_value(f1;f1;" + OpName %v "v" + OpName %w "w" + OpName %FragColor "FragColor" + OpName %Registers "Registers" + OpMemberName %Registers 0 "foo" + OpName %registers "registers" + OpDecorate %FragColor Location 0 + OpMemberDecorate %Registers 0 Offset 0 + OpDecorate %Registers Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %8 = OpTypeFunction %float %float %float +%_ptr_Output_float = OpTypePointer Output %float + %FragColor = OpVariable %_ptr_Output_float Output + %float_10 = OpConstant %float 10 + %Registers = OpTypeStruct %float +%_ptr_PushConstant_Registers = OpTypePointer PushConstant %Registers + %registers = OpVariable %_ptr_PushConstant_Registers PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_float = OpTypePointer PushConstant %float + %main = OpFunction %void None %3 + %5 = OpLabel + %29 = OpAccessChain %_ptr_PushConstant_float %registers %int_0 + %30 = OpLoad %float %29 + %31 = OpFunctionCall %float %add_value_f1_f1_ %float_10 %30 + OpStore %FragColor %31 + OpReturn + OpFunctionEnd +%add_value_f1_f1_ = OpFunction %float None %8 + %v = OpFunctionParameter %float + %w = OpFunctionParameter %float + %12 = OpLabel + %15 = OpFAdd %float %v %w + OpReturnValue %15 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/frag/texel-fetch-offset.frag b/third_party/spirv-cross/shaders-msl/frag/texel-fetch-offset.frag new file mode 100644 index 0000000000..e98748b8bc --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/texel-fetch-offset.frag @@ -0,0 +1,10 @@ +#version 310 es +precision mediump float; +layout(location = 0) out vec4 FragColor; +layout(binding = 0) uniform sampler2D uTexture; + +void main() +{ + FragColor = texelFetchOffset(uTexture, ivec2(gl_FragCoord.xy), 0, ivec2(1, 1)); + FragColor += texelFetchOffset(uTexture, ivec2(gl_FragCoord.xy), 0, ivec2(-1, 1)); +} diff --git a/third_party/spirv-cross/shaders-msl/vert/no_stage_out.vert b/third_party/spirv-cross/shaders-msl/vert/no_stage_out.vert new file mode 100644 index 0000000000..3c2573a628 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/no_stage_out.vert @@ -0,0 +1,14 @@ +#version 450 + +layout(binding = 0, std430) writeonly buffer _10_12 +{ + uvec4 _m0[1024]; +} _12; + +layout(location = 0) in uvec4 _19; + +void main() +{ + _12._m0[gl_VertexIndex] = _19; +} + diff --git a/third_party/spirv-cross/shaders-msl/vert/no_stage_out.write_buff.vert b/third_party/spirv-cross/shaders-msl/vert/no_stage_out.write_buff.vert new file mode 100644 index 0000000000..96ed2bd1fd --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/no_stage_out.write_buff.vert @@ -0,0 +1,23 @@ +#version 450 + +layout(binding = 1, std430) writeonly buffer _33_35 +{ + uvec4 _m0[1024]; +} _35; + +layout(binding = 0, std140) uniform _38_40 +{ + uvec4 _m0[1024]; +} _40; + +layout(location = 0) in vec4 _14; + +void main() +{ + gl_Position = _14; + for (int _19 = 0; _19 < 1024; _19++) + { + _35._m0[_19] = _40._m0[_19]; + } +} + diff --git a/third_party/spirv-cross/shaders-msl/vert/no_stage_out.write_buff_atomic.vert b/third_party/spirv-cross/shaders-msl/vert/no_stage_out.write_buff_atomic.vert new file mode 100644 index 0000000000..607ac9f342 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/no_stage_out.write_buff_atomic.vert @@ -0,0 +1,15 @@ +#version 450 + +layout(binding = 0, std430) coherent buffer _19_21 +{ + uint _m0; +} _21; + +layout(location = 0) in vec4 _14; + +void main() +{ + gl_Position = _14; + uint _26 = atomicAdd(_21._m0, 1u); +} + diff --git a/third_party/spirv-cross/shaders-msl/vert/no_stage_out.write_tex.vert b/third_party/spirv-cross/shaders-msl/vert/no_stage_out.write_tex.vert new file mode 100644 index 0000000000..19c667391d --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/no_stage_out.write_tex.vert @@ -0,0 +1,16 @@ +#version 450 + +layout(binding = 1, r32ui) uniform writeonly uimage1D _32; +layout(binding = 0, r32ui) uniform readonly uimage1D _35; + +layout(location = 0) in vec4 _14; + +void main() +{ + gl_Position = _14; + for (int _19 = 0; _19 < 128; _19++) + { + imageStore(_32, _19, imageLoad(_35, _19)); + } +} + diff --git a/third_party/spirv-cross/shaders/asm/frag/for-loop-phi-only-continue.asm.frag b/third_party/spirv-cross/shaders/asm/frag/for-loop-phi-only-continue.asm.frag new file mode 100644 index 0000000000..ae84b30b41 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/for-loop-phi-only-continue.asm.frag @@ -0,0 +1,48 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 51 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_16 = OpConstant %int 16 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %int_1 = OpConstant %int 1 + %float_2 = OpConstant %float 2 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + OpBranch %14 + %14 = OpLabel + %50 = OpPhi %float %float_0 %5 %25 %15 + %47 = OpPhi %int %int_0 %5 %28 %15 + %22 = OpSLessThan %bool %47 %int_16 + OpLoopMerge %16 %15 None + OpBranchConditional %22 %body1 %16 + %body1 = OpLabel + %25 = OpFAdd %float %50 %float_1 + %28 = OpIAdd %int %47 %int_1 + OpBranch %15 + %15 = OpLabel + OpBranch %14 + %16 = OpLabel + %46 = OpCompositeConstruct %v4float %50 %50 %50 %50 + OpStore %FragColor %46 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/pass-by-value.asm.frag b/third_party/spirv-cross/shaders/asm/frag/pass-by-value.asm.frag new file mode 100644 index 0000000000..083c85d9b0 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/pass-by-value.asm.frag @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %add_value_f1_f1_ "add_value(f1;f1;" + OpName %v "v" + OpName %w "w" + OpName %FragColor "FragColor" + OpName %Registers "Registers" + OpMemberName %Registers 0 "foo" + OpName %registers "registers" + OpDecorate %FragColor Location 0 + OpMemberDecorate %Registers 0 Offset 0 + OpDecorate %Registers Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %8 = OpTypeFunction %float %float %float +%_ptr_Output_float = OpTypePointer Output %float + %FragColor = OpVariable %_ptr_Output_float Output + %float_10 = OpConstant %float 10 + %Registers = OpTypeStruct %float +%_ptr_PushConstant_Registers = OpTypePointer PushConstant %Registers + %registers = OpVariable %_ptr_PushConstant_Registers PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_float = OpTypePointer PushConstant %float + %main = OpFunction %void None %3 + %5 = OpLabel + %29 = OpAccessChain %_ptr_PushConstant_float %registers %int_0 + %30 = OpLoad %float %29 + %31 = OpFunctionCall %float %add_value_f1_f1_ %float_10 %30 + OpStore %FragColor %31 + OpReturn + OpFunctionEnd +%add_value_f1_f1_ = OpFunction %float None %8 + %v = OpFunctionParameter %float + %w = OpFunctionParameter %float + %12 = OpLabel + %15 = OpFAdd %float %v %w + OpReturnValue %15 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/frag/texel-fetch-offset.frag b/third_party/spirv-cross/shaders/frag/texel-fetch-offset.frag new file mode 100644 index 0000000000..e98748b8bc --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/texel-fetch-offset.frag @@ -0,0 +1,10 @@ +#version 310 es +precision mediump float; +layout(location = 0) out vec4 FragColor; +layout(binding = 0) uniform sampler2D uTexture; + +void main() +{ + FragColor = texelFetchOffset(uTexture, ivec2(gl_FragCoord.xy), 0, ivec2(1, 1)); + FragColor += texelFetchOffset(uTexture, ivec2(gl_FragCoord.xy), 0, ivec2(-1, 1)); +} diff --git a/third_party/spirv-cross/spirv_cross.cpp b/third_party/spirv-cross/spirv_cross.cpp index dd2a44ca33..eaddeca5cb 100644 --- a/third_party/spirv-cross/spirv_cross.cpp +++ b/third_party/spirv-cross/spirv_cross.cpp @@ -2437,7 +2437,13 @@ bool Compiler::execution_is_noop(const SPIRBlock &from, const SPIRBlock &to) con if (!start->ops.empty()) return false; - start = &get(start->next_block); + auto &next = get(start->next_block); + // Flushing phi variables does not count as noop. + for (auto &phi : next.phi_variables) + if (phi.parent == start->self) + return false; + + start = &next; } } diff --git a/third_party/spirv-cross/spirv_glsl.cpp b/third_party/spirv-cross/spirv_glsl.cpp index b6987bc39a..dc237110a9 100644 --- a/third_party/spirv-cross/spirv_glsl.cpp +++ b/third_party/spirv-cross/spirv_glsl.cpp @@ -9292,6 +9292,16 @@ string CompilerGLSL::emit_continue_block(uint32_t continue_block) return merge(statements); } +void CompilerGLSL::emit_while_loop_initializers(const SPIRBlock &block) +{ + // While loops do not take initializers, so declare all of them outside. + for (auto &loop_var : block.loop_variables) + { + auto &var = get(loop_var); + statement(variable_decl(var), ";"); + } +} + string CompilerGLSL::emit_for_loop_initializers(const SPIRBlock &block) { if (block.loop_variables.empty()) @@ -9409,12 +9419,12 @@ bool CompilerGLSL::attempt_emit_loop_header(SPIRBlock &block, SPIRBlock::Method { // This block may be a dominating block, so make sure we flush undeclared variables before building the for loop header. flush_undeclared_variables(block); - emit_block_hints(block); // Important that we do this in this order because // emitting the continue block can invalidate the condition expression. auto initializer = emit_for_loop_initializers(block); auto condition = to_expression(block.condition); + emit_block_hints(block); if (method != SPIRBlock::MergeToSelectContinueForLoop) { auto continue_block = emit_continue_block(block.continue_block); @@ -9428,6 +9438,7 @@ bool CompilerGLSL::attempt_emit_loop_header(SPIRBlock &block, SPIRBlock::Method case SPIRBlock::WhileLoop: // This block may be a dominating block, so make sure we flush undeclared variables before building the while loop header. flush_undeclared_variables(block); + emit_while_loop_initializers(block); emit_block_hints(block); statement("while (", to_expression(block.condition), ")"); break; @@ -9482,6 +9493,7 @@ bool CompilerGLSL::attempt_emit_loop_header(SPIRBlock &block, SPIRBlock::Method } case SPIRBlock::WhileLoop: + emit_while_loop_initializers(block); emit_block_hints(block); statement("while (", to_expression(child.condition), ")"); break; @@ -9600,6 +9612,7 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block) else if (continue_type == SPIRBlock::DoWhileLoop) { flush_undeclared_variables(block); + emit_while_loop_initializers(block); // We have some temporaries where the loop header is the dominator. // We risk a case where we have code like: // for (;;) { create-temporary; break; } consume-temporary; @@ -9613,6 +9626,7 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block) else if (block.merge == SPIRBlock::MergeLoop) { flush_undeclared_variables(block); + emit_while_loop_initializers(block); // We have a generic loop without any distinguishable pattern like for, while or do while. get(block.continue_block).complex_continue = true; diff --git a/third_party/spirv-cross/spirv_glsl.hpp b/third_party/spirv-cross/spirv_glsl.hpp index a8fc8edd88..fa0475a883 100644 --- a/third_party/spirv-cross/spirv_glsl.hpp +++ b/third_party/spirv-cross/spirv_glsl.hpp @@ -549,6 +549,7 @@ protected: void find_static_extensions(); std::string emit_for_loop_initializers(const SPIRBlock &block); + void emit_while_loop_initializers(const SPIRBlock &block); bool for_loop_initializers_are_same_type(const SPIRBlock &block); bool optimize_read_modify_write(const SPIRType &type, const std::string &lhs, const std::string &rhs); void fixup_image_load_store_access(); diff --git a/third_party/spirv-cross/spirv_msl.cpp b/third_party/spirv-cross/spirv_msl.cpp index 3f8de118b1..ab00eedd5f 100644 --- a/third_party/spirv-cross/spirv_msl.cpp +++ b/third_party/spirv-cross/spirv_msl.cpp @@ -276,6 +276,8 @@ string CompilerMSL::compile() backend.boolean_mix_support = false; backend.allow_truncated_access_chain = true; + is_rasterization_disabled = msl_options.disable_rasterization; + replace_illegal_names(); struct_member_padding.clear(); @@ -299,6 +301,10 @@ string CompilerMSL::compile() stage_in_var_id = add_interface_block(StorageClassInput); stage_uniforms_var_id = add_interface_block(StorageClassUniformConstant); + // Metal vertex functions that define no output must disable rasterization and return void. + if (!stage_out_var_id) + is_rasterization_disabled = true; + // Convert the use of global variables to recursively-passed function parameters localize_global_variables(); extract_global_variables_from_functions(); @@ -376,6 +382,10 @@ void CompilerMSL::preprocess_op_codes() add_header_line("#include "); add_pragma_line("#pragma clang diagnostic ignored \"-Wunused-variable\""); } + + // Metal vertex functions that write to resources must disable rasterization and return void. + if (preproc.uses_resource_write) + is_rasterization_disabled = true; } // Move the Private and Workgroup global variables to the entry function. @@ -555,10 +565,20 @@ void CompilerMSL::extract_global_variables_from_function(uint32_t func_id, std:: if (is_builtin && has_active_builtin(builtin, var.storage)) { // Add a arg variable with the same type and decorations as the member - uint32_t next_id = increase_bound_by(1); - func.add_parameter(mbr_type_id, next_id, true); - set(next_id, mbr_type_id, StorageClassFunction); - meta[next_id].decoration = meta[type_id].members[mbr_idx]; + uint32_t next_ids = increase_bound_by(2); + uint32_t ptr_type_id = next_ids + 0; + uint32_t var_id = next_ids + 1; + + // Make sure we have an actual pointer type, + // so that we will get the appropriate address space when declaring these builtins. + auto &ptr = set(ptr_type_id, get(mbr_type_id)); + ptr.self = mbr_type_id; + ptr.storage = var.storage; + ptr.pointer = true; + + func.add_parameter(mbr_type_id, var_id, true); + set(var_id, ptr_type_id, StorageClassFunction); + meta[var_id].decoration = meta[type_id].members[mbr_idx]; } mbr_idx++; } @@ -634,8 +654,7 @@ void CompilerMSL::mark_as_packable(SPIRType &type) void CompilerMSL::mark_location_as_used_by_shader(uint32_t location, StorageClass storage) { MSLVertexAttr *p_va; - auto &execution = get_entry_point(); - if ((execution.model == ExecutionModelVertex) && (storage == StorageClassInput) && + if ((get_entry_point().model == ExecutionModelVertex) && (storage == StorageClassInput) && (p_va = vtx_attrs_by_location[location])) p_va->used_by_shader = true; } @@ -690,16 +709,19 @@ uint32_t CompilerMSL::add_interface_block(StorageClass storage) { ib_var_ref = stage_out_var_name; - // Add the output interface struct as a local variable to the entry function, force - // the entry function to return the output interface struct from any blocks that perform - // a function return, and indicate the output var requires early initialization + // Add the output interface struct as a local variable to the entry function. + // If the entry point should return the output struct, set the entry function + // to return the output interface struct, otherwise to return nothing. + // Indicate the output var requires early initialization. + bool ep_should_return_output = !get_is_rasterization_disabled(); + uint32_t rtn_id = ep_should_return_output ? ib_var_id : 0; auto &entry_func = get(entry_point); entry_func.add_local_variable(ib_var_id); for (auto &blk_id : entry_func.blocks) { auto &blk = get(blk_id); if (blk.terminator == SPIRBlock::Return) - blk.return_value = ib_var_id; + blk.return_value = rtn_id; } vars_needing_early_declaration.push_back(ib_var_id); break; @@ -1741,7 +1763,7 @@ void CompilerMSL::emit_instruction(const Instruction &instruction) break; case OpAtomicXor: - MSL_AFMO (xor); + MSL_AFMO(xor); break; // Images @@ -2112,7 +2134,7 @@ bool CompilerMSL::maybe_emit_array_assignment(uint32_t id_lhs, uint32_t id_rhs) auto *var = maybe_get(id_lhs); // Is this a remapped, static constant? Don't do anything. - if (var->remapped_variable && var->statically_assigned) + if (var && var->remapped_variable && var->statically_assigned) return true; if (ids[id_rhs].get_type() == TypeConstant && var && var->deferred_declaration) @@ -2388,8 +2410,7 @@ void CompilerMSL::emit_function_prototype(SPIRFunction &func, const Bitset &) { add_local_variable_name(arg.id); - string address_space = "thread"; - + string address_space; auto *var = maybe_get(arg.id); if (var) { @@ -2397,7 +2418,8 @@ void CompilerMSL::emit_function_prototype(SPIRFunction &func, const Bitset &) address_space = get_argument_address_space(*var); } - decl += address_space + " "; + if (!address_space.empty()) + decl += address_space + " "; decl += argument_decl(arg); // Manufacture automatic sampler arg for SampledImage texture @@ -2530,6 +2552,27 @@ string CompilerMSL::to_function_args(uint32_t img, const SPIRType &imgtype, bool break; } + if (is_fetch && offset) + { + // Fetch offsets must be applied directly to the coordinate. + forward = forward && should_forward(offset); + auto &type = expression_type(offset); + if (type.basetype != SPIRType::UInt) + tex_coords += " + " + bitcast_expression(SPIRType::UInt, offset); + else + tex_coords += " + " + to_enclosed_expression(offset); + } + else if (is_fetch && coffset) + { + // Fetch offsets must be applied directly to the coordinate. + forward = forward && should_forward(coffset); + auto &type = expression_type(coffset); + if (type.basetype != SPIRType::UInt) + tex_coords += " + " + bitcast_expression(SPIRType::UInt, coffset); + else + tex_coords += " + " + to_enclosed_expression(coffset); + } + // If projection, use alt coord as divisor if (is_proj) tex_coords += " / " + coord_expr + alt_coord; @@ -2621,12 +2664,12 @@ string CompilerMSL::to_function_args(uint32_t img, const SPIRType &imgtype, bool // Add offsets string offset_expr; - if (coffset) + if (coffset && !is_fetch) { forward = forward && should_forward(coffset); offset_expr = to_expression(coffset); } - else if (offset) + else if (offset && !is_fetch) { forward = forward && should_forward(offset); offset_expr = to_expression(offset); @@ -2844,9 +2887,7 @@ string CompilerMSL::convert_row_major_matrix(string exp_str, const SPIRType &exp // Called automatically at the end of the entry point function void CompilerMSL::emit_fixup() { - auto &execution = get_entry_point(); - - if ((execution.model == ExecutionModelVertex) && stage_out_var_id && !qual_pos_var_name.empty()) + if ((get_entry_point().model == ExecutionModelVertex) && stage_out_var_id && !qual_pos_var_name.empty()) { if (options.vertex.fixup_clipspace) statement(qual_pos_var_name, ".z = (", qual_pos_var_name, ".z + ", qual_pos_var_name, @@ -3081,14 +3122,14 @@ string CompilerMSL::constant_expression(const SPIRConstant &c) // entry type if the current function is the entry point function string CompilerMSL::func_type_decl(SPIRType &type) { - auto &execution = get_entry_point(); // The regular function return type. If not processing the entry point function, that's all we need string return_type = type_to_glsl(type) + type_to_array_glsl(type); if (!processing_entry_point) return return_type; - // If an outgoing interface block has been defined, override the entry point return type - if (stage_out_var_id) + // If an outgoing interface block has been defined, and it should be returned, override the entry point return type + bool ep_should_return_output = !get_is_rasterization_disabled(); + if (stage_out_var_id && ep_should_return_output) { auto &so_var = get(stage_out_var_id); auto &so_type = get(so_var.basetype); @@ -3097,6 +3138,7 @@ string CompilerMSL::func_type_decl(SPIRType &type) // Prepend a entry type, based on the execution model string entry_type; + auto &execution = get_entry_point(); switch (execution.model) { case ExecutionModelVertex: @@ -3130,8 +3172,8 @@ string CompilerMSL::get_argument_address_space(const SPIRVariable &argument) case StorageClassStorageBuffer: { - auto flags = get_buffer_block_flags(argument); - return flags.get(DecorationNonWritable) ? "const device" : "device"; + bool readonly = get_buffer_block_flags(argument).get(DecorationNonWritable); + return readonly ? "const device" : "device"; } case StorageClassUniform: @@ -3140,16 +3182,21 @@ string CompilerMSL::get_argument_address_space(const SPIRVariable &argument) if (type.basetype == SPIRType::Struct) { bool ssbo = has_decoration(type.self, DecorationBufferBlock); - if (!ssbo) - return "constant"; - else + if (ssbo) { bool readonly = get_buffer_block_flags(argument).get(DecorationNonWritable); return readonly ? "const device" : "device"; } + else + return "constant"; } break; + case StorageClassFunction: + case StorageClassGeneric: + // No address space for plain values. + return type.pointer ? "thread" : ""; + default: break; } @@ -3363,7 +3410,8 @@ string CompilerMSL::argument_decl(const SPIRFunction::Parameter &arg) { auto &var = get(arg.id); auto &type = expression_type(arg.id); - bool constref = !arg.alias_global_variable && (!type.pointer || arg.write_count == 0); + + bool constref = !arg.alias_global_variable && type.pointer && arg.write_count == 0; bool type_is_image = type.basetype == SPIRType::Image || type.basetype == SPIRType::SampledImage || type.basetype == SPIRType::Sampler; @@ -3372,27 +3420,34 @@ string CompilerMSL::argument_decl(const SPIRFunction::Parameter &arg) if (!type.array.empty() && type_is_image) constref = true; - // TODO: Check if this arg is an uniform pointer - bool pointer = type.storage == StorageClassUniformConstant; - string decl; if (constref) decl += "const "; - if (is_builtin_variable(var)) + bool builtin = is_builtin_variable(var); + if (builtin) decl += builtin_type_decl(static_cast(get_decoration(arg.id, DecorationBuiltIn))); else decl += type_to_glsl(type, arg.id); - // Arrays of images and samplers are special cased. - if (is_array(type) && !type_is_image) + bool opaque_handle = type.storage == StorageClassUniformConstant; + + if (!builtin && !opaque_handle && !type.pointer && + (type.storage == StorageClassFunction || type.storage == StorageClassGeneric)) { + // If the argument is a pure value and not an opaque type, we will pass by value. + decl += " "; + decl += to_expression(var.self); + } + else if (is_array(type) && !type_is_image) + { + // Arrays of images and samplers are special cased. decl += " (&"; decl += to_expression(var.self); decl += ")"; decl += type_to_array_glsl(type); } - else if (!pointer) + else if (!opaque_handle) { decl += "&"; decl += " "; @@ -3609,7 +3664,7 @@ std::string CompilerMSL::sampler_type(const SPIRType &type) return "sampler"; } -// Returns an MSL string describing the SPIR-V image type +// Returns an MSL string describing the SPIR-V image type string CompilerMSL::image_type_glsl(const SPIRType &type, uint32_t id) { auto *var = maybe_get(id); @@ -4027,10 +4082,17 @@ bool CompilerMSL::OpCodePreprocessor::handle(Op opcode, const uint32_t *args, ui suppress_missing_prototypes = true; break; + case OpImageWrite: + uses_resource_write = true; + break; + + case OpStore: + check_resource_write(args[0]); + break; + case OpAtomicExchange: case OpAtomicCompareExchange: case OpAtomicCompareExchangeWeak: - case OpAtomicLoad: case OpAtomicIIncrement: case OpAtomicIDecrement: case OpAtomicIAdd: @@ -4042,6 +4104,11 @@ bool CompilerMSL::OpCodePreprocessor::handle(Op opcode, const uint32_t *args, ui case OpAtomicAnd: case OpAtomicOr: case OpAtomicXor: + uses_atomics = true; + check_resource_write(args[2]); + break; + + case OpAtomicLoad: uses_atomics = true; break; @@ -4057,6 +4124,15 @@ bool CompilerMSL::OpCodePreprocessor::handle(Op opcode, const uint32_t *args, ui return true; } +// If the variable is a Uniform or StorageBuffer, mark that a resource has been written to. +void CompilerMSL::OpCodePreprocessor::check_resource_write(uint32_t var_id) +{ + auto *p_var = compiler.maybe_get_backing_variable(var_id); + StorageClass sc = p_var ? p_var->storage : StorageClassMax; + if (sc == StorageClassUniform || sc == StorageClassStorageBuffer) + uses_resource_write = true; +} + // Returns an enumeration of a SPIR-V function that needs to be output for certain Op codes. CompilerMSL::SPVFuncImpl CompilerMSL::OpCodePreprocessor::get_spv_func_impl(Op opcode, const uint32_t *args) { diff --git a/third_party/spirv-cross/spirv_msl.hpp b/third_party/spirv-cross/spirv_msl.hpp index f526db7036..78c9f2eccc 100644 --- a/third_party/spirv-cross/spirv_msl.hpp +++ b/third_party/spirv-cross/spirv_msl.hpp @@ -153,6 +153,7 @@ public: uint32_t msl_version = make_msl_version(1, 2); uint32_t texel_buffer_texture_width = 4096; // Width of 2D Metal textures used as 1D texel buffers bool enable_point_size_builtin = true; + bool disable_rasterization = false; bool resolve_specialized_array_lengths = true; bool is_ios() @@ -203,6 +204,13 @@ public: msl_options = opts; } + // Provide feedback to calling API to allow runtime to disable pipeline + // rasterization if vertex shader requires rasterization to be disabled. + bool get_is_rasterization_disabled() const + { + return is_rasterization_disabled && (get_entry_point().model == spv::ExecutionModelVertex); + } + // An enum of SPIR-V functions that are implemented in additional // source code that is added to the shader if necessary. enum SPVFuncImpl @@ -375,6 +383,7 @@ protected: uint32_t stage_uniforms_var_id = 0; bool needs_vertex_idx_arg = false; bool needs_instance_idx_arg = false; + bool is_rasterization_disabled = false; std::string qual_pos_var_name; std::string stage_in_var_name = "in"; std::string stage_out_var_name = "out"; @@ -394,11 +403,13 @@ protected: bool handle(spv::Op opcode, const uint32_t *args, uint32_t length) override; CompilerMSL::SPVFuncImpl get_spv_func_impl(spv::Op opcode, const uint32_t *args); + void check_resource_write(uint32_t var_id); CompilerMSL &compiler; std::unordered_map result_types; bool suppress_missing_prototypes = false; bool uses_atomics = false; + bool uses_resource_write = false; }; // Sorts the members of a SPIRType and associated Meta info based on a settable sorting diff --git a/third_party/spirv-tools/Android.mk b/third_party/spirv-tools/Android.mk old mode 100755 new mode 100644 index 163f9a36b9..bee489bec6 --- a/third_party/spirv-tools/Android.mk +++ b/third_party/spirv-tools/Android.mk @@ -24,7 +24,6 @@ SPVTOOLS_SRC_FILES := \ source/table.cpp \ source/text.cpp \ source/text_handler.cpp \ - source/util/bit_stream.cpp \ source/util/bit_vector.cpp \ source/util/parse_number.cpp \ source/util/string_utils.cpp \ @@ -36,6 +35,7 @@ SPVTOOLS_SRC_FILES := \ source/val/validation_state.cpp \ source/val/validate.cpp \ source/val/validate_adjacency.cpp \ + source/val/validate_annotation.cpp \ source/val/validate_arithmetics.cpp \ source/val/validate_atomics.cpp \ source/val/validate_barriers.cpp \ @@ -46,20 +46,24 @@ SPVTOOLS_SRC_FILES := \ source/val/validate_composites.cpp \ source/val/validate_conversion.cpp \ source/val/validate_datarules.cpp \ + source/val/validate_debug.cpp \ source/val/validate_decorations.cpp \ source/val/validate_derivatives.cpp \ source/val/validate_ext_inst.cpp \ + source/val/validate_execution_limitations.cpp \ + source/val/validate_function.cpp \ source/val/validate_id.cpp \ source/val/validate_image.cpp \ source/val/validate_interfaces.cpp \ source/val/validate_instruction.cpp \ source/val/validate_memory.cpp \ + source/val/validate_mode_setting.cpp \ source/val/validate_layout.cpp \ source/val/validate_literals.cpp \ source/val/validate_logicals.cpp \ source/val/validate_non_uniform.cpp \ source/val/validate_primitives.cpp \ - source/val/validate_type_unique.cpp + source/val/validate_type.cpp SPVTOOLS_OPT_SRC_FILES := \ source/opt/aggressive_dead_code_elim_pass.cpp \ @@ -305,7 +309,6 @@ include $(CLEAR_VARS) LOCAL_MODULE := SPIRV-Tools LOCAL_C_INCLUDES := \ $(LOCAL_PATH)/include \ - $(LOCAL_PATH)/source \ $(LOCAL_PATH)/external/spirv-headers/include \ $(SPVTOOLS_OUT_PATH) LOCAL_EXPORT_C_INCLUDES := \ diff --git a/third_party/spirv-tools/BUILD.gn b/third_party/spirv-tools/BUILD.gn index d79180afa0..6636495f64 100644 --- a/third_party/spirv-tools/BUILD.gn +++ b/third_party/spirv-tools/BUILD.gn @@ -12,14 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//build_overrides/spirv_tools.gni") + import("//testing/test.gni") import("//build_overrides/build.gni") -if (build_with_chromium) { - spirv_headers = "//third_party/spirv-headers/src" -} else { - spirv_headers = "external/spirv-headers" -} +spirv_headers = spirv_tools_spirv_headers_dir template("spvtools_core_tables") { assert(defined(invoker.version), "Need version in $target_name generation.") @@ -264,7 +262,6 @@ config("spvtools_config") { include_dirs = [ ".", "include", - "source", "$target_gen_dir", "${spirv_headers}/include", ] @@ -304,7 +301,6 @@ static_library("spvtools") { "source/instruction.h", "source/libspirv.cpp", "source/macro.h", - "source/message.cpp", "source/name_mapper.cpp", "source/name_mapper.h", "source/opcode.cpp", @@ -329,16 +325,13 @@ static_library("spvtools") { "source/text.h", "source/text_handler.cpp", "source/text_handler.h", - "source/util/bit_stream.cpp", - "source/util/bit_stream.h", "source/util/bit_vector.cpp", "source/util/bit_vector.h", "source/util/bitutils.h", "source/util/hex_float.h", - "source/util/hufman_codec.h", "source/util/ilist.h", "source/util/ilist_node.h", - "source/util/move_to_front.h", + "source/util/make_unique.h", "source/util/parse_number.cpp", "source/util/parse_number.h", "source/util/small_vector.h", @@ -362,6 +355,7 @@ static_library("spvtools_val") { "source/val/validate.cpp", "source/val/validate.h", "source/val/validate_adjacency.cpp", + "source/val/validate_annotation.cpp", "source/val/validate_arithmetics.cpp", "source/val/validate_atomics.cpp", "source/val/validate_barriers.cpp", @@ -372,9 +366,12 @@ static_library("spvtools_val") { "source/val/validate_composites.cpp", "source/val/validate_conversion.cpp", "source/val/validate_datarules.cpp", + "source/val/validate_debug.cpp", "source/val/validate_decorations.cpp", "source/val/validate_derivatives.cpp", + "source/val/validate_execution_limitations.cpp", "source/val/validate_ext_inst.cpp", + "source/val/validate_function.cpp", "source/val/validate_id.cpp", "source/val/validate_image.cpp", "source/val/validate_instruction.cpp", @@ -383,9 +380,10 @@ static_library("spvtools_val") { "source/val/validate_literals.cpp", "source/val/validate_logicals.cpp", "source/val/validate_memory.cpp", + "source/val/validate_mode_setting.cpp", "source/val/validate_non_uniform.cpp", "source/val/validate_primitives.cpp", - "source/val/validate_type_unique.cpp", + "source/val/validate_type.cpp", "source/val/validation_state.cpp", ] @@ -414,6 +412,8 @@ static_library("spvtools_opt") { "source/opt/cfg.h", "source/opt/cfg_cleanup_pass.cpp", "source/opt/cfg_cleanup_pass.h", + "source/opt/combine_access_chains.cpp", + "source/opt/combine_access_chains.h", "source/opt/common_uniform_elim_pass.cpp", "source/opt/common_uniform_elim_pass.h", "source/opt/compact_ids_pass.cpp", @@ -508,7 +508,6 @@ static_library("spvtools_opt") { "source/opt/loop_unswitch_pass.h", "source/opt/loop_utils.cpp", "source/opt/loop_utils.h", - "source/opt/make_unique.h", "source/opt/mem_pass.cpp", "source/opt/mem_pass.h", "source/opt/merge_return_pass.cpp", @@ -587,86 +586,42 @@ group("SPIRV-Tools") { } if (!build_with_chromium) { + googletest_dir = spirv_tools_googletest_dir + + config("gtest_config") { + include_dirs = [ + "${googletest_dir}/googletest", + "${googletest_dir}/googletest/include", + ] + } + static_library("gtest") { testonly = true - - defines = [ - # In order to allow regex matches in gtest to be shared between Windows - # and other systems, we tell gtest to always use its internal engine. - "GTEST_HAS_POSIX_RE=0", - - # Enables C++11 features. - "GTEST_LANG_CXX11=1", - - # Prevents gtest from including both and . - "GTEST_HAS_TR1_TUPLE=0", - ] - sources = [ - "external/googletest/googletest/include/gtest/gtest-death-test.h", - "external/googletest/googletest/include/gtest/gtest-message.h", - "external/googletest/googletest/include/gtest/gtest-param-test.h", - "external/googletest/googletest/include/gtest/gtest-printers.h", - "external/googletest/googletest/include/gtest/gtest-spi.h", - "external/googletest/googletest/include/gtest/gtest-test-part.h", - "external/googletest/googletest/include/gtest/gtest-typed-test.h", - "external/googletest/googletest/include/gtest/gtest.h", - "external/googletest/googletest/include/gtest/gtest_pred_impl.h", - "external/googletest/googletest/include/gtest/internal/gtest-death-test-internal.h", - "external/googletest/googletest/include/gtest/internal/gtest-filepath.h", - "external/googletest/googletest/include/gtest/internal/gtest-internal.h", - "external/googletest/googletest/include/gtest/internal/gtest-linked_ptr.h", - "external/googletest/googletest/include/gtest/internal/gtest-param-util-generated.h", - "external/googletest/googletest/include/gtest/internal/gtest-param-util.h", - "external/googletest/googletest/include/gtest/internal/gtest-port.h", - "external/googletest/googletest/include/gtest/internal/gtest-string.h", - "external/googletest/googletest/include/gtest/internal/gtest-tuple.h", - "external/googletest/googletest/include/gtest/internal/gtest-type-util.h", - "external/googletest/googletest/src/gtest-death-test.cc", - "external/googletest/googletest/src/gtest-filepath.cc", - "external/googletest/googletest/src/gtest-internal-inl.h", - "external/googletest/googletest/src/gtest-port.cc", - "external/googletest/googletest/src/gtest-printers.cc", - "external/googletest/googletest/src/gtest-test-part.cc", - "external/googletest/googletest/src/gtest-typed-test.cc", - "external/googletest/googletest/src/gtest.cc", + "${googletest_dir}/googletest/src/gtest-all.cc", ] + public_configs = [ ":gtest_config" ] + } + config("gmock_config") { include_dirs = [ - "external/googletest/googletest/include", - "external/googletest/googletest/", + "${googletest_dir}/googlemock", + "${googletest_dir}/googlemock/include", + "${googletest_dir}/googletest/include", ] - - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] + if (is_clang) { + # TODO: Can remove this if/when the issue is fixed. + # https://github.com/google/googletest/issues/533 + cflags = [ "-Wno-inconsistent-missing-override" ] + } } static_library("gmock") { testonly = true sources = [ - "external/googletest/googlemock/include/gmock/gmock-actions.h", - "external/googletest/googlemock/include/gmock/gmock-cardinalities.h", - "external/googletest/googlemock/include/gmock/gmock-generated-actions.h", - "external/googletest/googlemock/include/gmock/gmock-generated-function-mockers.h", - "external/googletest/googlemock/include/gmock/gmock-generated-matchers.h", - "external/googletest/googlemock/include/gmock/gmock-generated-nice-strict.h", - "external/googletest/googlemock/include/gmock/gmock-matchers.h", - "external/googletest/googlemock/include/gmock/gmock-spec-builders.h", - "external/googletest/googlemock/include/gmock/gmock.h", - "external/googletest/googlemock/include/gmock/internal/gmock-generated-internal-utils.h", - "external/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h", - "external/googletest/googlemock/include/gmock/internal/gmock-port.h", - "external/googletest/googlemock/src/gmock-cardinalities.cc", - "external/googletest/googlemock/src/gmock-internal-utils.cc", - "external/googletest/googlemock/src/gmock-matchers.cc", - "external/googletest/googlemock/src/gmock-spec-builders.cc", - "external/googletest/googlemock/src/gmock.cc", - ] - - include_dirs = [ - "external/googletest/googletest/include", - "external/googletest/googlemock/include", + "${googletest_dir}/googlemock/src/gmock-all.cc", ] + public_configs = [ ":gmock_config" ] } } @@ -739,6 +694,8 @@ test("spvtools_test") { deps = [ ":spvtools", + ":spvtools_language_header_unified1", + ":spvtools_val", ] if (build_with_chromium) { @@ -752,13 +709,7 @@ test("spvtools_test") { ":gmock", ":gtest", ] - - sources += [ "external/googletest/googletest/src/gtest_main.cc" ] - - include_dirs = [ - "external/googletest/googletest/include", - "external/googletest/googlemock/include", - ] + sources += [ "${googletest_dir}/googletest/src/gtest_main.cc" ] } configs += [ @@ -767,11 +718,11 @@ test("spvtools_test") { ] } -if (!build_with_chromium) { +if (spirv_tools_standalone) { group("fuzzers") { testonly = true deps = [ - "//testing/fuzzers", + "test/fuzzers", ] } } diff --git a/third_party/spirv-tools/CHANGES b/third_party/spirv-tools/CHANGES old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/CONTRIBUTING.md b/third_party/spirv-tools/CONTRIBUTING.md old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/DEPS b/third_party/spirv-tools/DEPS index a1f24fce0a..b69f0320c8 100644 --- a/third_party/spirv-tools/DEPS +++ b/third_party/spirv-tools/DEPS @@ -9,7 +9,7 @@ vars = { 'clang_revision': 'abe5e4f9dc0f1df848c7a0efa05256253e77a7b7', 'effcee_revision': '04b624799f5a9dbaf3fa1dbed2ba9dce2fc8dcf2', 'googletest_revision': '98a0d007d7092b72eea0e501bb9ad17908a1a036', - 'libfuzzer_revision': 'c24c2cd3f4d6130e815b6baff8165e4df440d442', + 'testing_revision': '340252637e2e7c72c0901dcbeeacfff419e19b59', 're2_revision': '6cf8ccd82dbaab2668e9b13596c68183c9ecd13f', 'spirv_headers_revision': 'ff684ffc6a35d2a58f0f63108877d0064ea33feb', } @@ -35,9 +35,9 @@ deps = { 'external/re2': Var('github') + '/google/re2.git@' + Var('re2_revision'), - 'testing/libfuzzer': - Var('chromium_git') + '/chromium/src/testing/libfuzzer@' + - Var('libfuzzer_revision'), + 'testing': + Var('chromium_git') + '/chromium/src/testing@' + + Var('testing_revision'), 'tools/clang': Var('chromium_git') + '/chromium/src/tools/clang@' + Var('clang_revision') diff --git a/third_party/spirv-tools/FILAMENT_README.md b/third_party/spirv-tools/FILAMENT_README.md index 0958048774..4db3206ef1 100644 --- a/third_party/spirv-tools/FILAMENT_README.md +++ b/third_party/spirv-tools/FILAMENT_README.md @@ -9,7 +9,7 @@ that needs to be downloaded (spirv-headers). ``` curl -L https://github.com/KhronosGroup/spirv-tools/archive/master.zip > master.zip unzip master.zip -rsync -r SPIRV-Tools-master/ spirv-cross/ --delete +rsync -r SPIRV-Tools-master/ spirv-tools/ --delete rm -rf SPIRV-Tools-master master.zip curl -L https://github.com/KhronosGroup/spirv-headers/archive/master.zip > master.zip unzip master.zip @@ -19,4 +19,6 @@ rm master.zip git add spirv-tools ``` +Edit the .gitignore so it doesn't prevent `spirv-headers` from being committed. + Finally, remember to bring back the Filament-specific changes in CMakeLists. diff --git a/third_party/spirv-tools/LICENSE b/third_party/spirv-tools/LICENSE old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/PRESUBMIT.py b/third_party/spirv-tools/PRESUBMIT.py index 1180462338..dd3117f229 100644 --- a/third_party/spirv-tools/PRESUBMIT.py +++ b/third_party/spirv-tools/PRESUBMIT.py @@ -19,16 +19,9 @@ for more details about the presubmit API built into depot_tools. """ LINT_FILTERS = [ - "-build/header_guard", - "-build/include", - "-build/include_order", - "-build/include_what_you_use", - "-build/namespaces", "-build/storage_class", - "-readability/braces", "-readability/casting", "-readability/fn_size", - "-readability/inheritance", "-readability/todo", "-runtime/explicit", "-runtime/int", diff --git a/third_party/spirv-tools/README.md b/third_party/spirv-tools/README.md old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/android_test/Android.mk b/third_party/spirv-tools/android_test/Android.mk old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/android_test/jni/Application.mk b/third_party/spirv-tools/android_test/jni/Application.mk old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/android_test/test.cpp b/third_party/spirv-tools/android_test/test.cpp old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/build_overrides/spirv_tools.gni b/third_party/spirv-tools/build_overrides/spirv_tools.gni new file mode 100644 index 0000000000..24aa033d7b --- /dev/null +++ b/third_party/spirv-tools/build_overrides/spirv_tools.gni @@ -0,0 +1,25 @@ +# Copyright 2018 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# These are variables that are overridable by projects that include +# SPIRV-Tools. The values in this file are the defaults for when we are +# building from SPIRV-Tools' repository. + +# Whether we are building from SPIRV-Tools' repository. +# MUST be set to false in other projects. +spirv_tools_standalone = true + +# The path to SPIRV-Tools' dependencies +spirv_tools_googletest_dir = "//external/googletest" +spirv_tools_spirv_headers_dir = "//external/spirv-headers" diff --git a/third_party/spirv-tools/cmake/SPIRV-Tools-shared.pc.in b/third_party/spirv-tools/cmake/SPIRV-Tools-shared.pc.in old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/cmake/SPIRV-Tools.pc.in b/third_party/spirv-tools/cmake/SPIRV-Tools.pc.in old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/cmake/write_pkg_config.cmake b/third_party/spirv-tools/cmake/write_pkg_config.cmake old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/examples/CMakeLists.txt b/third_party/spirv-tools/examples/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/examples/cpp-interface/CMakeLists.txt b/third_party/spirv-tools/examples/cpp-interface/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/examples/cpp-interface/main.cpp b/third_party/spirv-tools/examples/cpp-interface/main.cpp old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/external/CMakeLists.txt b/third_party/spirv-tools/external/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/include/spirv-tools/libspirv.h b/third_party/spirv-tools/include/spirv-tools/libspirv.h old mode 100755 new mode 100644 index d9952a555b..a7e1b30079 --- a/third_party/spirv-tools/include/spirv-tools/libspirv.h +++ b/third_party/spirv-tools/include/spirv-tools/libspirv.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef SPIRV_TOOLS_LIBSPIRV_H_ -#define SPIRV_TOOLS_LIBSPIRV_H_ +#ifndef INCLUDE_SPIRV_TOOLS_LIBSPIRV_H_ +#define INCLUDE_SPIRV_TOOLS_LIBSPIRV_H_ #ifdef __cplusplus extern "C" { @@ -596,4 +596,4 @@ SPIRV_TOOLS_EXPORT spv_result_t spvBinaryParse( } #endif -#endif // SPIRV_TOOLS_LIBSPIRV_H_ +#endif // INCLUDE_SPIRV_TOOLS_LIBSPIRV_H_ diff --git a/third_party/spirv-tools/include/spirv-tools/libspirv.hpp b/third_party/spirv-tools/include/spirv-tools/libspirv.hpp old mode 100755 new mode 100644 index 538a355bb8..b6ae38c10b --- a/third_party/spirv-tools/include/spirv-tools/libspirv.hpp +++ b/third_party/spirv-tools/include/spirv-tools/libspirv.hpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef SPIRV_TOOLS_LIBSPIRV_HPP_ -#define SPIRV_TOOLS_LIBSPIRV_HPP_ +#ifndef INCLUDE_SPIRV_TOOLS_LIBSPIRV_HPP_ +#define INCLUDE_SPIRV_TOOLS_LIBSPIRV_HPP_ #include #include @@ -182,4 +182,4 @@ class SpirvTools { } // namespace spvtools -#endif // SPIRV_TOOLS_LIBSPIRV_HPP_ +#endif // INCLUDE_SPIRV_TOOLS_LIBSPIRV_HPP_ diff --git a/third_party/spirv-tools/include/spirv-tools/linker.hpp b/third_party/spirv-tools/include/spirv-tools/linker.hpp old mode 100755 new mode 100644 index cce78a4459..d2f3e72ca2 --- a/third_party/spirv-tools/include/spirv-tools/linker.hpp +++ b/third_party/spirv-tools/include/spirv-tools/linker.hpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef SPIRV_TOOLS_LINKER_HPP_ -#define SPIRV_TOOLS_LINKER_HPP_ +#ifndef INCLUDE_SPIRV_TOOLS_LINKER_HPP_ +#define INCLUDE_SPIRV_TOOLS_LINKER_HPP_ #include @@ -94,4 +94,4 @@ spv_result_t Link(const Context& context, const uint32_t* const* binaries, } // namespace spvtools -#endif // SPIRV_TOOLS_LINKER_HPP_ +#endif // INCLUDE_SPIRV_TOOLS_LINKER_HPP_ diff --git a/third_party/spirv-tools/include/spirv-tools/optimizer.hpp b/third_party/spirv-tools/include/spirv-tools/optimizer.hpp old mode 100755 new mode 100644 index 2849e28c73..4364d9ff50 --- a/third_party/spirv-tools/include/spirv-tools/optimizer.hpp +++ b/third_party/spirv-tools/include/spirv-tools/optimizer.hpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef SPIRV_TOOLS_OPTIMIZER_HPP_ -#define SPIRV_TOOLS_OPTIMIZER_HPP_ +#ifndef INCLUDE_SPIRV_TOOLS_OPTIMIZER_HPP_ +#define INCLUDE_SPIRV_TOOLS_OPTIMIZER_HPP_ #include #include @@ -151,14 +151,23 @@ class Optimizer { // Optimizes the given SPIR-V module |original_binary| and writes the // optimized binary into |optimized_binary|. // Returns true on successful optimization, whether or not the module is - // modified. Returns false if errors occur when processing |original_binary| - // using any of the registered passes. In that case, no further passes are - // executed and the contents in |optimized_binary| may be invalid. + // modified. Returns false if |original_binary| fails to validate or if errors + // occur when processing |original_binary| using any of the registered passes. + // In that case, no further passes are executed and the contents in + // |optimized_binary| may be invalid. // // It's allowed to alias |original_binary| to the start of |optimized_binary|. bool Run(const uint32_t* original_binary, size_t original_binary_size, std::vector* optimized_binary) const; + // Same as above, except passes |options| to the validator when trying to + // validate the binary. If |skip_validation| is true, then the caller is + // guaranteeing that |original_binary| is valid, and the validator will not + // be run. + bool Run(const uint32_t* original_binary, const size_t original_binary_size, + std::vector* optimized_binary, + const ValidatorOptions& options, bool skip_validation = false) const; + // Returns a vector of strings with all the pass names added to this // optimizer's pass manager. These strings are valid until the associated // pass manager is destroyed. @@ -643,4 +652,4 @@ Optimizer::PassToken CreateCombineAccessChainsPass(); } // namespace spvtools -#endif // SPIRV_TOOLS_OPTIMIZER_HPP_ +#endif // INCLUDE_SPIRV_TOOLS_OPTIMIZER_HPP_ diff --git a/third_party/spirv-tools/projects.md b/third_party/spirv-tools/projects.md old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/source/CMakeLists.txt b/third_party/spirv-tools/source/CMakeLists.txt old mode 100755 new mode 100644 index 8dc4cb9190..dbb5cb6f5b --- a/third_party/spirv-tools/source/CMakeLists.txt +++ b/third_party/spirv-tools/source/CMakeLists.txt @@ -217,9 +217,9 @@ set(SPIRV_SOURCES ${spirv-tools_SOURCE_DIR}/include/spirv-tools/libspirv.h ${CMAKE_CURRENT_SOURCE_DIR}/util/bitutils.h - ${CMAKE_CURRENT_SOURCE_DIR}/util/bit_stream.h ${CMAKE_CURRENT_SOURCE_DIR}/util/bit_vector.h ${CMAKE_CURRENT_SOURCE_DIR}/util/hex_float.h + ${CMAKE_CURRENT_SOURCE_DIR}/util/make_unique.h ${CMAKE_CURRENT_SOURCE_DIR}/util/parse_number.h ${CMAKE_CURRENT_SOURCE_DIR}/util/small_vector.h ${CMAKE_CURRENT_SOURCE_DIR}/util/string_utils.h @@ -254,7 +254,6 @@ set(SPIRV_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/text_handler.h ${CMAKE_CURRENT_SOURCE_DIR}/val/validate.h - ${CMAKE_CURRENT_SOURCE_DIR}/util/bit_stream.cpp ${CMAKE_CURRENT_SOURCE_DIR}/util/bit_vector.cpp ${CMAKE_CURRENT_SOURCE_DIR}/util/parse_number.cpp ${CMAKE_CURRENT_SOURCE_DIR}/util/string_utils.cpp @@ -267,7 +266,6 @@ set(SPIRV_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/extensions.cpp ${CMAKE_CURRENT_SOURCE_DIR}/id_descriptor.cpp ${CMAKE_CURRENT_SOURCE_DIR}/libspirv.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/message.cpp ${CMAKE_CURRENT_SOURCE_DIR}/name_mapper.cpp ${CMAKE_CURRENT_SOURCE_DIR}/opcode.cpp ${CMAKE_CURRENT_SOURCE_DIR}/operand.cpp @@ -275,7 +273,6 @@ set(SPIRV_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/print.cpp ${CMAKE_CURRENT_SOURCE_DIR}/software_version.cpp ${CMAKE_CURRENT_SOURCE_DIR}/spirv_endian.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/spirv_stats.cpp ${CMAKE_CURRENT_SOURCE_DIR}/spirv_target_env.cpp ${CMAKE_CURRENT_SOURCE_DIR}/spirv_validator_options.cpp ${CMAKE_CURRENT_SOURCE_DIR}/table.cpp @@ -283,6 +280,7 @@ set(SPIRV_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/text_handler.cpp ${CMAKE_CURRENT_SOURCE_DIR}/val/validate.cpp ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_adjacency.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_annotation.cpp ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_arithmetics.cpp ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_atomics.cpp ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_barriers.cpp @@ -293,9 +291,12 @@ set(SPIRV_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_composites.cpp ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_conversion.cpp ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_datarules.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_debug.cpp ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_decorations.cpp ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_derivatives.cpp ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_ext_inst.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_execution_limitations.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_function.cpp ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_id.cpp ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_image.cpp ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_interfaces.cpp @@ -304,9 +305,10 @@ set(SPIRV_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_literals.cpp ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_logicals.cpp ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_memory.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_mode_setting.cpp ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_non_uniform.cpp ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_primitives.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_type_unique.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_type.cpp ${CMAKE_CURRENT_SOURCE_DIR}/val/decoration.h ${CMAKE_CURRENT_SOURCE_DIR}/val/basic_block.cpp ${CMAKE_CURRENT_SOURCE_DIR}/val/construct.cpp diff --git a/third_party/spirv-tools/source/assembly_grammar.cpp b/third_party/spirv-tools/source/assembly_grammar.cpp old mode 100755 new mode 100644 index f20810d902..4d98e3dab8 --- a/third_party/spirv-tools/source/assembly_grammar.cpp +++ b/third_party/spirv-tools/source/assembly_grammar.cpp @@ -12,16 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "assembly_grammar.h" +#include "source/assembly_grammar.h" #include #include #include -#include "ext_inst.h" -#include "opcode.h" -#include "operand.h" -#include "table.h" +#include "source/ext_inst.h" +#include "source/opcode.h" +#include "source/operand.h" +#include "source/table.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/source/assembly_grammar.h b/third_party/spirv-tools/source/assembly_grammar.h old mode 100755 new mode 100644 index eae036e301..17c2bd3bac --- a/third_party/spirv-tools/source/assembly_grammar.h +++ b/third_party/spirv-tools/source/assembly_grammar.h @@ -12,14 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_ASSEMBLY_GRAMMAR_H_ -#define LIBSPIRV_ASSEMBLY_GRAMMAR_H_ +#ifndef SOURCE_ASSEMBLY_GRAMMAR_H_ +#define SOURCE_ASSEMBLY_GRAMMAR_H_ -#include "enum_set.h" -#include "latest_version_spirv_header.h" -#include "operand.h" +#include "source/enum_set.h" +#include "source/latest_version_spirv_header.h" +#include "source/operand.h" +#include "source/table.h" #include "spirv-tools/libspirv.h" -#include "table.h" namespace spvtools { @@ -135,4 +135,4 @@ class AssemblyGrammar { } // namespace spvtools -#endif // LIBSPIRV_ASSEMBLY_GRAMMAR_H_ +#endif // SOURCE_ASSEMBLY_GRAMMAR_H_ diff --git a/third_party/spirv-tools/source/binary.cpp b/third_party/spirv-tools/source/binary.cpp old mode 100755 new mode 100644 index 690ef0a54c..6604d80945 --- a/third_party/spirv-tools/source/binary.cpp +++ b/third_party/spirv-tools/source/binary.cpp @@ -12,24 +12,25 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "binary.h" +#include "source/binary.h" #include #include #include #include #include +#include #include #include -#include "assembly_grammar.h" -#include "diagnostic.h" -#include "ext_inst.h" -#include "latest_version_spirv_header.h" -#include "opcode.h" -#include "operand.h" -#include "spirv_constant.h" -#include "spirv_endian.h" +#include "source/assembly_grammar.h" +#include "source/diagnostic.h" +#include "source/ext_inst.h" +#include "source/latest_version_spirv_header.h" +#include "source/opcode.h" +#include "source/operand.h" +#include "source/spirv_constant.h" +#include "source/spirv_endian.h" spv_result_t spvBinaryHeaderGet(const spv_const_binary binary, const spv_endianness_t endian, diff --git a/third_party/spirv-tools/source/binary.h b/third_party/spirv-tools/source/binary.h old mode 100755 new mode 100644 index f6237e32b6..66d24c7e41 --- a/third_party/spirv-tools/source/binary.h +++ b/third_party/spirv-tools/source/binary.h @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_BINARY_H_ -#define LIBSPIRV_BINARY_H_ +#ifndef SOURCE_BINARY_H_ +#define SOURCE_BINARY_H_ +#include "source/spirv_definition.h" #include "spirv-tools/libspirv.h" -#include "spirv_definition.h" // Functions @@ -33,4 +33,4 @@ spv_result_t spvBinaryHeaderGet(const spv_const_binary binary, // replacement for C11's strnlen_s which might not exist in all environments. size_t spv_strnlen_s(const char* str, size_t strsz); -#endif // LIBSPIRV_BINARY_H_ +#endif // SOURCE_BINARY_H_ diff --git a/third_party/spirv-tools/source/cfa.h b/third_party/spirv-tools/source/cfa.h old mode 100755 new mode 100644 index 9e7081b952..97ef398d69 --- a/third_party/spirv-tools/source/cfa.h +++ b/third_party/spirv-tools/source/cfa.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef SPVTOOLS_CFA_H_ -#define SPVTOOLS_CFA_H_ +#ifndef SOURCE_CFA_H_ +#define SOURCE_CFA_H_ #include #include @@ -344,4 +344,4 @@ void CFA::ComputeAugmentedCFG( } // namespace spvtools -#endif // SPVTOOLS_CFA_H_ +#endif // SOURCE_CFA_H_ diff --git a/third_party/spirv-tools/source/comp/CMakeLists.txt b/third_party/spirv-tools/source/comp/CMakeLists.txt old mode 100755 new mode 100644 index ff52d5e1ec..f65f9f670d --- a/third_party/spirv-tools/source/comp/CMakeLists.txt +++ b/third_party/spirv-tools/source/comp/CMakeLists.txt @@ -13,7 +13,21 @@ # limitations under the License. if(SPIRV_BUILD_COMPRESSION) - add_library(SPIRV-Tools-comp markv_codec.cpp) + add_library(SPIRV-Tools-comp + bit_stream.cpp + bit_stream.h + huffman_codec.h + markv_codec.cpp + markv_codec.h + markv.cpp + markv.h + markv_decoder.cpp + markv_decoder.h + markv_encoder.cpp + markv_encoder.h + markv_logger.h + move_to_front.h + move_to_front.cpp) spvtools_default_compile_options(SPIRV-Tools-comp) target_include_directories(SPIRV-Tools-comp diff --git a/third_party/spirv-tools/source/util/bit_stream.cpp b/third_party/spirv-tools/source/comp/bit_stream.cpp old mode 100755 new mode 100644 similarity index 82% rename from third_party/spirv-tools/source/util/bit_stream.cpp rename to third_party/spirv-tools/source/comp/bit_stream.cpp index e30c626203..a5769e03e4 --- a/third_party/spirv-tools/source/util/bit_stream.cpp +++ b/third_party/spirv-tools/source/comp/bit_stream.cpp @@ -18,10 +18,10 @@ #include #include -#include "util/bit_stream.h" +#include "source/comp/bit_stream.h" namespace spvtools { -namespace utils { +namespace comp { namespace { // Returns if the system is little-endian. Unfortunately only works during @@ -197,41 +197,6 @@ bool ReadVariableWidthSigned(BitReaderInterface* reader, T* val, } // namespace -size_t Log2U64(uint64_t val) { - size_t res = 0; - - if (val & 0xFFFFFFFF00000000) { - val >>= 32; - res |= 32; - } - - if (val & 0xFFFF0000) { - val >>= 16; - res |= 16; - } - - if (val & 0xFF00) { - val >>= 8; - res |= 8; - } - - if (val & 0xF0) { - val >>= 4; - res |= 4; - } - - if (val & 0xC) { - val >>= 2; - res |= 2; - } - - if (val & 0x2) { - res |= 1; - } - - return res; -} - void BitWriterInterface::WriteVariableWidthU64(uint64_t val, size_t chunk_length) { WriteVariableWidthUnsigned(this, val, chunk_length); @@ -247,41 +212,11 @@ void BitWriterInterface::WriteVariableWidthU16(uint16_t val, WriteVariableWidthUnsigned(this, val, chunk_length); } -void BitWriterInterface::WriteVariableWidthU8(uint8_t val, - size_t chunk_length) { - WriteVariableWidthUnsigned(this, val, chunk_length); -} - void BitWriterInterface::WriteVariableWidthS64(int64_t val, size_t chunk_length, size_t zigzag_exponent) { WriteVariableWidthSigned(this, val, chunk_length, zigzag_exponent); } -void BitWriterInterface::WriteVariableWidthS32(int32_t val, size_t chunk_length, - size_t zigzag_exponent) { - WriteVariableWidthSigned(this, val, chunk_length, zigzag_exponent); -} - -void BitWriterInterface::WriteVariableWidthS16(int16_t val, size_t chunk_length, - size_t zigzag_exponent) { - WriteVariableWidthSigned(this, val, chunk_length, zigzag_exponent); -} - -void BitWriterInterface::WriteVariableWidthS8(int8_t val, size_t chunk_length, - size_t zigzag_exponent) { - WriteVariableWidthSigned(this, val, chunk_length, zigzag_exponent); -} - -void BitWriterInterface::WriteFixedWidth(uint64_t val, uint64_t max_val) { - if (val > max_val) { - assert(0 && "WriteFixedWidth: value too wide"); - return; - } - - const size_t num_bits = 1 + Log2U64(max_val); - WriteBits(val, num_bits); -} - BitWriterWord64::BitWriterWord64(size_t reserve_bits) : end_(0) { buffer_.reserve(NumBitsToNumWords<64>(reserve_bits)); } @@ -340,36 +275,11 @@ bool BitReaderInterface::ReadVariableWidthU16(uint16_t* val, return ReadVariableWidthUnsigned(this, val, chunk_length); } -bool BitReaderInterface::ReadVariableWidthU8(uint8_t* val, - size_t chunk_length) { - return ReadVariableWidthUnsigned(this, val, chunk_length); -} - bool BitReaderInterface::ReadVariableWidthS64(int64_t* val, size_t chunk_length, size_t zigzag_exponent) { return ReadVariableWidthSigned(this, val, chunk_length, zigzag_exponent); } -bool BitReaderInterface::ReadVariableWidthS32(int32_t* val, size_t chunk_length, - size_t zigzag_exponent) { - return ReadVariableWidthSigned(this, val, chunk_length, zigzag_exponent); -} - -bool BitReaderInterface::ReadVariableWidthS16(int16_t* val, size_t chunk_length, - size_t zigzag_exponent) { - return ReadVariableWidthSigned(this, val, chunk_length, zigzag_exponent); -} - -bool BitReaderInterface::ReadVariableWidthS8(int8_t* val, size_t chunk_length, - size_t zigzag_exponent) { - return ReadVariableWidthSigned(this, val, chunk_length, zigzag_exponent); -} - -bool BitReaderInterface::ReadFixedWidth(uint64_t* val, uint64_t max_val) { - const size_t num_bits = 1 + Log2U64(max_val); - return ReadBits(val, num_bits) == num_bits; -} - BitReaderWord64::BitReaderWord64(std::vector&& buffer) : buffer_(std::move(buffer)), pos_(0) {} @@ -434,5 +344,5 @@ bool BitReaderWord64::OnlyZeroesLeft() const { return !remaining_bits; } -} // namespace utils +} // namespace comp } // namespace spvtools diff --git a/third_party/spirv-tools/source/util/bit_stream.h b/third_party/spirv-tools/source/comp/bit_stream.h old mode 100755 new mode 100644 similarity index 60% rename from third_party/spirv-tools/source/util/bit_stream.h rename to third_party/spirv-tools/source/comp/bit_stream.h index 77ee58ca2f..5f82344d6a --- a/third_party/spirv-tools/source/util/bit_stream.h +++ b/third_party/spirv-tools/source/comp/bit_stream.h @@ -14,22 +14,22 @@ // Contains utils for reading, writing and debug printing bit streams. -#ifndef LIBSPIRV_UTIL_BIT_STREAM_H_ -#define LIBSPIRV_UTIL_BIT_STREAM_H_ +#ifndef SOURCE_COMP_BIT_STREAM_H_ +#define SOURCE_COMP_BIT_STREAM_H_ #include #include +#include #include +#include #include #include #include +#include #include namespace spvtools { -namespace utils { - -// Returns rounded down log2(val). log2(0) is considered 0. -size_t Log2U64(uint64_t val); +namespace comp { // Terminology: // Bits - usually used for a uint64 word, first bit is the lowest. @@ -53,33 +53,6 @@ inline T GetLowerBits(T in, size_t num_bits) { return sizeof(T) * 8 == num_bits ? in : in & T((T(1) << num_bits) - T(1)); } -// Encodes signed integer as unsigned in zigzag order: -// 0 -> 0 -// -1 -> 1 -// 1 -> 2 -// -2 -> 3 -// 2 -> 4 -// Motivation: -1 is 0xFF...FF what doesn't work very well with -// WriteVariableWidth which prefers to have as many 0 bits as possible. -inline uint64_t EncodeZigZag(int64_t val) { return (val << 1) ^ (val >> 63); } - -// Decodes signed integer encoded with EncodeZigZag. -inline int64_t DecodeZigZag(uint64_t val) { - if (val & 1) { - // Negative. - // 1 -> -1 - // 3 -> -2 - // 5 -> -3 - return -1 - (val >> 1); - } else { - // Non-negative. - // 0 -> 0 - // 2 -> 1 - // 4 -> 2 - return val >> 1; - } -} - // Encodes signed integer as unsigned. This is a generalized version of // EncodeZigZag, designed to favor small positive numbers. // Values are transformed in blocks of 2^|block_exponent|. @@ -112,111 +85,24 @@ inline int64_t DecodeZigZag(uint64_t val, size_t block_exponent) { } } -// Converts |buffer| to a stream of '0' and '1'. -template -std::string BufferToStream(const std::vector& buffer) { - std::stringstream ss; - for (auto it = buffer.begin(); it != buffer.end(); ++it) { - std::string str = std::bitset(*it).to_string(); - // Strings generated by std::bitset::to_string are read right to left. - // Reversing to left to right. - std::reverse(str.begin(), str.end()); - ss << str; - } - return ss.str(); -} - -// Converts a left-to-right input string of '0' and '1' to a buffer of |T| -// words. -template -std::vector StreamToBuffer(std::string str) { - // The input string is left-to-right, the input argument of std::bitset needs - // to right-to-left. Instead of reversing tokens, reverse the entire string - // and iterate tokens from end to begin. - std::reverse(str.begin(), str.end()); - const int word_size = static_cast(sizeof(T) * 8); - const int str_length = static_cast(str.length()); - std::vector buffer; - buffer.reserve(NumBitsToNumWords(str.length())); - for (int index = str_length - word_size; index >= 0; index -= word_size) { - buffer.push_back(static_cast( - std::bitset(str, index, word_size).to_ullong())); - } - const size_t suffix_length = str.length() % word_size; - if (suffix_length != 0) { - buffer.push_back(static_cast( - std::bitset(str, 0, suffix_length).to_ullong())); - } - return buffer; -} - -// Adds '0' chars at the end of the string until the size is a multiple of N. -template -inline std::string PadToWord(std::string&& str) { - const size_t tail_length = str.size() % N; - if (tail_length != 0) str += std::string(N - tail_length, '0'); - return std::move(str); -} - -// Adds '0' chars at the end of the string until the size is a multiple of N. -template -inline std::string PadToWord(const std::string& str) { - return PadToWord(std::string(str)); -} - -// Converts a left-to-right stream of bits to std::bitset. -template -inline std::bitset StreamToBitset(std::string str) { - std::reverse(str.begin(), str.end()); - return std::bitset(str); -} - -// Converts first |num_bits| of std::bitset to a left-to-right stream of bits. -template -inline std::string BitsetToStream(const std::bitset& bits, - size_t num_bits = N) { - std::string str = bits.to_string().substr(N - num_bits); - std::reverse(str.begin(), str.end()); - return str; -} - -// Converts a left-to-right stream of bits to uint64. -inline uint64_t StreamToBits(std::string str) { - std::reverse(str.begin(), str.end()); - return std::bitset<64>(str).to_ullong(); -} - // Converts first |num_bits| stored in uint64 to a left-to-right stream of bits. inline std::string BitsToStream(uint64_t bits, size_t num_bits = 64) { std::bitset<64> bitset(bits); - return BitsetToStream(bitset, num_bits); + std::string str = bitset.to_string().substr(64 - num_bits); + std::reverse(str.begin(), str.end()); + return str; } // Base class for writing sequences of bits. class BitWriterInterface { public: - BitWriterInterface() {} - virtual ~BitWriterInterface() {} + BitWriterInterface() = default; + virtual ~BitWriterInterface() = default; // Writes lower |num_bits| in |bits| to the stream. // |num_bits| must be no greater than 64. virtual void WriteBits(uint64_t bits, size_t num_bits) = 0; - // Writes left-to-right string of '0' and '1' to stream. - // String length must be no greater than 64. - // Note: "01" will be writen as 0x2, not 0x1. The string doesn't represent - // numbers but a stream of bits in the order they come from encoder. - virtual void WriteStream(const std::string& bits) { - WriteBits(StreamToBits(bits), bits.length()); - } - - // Writes lower |num_bits| in |bits| to the stream. - // |num_bits| must be no greater than 64. - template - void WriteBitset(const std::bitset& bits, size_t num_bits = N) { - WriteBits(bits.to_ullong(), num_bits); - } - // Writes bits from value of type |T| to the stream. No encoding is done. // Always writes 8 * sizeof(T) bits. template @@ -236,27 +122,8 @@ class BitWriterInterface { void WriteVariableWidthU64(uint64_t val, size_t chunk_length); void WriteVariableWidthU32(uint32_t val, size_t chunk_length); void WriteVariableWidthU16(uint16_t val, size_t chunk_length); - void WriteVariableWidthU8(uint8_t val, size_t chunk_length); void WriteVariableWidthS64(int64_t val, size_t chunk_length, size_t zigzag_exponent); - void WriteVariableWidthS32(int32_t val, size_t chunk_length, - size_t zigzag_exponent); - void WriteVariableWidthS16(int16_t val, size_t chunk_length, - size_t zigzag_exponent); - void WriteVariableWidthS8(int8_t val, size_t chunk_length, - size_t zigzag_exponent); - - // Writes |val| using fixed bit width. Bit width is determined by |max_val|: - // max_val 0 -> bit width 1 - // max_val 1 -> bit width 1 - // max_val 2 -> bit width 2 - // max_val 3 -> bit width 2 - // max_val 4 -> bit width 3 - // max_val 5 -> bit width 3 - // max_val 8 -> bit width 4 - // max_val n -> bit width 1 + floor(log2(n)) - // |val| needs to be <= |max_val|. - void WriteFixedWidth(uint64_t val, uint64_t max_val); // Returns number of bits written. virtual size_t GetNumBits() const = 0; @@ -292,10 +159,6 @@ class BitWriterWord64 : public BitWriterInterface { return std::vector(GetData(), GetData() + GetDataSizeBytes()); } - // Returns written stream as std::string, padded with zeroes so that the - // length is a multiple of 64. - std::string GetStreamPadded64() const { return BufferToStream(buffer_); } - // Sets callback to emit bit sequences after every write. void SetCallback(std::function callback) { callback_ = callback; @@ -327,27 +190,6 @@ class BitReaderInterface { // Returns number of read bits. |num_bits| must be no greater than 64. virtual size_t ReadBits(uint64_t* bits, size_t num_bits) = 0; - // Reads |num_bits| from the stream, stores them in |bits|. - // Returns number of read bits. |num_bits| must be no greater than 64. - template - size_t ReadBitset(std::bitset* bits, size_t num_bits = N) { - uint64_t val = 0; - size_t num_read = ReadBits(&val, num_bits); - if (num_read) { - *bits = std::bitset(val); - } - return num_read; - } - - // Reads |num_bits| from the stream, returns string in left-to-right order. - // The length of the returned string may be less than |num_bits| if end was - // reached. - std::string ReadStream(size_t num_bits) { - uint64_t bits = 0; - size_t num_read = ReadBits(&bits, num_bits); - return BitsToStream(bits, num_read); - } - // Reads 8 * sizeof(T) bits and stores them in |val|. template bool ReadUnencoded(T* val) { @@ -382,19 +224,8 @@ class BitReaderInterface { bool ReadVariableWidthU64(uint64_t* val, size_t chunk_length); bool ReadVariableWidthU32(uint32_t* val, size_t chunk_length); bool ReadVariableWidthU16(uint16_t* val, size_t chunk_length); - bool ReadVariableWidthU8(uint8_t* val, size_t chunk_length); bool ReadVariableWidthS64(int64_t* val, size_t chunk_length, size_t zigzag_exponent); - bool ReadVariableWidthS32(int32_t* val, size_t chunk_length, - size_t zigzag_exponent); - bool ReadVariableWidthS16(int16_t* val, size_t chunk_length, - size_t zigzag_exponent); - bool ReadVariableWidthS8(int8_t* val, size_t chunk_length, - size_t zigzag_exponent); - - // Reads value written by WriteFixedWidth (|max_val| needs to be the same). - // Returns true on success, false if the bit stream ends prematurely. - bool ReadFixedWidth(uint64_t* val, uint64_t max_val); BitReaderInterface(const BitReaderInterface&) = delete; BitReaderInterface& operator=(const BitReaderInterface&) = delete; @@ -443,7 +274,7 @@ class BitReaderWord64 : public BitReaderInterface { std::function callback_; }; -} // namespace utils +} // namespace comp } // namespace spvtools -#endif // LIBSPIRV_UTIL_BIT_STREAM_H_ +#endif // SOURCE_COMP_BIT_STREAM_H_ diff --git a/third_party/spirv-tools/source/util/huffman_codec.h b/third_party/spirv-tools/source/comp/huffman_codec.h old mode 100755 new mode 100644 similarity index 98% rename from third_party/spirv-tools/source/util/huffman_codec.h rename to third_party/spirv-tools/source/comp/huffman_codec.h index e4bd9577d8..1660216144 --- a/third_party/spirv-tools/source/util/huffman_codec.h +++ b/third_party/spirv-tools/source/comp/huffman_codec.h @@ -14,8 +14,8 @@ // Contains utils for reading, writing and debug printing bit streams. -#ifndef LIBSPIRV_UTIL_HUFFMAN_CODEC_H_ -#define LIBSPIRV_UTIL_HUFFMAN_CODEC_H_ +#ifndef SOURCE_COMP_HUFFMAN_CODEC_H_ +#define SOURCE_COMP_HUFFMAN_CODEC_H_ #include #include @@ -27,12 +27,14 @@ #include #include #include +#include #include #include +#include #include namespace spvtools { -namespace utils { +namespace comp { // Used to generate and apply a Huffman coding scheme. // |Val| is the type of variable being encoded (for example a string or a @@ -381,7 +383,7 @@ class HuffmanCodec { uint32_t next_node_id_ = 1; }; -} // namespace utils +} // namespace comp } // namespace spvtools -#endif // LIBSPIRV_UTIL_HUFFMAN_CODEC_H_ +#endif // SOURCE_COMP_HUFFMAN_CODEC_H_ diff --git a/third_party/spirv-tools/source/comp/markv.cpp b/third_party/spirv-tools/source/comp/markv.cpp new file mode 100644 index 0000000000..736bc51ba2 --- /dev/null +++ b/third_party/spirv-tools/source/comp/markv.cpp @@ -0,0 +1,112 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "source/comp/markv.h" + +#include "source/comp/markv_decoder.h" +#include "source/comp/markv_encoder.h" + +namespace spvtools { +namespace comp { +namespace { + +spv_result_t EncodeHeader(void* user_data, spv_endianness_t endian, + uint32_t magic, uint32_t version, uint32_t generator, + uint32_t id_bound, uint32_t schema) { + MarkvEncoder* encoder = reinterpret_cast(user_data); + return encoder->EncodeHeader(endian, magic, version, generator, id_bound, + schema); +} + +spv_result_t EncodeInstruction(void* user_data, + const spv_parsed_instruction_t* inst) { + MarkvEncoder* encoder = reinterpret_cast(user_data); + return encoder->EncodeInstruction(*inst); +} + +} // namespace + +spv_result_t SpirvToMarkv( + spv_const_context context, const std::vector& spirv, + const MarkvCodecOptions& options, const MarkvModel& markv_model, + MessageConsumer message_consumer, MarkvLogConsumer log_consumer, + MarkvDebugConsumer debug_consumer, std::vector* markv) { + spv_context_t hijack_context = *context; + SetContextMessageConsumer(&hijack_context, message_consumer); + + spv_validator_options validator_options = + MarkvDecoder::GetValidatorOptions(options); + if (validator_options) { + spv_const_binary_t spirv_binary = {spirv.data(), spirv.size()}; + const spv_result_t result = spvValidateWithOptions( + &hijack_context, validator_options, &spirv_binary, nullptr); + if (result != SPV_SUCCESS) return result; + } + + MarkvEncoder encoder(&hijack_context, options, &markv_model); + + spv_position_t position = {}; + if (log_consumer || debug_consumer) { + encoder.CreateLogger(log_consumer, debug_consumer); + + spv_text text = nullptr; + if (spvBinaryToText(&hijack_context, spirv.data(), spirv.size(), + SPV_BINARY_TO_TEXT_OPTION_NO_HEADER, &text, + nullptr) != SPV_SUCCESS) { + return DiagnosticStream(position, hijack_context.consumer, "", + SPV_ERROR_INVALID_BINARY) + << "Failed to disassemble SPIR-V binary."; + } + assert(text); + encoder.SetDisassembly(std::string(text->str, text->length)); + spvTextDestroy(text); + } + + if (spvBinaryParse(&hijack_context, &encoder, spirv.data(), spirv.size(), + EncodeHeader, EncodeInstruction, nullptr) != SPV_SUCCESS) { + return DiagnosticStream(position, hijack_context.consumer, "", + SPV_ERROR_INVALID_BINARY) + << "Unable to encode to MARK-V."; + } + + *markv = encoder.GetMarkvBinary(); + return SPV_SUCCESS; +} + +spv_result_t MarkvToSpirv( + spv_const_context context, const std::vector& markv, + const MarkvCodecOptions& options, const MarkvModel& markv_model, + MessageConsumer message_consumer, MarkvLogConsumer log_consumer, + MarkvDebugConsumer debug_consumer, std::vector* spirv) { + spv_position_t position = {}; + spv_context_t hijack_context = *context; + SetContextMessageConsumer(&hijack_context, message_consumer); + + MarkvDecoder decoder(&hijack_context, markv, options, &markv_model); + + if (log_consumer || debug_consumer) + decoder.CreateLogger(log_consumer, debug_consumer); + + if (decoder.DecodeModule(spirv) != SPV_SUCCESS) { + return DiagnosticStream(position, hijack_context.consumer, "", + SPV_ERROR_INVALID_BINARY) + << "Unable to decode MARK-V."; + } + + assert(!spirv->empty()); + return SPV_SUCCESS; +} + +} // namespace comp +} // namespace spvtools diff --git a/third_party/spirv-tools/source/comp/markv.h b/third_party/spirv-tools/source/comp/markv.h old mode 100755 new mode 100644 index 101997e2ce..587086f912 --- a/third_party/spirv-tools/source/comp/markv.h +++ b/third_party/spirv-tools/source/comp/markv.h @@ -1,4 +1,4 @@ -// Copyright (c) 2017 Google Inc. +// Copyright (c) 2018 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,18 +18,16 @@ // make it more similar to other compressed SPIR-V files to further improve // compression of the dataset. -#ifndef SPIRV_TOOLS_MARKV_HPP_ -#define SPIRV_TOOLS_MARKV_HPP_ +#ifndef SOURCE_COMP_MARKV_H_ +#define SOURCE_COMP_MARKV_H_ -#include -#include - -#include "comp/markv_model.h" #include "spirv-tools/libspirv.hpp" namespace spvtools { namespace comp { +class MarkvModel; + struct MarkvCodecOptions { bool validate_spirv_binary = false; }; @@ -73,4 +71,4 @@ spv_result_t MarkvToSpirv( } // namespace comp } // namespace spvtools -#endif // SPIRV_TOOLS_MARKV_HPP_ +#endif // SOURCE_COMP_MARKV_H_ diff --git a/third_party/spirv-tools/source/comp/markv_codec.cpp b/third_party/spirv-tools/source/comp/markv_codec.cpp old mode 100755 new mode 100644 index 825f2eb5a3..ae3ce79f2b --- a/third_party/spirv-tools/source/comp/markv_codec.cpp +++ b/third_party/spirv-tools/source/comp/markv_codec.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017 Google Inc. +// Copyright (c) 2018 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,144 +12,22 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Contains -// - SPIR-V to MARK-V encoder -// - MARK-V to SPIR-V decoder -// // MARK-V is a compression format for SPIR-V binaries. It strips away // non-essential information (such as result IDs which can be regenerated) and -// uses various bit reduction techiniques to reduce the size of the binary. +// uses various bit reduction techniques to reduce the size of the binary. -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "source/comp/markv_codec.h" -#include "latest_version_glsl_std_450_header.h" -#include "latest_version_opencl_std_header.h" -#include "latest_version_spirv_header.h" - -#include "binary.h" -#include "diagnostic.h" -#include "enum_string_mapping.h" -#include "ext_inst.h" -#include "extensions.h" -#include "id_descriptor.h" -#include "instruction.h" -#include "markv.h" -#include "markv_model.h" -#include "opcode.h" -#include "operand.h" -#include "source/assembly_grammar.h" -#include "spirv-tools/libspirv.h" -#include "spirv_endian.h" -#include "spirv_validator_options.h" -#include "util/bit_stream.h" -#include "util/huffman_codec.h" -#include "util/move_to_front.h" -#include "util/parse_number.h" -#include "val/instruction.h" -#include "val/validate.h" +#include "source/comp/markv_logger.h" +#include "source/latest_version_glsl_std_450_header.h" +#include "source/latest_version_opencl_std_header.h" +#include "source/opcode.h" +#include "source/util/make_unique.h" namespace spvtools { namespace comp { namespace { -using utils::BitReaderWord64; -using utils::BitWriterWord64; -using utils::HuffmanCodec; -using MoveToFront = utils::MoveToFront; -using MultiMoveToFront = utils::MultiMoveToFront; - -const uint32_t kSpirvMagicNumber = SpvMagicNumber; -const uint32_t kMarkvMagicNumber = 0x07230303; - -// Handles for move-to-front sequences. Enums which end with "Begin" define -// handle spaces which start at that value and span 16 or 32 bit wide. -enum : uint64_t { - kMtfNone = 0, - // All ids. - kMtfAll, - // All forward declared ids. - kMtfForwardDeclared, - // All type ids except for generated by OpTypeFunction. - kMtfTypeNonFunction, - // All labels. - kMtfLabel, - // All ids created by instructions which had type_id. - kMtfObject, - // All types generated by OpTypeFloat, OpTypeInt, OpTypeBool. - kMtfTypeScalar, - // All composite types. - kMtfTypeComposite, - // Boolean type or any vector type of it. - kMtfTypeBoolScalarOrVector, - // All float types or any vector floats type. - kMtfTypeFloatScalarOrVector, - // All int types or any vector int type. - kMtfTypeIntScalarOrVector, - // All types declared as return types in OpTypeFunction. - kMtfTypeReturnedByFunction, - // All composite objects. - kMtfComposite, - // All bool objects or vectors of bools. - kMtfBoolScalarOrVector, - // All float objects or vectors of float. - kMtfFloatScalarOrVector, - // All int objects or vectors of int. - kMtfIntScalarOrVector, - // All pointer types which point to composited. - kMtfTypePointerToComposite, - // Used by EncodeMtfRankHuffman. - kMtfGenericNonZeroRank, - // Handle space for ids of specific type. - kMtfIdOfTypeBegin = 0x10000, - // Handle space for ids generated by specific opcode. - kMtfIdGeneratedByOpcode = 0x20000, - // Handle space for ids of objects with type generated by specific opcode. - kMtfIdWithTypeGeneratedByOpcodeBegin = 0x30000, - // All vectors of specific component type. - kMtfVectorOfComponentTypeBegin = 0x40000, - // All vector types of specific size. - kMtfTypeVectorOfSizeBegin = 0x50000, - // All pointer types to specific type. - kMtfPointerToTypeBegin = 0x60000, - // All function types which return specific type. - kMtfFunctionTypeWithReturnTypeBegin = 0x70000, - // All function objects which return specific type. - kMtfFunctionWithReturnTypeBegin = 0x80000, - // Short id descriptor space (max 16-bit). - kMtfShortIdDescriptorSpaceBegin = 0x90000, - // Long id descriptor space (32-bit). - kMtfLongIdDescriptorSpaceBegin = 0x100000000, -}; - -// Signals that the value is not in the coding scheme and a fallback method -// needs to be used. -const uint64_t kMarkvNoneOfTheAbove = MarkvModel::GetMarkvNoneOfTheAbove(); - -// Mtf ranks smaller than this are encoded with Huffman coding. -const uint32_t kMtfSmallestRankEncodedByValue = 10; - -// Signals that the mtf rank is too large to be encoded with Huffman. -const uint32_t kMtfRankEncodedByValueSignal = - std::numeric_limits::max(); - -const size_t kCommentNumWhitespaces = 2; - -const size_t kByteBreakAfterInstIfLessThanUntilNextByte = 8; - -const uint32_t kShortDescriptorNumBits = 8; - // Custom hash function used to produce short descriptors. uint32_t ShortHashU32Array(const std::vector& words) { // The hash function is a sum of hashes of each word seeded by word index. @@ -159,7 +37,7 @@ uint32_t ShortHashU32Array(const std::vector& words) { for (uint32_t i = 0; i < words.size(); ++i) { val += (words[i] + i + 123) * kKnuthMulHash; } - return 1 + val % ((1 << kShortDescriptorNumBits) - 1); + return 1 + val % ((1 << MarkvCodec::kShortDescriptorNumBits) - 1); } // Returns a set of mtf rank codecs based on a plausible hand-coded @@ -170,7 +48,7 @@ GetMtfHuffmanCodecs() { std::unique_ptr> codec; - codec.reset(new HuffmanCodec(std::map({ + codec = MakeUnique>(std::map({ {0, 5}, {1, 40}, {2, 10}, @@ -181,11 +59,11 @@ GetMtfHuffmanCodecs() { {7, 3}, {8, 3}, {9, 3}, - {kMtfRankEncodedByValueSignal, 10}, - }))); + {MarkvCodec::kMtfRankEncodedByValueSignal, 10}, + })); codecs.emplace(kMtfAll, std::move(codec)); - codec.reset(new HuffmanCodec(std::map({ + codec = MakeUnique>(std::map({ {1, 50}, {2, 20}, {3, 5}, @@ -195,16 +73,57 @@ GetMtfHuffmanCodecs() { {7, 1}, {8, 1}, {9, 1}, - {kMtfRankEncodedByValueSignal, 10}, - }))); + {MarkvCodec::kMtfRankEncodedByValueSignal, 10}, + })); codecs.emplace(kMtfGenericNonZeroRank, std::move(codec)); return codecs; } +} // namespace + +const uint32_t MarkvCodec::kMarkvMagicNumber = 0x07230303; + +const uint32_t MarkvCodec::kMtfSmallestRankEncodedByValue = 10; + +const uint32_t MarkvCodec::kMtfRankEncodedByValueSignal = + std::numeric_limits::max(); + +const uint32_t MarkvCodec::kShortDescriptorNumBits = 8; + +const size_t MarkvCodec::kByteBreakAfterInstIfLessThanUntilNextByte = 8; + +MarkvCodec::MarkvCodec(spv_const_context context, + spv_validator_options validator_options, + const MarkvModel* model) + : validator_options_(validator_options), + grammar_(context), + model_(model), + short_id_descriptors_(ShortHashU32Array), + mtf_huffman_codecs_(GetMtfHuffmanCodecs()), + context_(context) {} + +MarkvCodec::~MarkvCodec() { spvValidatorOptionsDestroy(validator_options_); } + +MarkvCodec::MarkvHeader::MarkvHeader() + : magic_number(MarkvCodec::kMarkvMagicNumber), + markv_version(MarkvCodec::GetMarkvVersion()) {} + +// Defines and returns current MARK-V version. +// static +uint32_t MarkvCodec::GetMarkvVersion() { + const uint32_t kVersionMajor = 1; + const uint32_t kVersionMinor = 4; + return kVersionMinor | (kVersionMajor << 16); +} + +size_t MarkvCodec::GetNumBitsToNextByte(size_t bit_pos) const { + return (8 - (bit_pos % 8)) % 8; +} + // Returns true if the opcode has a fixed number of operands. May return a // false negative. -bool OpcodeHasFixedNumberOfOperands(SpvOp opcode) { +bool MarkvCodec::OpcodeHasFixedNumberOfOperands(SpvOp opcode) const { switch (opcode) { // TODO(atgoo@github.com) This is not a complete list. case SpvOpNop: @@ -268,597 +187,7 @@ bool OpcodeHasFixedNumberOfOperands(SpvOp opcode) { return false; } -size_t GetNumBitsToNextByte(size_t bit_pos) { return (8 - (bit_pos % 8)) % 8; } - -// Defines and returns current MARK-V version. -uint32_t GetMarkvVersion() { - const uint32_t kVersionMajor = 1; - const uint32_t kVersionMinor = 4; - return kVersionMinor | (kVersionMajor << 16); -} - -class MarkvLogger { - public: - MarkvLogger(MarkvLogConsumer log_consumer, MarkvDebugConsumer debug_consumer) - : log_consumer_(log_consumer), debug_consumer_(debug_consumer) {} - - void AppendText(const std::string& str) { - Append(str); - use_delimiter_ = false; - } - - void AppendTextNewLine(const std::string& str) { - Append(str); - Append("\n"); - use_delimiter_ = false; - } - - void AppendBitSequence(const std::string& str) { - if (debug_consumer_) instruction_bits_ << str; - if (use_delimiter_) Append("-"); - Append(str); - use_delimiter_ = true; - } - - void AppendWhitespaces(size_t num) { - Append(std::string(num, ' ')); - use_delimiter_ = false; - } - - void NewLine() { - Append("\n"); - use_delimiter_ = false; - } - - bool DebugInstruction(const spv_parsed_instruction_t& inst) { - bool result = true; - if (debug_consumer_) { - result = debug_consumer_( - std::vector(inst.words, inst.words + inst.num_words), - instruction_bits_.str(), instruction_comment_.str()); - instruction_bits_.str(std::string()); - instruction_comment_.str(std::string()); - } - return result; - } - - private: - MarkvLogger(const MarkvLogger&) = delete; - MarkvLogger(MarkvLogger&&) = delete; - MarkvLogger& operator=(const MarkvLogger&) = delete; - MarkvLogger& operator=(MarkvLogger&&) = delete; - - void Append(const std::string& str) { - if (log_consumer_) log_consumer_(str); - if (debug_consumer_) instruction_comment_ << str; - } - - MarkvLogConsumer log_consumer_; - MarkvDebugConsumer debug_consumer_; - - std::stringstream instruction_bits_; - std::stringstream instruction_comment_; - - // If true a delimiter will be appended before the next bit sequence. - // Used to generate outputs like: 1100-0 1110-1-1100-1-1111-0 110-0. - bool use_delimiter_ = false; -}; - -// Base class for MARK-V encoder and decoder. Contains common functionality -// such as: -// - Validator connection and validation state. -// - SPIR-V grammar and helper functions. -class MarkvCodecBase { - public: - virtual ~MarkvCodecBase() { spvValidatorOptionsDestroy(validator_options_); } - - MarkvCodecBase() = delete; - - protected: - struct MarkvHeader { - MarkvHeader() { - magic_number = kMarkvMagicNumber; - markv_version = GetMarkvVersion(); - markv_model = 0; - markv_length_in_bits = 0; - spirv_version = 0; - spirv_generator = 0; - } - - uint32_t magic_number; - uint32_t markv_version; - // Magic number to identify or verify MarkvModel used for encoding. - uint32_t markv_model; - uint32_t markv_length_in_bits; - uint32_t spirv_version; - uint32_t spirv_generator; - }; - - // |model| is owned by the caller, must be not null and valid during the - // lifetime of the codec. - explicit MarkvCodecBase(spv_const_context context, - spv_validator_options validator_options, - const MarkvModel* model) - : validator_options_(validator_options), - grammar_(context), - model_(model), - short_id_descriptors_(ShortHashU32Array), - mtf_huffman_codecs_(GetMtfHuffmanCodecs()), - context_(context) {} - - // Returns instruction which created |id| or nullptr if such instruction was - // not registered. - const val::Instruction* FindDef(uint32_t id) const { - const auto it = id_to_def_instruction_.find(id); - if (it == id_to_def_instruction_.end()) return nullptr; - return it->second; - } - - // Returns type id of vector type component. - uint32_t GetVectorComponentType(uint32_t vector_type_id) const { - const val::Instruction* type_inst = FindDef(vector_type_id); - assert(type_inst); - assert(type_inst->opcode() == SpvOpTypeVector); - - const uint32_t component_type = - type_inst->word(type_inst->operands()[1].offset); - return component_type; - } - - // Returns mtf handle for ids of given type. - uint64_t GetMtfIdOfType(uint32_t type_id) const { - return kMtfIdOfTypeBegin + type_id; - } - - // Returns mtf handle for ids generated by given opcode. - uint64_t GetMtfIdGeneratedByOpcode(SpvOp opcode) const { - return kMtfIdGeneratedByOpcode + opcode; - } - - // Returns mtf handle for ids of type generated by given opcode. - uint64_t GetMtfIdWithTypeGeneratedByOpcode(SpvOp opcode) const { - return kMtfIdWithTypeGeneratedByOpcodeBegin + opcode; - } - - // Returns mtf handle for vectors of specific component type. - uint64_t GetMtfVectorOfComponentType(uint32_t type_id) const { - return kMtfVectorOfComponentTypeBegin + type_id; - } - - // Returns mtf handle for vector type of specific size. - uint64_t GetMtfTypeVectorOfSize(uint32_t size) const { - return kMtfTypeVectorOfSizeBegin + size; - } - - // Returns mtf handle for pointers to specific size. - uint64_t GetMtfPointerToType(uint32_t type_id) const { - return kMtfPointerToTypeBegin + type_id; - } - - // Returns mtf handle for function types with given return type. - uint64_t GetMtfFunctionTypeWithReturnType(uint32_t type_id) const { - return kMtfFunctionTypeWithReturnTypeBegin + type_id; - } - - // Returns mtf handle for functions with given return type. - uint64_t GetMtfFunctionWithReturnType(uint32_t type_id) const { - return kMtfFunctionWithReturnTypeBegin + type_id; - } - - // Returns mtf handle for the given long id descriptor. - uint64_t GetMtfLongIdDescriptor(uint32_t descriptor) const { - return kMtfLongIdDescriptorSpaceBegin + descriptor; - } - - // Returns mtf handle for the given short id descriptor. - uint64_t GetMtfShortIdDescriptor(uint32_t descriptor) const { - return kMtfShortIdDescriptorSpaceBegin + descriptor; - } - - // Process data from the current instruction. This would update MTFs and - // other data containers. - void ProcessCurInstruction(); - - // Returns move-to-front handle to be used for the current operand slot. - // Mtf handle is chosen based on a set of rules defined by SPIR-V grammar. - uint64_t GetRuleBasedMtf(); - - // Returns words of the current instruction. Decoder has a different - // implementation and the array is valid only until the previously decoded - // word. - virtual const uint32_t* GetInstWords() const { return inst_.words; } - - // Returns the opcode of the previous instruction. - SpvOp GetPrevOpcode() const { - if (instructions_.empty()) return SpvOpNop; - - return instructions_.back()->opcode(); - } - - // Returns diagnostic stream, position index is set to instruction number. - DiagnosticStream Diag(spv_result_t error_code) const { - return DiagnosticStream({0, 0, instructions_.size()}, context_->consumer, - "", error_code); - } - - // Returns current id bound. - uint32_t GetIdBound() const { return id_bound_; } - - // Sets current id bound, expected to be no lower than the previous one. - void SetIdBound(uint32_t id_bound) { - assert(id_bound >= id_bound_); - id_bound_ = id_bound; - } - - // Returns Huffman codec for ranks of the mtf with given |handle|. - // Different mtfs can use different rank distributions. - // May return nullptr if the codec doesn't exist. - const spvtools::utils::HuffmanCodec* GetMtfHuffmanCodec( - uint64_t handle) const { - const auto it = mtf_huffman_codecs_.find(handle); - if (it == mtf_huffman_codecs_.end()) return nullptr; - return it->second.get(); - } - - // Promotes id in all move-to-front sequences if ids can be shared by multiple - // sequences. - void PromoteIfNeeded(uint32_t id) { - if (!model_->AnyDescriptorHasCodingScheme() && - model_->id_fallback_strategy() == - MarkvModel::IdFallbackStrategy::kShortDescriptor) { - // Move-to-front sequences do not share ids. Nothing to do. - return; - } - multi_mtf_.Promote(id); - } - - spv_validator_options validator_options_ = nullptr; - const AssemblyGrammar grammar_; - MarkvHeader header_; - - // MARK-V model, not owned. - const MarkvModel* model_ = nullptr; - - // Current instruction, current operand and current operand index. - spv_parsed_instruction_t inst_; - spv_parsed_operand_t operand_; - uint32_t operand_index_; - - // Maps a result ID to its type ID. By convention: - // - a result ID that is a type definition maps to itself. - // - a result ID without a type maps to 0. (E.g. for OpLabel) - std::unordered_map id_to_type_id_; - - // Container for all move-to-front sequences. - MultiMoveToFront multi_mtf_; - - // Id of the current function or zero if outside of function. - uint32_t cur_function_id_ = 0; - - // Return type of the current function. - uint32_t cur_function_return_type_ = 0; - - // Remaining function parameter types. This container is filled on OpFunction, - // and drained on OpFunctionParameter. - std::list remaining_function_parameter_types_; - - // List of ids local to the current function. - std::vector ids_local_to_cur_function_; - - // List of instructions in the order they are given in the module. - std::vector> instructions_; - - // Container/computer for long (32-bit) id descriptors. - IdDescriptorCollection long_id_descriptors_; - - // Container/computer for short id descriptors. - // Short descriptors are stored in uint32_t, but their actual bit width is - // defined with kShortDescriptorNumBits. - // It doesn't seem logical to have a different computer for short id - // descriptors, since one could actually map/truncate long descriptors. - // But as short descriptors have collisions, the efficiency of - // compression depends on the collision pattern, and short descriptors - // produced by function ShortHashU32Array have been empirically proven to - // produce better results. - IdDescriptorCollection short_id_descriptors_; - - // Huffman codecs for move-to-front ranks. The map key is mtf handle. Doesn't - // need to contain a different codec for every handle as most use one and the - // same. - std::map>> - mtf_huffman_codecs_; - - // If not nullptr, codec will log comments on the compression process. - std::unique_ptr logger_; - - spv_const_context context_ = nullptr; - - private: - // Maps result id to the instruction which defined it. - std::unordered_map id_to_def_instruction_; - - uint32_t id_bound_ = 1; -}; - -// SPIR-V to MARK-V encoder. Exposes functions EncodeHeader and -// EncodeInstruction which can be used as callback by spvBinaryParse. -// Encoded binary is written to an internally maintained bitstream. -// After the last instruction is encoded, the resulting MARK-V binary can be -// acquired by calling GetMarkvBinary(). -// The encoder uses SPIR-V validator to keep internal state, therefore -// SPIR-V binary needs to be able to pass validator checks. -// CreateCommentsLogger() can be used to enable the encoder to write comments -// on how encoding was done, which can later be accessed with GetComments(). -class MarkvEncoder : public MarkvCodecBase { - public: - // |model| is owned by the caller, must be not null and valid during the - // lifetime of MarkvEncoder. - MarkvEncoder(spv_const_context context, const MarkvCodecOptions& options, - const MarkvModel* model) - : MarkvCodecBase(context, GetValidatorOptions(options), model), - options_(options) { - (void)options_; - } - - // Writes data from SPIR-V header to MARK-V header. - spv_result_t EncodeHeader(spv_endianness_t /* endian */, uint32_t /* magic */, - uint32_t version, uint32_t generator, - uint32_t id_bound, uint32_t /* schema */) { - SetIdBound(id_bound); - header_.spirv_version = version; - header_.spirv_generator = generator; - return SPV_SUCCESS; - } - - // Creates an internal logger which writes comments on the encoding process. - void CreateLogger(MarkvLogConsumer log_consumer, - MarkvDebugConsumer debug_consumer) { - logger_.reset(new MarkvLogger(log_consumer, debug_consumer)); - writer_.SetCallback( - [this](const std::string& str) { logger_->AppendBitSequence(str); }); - } - - // Encodes SPIR-V instruction to MARK-V and writes to bit stream. - // Operation can fail if the instruction fails to pass the validator or if - // the encoder stubmles on something unexpected. - spv_result_t EncodeInstruction(const spv_parsed_instruction_t& inst); - - // Concatenates MARK-V header and the bit stream with encoded instructions - // into a single buffer and returns it as spv_markv_binary. The returned - // value is owned by the caller and needs to be destroyed with - // spvMarkvBinaryDestroy(). - std::vector GetMarkvBinary() { - header_.markv_length_in_bits = - static_cast(sizeof(header_) * 8 + writer_.GetNumBits()); - header_.markv_model = - (model_->model_type() << 16) | model_->model_version(); - - const size_t num_bytes = sizeof(header_) + writer_.GetDataSizeBytes(); - std::vector markv(num_bytes); - - assert(writer_.GetData()); - std::memcpy(markv.data(), &header_, sizeof(header_)); - std::memcpy(markv.data() + sizeof(header_), writer_.GetData(), - writer_.GetDataSizeBytes()); - return markv; - } - - // Optionally adds disassembly to the comments. - // Disassembly should contain all instructions in the module separated by - // \n, and no header. - void SetDisassembly(std::string&& disassembly) { - disassembly_.reset(new std::stringstream(std::move(disassembly))); - } - - // Extracts the next instruction line from the disassembly and logs it. - void LogDisassemblyInstruction() { - if (logger_ && disassembly_) { - std::string line; - std::getline(*disassembly_, line, '\n'); - logger_->AppendTextNewLine(line); - } - } - - private: - // Creates and returns validator options. Returned value owned by the caller. - static spv_validator_options GetValidatorOptions( - const MarkvCodecOptions& options) { - return options.validate_spirv_binary ? spvValidatorOptionsCreate() - : nullptr; - } - - // Writes a single word to bit stream. operand_.type determines if the word is - // encoded and how. - spv_result_t EncodeNonIdWord(uint32_t word); - - // Writes both opcode and num_operands as a single code. - // Returns SPV_UNSUPPORTED iff no suitable codec was found. - spv_result_t EncodeOpcodeAndNumOperands(uint32_t opcode, - uint32_t num_operands); - - // Writes mtf rank to bit stream. |mtf| is used to determine the codec - // scheme. |fallback_method| is used if no codec defined for |mtf|. - spv_result_t EncodeMtfRankHuffman(uint32_t rank, uint64_t mtf, - uint64_t fallback_method); - - // Writes id using coding based on mtf associated with the id descriptor. - // Returns SPV_UNSUPPORTED iff fallback method needs to be used. - spv_result_t EncodeIdWithDescriptor(uint32_t id); - - // Writes id using coding based on the given |mtf|, which is expected to - // contain the given |id|. - spv_result_t EncodeExistingId(uint64_t mtf, uint32_t id); - - // Writes type id of the current instruction if can't be inferred. - spv_result_t EncodeTypeId(); - - // Writes result id of the current instruction if can't be inferred. - spv_result_t EncodeResultId(); - - // Writes ids which are neither type nor result ids. - spv_result_t EncodeRefId(uint32_t id); - - // Writes bits to the stream until the beginning of the next byte if the - // number of bits until the next byte is less than |byte_break_if_less_than|. - void AddByteBreak(size_t byte_break_if_less_than); - - // Encodes a literal number operand and writes it to the bit stream. - spv_result_t EncodeLiteralNumber(const spv_parsed_operand_t& operand); - - MarkvCodecOptions options_; - - // Bit stream where encoded instructions are written. - BitWriterWord64 writer_; - - // If not nullptr, disassembled instruction lines will be written to comments. - // Format: \n separated instruction lines, no header. - std::unique_ptr disassembly_; -}; - -// Decodes MARK-V buffers written by MarkvEncoder. -class MarkvDecoder : public MarkvCodecBase { - public: - // |model| is owned by the caller, must be not null and valid during the - // lifetime of MarkvEncoder. - MarkvDecoder(spv_const_context context, const std::vector& markv, - const MarkvCodecOptions& options, const MarkvModel* model) - : MarkvCodecBase(context, GetValidatorOptions(options), model), - options_(options), - reader_(markv) { - (void)options_; - SetIdBound(1); - parsed_operands_.reserve(25); - inst_words_.reserve(25); - } - - // Creates an internal logger which writes comments on the decoding process. - void CreateLogger(MarkvLogConsumer log_consumer, - MarkvDebugConsumer debug_consumer) { - logger_.reset(new MarkvLogger(log_consumer, debug_consumer)); - } - - // Decodes SPIR-V from MARK-V and stores the words in |spirv_binary|. - // Can be called only once. Fails if data of wrong format or ends prematurely, - // of if validation fails. - spv_result_t DecodeModule(std::vector* spirv_binary); - - // Creates and returns validator options. Returned value owned by the caller. - static spv_validator_options GetValidatorOptions( - const MarkvCodecOptions& options) { - return options.validate_spirv_binary ? spvValidatorOptionsCreate() - : nullptr; - } - - private: - // Describes the format of a typed literal number. - struct NumberType { - spv_number_kind_t type; - uint32_t bit_width; - }; - - // Reads a single bit from reader_. The read bit is stored in |bit|. - // Returns false iff reader_ fails. - bool ReadBit(bool* bit) { - uint64_t bits = 0; - const bool result = reader_.ReadBits(&bits, 1); - if (result) *bit = bits ? true : false; - return result; - }; - - // Returns ReadBit bound to the class object. - std::function GetReadBitCallback() { - return std::bind(&MarkvDecoder::ReadBit, this, std::placeholders::_1); - } - - // Reads a single non-id word from bit stream. operand_.type determines if - // the word needs to be decoded and how. - spv_result_t DecodeNonIdWord(uint32_t* word); - - // Reads and decodes both opcode and num_operands as a single code. - // Returns SPV_UNSUPPORTED iff no suitable codec was found. - spv_result_t DecodeOpcodeAndNumberOfOperands(uint32_t* opcode, - uint32_t* num_operands); - - // Reads mtf rank from bit stream. |mtf| is used to determine the codec - // scheme. |fallback_method| is used if no codec defined for |mtf|. - spv_result_t DecodeMtfRankHuffman(uint64_t mtf, uint32_t fallback_method, - uint32_t* rank); - - // Reads id using coding based on mtf associated with the id descriptor. - // Returns SPV_UNSUPPORTED iff fallback method needs to be used. - spv_result_t DecodeIdWithDescriptor(uint32_t* id); - - // Reads id using coding based on the given |mtf|, which is expected to - // contain the needed |id|. - spv_result_t DecodeExistingId(uint64_t mtf, uint32_t* id); - - // Reads type id of the current instruction if can't be inferred. - spv_result_t DecodeTypeId(); - - // Reads result id of the current instruction if can't be inferred. - spv_result_t DecodeResultId(); - - // Reads id which is neither type nor result id. - spv_result_t DecodeRefId(uint32_t* id); - - // Reads and discards bits until the beginning of the next byte if the - // number of bits until the next byte is less than |byte_break_if_less_than|. - bool ReadToByteBreak(size_t byte_break_if_less_than); - - // Returns instruction words decoded up to this point. - const uint32_t* GetInstWords() const override { return inst_words_.data(); } - - // Reads a literal number as it is described in |operand| from the bit stream, - // decodes and writes it to spirv_. - spv_result_t DecodeLiteralNumber(const spv_parsed_operand_t& operand); - - // Reads instruction from bit stream, decodes and validates it. - // Decoded instruction is valid until the next call of DecodeInstruction(). - spv_result_t DecodeInstruction(); - - // Read operand from the stream decodes and validates it. - spv_result_t DecodeOperand(size_t operand_offset, - const spv_operand_type_t type, - spv_operand_pattern_t* expected_operands); - - // Records the numeric type for an operand according to the type information - // associated with the given non-zero type Id. This can fail if the type Id - // is not a type Id, or if the type Id does not reference a scalar numeric - // type. On success, return SPV_SUCCESS and populates the num_words, - // number_kind, and number_bit_width fields of parsed_operand. - spv_result_t SetNumericTypeInfoForType(spv_parsed_operand_t* parsed_operand, - uint32_t type_id); - - // Records the number type for the current instruction, if it generates a - // type. For types that aren't scalar numbers, record something with number - // kind SPV_NUMBER_NONE. - void RecordNumberType(); - - MarkvCodecOptions options_; - - // Temporary sink where decoded SPIR-V words are written. Once it contains the - // entire module, the container is moved and returned. - std::vector spirv_; - - // Bit stream containing encoded data. - BitReaderWord64 reader_; - - // Temporary storage for operands of the currently parsed instruction. - // Valid until next DecodeInstruction call. - std::vector parsed_operands_; - - // Temporary storage for current instruction words. - // Valid until next DecodeInstruction call. - std::vector inst_words_; - - // Maps a type ID to its number type description. - std::unordered_map type_id_to_number_type_info_; - - // Maps an ExtInstImport id to the extended instruction type. - std::unordered_map import_id_to_ext_inst_type_; -}; - -void MarkvCodecBase::ProcessCurInstruction() { +void MarkvCodec::ProcessCurInstruction() { instructions_.emplace_back(new val::Instruction(&inst_)); const SpvOp opcode = SpvOp(inst_.opcode); @@ -1060,7 +389,7 @@ void MarkvCodecBase::ProcessCurInstruction() { } } -uint64_t MarkvCodecBase::GetRuleBasedMtf() { +uint64_t MarkvCodec::GetRuleBasedMtf() { // This function is only called for id operands (but not result ids). assert(spvIsIdType(operand_.type) || operand_.type == SPV_OPERAND_TYPE_OPTIONAL_ID); @@ -1460,1439 +789,5 @@ uint64_t MarkvCodecBase::GetRuleBasedMtf() { return kMtfNone; } -spv_result_t MarkvEncoder::EncodeNonIdWord(uint32_t word) { - auto* codec = model_->GetNonIdWordHuffmanCodec(inst_.opcode, operand_index_); - - if (codec) { - uint64_t bits = 0; - size_t num_bits = 0; - if (codec->Encode(word, &bits, &num_bits)) { - // Encoding successful. - writer_.WriteBits(bits, num_bits); - return SPV_SUCCESS; - } else { - // Encoding failed, write kMarkvNoneOfTheAbove flag. - if (!codec->Encode(kMarkvNoneOfTheAbove, &bits, &num_bits)) - return Diag(SPV_ERROR_INTERNAL) - << "Non-id word Huffman table for " - << spvOpcodeString(SpvOp(inst_.opcode)) << " operand index " - << operand_index_ << " is missing kMarkvNoneOfTheAbove"; - writer_.WriteBits(bits, num_bits); - } - } - - // Fallback encoding. - const size_t chunk_length = - model_->GetOperandVariableWidthChunkLength(operand_.type); - if (chunk_length) { - writer_.WriteVariableWidthU32(word, chunk_length); - } else { - writer_.WriteUnencoded(word); - } - return SPV_SUCCESS; -} - -spv_result_t MarkvDecoder::DecodeNonIdWord(uint32_t* word) { - auto* codec = model_->GetNonIdWordHuffmanCodec(inst_.opcode, operand_index_); - - if (codec) { - uint64_t decoded_value = 0; - if (!codec->DecodeFromStream(GetReadBitCallback(), &decoded_value)) - return Diag(SPV_ERROR_INVALID_BINARY) - << "Failed to decode non-id word with Huffman"; - - if (decoded_value != kMarkvNoneOfTheAbove) { - // The word decoded successfully. - *word = uint32_t(decoded_value); - assert(*word == decoded_value); - return SPV_SUCCESS; - } - - // Received kMarkvNoneOfTheAbove signal, use fallback decoding. - } - - const size_t chunk_length = - model_->GetOperandVariableWidthChunkLength(operand_.type); - if (chunk_length) { - if (!reader_.ReadVariableWidthU32(word, chunk_length)) - return Diag(SPV_ERROR_INVALID_BINARY) - << "Failed to decode non-id word with varint"; - } else { - if (!reader_.ReadUnencoded(word)) - return Diag(SPV_ERROR_INVALID_BINARY) - << "Failed to read unencoded non-id word"; - } - return SPV_SUCCESS; -} - -spv_result_t MarkvEncoder::EncodeOpcodeAndNumOperands(uint32_t opcode, - uint32_t num_operands) { - uint64_t bits = 0; - size_t num_bits = 0; - - const uint32_t word = opcode | (num_operands << 16); - - // First try to use the Markov chain codec. - auto* codec = - model_->GetOpcodeAndNumOperandsMarkovHuffmanCodec(GetPrevOpcode()); - if (codec) { - if (codec->Encode(word, &bits, &num_bits)) { - // The word was successfully encoded into bits/num_bits. - writer_.WriteBits(bits, num_bits); - return SPV_SUCCESS; - } else { - // The word is not in the Huffman table. Write kMarkvNoneOfTheAbove - // and use fallback encoding. - if (!codec->Encode(kMarkvNoneOfTheAbove, &bits, &num_bits)) - return Diag(SPV_ERROR_INTERNAL) - << "opcode_and_num_operands Huffman table for " - << spvOpcodeString(GetPrevOpcode()) - << "is missing kMarkvNoneOfTheAbove"; - writer_.WriteBits(bits, num_bits); - } - } - - // Fallback to base-rate codec. - codec = model_->GetOpcodeAndNumOperandsMarkovHuffmanCodec(SpvOpNop); - assert(codec); - if (codec->Encode(word, &bits, &num_bits)) { - // The word was successfully encoded into bits/num_bits. - writer_.WriteBits(bits, num_bits); - return SPV_SUCCESS; - } else { - // The word is not in the Huffman table. Write kMarkvNoneOfTheAbove - // and return false. - if (!codec->Encode(kMarkvNoneOfTheAbove, &bits, &num_bits)) - return Diag(SPV_ERROR_INTERNAL) - << "Global opcode_and_num_operands Huffman table is missing " - << "kMarkvNoneOfTheAbove"; - writer_.WriteBits(bits, num_bits); - return SPV_UNSUPPORTED; - } -} - -spv_result_t MarkvDecoder::DecodeOpcodeAndNumberOfOperands( - uint32_t* opcode, uint32_t* num_operands) { - // First try to use the Markov chain codec. - auto* codec = - model_->GetOpcodeAndNumOperandsMarkovHuffmanCodec(GetPrevOpcode()); - if (codec) { - uint64_t decoded_value = 0; - if (!codec->DecodeFromStream(GetReadBitCallback(), &decoded_value)) - return Diag(SPV_ERROR_INTERNAL) - << "Failed to decode opcode_and_num_operands, previous opcode is " - << spvOpcodeString(GetPrevOpcode()); - - if (decoded_value != kMarkvNoneOfTheAbove) { - // The word was successfully decoded. - *opcode = uint32_t(decoded_value & 0xFFFF); - *num_operands = uint32_t(decoded_value >> 16); - return SPV_SUCCESS; - } - - // Received kMarkvNoneOfTheAbove signal, use fallback decoding. - } - - // Fallback to base-rate codec. - codec = model_->GetOpcodeAndNumOperandsMarkovHuffmanCodec(SpvOpNop); - assert(codec); - uint64_t decoded_value = 0; - if (!codec->DecodeFromStream(GetReadBitCallback(), &decoded_value)) - return Diag(SPV_ERROR_INTERNAL) - << "Failed to decode opcode_and_num_operands with global codec"; - - if (decoded_value == kMarkvNoneOfTheAbove) { - // Received kMarkvNoneOfTheAbove signal, fallback further. - return SPV_UNSUPPORTED; - } - - *opcode = uint32_t(decoded_value & 0xFFFF); - *num_operands = uint32_t(decoded_value >> 16); - return SPV_SUCCESS; -} - -spv_result_t MarkvEncoder::EncodeMtfRankHuffman(uint32_t rank, uint64_t mtf, - uint64_t fallback_method) { - const auto* codec = GetMtfHuffmanCodec(mtf); - if (!codec) { - assert(fallback_method != kMtfNone); - codec = GetMtfHuffmanCodec(fallback_method); - } - - if (!codec) return Diag(SPV_ERROR_INTERNAL) << "No codec to encode MTF rank"; - - uint64_t bits = 0; - size_t num_bits = 0; - if (rank < kMtfSmallestRankEncodedByValue) { - // Encode using Huffman coding. - if (!codec->Encode(rank, &bits, &num_bits)) - return Diag(SPV_ERROR_INTERNAL) - << "Failed to encode MTF rank with Huffman"; - - writer_.WriteBits(bits, num_bits); - } else { - // Encode by value. - if (!codec->Encode(kMtfRankEncodedByValueSignal, &bits, &num_bits)) - return Diag(SPV_ERROR_INTERNAL) - << "Failed to encode kMtfRankEncodedByValueSignal"; - - writer_.WriteBits(bits, num_bits); - writer_.WriteVariableWidthU32(rank - kMtfSmallestRankEncodedByValue, - model_->mtf_rank_chunk_length()); - } - return SPV_SUCCESS; -} - -spv_result_t MarkvDecoder::DecodeMtfRankHuffman(uint64_t mtf, - uint32_t fallback_method, - uint32_t* rank) { - const auto* codec = GetMtfHuffmanCodec(mtf); - if (!codec) { - assert(fallback_method != kMtfNone); - codec = GetMtfHuffmanCodec(fallback_method); - } - - if (!codec) return Diag(SPV_ERROR_INTERNAL) << "No codec to decode MTF rank"; - - uint32_t decoded_value = 0; - if (!codec->DecodeFromStream(GetReadBitCallback(), &decoded_value)) - return Diag(SPV_ERROR_INTERNAL) << "Failed to decode MTF rank with Huffman"; - - if (decoded_value == kMtfRankEncodedByValueSignal) { - // Decode by value. - if (!reader_.ReadVariableWidthU32(rank, model_->mtf_rank_chunk_length())) - return Diag(SPV_ERROR_INTERNAL) - << "Failed to decode MTF rank with varint"; - *rank += kMtfSmallestRankEncodedByValue; - } else { - // Decode using Huffman coding. - assert(decoded_value < kMtfSmallestRankEncodedByValue); - *rank = decoded_value; - } - return SPV_SUCCESS; -} - -spv_result_t MarkvEncoder::EncodeIdWithDescriptor(uint32_t id) { - // Get the descriptor for id. - const uint32_t long_descriptor = long_id_descriptors_.GetDescriptor(id); - auto* codec = - model_->GetIdDescriptorHuffmanCodec(inst_.opcode, operand_index_); - uint64_t bits = 0; - size_t num_bits = 0; - uint64_t mtf = kMtfNone; - if (long_descriptor && codec && - codec->Encode(long_descriptor, &bits, &num_bits)) { - // If the descriptor exists and is in the table, write the descriptor and - // proceed to encoding the rank. - writer_.WriteBits(bits, num_bits); - mtf = GetMtfLongIdDescriptor(long_descriptor); - } else { - if (codec) { - // The descriptor doesn't exist or we have no coding for it. Write - // kMarkvNoneOfTheAbove and go to fallback method. - if (!codec->Encode(kMarkvNoneOfTheAbove, &bits, &num_bits)) - return Diag(SPV_ERROR_INTERNAL) - << "Descriptor Huffman table for " - << spvOpcodeString(SpvOp(inst_.opcode)) << " operand index " - << operand_index_ << " is missing kMarkvNoneOfTheAbove"; - - writer_.WriteBits(bits, num_bits); - } - - if (model_->id_fallback_strategy() != - MarkvModel::IdFallbackStrategy::kShortDescriptor) { - return SPV_UNSUPPORTED; - } - - const uint32_t short_descriptor = short_id_descriptors_.GetDescriptor(id); - writer_.WriteBits(short_descriptor, kShortDescriptorNumBits); - - if (short_descriptor == 0) { - // Forward declared id. - return SPV_UNSUPPORTED; - } - - mtf = GetMtfShortIdDescriptor(short_descriptor); - } - - // Descriptor has been encoded. Now encode the rank of the id in the - // associated mtf sequence. - return EncodeExistingId(mtf, id); -} - -spv_result_t MarkvDecoder::DecodeIdWithDescriptor(uint32_t* id) { - auto* codec = - model_->GetIdDescriptorHuffmanCodec(inst_.opcode, operand_index_); - - uint64_t mtf = kMtfNone; - if (codec) { - uint64_t decoded_value = 0; - if (!codec->DecodeFromStream(GetReadBitCallback(), &decoded_value)) - return Diag(SPV_ERROR_INTERNAL) - << "Failed to decode descriptor with Huffman"; - - if (decoded_value != kMarkvNoneOfTheAbove) { - const uint32_t long_descriptor = uint32_t(decoded_value); - mtf = GetMtfLongIdDescriptor(long_descriptor); - } - } - - if (mtf == kMtfNone) { - if (model_->id_fallback_strategy() != - MarkvModel::IdFallbackStrategy::kShortDescriptor) { - return SPV_UNSUPPORTED; - } - - uint64_t decoded_value = 0; - if (!reader_.ReadBits(&decoded_value, kShortDescriptorNumBits)) - return Diag(SPV_ERROR_INTERNAL) << "Failed to read short descriptor"; - const uint32_t short_descriptor = uint32_t(decoded_value); - if (short_descriptor == 0) { - // Forward declared id. - return SPV_UNSUPPORTED; - } - mtf = GetMtfShortIdDescriptor(short_descriptor); - } - - return DecodeExistingId(mtf, id); -} - -spv_result_t MarkvEncoder::EncodeExistingId(uint64_t mtf, uint32_t id) { - assert(multi_mtf_.GetSize(mtf) > 0); - if (multi_mtf_.GetSize(mtf) == 1) { - // If the sequence has only one element no need to write rank, the decoder - // would make the same decision. - return SPV_SUCCESS; - } - - uint32_t rank = 0; - if (!multi_mtf_.RankFromValue(mtf, id, &rank)) - return Diag(SPV_ERROR_INTERNAL) << "Id is not in the MTF sequence"; - - return EncodeMtfRankHuffman(rank, mtf, kMtfGenericNonZeroRank); -} - -spv_result_t MarkvDecoder::DecodeExistingId(uint64_t mtf, uint32_t* id) { - assert(multi_mtf_.GetSize(mtf) > 0); - *id = 0; - - uint32_t rank = 0; - - if (multi_mtf_.GetSize(mtf) == 1) { - rank = 1; - } else { - const spv_result_t result = - DecodeMtfRankHuffman(mtf, kMtfGenericNonZeroRank, &rank); - if (result != SPV_SUCCESS) return result; - } - - assert(rank); - if (!multi_mtf_.ValueFromRank(mtf, rank, id)) - return Diag(SPV_ERROR_INTERNAL) << "MTF rank is out of bounds"; - - return SPV_SUCCESS; -} - -spv_result_t MarkvEncoder::EncodeRefId(uint32_t id) { - { - // Try to encode using id descriptor mtfs. - const spv_result_t result = EncodeIdWithDescriptor(id); - if (result != SPV_UNSUPPORTED) return result; - // If can't be done continue with other methods. - } - - const bool can_forward_declare = spvOperandCanBeForwardDeclaredFunction( - SpvOp(inst_.opcode))(operand_index_); - uint32_t rank = 0; - - if (model_->id_fallback_strategy() == - MarkvModel::IdFallbackStrategy::kRuleBased) { - // Encode using rule-based mtf. - uint64_t mtf = GetRuleBasedMtf(); - - if (mtf != kMtfNone && !can_forward_declare) { - assert(multi_mtf_.HasValue(kMtfAll, id)); - return EncodeExistingId(mtf, id); - } - - if (mtf == kMtfNone) mtf = kMtfAll; - - if (!multi_mtf_.RankFromValue(mtf, id, &rank)) { - // This is the first occurrence of a forward declared id. - multi_mtf_.Insert(kMtfAll, id); - multi_mtf_.Insert(kMtfForwardDeclared, id); - if (mtf != kMtfAll) multi_mtf_.Insert(mtf, id); - rank = 0; - } - - return EncodeMtfRankHuffman(rank, mtf, kMtfAll); - } else { - assert(can_forward_declare); - - if (!multi_mtf_.RankFromValue(kMtfForwardDeclared, id, &rank)) { - // This is the first occurrence of a forward declared id. - multi_mtf_.Insert(kMtfForwardDeclared, id); - rank = 0; - } - - writer_.WriteVariableWidthU32(rank, model_->mtf_rank_chunk_length()); - return SPV_SUCCESS; - } -} - -spv_result_t MarkvDecoder::DecodeRefId(uint32_t* id) { - { - const spv_result_t result = DecodeIdWithDescriptor(id); - if (result != SPV_UNSUPPORTED) return result; - } - - const bool can_forward_declare = spvOperandCanBeForwardDeclaredFunction( - SpvOp(inst_.opcode))(operand_index_); - uint32_t rank = 0; - *id = 0; - - if (model_->id_fallback_strategy() == - MarkvModel::IdFallbackStrategy::kRuleBased) { - uint64_t mtf = GetRuleBasedMtf(); - if (mtf != kMtfNone && !can_forward_declare) { - return DecodeExistingId(mtf, id); - } - - if (mtf == kMtfNone) mtf = kMtfAll; - { - const spv_result_t result = DecodeMtfRankHuffman(mtf, kMtfAll, &rank); - if (result != SPV_SUCCESS) return result; - } - - if (rank == 0) { - // This is the first occurrence of a forward declared id. - *id = GetIdBound(); - SetIdBound(*id + 1); - multi_mtf_.Insert(kMtfAll, *id); - multi_mtf_.Insert(kMtfForwardDeclared, *id); - if (mtf != kMtfAll) multi_mtf_.Insert(mtf, *id); - } else { - if (!multi_mtf_.ValueFromRank(mtf, rank, id)) - return Diag(SPV_ERROR_INTERNAL) << "MTF rank out of bounds"; - } - } else { - assert(can_forward_declare); - - if (!reader_.ReadVariableWidthU32(&rank, model_->mtf_rank_chunk_length())) - return Diag(SPV_ERROR_INTERNAL) - << "Failed to decode MTF rank with varint"; - - if (rank == 0) { - // This is the first occurrence of a forward declared id. - *id = GetIdBound(); - SetIdBound(*id + 1); - multi_mtf_.Insert(kMtfForwardDeclared, *id); - } else { - if (!multi_mtf_.ValueFromRank(kMtfForwardDeclared, rank, id)) - return Diag(SPV_ERROR_INTERNAL) << "MTF rank out of bounds"; - } - } - assert(*id); - return SPV_SUCCESS; -} - -spv_result_t MarkvEncoder::EncodeTypeId() { - if (inst_.opcode == SpvOpFunctionParameter) { - assert(!remaining_function_parameter_types_.empty()); - assert(inst_.type_id == remaining_function_parameter_types_.front()); - remaining_function_parameter_types_.pop_front(); - return SPV_SUCCESS; - } - - { - // Try to encode using id descriptor mtfs. - const spv_result_t result = EncodeIdWithDescriptor(inst_.type_id); - if (result != SPV_UNSUPPORTED) return result; - // If can't be done continue with other methods. - } - - assert(model_->id_fallback_strategy() == - MarkvModel::IdFallbackStrategy::kRuleBased); - - uint64_t mtf = GetRuleBasedMtf(); - assert(!spvOperandCanBeForwardDeclaredFunction(SpvOp(inst_.opcode))( - operand_index_)); - - if (mtf == kMtfNone) { - mtf = kMtfTypeNonFunction; - // Function types should have been handled by GetRuleBasedMtf. - assert(inst_.opcode != SpvOpFunction); - } - - return EncodeExistingId(mtf, inst_.type_id); -} - -spv_result_t MarkvDecoder::DecodeTypeId() { - if (inst_.opcode == SpvOpFunctionParameter) { - assert(!remaining_function_parameter_types_.empty()); - inst_.type_id = remaining_function_parameter_types_.front(); - remaining_function_parameter_types_.pop_front(); - return SPV_SUCCESS; - } - - { - const spv_result_t result = DecodeIdWithDescriptor(&inst_.type_id); - if (result != SPV_UNSUPPORTED) return result; - } - - assert(model_->id_fallback_strategy() == - MarkvModel::IdFallbackStrategy::kRuleBased); - - uint64_t mtf = GetRuleBasedMtf(); - assert(!spvOperandCanBeForwardDeclaredFunction(SpvOp(inst_.opcode))( - operand_index_)); - - if (mtf == kMtfNone) { - mtf = kMtfTypeNonFunction; - // Function types should have been handled by GetRuleBasedMtf. - assert(inst_.opcode != SpvOpFunction); - } - - return DecodeExistingId(mtf, &inst_.type_id); -} - -spv_result_t MarkvEncoder::EncodeResultId() { - uint32_t rank = 0; - - const uint64_t num_still_forward_declared = - multi_mtf_.GetSize(kMtfForwardDeclared); - - if (num_still_forward_declared) { - // We write the rank only if kMtfForwardDeclared is not empty. If it is - // empty the decoder knows that there are no forward declared ids to expect. - if (multi_mtf_.RankFromValue(kMtfForwardDeclared, inst_.result_id, &rank)) { - // This is a definition of a forward declared id. We can remove the id - // from kMtfForwardDeclared. - if (!multi_mtf_.Remove(kMtfForwardDeclared, inst_.result_id)) - return Diag(SPV_ERROR_INTERNAL) - << "Failed to remove id from kMtfForwardDeclared"; - writer_.WriteBits(1, 1); - writer_.WriteVariableWidthU32(rank, model_->mtf_rank_chunk_length()); - } else { - rank = 0; - writer_.WriteBits(0, 1); - } - } - - if (model_->id_fallback_strategy() == - MarkvModel::IdFallbackStrategy::kRuleBased) { - if (!rank) { - multi_mtf_.Insert(kMtfAll, inst_.result_id); - } - } - - return SPV_SUCCESS; -} - -spv_result_t MarkvDecoder::DecodeResultId() { - uint32_t rank = 0; - - const uint64_t num_still_forward_declared = - multi_mtf_.GetSize(kMtfForwardDeclared); - - if (num_still_forward_declared) { - // Some ids were forward declared. Check if this id is one of them. - uint64_t id_was_forward_declared; - if (!reader_.ReadBits(&id_was_forward_declared, 1)) - return Diag(SPV_ERROR_INVALID_BINARY) - << "Failed to read id_was_forward_declared flag"; - - if (id_was_forward_declared) { - if (!reader_.ReadVariableWidthU32(&rank, model_->mtf_rank_chunk_length())) - return Diag(SPV_ERROR_INVALID_BINARY) - << "Failed to read MTF rank of forward declared id"; - - if (rank) { - // The id was forward declared, recover it from kMtfForwardDeclared. - if (!multi_mtf_.ValueFromRank(kMtfForwardDeclared, rank, - &inst_.result_id)) - return Diag(SPV_ERROR_INTERNAL) - << "Forward declared MTF rank is out of bounds"; - - // We can now remove the id from kMtfForwardDeclared. - if (!multi_mtf_.Remove(kMtfForwardDeclared, inst_.result_id)) - return Diag(SPV_ERROR_INTERNAL) - << "Failed to remove id from kMtfForwardDeclared"; - } - } - } - - if (inst_.result_id == 0) { - // The id was not forward declared, issue a new id. - inst_.result_id = GetIdBound(); - SetIdBound(inst_.result_id + 1); - } - - if (model_->id_fallback_strategy() == - MarkvModel::IdFallbackStrategy::kRuleBased) { - if (!rank) { - multi_mtf_.Insert(kMtfAll, inst_.result_id); - } - } - - return SPV_SUCCESS; -} - -spv_result_t MarkvEncoder::EncodeLiteralNumber( - const spv_parsed_operand_t& operand) { - if (operand.number_bit_width <= 32) { - const uint32_t word = inst_.words[operand.offset]; - return EncodeNonIdWord(word); - } else { - assert(operand.number_bit_width <= 64); - const uint64_t word = uint64_t(inst_.words[operand.offset]) | - (uint64_t(inst_.words[operand.offset + 1]) << 32); - if (operand.number_kind == SPV_NUMBER_UNSIGNED_INT) { - writer_.WriteVariableWidthU64(word, model_->u64_chunk_length()); - } else if (operand.number_kind == SPV_NUMBER_SIGNED_INT) { - int64_t val = 0; - std::memcpy(&val, &word, 8); - writer_.WriteVariableWidthS64(val, model_->s64_chunk_length(), - model_->s64_block_exponent()); - } else if (operand.number_kind == SPV_NUMBER_FLOATING) { - writer_.WriteUnencoded(word); - } else { - return Diag(SPV_ERROR_INTERNAL) << "Unsupported bit length"; - } - } - return SPV_SUCCESS; -} - -spv_result_t MarkvDecoder::DecodeLiteralNumber( - const spv_parsed_operand_t& operand) { - if (operand.number_bit_width <= 32) { - uint32_t word = 0; - const spv_result_t result = DecodeNonIdWord(&word); - if (result != SPV_SUCCESS) return result; - inst_words_.push_back(word); - } else { - assert(operand.number_bit_width <= 64); - uint64_t word = 0; - if (operand.number_kind == SPV_NUMBER_UNSIGNED_INT) { - if (!reader_.ReadVariableWidthU64(&word, model_->u64_chunk_length())) - return Diag(SPV_ERROR_INVALID_BINARY) << "Failed to read literal U64"; - } else if (operand.number_kind == SPV_NUMBER_SIGNED_INT) { - int64_t val = 0; - if (!reader_.ReadVariableWidthS64(&val, model_->s64_chunk_length(), - model_->s64_block_exponent())) - return Diag(SPV_ERROR_INVALID_BINARY) << "Failed to read literal S64"; - std::memcpy(&word, &val, 8); - } else if (operand.number_kind == SPV_NUMBER_FLOATING) { - if (!reader_.ReadUnencoded(&word)) - return Diag(SPV_ERROR_INVALID_BINARY) << "Failed to read literal F64"; - } else { - return Diag(SPV_ERROR_INTERNAL) << "Unsupported bit length"; - } - inst_words_.push_back(static_cast(word)); - inst_words_.push_back(static_cast(word >> 32)); - } - return SPV_SUCCESS; -} - -void MarkvEncoder::AddByteBreak(size_t byte_break_if_less_than) { - const size_t num_bits_to_next_byte = - GetNumBitsToNextByte(writer_.GetNumBits()); - if (num_bits_to_next_byte == 0 || - num_bits_to_next_byte > byte_break_if_less_than) - return; - - if (logger_) { - logger_->AppendWhitespaces(kCommentNumWhitespaces); - logger_->AppendText(""); - } - - writer_.WriteBits(0, num_bits_to_next_byte); -} - -bool MarkvDecoder::ReadToByteBreak(size_t byte_break_if_less_than) { - const size_t num_bits_to_next_byte = - GetNumBitsToNextByte(reader_.GetNumReadBits()); - if (num_bits_to_next_byte == 0 || - num_bits_to_next_byte > byte_break_if_less_than) - return true; - - uint64_t bits = 0; - if (!reader_.ReadBits(&bits, num_bits_to_next_byte)) return false; - - assert(bits == 0); - if (bits != 0) return false; - - return true; -} - -spv_result_t MarkvEncoder::EncodeInstruction( - const spv_parsed_instruction_t& inst) { - SpvOp opcode = SpvOp(inst.opcode); - inst_ = inst; - - LogDisassemblyInstruction(); - - const spv_result_t opcode_encodig_result = - EncodeOpcodeAndNumOperands(opcode, inst.num_operands); - if (opcode_encodig_result < 0) return opcode_encodig_result; - - if (opcode_encodig_result != SPV_SUCCESS) { - // Fallback encoding for opcode and num_operands. - writer_.WriteVariableWidthU32(opcode, model_->opcode_chunk_length()); - - if (!OpcodeHasFixedNumberOfOperands(opcode)) { - // If the opcode has a variable number of operands, encode the number of - // operands with the instruction. - - if (logger_) logger_->AppendWhitespaces(kCommentNumWhitespaces); - - writer_.WriteVariableWidthU16(inst.num_operands, - model_->num_operands_chunk_length()); - } - } - - // Write operands. - const uint32_t num_operands = inst_.num_operands; - for (operand_index_ = 0; operand_index_ < num_operands; ++operand_index_) { - operand_ = inst_.operands[operand_index_]; - - if (logger_) { - logger_->AppendWhitespaces(kCommentNumWhitespaces); - logger_->AppendText("<"); - logger_->AppendText(spvOperandTypeStr(operand_.type)); - logger_->AppendText(">"); - } - - switch (operand_.type) { - case SPV_OPERAND_TYPE_RESULT_ID: - case SPV_OPERAND_TYPE_TYPE_ID: - case SPV_OPERAND_TYPE_ID: - case SPV_OPERAND_TYPE_OPTIONAL_ID: - case SPV_OPERAND_TYPE_SCOPE_ID: - case SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID: { - const uint32_t id = inst_.words[operand_.offset]; - if (operand_.type == SPV_OPERAND_TYPE_TYPE_ID) { - const spv_result_t result = EncodeTypeId(); - if (result != SPV_SUCCESS) return result; - } else if (operand_.type == SPV_OPERAND_TYPE_RESULT_ID) { - const spv_result_t result = EncodeResultId(); - if (result != SPV_SUCCESS) return result; - } else { - const spv_result_t result = EncodeRefId(id); - if (result != SPV_SUCCESS) return result; - } - - PromoteIfNeeded(id); - break; - } - - case SPV_OPERAND_TYPE_LITERAL_INTEGER: { - const spv_result_t result = - EncodeNonIdWord(inst_.words[operand_.offset]); - if (result != SPV_SUCCESS) return result; - break; - } - - case SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER: { - const spv_result_t result = EncodeLiteralNumber(operand_); - if (result != SPV_SUCCESS) return result; - break; - } - - case SPV_OPERAND_TYPE_LITERAL_STRING: { - const char* src = - reinterpret_cast(&inst_.words[operand_.offset]); - - auto* codec = model_->GetLiteralStringHuffmanCodec(opcode); - if (codec) { - uint64_t bits = 0; - size_t num_bits = 0; - const std::string str = src; - if (codec->Encode(str, &bits, &num_bits)) { - writer_.WriteBits(bits, num_bits); - break; - } else { - bool result = - codec->Encode("kMarkvNoneOfTheAbove", &bits, &num_bits); - (void)result; - assert(result); - writer_.WriteBits(bits, num_bits); - } - } - - const size_t length = spv_strnlen_s(src, operand_.num_words * 4); - if (length == operand_.num_words * 4) - return Diag(SPV_ERROR_INVALID_BINARY) - << "Failed to find terminal character of literal string"; - for (size_t i = 0; i < length + 1; ++i) writer_.WriteUnencoded(src[i]); - break; - } - - default: { - for (int i = 0; i < operand_.num_words; ++i) { - const uint32_t word = inst_.words[operand_.offset + i]; - const spv_result_t result = EncodeNonIdWord(word); - if (result != SPV_SUCCESS) return result; - } - break; - } - } - } - - AddByteBreak(kByteBreakAfterInstIfLessThanUntilNextByte); - - if (logger_) { - logger_->NewLine(); - logger_->NewLine(); - if (!logger_->DebugInstruction(inst_)) return SPV_REQUESTED_TERMINATION; - } - - ProcessCurInstruction(); - - return SPV_SUCCESS; -} - -spv_result_t MarkvDecoder::DecodeModule(std::vector* spirv_binary) { - const bool header_read_success = - reader_.ReadUnencoded(&header_.magic_number) && - reader_.ReadUnencoded(&header_.markv_version) && - reader_.ReadUnencoded(&header_.markv_model) && - reader_.ReadUnencoded(&header_.markv_length_in_bits) && - reader_.ReadUnencoded(&header_.spirv_version) && - reader_.ReadUnencoded(&header_.spirv_generator); - - if (!header_read_success) - return Diag(SPV_ERROR_INVALID_BINARY) << "Unable to read MARK-V header"; - - if (header_.markv_length_in_bits == 0) - return Diag(SPV_ERROR_INVALID_BINARY) - << "Header markv_length_in_bits field is zero"; - - if (header_.magic_number != kMarkvMagicNumber) - return Diag(SPV_ERROR_INVALID_BINARY) - << "MARK-V binary has incorrect magic number"; - - // TODO(atgoo@github.com): Print version strings. - if (header_.markv_version != GetMarkvVersion()) - return Diag(SPV_ERROR_INVALID_BINARY) - << "MARK-V binary and the codec have different versions"; - - const uint32_t model_type = header_.markv_model >> 16; - const uint32_t model_version = header_.markv_model & 0xFFFF; - if (model_type != model_->model_type()) - return Diag(SPV_ERROR_INVALID_BINARY) - << "MARK-V binary and the codec use different MARK-V models"; - - if (model_version != model_->model_version()) - return Diag(SPV_ERROR_INVALID_BINARY) - << "MARK-V binary and the codec use different versions if the same " - << "MARK-V model"; - - spirv_.reserve(header_.markv_length_in_bits / 2); // Heuristic. - spirv_.resize(5, 0); - spirv_[0] = kSpirvMagicNumber; - spirv_[1] = header_.spirv_version; - spirv_[2] = header_.spirv_generator; - - if (logger_) { - reader_.SetCallback( - [this](const std::string& str) { logger_->AppendBitSequence(str); }); - } - - while (reader_.GetNumReadBits() < header_.markv_length_in_bits) { - inst_ = {}; - const spv_result_t decode_result = DecodeInstruction(); - if (decode_result != SPV_SUCCESS) return decode_result; - } - - if (validator_options_) { - spv_const_binary_t validation_binary = {spirv_.data(), spirv_.size()}; - const spv_result_t result = spvValidateWithOptions( - context_, validator_options_, &validation_binary, nullptr); - if (result != SPV_SUCCESS) return result; - } - - // Validate the decode binary - if (reader_.GetNumReadBits() != header_.markv_length_in_bits || - !reader_.OnlyZeroesLeft()) { - return Diag(SPV_ERROR_INVALID_BINARY) - << "MARK-V binary has wrong stated bit length " - << reader_.GetNumReadBits() << " " << header_.markv_length_in_bits; - } - - // Decoding of the module is finished, validation state should have correct - // id bound. - spirv_[3] = GetIdBound(); - - *spirv_binary = std::move(spirv_); - return SPV_SUCCESS; -} - -// TODO(atgoo@github.com): The implementation borrows heavily from -// Parser::parseOperand. -// Consider coupling them together in some way once MARK-V codec is more mature. -// For now it's better to keep the code independent for experimentation -// purposes. -spv_result_t MarkvDecoder::DecodeOperand( - size_t operand_offset, const spv_operand_type_t type, - spv_operand_pattern_t* expected_operands) { - const SpvOp opcode = static_cast(inst_.opcode); - - memset(&operand_, 0, sizeof(operand_)); - - assert((operand_offset >> 16) == 0); - operand_.offset = static_cast(operand_offset); - operand_.type = type; - - // Set default values, may be updated later. - operand_.number_kind = SPV_NUMBER_NONE; - operand_.number_bit_width = 0; - - const size_t first_word_index = inst_words_.size(); - - switch (type) { - case SPV_OPERAND_TYPE_RESULT_ID: { - const spv_result_t result = DecodeResultId(); - if (result != SPV_SUCCESS) return result; - - inst_words_.push_back(inst_.result_id); - SetIdBound(std::max(GetIdBound(), inst_.result_id + 1)); - PromoteIfNeeded(inst_.result_id); - break; - } - - case SPV_OPERAND_TYPE_TYPE_ID: { - const spv_result_t result = DecodeTypeId(); - if (result != SPV_SUCCESS) return result; - - inst_words_.push_back(inst_.type_id); - SetIdBound(std::max(GetIdBound(), inst_.type_id + 1)); - PromoteIfNeeded(inst_.type_id); - break; - } - - case SPV_OPERAND_TYPE_ID: - case SPV_OPERAND_TYPE_OPTIONAL_ID: - case SPV_OPERAND_TYPE_SCOPE_ID: - case SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID: { - uint32_t id = 0; - const spv_result_t result = DecodeRefId(&id); - if (result != SPV_SUCCESS) return result; - - if (id == 0) return Diag(SPV_ERROR_INVALID_BINARY) << "Decoded id is 0"; - - if (type == SPV_OPERAND_TYPE_ID || type == SPV_OPERAND_TYPE_OPTIONAL_ID) { - operand_.type = SPV_OPERAND_TYPE_ID; - - if (opcode == SpvOpExtInst && operand_.offset == 3) { - // The current word is the extended instruction set id. - // Set the extended instruction set type for the current - // instruction. - auto ext_inst_type_iter = import_id_to_ext_inst_type_.find(id); - if (ext_inst_type_iter == import_id_to_ext_inst_type_.end()) { - return Diag(SPV_ERROR_INVALID_ID) - << "OpExtInst set id " << id - << " does not reference an OpExtInstImport result Id"; - } - inst_.ext_inst_type = ext_inst_type_iter->second; - } - } - - inst_words_.push_back(id); - SetIdBound(std::max(GetIdBound(), id + 1)); - PromoteIfNeeded(id); - break; - } - - case SPV_OPERAND_TYPE_EXTENSION_INSTRUCTION_NUMBER: { - uint32_t word = 0; - const spv_result_t result = DecodeNonIdWord(&word); - if (result != SPV_SUCCESS) return result; - - inst_words_.push_back(word); - - assert(SpvOpExtInst == opcode); - assert(inst_.ext_inst_type != SPV_EXT_INST_TYPE_NONE); - spv_ext_inst_desc ext_inst; - if (grammar_.lookupExtInst(inst_.ext_inst_type, word, &ext_inst)) - return Diag(SPV_ERROR_INVALID_BINARY) - << "Invalid extended instruction number: " << word; - spvPushOperandTypes(ext_inst->operandTypes, expected_operands); - break; - } - - case SPV_OPERAND_TYPE_LITERAL_INTEGER: - case SPV_OPERAND_TYPE_OPTIONAL_LITERAL_INTEGER: { - // These are regular single-word literal integer operands. - // Post-parsing validation should check the range of the parsed value. - operand_.type = SPV_OPERAND_TYPE_LITERAL_INTEGER; - // It turns out they are always unsigned integers! - operand_.number_kind = SPV_NUMBER_UNSIGNED_INT; - operand_.number_bit_width = 32; - - uint32_t word = 0; - const spv_result_t result = DecodeNonIdWord(&word); - if (result != SPV_SUCCESS) return result; - - inst_words_.push_back(word); - break; - } - - case SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER: - case SPV_OPERAND_TYPE_OPTIONAL_TYPED_LITERAL_INTEGER: { - operand_.type = SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER; - if (opcode == SpvOpSwitch) { - // The literal operands have the same type as the value - // referenced by the selector Id. - const uint32_t selector_id = inst_words_.at(1); - const auto type_id_iter = id_to_type_id_.find(selector_id); - if (type_id_iter == id_to_type_id_.end() || type_id_iter->second == 0) { - return Diag(SPV_ERROR_INVALID_BINARY) - << "Invalid OpSwitch: selector id " << selector_id - << " has no type"; - } - uint32_t type_id = type_id_iter->second; - - if (selector_id == type_id) { - // Recall that by convention, a result ID that is a type definition - // maps to itself. - return Diag(SPV_ERROR_INVALID_BINARY) - << "Invalid OpSwitch: selector id " << selector_id - << " is a type, not a value"; - } - if (auto error = SetNumericTypeInfoForType(&operand_, type_id)) - return error; - if (operand_.number_kind != SPV_NUMBER_UNSIGNED_INT && - operand_.number_kind != SPV_NUMBER_SIGNED_INT) { - return Diag(SPV_ERROR_INVALID_BINARY) - << "Invalid OpSwitch: selector id " << selector_id - << " is not a scalar integer"; - } - } else { - assert(opcode == SpvOpConstant || opcode == SpvOpSpecConstant); - // The literal number type is determined by the type Id for the - // constant. - assert(inst_.type_id); - if (auto error = SetNumericTypeInfoForType(&operand_, inst_.type_id)) - return error; - } - - if (auto error = DecodeLiteralNumber(operand_)) return error; - - break; - } - - case SPV_OPERAND_TYPE_LITERAL_STRING: - case SPV_OPERAND_TYPE_OPTIONAL_LITERAL_STRING: { - operand_.type = SPV_OPERAND_TYPE_LITERAL_STRING; - std::vector str; - auto* codec = model_->GetLiteralStringHuffmanCodec(inst_.opcode); - - if (codec) { - std::string decoded_string; - const bool huffman_result = - codec->DecodeFromStream(GetReadBitCallback(), &decoded_string); - assert(huffman_result); - if (!huffman_result) - return Diag(SPV_ERROR_INVALID_BINARY) - << "Failed to read literal string"; - - if (decoded_string != "kMarkvNoneOfTheAbove") { - std::copy(decoded_string.begin(), decoded_string.end(), - std::back_inserter(str)); - str.push_back('\0'); - } - } - - // The loop is expected to terminate once we encounter '\0' or exhaust - // the bit stream. - if (str.empty()) { - while (true) { - char ch = 0; - if (!reader_.ReadUnencoded(&ch)) - return Diag(SPV_ERROR_INVALID_BINARY) - << "Failed to read literal string"; - - str.push_back(ch); - - if (ch == '\0') break; - } - } - - while (str.size() % 4 != 0) str.push_back('\0'); - - inst_words_.resize(inst_words_.size() + str.size() / 4); - std::memcpy(&inst_words_[first_word_index], str.data(), str.size()); - - if (SpvOpExtInstImport == opcode) { - // Record the extended instruction type for the ID for this import. - // There is only one string literal argument to OpExtInstImport, - // so it's sufficient to guard this just on the opcode. - const spv_ext_inst_type_t ext_inst_type = - spvExtInstImportTypeGet(str.data()); - if (SPV_EXT_INST_TYPE_NONE == ext_inst_type) { - return Diag(SPV_ERROR_INVALID_BINARY) - << "Invalid extended instruction import '" << str.data() - << "'"; - } - // We must have parsed a valid result ID. It's a condition - // of the grammar, and we only accept non-zero result Ids. - assert(inst_.result_id); - const bool inserted = - import_id_to_ext_inst_type_.emplace(inst_.result_id, ext_inst_type) - .second; - (void)inserted; - assert(inserted); - } - break; - } - - case SPV_OPERAND_TYPE_CAPABILITY: - case SPV_OPERAND_TYPE_SOURCE_LANGUAGE: - case SPV_OPERAND_TYPE_EXECUTION_MODEL: - case SPV_OPERAND_TYPE_ADDRESSING_MODEL: - case SPV_OPERAND_TYPE_MEMORY_MODEL: - case SPV_OPERAND_TYPE_EXECUTION_MODE: - case SPV_OPERAND_TYPE_STORAGE_CLASS: - case SPV_OPERAND_TYPE_DIMENSIONALITY: - case SPV_OPERAND_TYPE_SAMPLER_ADDRESSING_MODE: - case SPV_OPERAND_TYPE_SAMPLER_FILTER_MODE: - case SPV_OPERAND_TYPE_SAMPLER_IMAGE_FORMAT: - case SPV_OPERAND_TYPE_FP_ROUNDING_MODE: - case SPV_OPERAND_TYPE_LINKAGE_TYPE: - case SPV_OPERAND_TYPE_ACCESS_QUALIFIER: - case SPV_OPERAND_TYPE_OPTIONAL_ACCESS_QUALIFIER: - case SPV_OPERAND_TYPE_FUNCTION_PARAMETER_ATTRIBUTE: - case SPV_OPERAND_TYPE_DECORATION: - case SPV_OPERAND_TYPE_BUILT_IN: - case SPV_OPERAND_TYPE_GROUP_OPERATION: - case SPV_OPERAND_TYPE_KERNEL_ENQ_FLAGS: - case SPV_OPERAND_TYPE_KERNEL_PROFILING_INFO: { - // A single word that is a plain enum value. - uint32_t word = 0; - const spv_result_t result = DecodeNonIdWord(&word); - if (result != SPV_SUCCESS) return result; - - inst_words_.push_back(word); - - // Map an optional operand type to its corresponding concrete type. - if (type == SPV_OPERAND_TYPE_OPTIONAL_ACCESS_QUALIFIER) - operand_.type = SPV_OPERAND_TYPE_ACCESS_QUALIFIER; - - spv_operand_desc entry; - if (grammar_.lookupOperand(type, word, &entry)) { - return Diag(SPV_ERROR_INVALID_BINARY) - << "Invalid " << spvOperandTypeStr(operand_.type) - << " operand: " << word; - } - - // Prepare to accept operands to this operand, if needed. - spvPushOperandTypes(entry->operandTypes, expected_operands); - break; - } - - case SPV_OPERAND_TYPE_FP_FAST_MATH_MODE: - case SPV_OPERAND_TYPE_FUNCTION_CONTROL: - case SPV_OPERAND_TYPE_LOOP_CONTROL: - case SPV_OPERAND_TYPE_IMAGE: - case SPV_OPERAND_TYPE_OPTIONAL_IMAGE: - case SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS: - case SPV_OPERAND_TYPE_SELECTION_CONTROL: { - // This operand is a mask. - uint32_t word = 0; - const spv_result_t result = DecodeNonIdWord(&word); - if (result != SPV_SUCCESS) return result; - - inst_words_.push_back(word); - - // Map an optional operand type to its corresponding concrete type. - if (type == SPV_OPERAND_TYPE_OPTIONAL_IMAGE) - operand_.type = SPV_OPERAND_TYPE_IMAGE; - else if (type == SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS) - operand_.type = SPV_OPERAND_TYPE_MEMORY_ACCESS; - - // Check validity of set mask bits. Also prepare for operands for those - // masks if they have any. To get operand order correct, scan from - // MSB to LSB since we can only prepend operands to a pattern. - // The only case in the grammar where you have more than one mask bit - // having an operand is for image operands. See SPIR-V 3.14 Image - // Operands. - uint32_t remaining_word = word; - for (uint32_t mask = (1u << 31); remaining_word; mask >>= 1) { - if (remaining_word & mask) { - spv_operand_desc entry; - if (grammar_.lookupOperand(type, mask, &entry)) { - return Diag(SPV_ERROR_INVALID_BINARY) - << "Invalid " << spvOperandTypeStr(operand_.type) - << " operand: " << word << " has invalid mask component " - << mask; - } - remaining_word ^= mask; - spvPushOperandTypes(entry->operandTypes, expected_operands); - } - } - if (word == 0) { - // An all-zeroes mask *might* also be valid. - spv_operand_desc entry; - if (SPV_SUCCESS == grammar_.lookupOperand(type, 0, &entry)) { - // Prepare for its operands, if any. - spvPushOperandTypes(entry->operandTypes, expected_operands); - } - } - break; - } - default: - return Diag(SPV_ERROR_INVALID_BINARY) - << "Internal error: Unhandled operand type: " << type; - } - - operand_.num_words = uint16_t(inst_words_.size() - first_word_index); - - assert(spvOperandIsConcrete(operand_.type)); - - parsed_operands_.push_back(operand_); - - return SPV_SUCCESS; -} - -spv_result_t MarkvDecoder::DecodeInstruction() { - parsed_operands_.clear(); - inst_words_.clear(); - - // Opcode/num_words placeholder, the word will be filled in later. - inst_words_.push_back(0); - - bool num_operands_still_unknown = true; - { - uint32_t opcode = 0; - uint32_t num_operands = 0; - - const spv_result_t opcode_decoding_result = - DecodeOpcodeAndNumberOfOperands(&opcode, &num_operands); - if (opcode_decoding_result < 0) return opcode_decoding_result; - - if (opcode_decoding_result == SPV_SUCCESS) { - inst_.num_operands = static_cast(num_operands); - num_operands_still_unknown = false; - } else { - if (!reader_.ReadVariableWidthU32(&opcode, - model_->opcode_chunk_length())) { - return Diag(SPV_ERROR_INVALID_BINARY) - << "Failed to read opcode of instruction"; - } - } - - inst_.opcode = static_cast(opcode); - } - - const SpvOp opcode = static_cast(inst_.opcode); - - spv_opcode_desc opcode_desc; - if (grammar_.lookupOpcode(opcode, &opcode_desc) != SPV_SUCCESS) { - return Diag(SPV_ERROR_INVALID_BINARY) << "Invalid opcode"; - } - - spv_operand_pattern_t expected_operands; - expected_operands.reserve(opcode_desc->numTypes); - for (auto i = 0; i < opcode_desc->numTypes; i++) { - expected_operands.push_back( - opcode_desc->operandTypes[opcode_desc->numTypes - i - 1]); - } - - if (num_operands_still_unknown) { - if (!OpcodeHasFixedNumberOfOperands(opcode)) { - if (!reader_.ReadVariableWidthU16(&inst_.num_operands, - model_->num_operands_chunk_length())) - return Diag(SPV_ERROR_INVALID_BINARY) - << "Failed to read num_operands of instruction"; - } else { - inst_.num_operands = static_cast(expected_operands.size()); - } - } - - for (operand_index_ = 0; - operand_index_ < static_cast(inst_.num_operands); - ++operand_index_) { - assert(!expected_operands.empty()); - const spv_operand_type_t type = - spvTakeFirstMatchableOperand(&expected_operands); - - const size_t operand_offset = inst_words_.size(); - - const spv_result_t decode_result = - DecodeOperand(operand_offset, type, &expected_operands); - - if (decode_result != SPV_SUCCESS) return decode_result; - } - - assert(inst_.num_operands == parsed_operands_.size()); - - // Only valid while inst_words_ and parsed_operands_ remain unchanged (until - // next DecodeInstruction call). - inst_.words = inst_words_.data(); - inst_.operands = parsed_operands_.empty() ? nullptr : parsed_operands_.data(); - inst_.num_words = static_cast(inst_words_.size()); - inst_words_[0] = spvOpcodeMake(inst_.num_words, SpvOp(inst_.opcode)); - - std::copy(inst_words_.begin(), inst_words_.end(), std::back_inserter(spirv_)); - - assert(inst_.num_words == - std::accumulate( - parsed_operands_.begin(), parsed_operands_.end(), 1, - [](int num_words, const spv_parsed_operand_t& operand) { - return num_words += operand.num_words; - }) && - "num_words in instruction doesn't correspond to the sum of num_words" - "in the operands"); - - RecordNumberType(); - ProcessCurInstruction(); - - if (!ReadToByteBreak(kByteBreakAfterInstIfLessThanUntilNextByte)) - return Diag(SPV_ERROR_INVALID_BINARY) << "Failed to read to byte break"; - - if (logger_) { - logger_->NewLine(); - std::stringstream ss; - ss << spvOpcodeString(opcode) << " "; - for (size_t index = 1; index < inst_words_.size(); ++index) - ss << inst_words_[index] << " "; - logger_->AppendText(ss.str()); - logger_->NewLine(); - logger_->NewLine(); - if (!logger_->DebugInstruction(inst_)) return SPV_REQUESTED_TERMINATION; - } - - return SPV_SUCCESS; -} - -spv_result_t MarkvDecoder::SetNumericTypeInfoForType( - spv_parsed_operand_t* parsed_operand, uint32_t type_id) { - assert(type_id != 0); - auto type_info_iter = type_id_to_number_type_info_.find(type_id); - if (type_info_iter == type_id_to_number_type_info_.end()) { - return Diag(SPV_ERROR_INVALID_BINARY) - << "Type Id " << type_id << " is not a type"; - } - - const NumberType& info = type_info_iter->second; - if (info.type == SPV_NUMBER_NONE) { - // This is a valid type, but for something other than a scalar number. - return Diag(SPV_ERROR_INVALID_BINARY) - << "Type Id " << type_id << " is not a scalar numeric type"; - } - - parsed_operand->number_kind = info.type; - parsed_operand->number_bit_width = info.bit_width; - // Round up the word count. - parsed_operand->num_words = static_cast((info.bit_width + 31) / 32); - return SPV_SUCCESS; -} - -void MarkvDecoder::RecordNumberType() { - const SpvOp opcode = static_cast(inst_.opcode); - if (spvOpcodeGeneratesType(opcode)) { - NumberType info = {SPV_NUMBER_NONE, 0}; - if (SpvOpTypeInt == opcode) { - info.bit_width = inst_.words[inst_.operands[1].offset]; - info.type = inst_.words[inst_.operands[2].offset] - ? SPV_NUMBER_SIGNED_INT - : SPV_NUMBER_UNSIGNED_INT; - } else if (SpvOpTypeFloat == opcode) { - info.bit_width = inst_.words[inst_.operands[1].offset]; - info.type = SPV_NUMBER_FLOATING; - } - // The *result* Id of a type generating instruction is the type Id. - type_id_to_number_type_info_[inst_.result_id] = info; - } -} - -spv_result_t EncodeHeader(void* user_data, spv_endianness_t endian, - uint32_t magic, uint32_t version, uint32_t generator, - uint32_t id_bound, uint32_t schema) { - MarkvEncoder* encoder = reinterpret_cast(user_data); - return encoder->EncodeHeader(endian, magic, version, generator, id_bound, - schema); -} - -spv_result_t EncodeInstruction(void* user_data, - const spv_parsed_instruction_t* inst) { - MarkvEncoder* encoder = reinterpret_cast(user_data); - return encoder->EncodeInstruction(*inst); -} - -} // namespace - -spv_result_t SpirvToMarkv( - spv_const_context context, const std::vector& spirv, - const MarkvCodecOptions& options, const MarkvModel& markv_model, - MessageConsumer message_consumer, MarkvLogConsumer log_consumer, - MarkvDebugConsumer debug_consumer, std::vector* markv) { - spv_context_t hijack_context = *context; - SetContextMessageConsumer(&hijack_context, message_consumer); - - spv_validator_options validator_options = - MarkvDecoder::GetValidatorOptions(options); - if (validator_options) { - spv_const_binary_t spirv_binary = {spirv.data(), spirv.size()}; - const spv_result_t result = spvValidateWithOptions( - &hijack_context, validator_options, &spirv_binary, nullptr); - if (result != SPV_SUCCESS) return result; - } - - MarkvEncoder encoder(&hijack_context, options, &markv_model); - - spv_position_t position = {}; - if (log_consumer || debug_consumer) { - encoder.CreateLogger(log_consumer, debug_consumer); - - spv_text text = nullptr; - if (spvBinaryToText(&hijack_context, spirv.data(), spirv.size(), - SPV_BINARY_TO_TEXT_OPTION_NO_HEADER, &text, - nullptr) != SPV_SUCCESS) { - return DiagnosticStream(position, hijack_context.consumer, "", - SPV_ERROR_INVALID_BINARY) - << "Failed to disassemble SPIR-V binary."; - } - assert(text); - encoder.SetDisassembly(std::string(text->str, text->length)); - spvTextDestroy(text); - } - - if (spvBinaryParse(&hijack_context, &encoder, spirv.data(), spirv.size(), - EncodeHeader, EncodeInstruction, nullptr) != SPV_SUCCESS) { - return DiagnosticStream(position, hijack_context.consumer, "", - SPV_ERROR_INVALID_BINARY) - << "Unable to encode to MARK-V."; - } - - *markv = encoder.GetMarkvBinary(); - return SPV_SUCCESS; -} - -spv_result_t MarkvToSpirv( - spv_const_context context, const std::vector& markv, - const MarkvCodecOptions& options, const MarkvModel& markv_model, - MessageConsumer message_consumer, MarkvLogConsumer log_consumer, - MarkvDebugConsumer debug_consumer, std::vector* spirv) { - spv_position_t position = {}; - spv_context_t hijack_context = *context; - SetContextMessageConsumer(&hijack_context, message_consumer); - - MarkvDecoder decoder(&hijack_context, markv, options, &markv_model); - - if (log_consumer || debug_consumer) - decoder.CreateLogger(log_consumer, debug_consumer); - - if (decoder.DecodeModule(spirv) != SPV_SUCCESS) { - return DiagnosticStream(position, hijack_context.consumer, "", - SPV_ERROR_INVALID_BINARY) - << "Unable to decode MARK-V."; - } - - assert(!spirv->empty()); - return SPV_SUCCESS; -} - } // namespace comp } // namespace spvtools diff --git a/third_party/spirv-tools/source/comp/markv_codec.h b/third_party/spirv-tools/source/comp/markv_codec.h new file mode 100644 index 0000000000..f313d61788 --- /dev/null +++ b/third_party/spirv-tools/source/comp/markv_codec.h @@ -0,0 +1,337 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SOURCE_COMP_MARKV_CODEC_H_ +#define SOURCE_COMP_MARKV_CODEC_H_ + +#include +#include +#include +#include + +#include "source/assembly_grammar.h" +#include "source/comp/huffman_codec.h" +#include "source/comp/markv_model.h" +#include "source/comp/move_to_front.h" +#include "source/diagnostic.h" +#include "source/id_descriptor.h" + +#include "source/val/instruction.h" + +// Base class for MARK-V encoder and decoder. Contains common functionality +// such as: +// - Validator connection and validation state. +// - SPIR-V grammar and helper functions. + +namespace spvtools { +namespace comp { + +class MarkvLogger; + +// Handles for move-to-front sequences. Enums which end with "Begin" define +// handle spaces which start at that value and span 16 or 32 bit wide. +enum : uint64_t { + kMtfNone = 0, + // All ids. + kMtfAll, + // All forward declared ids. + kMtfForwardDeclared, + // All type ids except for generated by OpTypeFunction. + kMtfTypeNonFunction, + // All labels. + kMtfLabel, + // All ids created by instructions which had type_id. + kMtfObject, + // All types generated by OpTypeFloat, OpTypeInt, OpTypeBool. + kMtfTypeScalar, + // All composite types. + kMtfTypeComposite, + // Boolean type or any vector type of it. + kMtfTypeBoolScalarOrVector, + // All float types or any vector floats type. + kMtfTypeFloatScalarOrVector, + // All int types or any vector int type. + kMtfTypeIntScalarOrVector, + // All types declared as return types in OpTypeFunction. + kMtfTypeReturnedByFunction, + // All composite objects. + kMtfComposite, + // All bool objects or vectors of bools. + kMtfBoolScalarOrVector, + // All float objects or vectors of float. + kMtfFloatScalarOrVector, + // All int objects or vectors of int. + kMtfIntScalarOrVector, + // All pointer types which point to composited. + kMtfTypePointerToComposite, + // Used by EncodeMtfRankHuffman. + kMtfGenericNonZeroRank, + // Handle space for ids of specific type. + kMtfIdOfTypeBegin = 0x10000, + // Handle space for ids generated by specific opcode. + kMtfIdGeneratedByOpcode = 0x20000, + // Handle space for ids of objects with type generated by specific opcode. + kMtfIdWithTypeGeneratedByOpcodeBegin = 0x30000, + // All vectors of specific component type. + kMtfVectorOfComponentTypeBegin = 0x40000, + // All vector types of specific size. + kMtfTypeVectorOfSizeBegin = 0x50000, + // All pointer types to specific type. + kMtfPointerToTypeBegin = 0x60000, + // All function types which return specific type. + kMtfFunctionTypeWithReturnTypeBegin = 0x70000, + // All function objects which return specific type. + kMtfFunctionWithReturnTypeBegin = 0x80000, + // Short id descriptor space (max 16-bit). + kMtfShortIdDescriptorSpaceBegin = 0x90000, + // Long id descriptor space (32-bit). + kMtfLongIdDescriptorSpaceBegin = 0x100000000, +}; + +class MarkvCodec { + public: + static const uint32_t kMarkvMagicNumber; + + // Mtf ranks smaller than this are encoded with Huffman coding. + static const uint32_t kMtfSmallestRankEncodedByValue; + + // Signals that the mtf rank is too large to be encoded with Huffman. + static const uint32_t kMtfRankEncodedByValueSignal; + + static const uint32_t kShortDescriptorNumBits; + + static const size_t kByteBreakAfterInstIfLessThanUntilNextByte; + + static uint32_t GetMarkvVersion(); + + virtual ~MarkvCodec(); + + protected: + struct MarkvHeader { + MarkvHeader(); + + uint32_t magic_number; + uint32_t markv_version; + // Magic number to identify or verify MarkvModel used for encoding. + uint32_t markv_model = 0; + uint32_t markv_length_in_bits = 0; + uint32_t spirv_version = 0; + uint32_t spirv_generator = 0; + }; + + // |model| is owned by the caller, must be not null and valid during the + // lifetime of the codec. + MarkvCodec(spv_const_context context, spv_validator_options validator_options, + const MarkvModel* model); + + // Returns instruction which created |id| or nullptr if such instruction was + // not registered. + const val::Instruction* FindDef(uint32_t id) const { + const auto it = id_to_def_instruction_.find(id); + if (it == id_to_def_instruction_.end()) return nullptr; + return it->second; + } + + size_t GetNumBitsToNextByte(size_t bit_pos) const; + bool OpcodeHasFixedNumberOfOperands(SpvOp opcode) const; + + // Returns type id of vector type component. + uint32_t GetVectorComponentType(uint32_t vector_type_id) const { + const val::Instruction* type_inst = FindDef(vector_type_id); + assert(type_inst); + assert(type_inst->opcode() == SpvOpTypeVector); + + const uint32_t component_type = + type_inst->word(type_inst->operands()[1].offset); + return component_type; + } + + // Returns mtf handle for ids of given type. + uint64_t GetMtfIdOfType(uint32_t type_id) const { + return kMtfIdOfTypeBegin + type_id; + } + + // Returns mtf handle for ids generated by given opcode. + uint64_t GetMtfIdGeneratedByOpcode(SpvOp opcode) const { + return kMtfIdGeneratedByOpcode + opcode; + } + + // Returns mtf handle for ids of type generated by given opcode. + uint64_t GetMtfIdWithTypeGeneratedByOpcode(SpvOp opcode) const { + return kMtfIdWithTypeGeneratedByOpcodeBegin + opcode; + } + + // Returns mtf handle for vectors of specific component type. + uint64_t GetMtfVectorOfComponentType(uint32_t type_id) const { + return kMtfVectorOfComponentTypeBegin + type_id; + } + + // Returns mtf handle for vector type of specific size. + uint64_t GetMtfTypeVectorOfSize(uint32_t size) const { + return kMtfTypeVectorOfSizeBegin + size; + } + + // Returns mtf handle for pointers to specific size. + uint64_t GetMtfPointerToType(uint32_t type_id) const { + return kMtfPointerToTypeBegin + type_id; + } + + // Returns mtf handle for function types with given return type. + uint64_t GetMtfFunctionTypeWithReturnType(uint32_t type_id) const { + return kMtfFunctionTypeWithReturnTypeBegin + type_id; + } + + // Returns mtf handle for functions with given return type. + uint64_t GetMtfFunctionWithReturnType(uint32_t type_id) const { + return kMtfFunctionWithReturnTypeBegin + type_id; + } + + // Returns mtf handle for the given long id descriptor. + uint64_t GetMtfLongIdDescriptor(uint32_t descriptor) const { + return kMtfLongIdDescriptorSpaceBegin + descriptor; + } + + // Returns mtf handle for the given short id descriptor. + uint64_t GetMtfShortIdDescriptor(uint32_t descriptor) const { + return kMtfShortIdDescriptorSpaceBegin + descriptor; + } + + // Process data from the current instruction. This would update MTFs and + // other data containers. + void ProcessCurInstruction(); + + // Returns move-to-front handle to be used for the current operand slot. + // Mtf handle is chosen based on a set of rules defined by SPIR-V grammar. + uint64_t GetRuleBasedMtf(); + + // Returns words of the current instruction. Decoder has a different + // implementation and the array is valid only until the previously decoded + // word. + virtual const uint32_t* GetInstWords() const { return inst_.words; } + + // Returns the opcode of the previous instruction. + SpvOp GetPrevOpcode() const { + if (instructions_.empty()) return SpvOpNop; + + return instructions_.back()->opcode(); + } + + // Returns diagnostic stream, position index is set to instruction number. + DiagnosticStream Diag(spv_result_t error_code) const { + return DiagnosticStream({0, 0, instructions_.size()}, context_->consumer, + "", error_code); + } + + // Returns current id bound. + uint32_t GetIdBound() const { return id_bound_; } + + // Sets current id bound, expected to be no lower than the previous one. + void SetIdBound(uint32_t id_bound) { + assert(id_bound >= id_bound_); + id_bound_ = id_bound; + } + + // Returns Huffman codec for ranks of the mtf with given |handle|. + // Different mtfs can use different rank distributions. + // May return nullptr if the codec doesn't exist. + const HuffmanCodec* GetMtfHuffmanCodec(uint64_t handle) const { + const auto it = mtf_huffman_codecs_.find(handle); + if (it == mtf_huffman_codecs_.end()) return nullptr; + return it->second.get(); + } + + // Promotes id in all move-to-front sequences if ids can be shared by multiple + // sequences. + void PromoteIfNeeded(uint32_t id) { + if (!model_->AnyDescriptorHasCodingScheme() && + model_->id_fallback_strategy() == + MarkvModel::IdFallbackStrategy::kShortDescriptor) { + // Move-to-front sequences do not share ids. Nothing to do. + return; + } + multi_mtf_.Promote(id); + } + + spv_validator_options validator_options_ = nullptr; + const AssemblyGrammar grammar_; + MarkvHeader header_; + + // MARK-V model, not owned. + const MarkvModel* model_ = nullptr; + + // Current instruction, current operand and current operand index. + spv_parsed_instruction_t inst_; + spv_parsed_operand_t operand_; + uint32_t operand_index_; + + // Maps a result ID to its type ID. By convention: + // - a result ID that is a type definition maps to itself. + // - a result ID without a type maps to 0. (E.g. for OpLabel) + std::unordered_map id_to_type_id_; + + // Container for all move-to-front sequences. + MultiMoveToFront multi_mtf_; + + // Id of the current function or zero if outside of function. + uint32_t cur_function_id_ = 0; + + // Return type of the current function. + uint32_t cur_function_return_type_ = 0; + + // Remaining function parameter types. This container is filled on OpFunction, + // and drained on OpFunctionParameter. + std::list remaining_function_parameter_types_; + + // List of ids local to the current function. + std::vector ids_local_to_cur_function_; + + // List of instructions in the order they are given in the module. + std::vector> instructions_; + + // Container/computer for long (32-bit) id descriptors. + IdDescriptorCollection long_id_descriptors_; + + // Container/computer for short id descriptors. + // Short descriptors are stored in uint32_t, but their actual bit width is + // defined with kShortDescriptorNumBits. + // It doesn't seem logical to have a different computer for short id + // descriptors, since one could actually map/truncate long descriptors. + // But as short descriptors have collisions, the efficiency of + // compression depends on the collision pattern, and short descriptors + // produced by function ShortHashU32Array have been empirically proven to + // produce better results. + IdDescriptorCollection short_id_descriptors_; + + // Huffman codecs for move-to-front ranks. The map key is mtf handle. Doesn't + // need to contain a different codec for every handle as most use one and the + // same. + std::map>> + mtf_huffman_codecs_; + + // If not nullptr, codec will log comments on the compression process. + std::unique_ptr logger_; + + spv_const_context context_ = nullptr; + + private: + // Maps result id to the instruction which defined it. + std::unordered_map id_to_def_instruction_; + + uint32_t id_bound_ = 1; +}; + +} // namespace comp +} // namespace spvtools + +#endif // SOURCE_COMP_MARKV_CODEC_H_ diff --git a/third_party/spirv-tools/source/comp/markv_decoder.cpp b/third_party/spirv-tools/source/comp/markv_decoder.cpp new file mode 100644 index 0000000000..22115831dc --- /dev/null +++ b/third_party/spirv-tools/source/comp/markv_decoder.cpp @@ -0,0 +1,925 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "source/comp/markv_decoder.h" + +#include +#include +#include + +#include "source/ext_inst.h" +#include "source/opcode.h" +#include "spirv-tools/libspirv.hpp" + +namespace spvtools { +namespace comp { + +spv_result_t MarkvDecoder::DecodeNonIdWord(uint32_t* word) { + auto* codec = model_->GetNonIdWordHuffmanCodec(inst_.opcode, operand_index_); + + if (codec) { + uint64_t decoded_value = 0; + if (!codec->DecodeFromStream(GetReadBitCallback(), &decoded_value)) + return Diag(SPV_ERROR_INVALID_BINARY) + << "Failed to decode non-id word with Huffman"; + + if (decoded_value != MarkvModel::GetMarkvNoneOfTheAbove()) { + // The word decoded successfully. + *word = uint32_t(decoded_value); + assert(*word == decoded_value); + return SPV_SUCCESS; + } + + // Received kMarkvNoneOfTheAbove signal, use fallback decoding. + } + + const size_t chunk_length = + model_->GetOperandVariableWidthChunkLength(operand_.type); + if (chunk_length) { + if (!reader_.ReadVariableWidthU32(word, chunk_length)) + return Diag(SPV_ERROR_INVALID_BINARY) + << "Failed to decode non-id word with varint"; + } else { + if (!reader_.ReadUnencoded(word)) + return Diag(SPV_ERROR_INVALID_BINARY) + << "Failed to read unencoded non-id word"; + } + return SPV_SUCCESS; +} + +spv_result_t MarkvDecoder::DecodeOpcodeAndNumberOfOperands( + uint32_t* opcode, uint32_t* num_operands) { + // First try to use the Markov chain codec. + auto* codec = + model_->GetOpcodeAndNumOperandsMarkovHuffmanCodec(GetPrevOpcode()); + if (codec) { + uint64_t decoded_value = 0; + if (!codec->DecodeFromStream(GetReadBitCallback(), &decoded_value)) + return Diag(SPV_ERROR_INTERNAL) + << "Failed to decode opcode_and_num_operands, previous opcode is " + << spvOpcodeString(GetPrevOpcode()); + + if (decoded_value != MarkvModel::GetMarkvNoneOfTheAbove()) { + // The word was successfully decoded. + *opcode = uint32_t(decoded_value & 0xFFFF); + *num_operands = uint32_t(decoded_value >> 16); + return SPV_SUCCESS; + } + + // Received kMarkvNoneOfTheAbove signal, use fallback decoding. + } + + // Fallback to base-rate codec. + codec = model_->GetOpcodeAndNumOperandsMarkovHuffmanCodec(SpvOpNop); + assert(codec); + uint64_t decoded_value = 0; + if (!codec->DecodeFromStream(GetReadBitCallback(), &decoded_value)) + return Diag(SPV_ERROR_INTERNAL) + << "Failed to decode opcode_and_num_operands with global codec"; + + if (decoded_value == MarkvModel::GetMarkvNoneOfTheAbove()) { + // Received kMarkvNoneOfTheAbove signal, fallback further. + return SPV_UNSUPPORTED; + } + + *opcode = uint32_t(decoded_value & 0xFFFF); + *num_operands = uint32_t(decoded_value >> 16); + return SPV_SUCCESS; +} + +spv_result_t MarkvDecoder::DecodeMtfRankHuffman(uint64_t mtf, + uint32_t fallback_method, + uint32_t* rank) { + const auto* codec = GetMtfHuffmanCodec(mtf); + if (!codec) { + assert(fallback_method != kMtfNone); + codec = GetMtfHuffmanCodec(fallback_method); + } + + if (!codec) return Diag(SPV_ERROR_INTERNAL) << "No codec to decode MTF rank"; + + uint32_t decoded_value = 0; + if (!codec->DecodeFromStream(GetReadBitCallback(), &decoded_value)) + return Diag(SPV_ERROR_INTERNAL) << "Failed to decode MTF rank with Huffman"; + + if (decoded_value == kMtfRankEncodedByValueSignal) { + // Decode by value. + if (!reader_.ReadVariableWidthU32(rank, model_->mtf_rank_chunk_length())) + return Diag(SPV_ERROR_INTERNAL) + << "Failed to decode MTF rank with varint"; + *rank += MarkvCodec::kMtfSmallestRankEncodedByValue; + } else { + // Decode using Huffman coding. + assert(decoded_value < MarkvCodec::kMtfSmallestRankEncodedByValue); + *rank = decoded_value; + } + return SPV_SUCCESS; +} + +spv_result_t MarkvDecoder::DecodeIdWithDescriptor(uint32_t* id) { + auto* codec = + model_->GetIdDescriptorHuffmanCodec(inst_.opcode, operand_index_); + + uint64_t mtf = kMtfNone; + if (codec) { + uint64_t decoded_value = 0; + if (!codec->DecodeFromStream(GetReadBitCallback(), &decoded_value)) + return Diag(SPV_ERROR_INTERNAL) + << "Failed to decode descriptor with Huffman"; + + if (decoded_value != MarkvModel::GetMarkvNoneOfTheAbove()) { + const uint32_t long_descriptor = uint32_t(decoded_value); + mtf = GetMtfLongIdDescriptor(long_descriptor); + } + } + + if (mtf == kMtfNone) { + if (model_->id_fallback_strategy() != + MarkvModel::IdFallbackStrategy::kShortDescriptor) { + return SPV_UNSUPPORTED; + } + + uint64_t decoded_value = 0; + if (!reader_.ReadBits(&decoded_value, MarkvCodec::kShortDescriptorNumBits)) + return Diag(SPV_ERROR_INTERNAL) << "Failed to read short descriptor"; + const uint32_t short_descriptor = uint32_t(decoded_value); + if (short_descriptor == 0) { + // Forward declared id. + return SPV_UNSUPPORTED; + } + mtf = GetMtfShortIdDescriptor(short_descriptor); + } + + return DecodeExistingId(mtf, id); +} + +spv_result_t MarkvDecoder::DecodeExistingId(uint64_t mtf, uint32_t* id) { + assert(multi_mtf_.GetSize(mtf) > 0); + *id = 0; + + uint32_t rank = 0; + + if (multi_mtf_.GetSize(mtf) == 1) { + rank = 1; + } else { + const spv_result_t result = + DecodeMtfRankHuffman(mtf, kMtfGenericNonZeroRank, &rank); + if (result != SPV_SUCCESS) return result; + } + + assert(rank); + if (!multi_mtf_.ValueFromRank(mtf, rank, id)) + return Diag(SPV_ERROR_INTERNAL) << "MTF rank is out of bounds"; + + return SPV_SUCCESS; +} + +spv_result_t MarkvDecoder::DecodeRefId(uint32_t* id) { + { + const spv_result_t result = DecodeIdWithDescriptor(id); + if (result != SPV_UNSUPPORTED) return result; + } + + const bool can_forward_declare = spvOperandCanBeForwardDeclaredFunction( + SpvOp(inst_.opcode))(operand_index_); + uint32_t rank = 0; + *id = 0; + + if (model_->id_fallback_strategy() == + MarkvModel::IdFallbackStrategy::kRuleBased) { + uint64_t mtf = GetRuleBasedMtf(); + if (mtf != kMtfNone && !can_forward_declare) { + return DecodeExistingId(mtf, id); + } + + if (mtf == kMtfNone) mtf = kMtfAll; + { + const spv_result_t result = DecodeMtfRankHuffman(mtf, kMtfAll, &rank); + if (result != SPV_SUCCESS) return result; + } + + if (rank == 0) { + // This is the first occurrence of a forward declared id. + *id = GetIdBound(); + SetIdBound(*id + 1); + multi_mtf_.Insert(kMtfAll, *id); + multi_mtf_.Insert(kMtfForwardDeclared, *id); + if (mtf != kMtfAll) multi_mtf_.Insert(mtf, *id); + } else { + if (!multi_mtf_.ValueFromRank(mtf, rank, id)) + return Diag(SPV_ERROR_INTERNAL) << "MTF rank out of bounds"; + } + } else { + assert(can_forward_declare); + + if (!reader_.ReadVariableWidthU32(&rank, model_->mtf_rank_chunk_length())) + return Diag(SPV_ERROR_INTERNAL) + << "Failed to decode MTF rank with varint"; + + if (rank == 0) { + // This is the first occurrence of a forward declared id. + *id = GetIdBound(); + SetIdBound(*id + 1); + multi_mtf_.Insert(kMtfForwardDeclared, *id); + } else { + if (!multi_mtf_.ValueFromRank(kMtfForwardDeclared, rank, id)) + return Diag(SPV_ERROR_INTERNAL) << "MTF rank out of bounds"; + } + } + assert(*id); + return SPV_SUCCESS; +} + +spv_result_t MarkvDecoder::DecodeTypeId() { + if (inst_.opcode == SpvOpFunctionParameter) { + assert(!remaining_function_parameter_types_.empty()); + inst_.type_id = remaining_function_parameter_types_.front(); + remaining_function_parameter_types_.pop_front(); + return SPV_SUCCESS; + } + + { + const spv_result_t result = DecodeIdWithDescriptor(&inst_.type_id); + if (result != SPV_UNSUPPORTED) return result; + } + + assert(model_->id_fallback_strategy() == + MarkvModel::IdFallbackStrategy::kRuleBased); + + uint64_t mtf = GetRuleBasedMtf(); + assert(!spvOperandCanBeForwardDeclaredFunction(SpvOp(inst_.opcode))( + operand_index_)); + + if (mtf == kMtfNone) { + mtf = kMtfTypeNonFunction; + // Function types should have been handled by GetRuleBasedMtf. + assert(inst_.opcode != SpvOpFunction); + } + + return DecodeExistingId(mtf, &inst_.type_id); +} + +spv_result_t MarkvDecoder::DecodeResultId() { + uint32_t rank = 0; + + const uint64_t num_still_forward_declared = + multi_mtf_.GetSize(kMtfForwardDeclared); + + if (num_still_forward_declared) { + // Some ids were forward declared. Check if this id is one of them. + uint64_t id_was_forward_declared; + if (!reader_.ReadBits(&id_was_forward_declared, 1)) + return Diag(SPV_ERROR_INVALID_BINARY) + << "Failed to read id_was_forward_declared flag"; + + if (id_was_forward_declared) { + if (!reader_.ReadVariableWidthU32(&rank, model_->mtf_rank_chunk_length())) + return Diag(SPV_ERROR_INVALID_BINARY) + << "Failed to read MTF rank of forward declared id"; + + if (rank) { + // The id was forward declared, recover it from kMtfForwardDeclared. + if (!multi_mtf_.ValueFromRank(kMtfForwardDeclared, rank, + &inst_.result_id)) + return Diag(SPV_ERROR_INTERNAL) + << "Forward declared MTF rank is out of bounds"; + + // We can now remove the id from kMtfForwardDeclared. + if (!multi_mtf_.Remove(kMtfForwardDeclared, inst_.result_id)) + return Diag(SPV_ERROR_INTERNAL) + << "Failed to remove id from kMtfForwardDeclared"; + } + } + } + + if (inst_.result_id == 0) { + // The id was not forward declared, issue a new id. + inst_.result_id = GetIdBound(); + SetIdBound(inst_.result_id + 1); + } + + if (model_->id_fallback_strategy() == + MarkvModel::IdFallbackStrategy::kRuleBased) { + if (!rank) { + multi_mtf_.Insert(kMtfAll, inst_.result_id); + } + } + + return SPV_SUCCESS; +} + +spv_result_t MarkvDecoder::DecodeLiteralNumber( + const spv_parsed_operand_t& operand) { + if (operand.number_bit_width <= 32) { + uint32_t word = 0; + const spv_result_t result = DecodeNonIdWord(&word); + if (result != SPV_SUCCESS) return result; + inst_words_.push_back(word); + } else { + assert(operand.number_bit_width <= 64); + uint64_t word = 0; + if (operand.number_kind == SPV_NUMBER_UNSIGNED_INT) { + if (!reader_.ReadVariableWidthU64(&word, model_->u64_chunk_length())) + return Diag(SPV_ERROR_INVALID_BINARY) << "Failed to read literal U64"; + } else if (operand.number_kind == SPV_NUMBER_SIGNED_INT) { + int64_t val = 0; + if (!reader_.ReadVariableWidthS64(&val, model_->s64_chunk_length(), + model_->s64_block_exponent())) + return Diag(SPV_ERROR_INVALID_BINARY) << "Failed to read literal S64"; + std::memcpy(&word, &val, 8); + } else if (operand.number_kind == SPV_NUMBER_FLOATING) { + if (!reader_.ReadUnencoded(&word)) + return Diag(SPV_ERROR_INVALID_BINARY) << "Failed to read literal F64"; + } else { + return Diag(SPV_ERROR_INTERNAL) << "Unsupported bit length"; + } + inst_words_.push_back(static_cast(word)); + inst_words_.push_back(static_cast(word >> 32)); + } + return SPV_SUCCESS; +} + +bool MarkvDecoder::ReadToByteBreak(size_t byte_break_if_less_than) { + const size_t num_bits_to_next_byte = + GetNumBitsToNextByte(reader_.GetNumReadBits()); + if (num_bits_to_next_byte == 0 || + num_bits_to_next_byte > byte_break_if_less_than) + return true; + + uint64_t bits = 0; + if (!reader_.ReadBits(&bits, num_bits_to_next_byte)) return false; + + assert(bits == 0); + if (bits != 0) return false; + + return true; +} + +spv_result_t MarkvDecoder::DecodeModule(std::vector* spirv_binary) { + const bool header_read_success = + reader_.ReadUnencoded(&header_.magic_number) && + reader_.ReadUnencoded(&header_.markv_version) && + reader_.ReadUnencoded(&header_.markv_model) && + reader_.ReadUnencoded(&header_.markv_length_in_bits) && + reader_.ReadUnencoded(&header_.spirv_version) && + reader_.ReadUnencoded(&header_.spirv_generator); + + if (!header_read_success) + return Diag(SPV_ERROR_INVALID_BINARY) << "Unable to read MARK-V header"; + + if (header_.markv_length_in_bits == 0) + return Diag(SPV_ERROR_INVALID_BINARY) + << "Header markv_length_in_bits field is zero"; + + if (header_.magic_number != MarkvCodec::kMarkvMagicNumber) + return Diag(SPV_ERROR_INVALID_BINARY) + << "MARK-V binary has incorrect magic number"; + + // TODO(atgoo@github.com): Print version strings. + if (header_.markv_version != MarkvCodec::GetMarkvVersion()) + return Diag(SPV_ERROR_INVALID_BINARY) + << "MARK-V binary and the codec have different versions"; + + const uint32_t model_type = header_.markv_model >> 16; + const uint32_t model_version = header_.markv_model & 0xFFFF; + if (model_type != model_->model_type()) + return Diag(SPV_ERROR_INVALID_BINARY) + << "MARK-V binary and the codec use different MARK-V models"; + + if (model_version != model_->model_version()) + return Diag(SPV_ERROR_INVALID_BINARY) + << "MARK-V binary and the codec use different versions if the same " + << "MARK-V model"; + + spirv_.reserve(header_.markv_length_in_bits / 2); // Heuristic. + spirv_.resize(5, 0); + spirv_[0] = SpvMagicNumber; + spirv_[1] = header_.spirv_version; + spirv_[2] = header_.spirv_generator; + + if (logger_) { + reader_.SetCallback( + [this](const std::string& str) { logger_->AppendBitSequence(str); }); + } + + while (reader_.GetNumReadBits() < header_.markv_length_in_bits) { + inst_ = {}; + const spv_result_t decode_result = DecodeInstruction(); + if (decode_result != SPV_SUCCESS) return decode_result; + } + + if (validator_options_) { + spv_const_binary_t validation_binary = {spirv_.data(), spirv_.size()}; + const spv_result_t result = spvValidateWithOptions( + context_, validator_options_, &validation_binary, nullptr); + if (result != SPV_SUCCESS) return result; + } + + // Validate the decode binary + if (reader_.GetNumReadBits() != header_.markv_length_in_bits || + !reader_.OnlyZeroesLeft()) { + return Diag(SPV_ERROR_INVALID_BINARY) + << "MARK-V binary has wrong stated bit length " + << reader_.GetNumReadBits() << " " << header_.markv_length_in_bits; + } + + // Decoding of the module is finished, validation state should have correct + // id bound. + spirv_[3] = GetIdBound(); + + *spirv_binary = std::move(spirv_); + return SPV_SUCCESS; +} + +// TODO(atgoo@github.com): The implementation borrows heavily from +// Parser::parseOperand. +// Consider coupling them together in some way once MARK-V codec is more mature. +// For now it's better to keep the code independent for experimentation +// purposes. +spv_result_t MarkvDecoder::DecodeOperand( + size_t operand_offset, const spv_operand_type_t type, + spv_operand_pattern_t* expected_operands) { + const SpvOp opcode = static_cast(inst_.opcode); + + memset(&operand_, 0, sizeof(operand_)); + + assert((operand_offset >> 16) == 0); + operand_.offset = static_cast(operand_offset); + operand_.type = type; + + // Set default values, may be updated later. + operand_.number_kind = SPV_NUMBER_NONE; + operand_.number_bit_width = 0; + + const size_t first_word_index = inst_words_.size(); + + switch (type) { + case SPV_OPERAND_TYPE_RESULT_ID: { + const spv_result_t result = DecodeResultId(); + if (result != SPV_SUCCESS) return result; + + inst_words_.push_back(inst_.result_id); + SetIdBound(std::max(GetIdBound(), inst_.result_id + 1)); + PromoteIfNeeded(inst_.result_id); + break; + } + + case SPV_OPERAND_TYPE_TYPE_ID: { + const spv_result_t result = DecodeTypeId(); + if (result != SPV_SUCCESS) return result; + + inst_words_.push_back(inst_.type_id); + SetIdBound(std::max(GetIdBound(), inst_.type_id + 1)); + PromoteIfNeeded(inst_.type_id); + break; + } + + case SPV_OPERAND_TYPE_ID: + case SPV_OPERAND_TYPE_OPTIONAL_ID: + case SPV_OPERAND_TYPE_SCOPE_ID: + case SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID: { + uint32_t id = 0; + const spv_result_t result = DecodeRefId(&id); + if (result != SPV_SUCCESS) return result; + + if (id == 0) return Diag(SPV_ERROR_INVALID_BINARY) << "Decoded id is 0"; + + if (type == SPV_OPERAND_TYPE_ID || type == SPV_OPERAND_TYPE_OPTIONAL_ID) { + operand_.type = SPV_OPERAND_TYPE_ID; + + if (opcode == SpvOpExtInst && operand_.offset == 3) { + // The current word is the extended instruction set id. + // Set the extended instruction set type for the current + // instruction. + auto ext_inst_type_iter = import_id_to_ext_inst_type_.find(id); + if (ext_inst_type_iter == import_id_to_ext_inst_type_.end()) { + return Diag(SPV_ERROR_INVALID_ID) + << "OpExtInst set id " << id + << " does not reference an OpExtInstImport result Id"; + } + inst_.ext_inst_type = ext_inst_type_iter->second; + } + } + + inst_words_.push_back(id); + SetIdBound(std::max(GetIdBound(), id + 1)); + PromoteIfNeeded(id); + break; + } + + case SPV_OPERAND_TYPE_EXTENSION_INSTRUCTION_NUMBER: { + uint32_t word = 0; + const spv_result_t result = DecodeNonIdWord(&word); + if (result != SPV_SUCCESS) return result; + + inst_words_.push_back(word); + + assert(SpvOpExtInst == opcode); + assert(inst_.ext_inst_type != SPV_EXT_INST_TYPE_NONE); + spv_ext_inst_desc ext_inst; + if (grammar_.lookupExtInst(inst_.ext_inst_type, word, &ext_inst)) + return Diag(SPV_ERROR_INVALID_BINARY) + << "Invalid extended instruction number: " << word; + spvPushOperandTypes(ext_inst->operandTypes, expected_operands); + break; + } + + case SPV_OPERAND_TYPE_LITERAL_INTEGER: + case SPV_OPERAND_TYPE_OPTIONAL_LITERAL_INTEGER: { + // These are regular single-word literal integer operands. + // Post-parsing validation should check the range of the parsed value. + operand_.type = SPV_OPERAND_TYPE_LITERAL_INTEGER; + // It turns out they are always unsigned integers! + operand_.number_kind = SPV_NUMBER_UNSIGNED_INT; + operand_.number_bit_width = 32; + + uint32_t word = 0; + const spv_result_t result = DecodeNonIdWord(&word); + if (result != SPV_SUCCESS) return result; + + inst_words_.push_back(word); + break; + } + + case SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER: + case SPV_OPERAND_TYPE_OPTIONAL_TYPED_LITERAL_INTEGER: { + operand_.type = SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER; + if (opcode == SpvOpSwitch) { + // The literal operands have the same type as the value + // referenced by the selector Id. + const uint32_t selector_id = inst_words_.at(1); + const auto type_id_iter = id_to_type_id_.find(selector_id); + if (type_id_iter == id_to_type_id_.end() || type_id_iter->second == 0) { + return Diag(SPV_ERROR_INVALID_BINARY) + << "Invalid OpSwitch: selector id " << selector_id + << " has no type"; + } + uint32_t type_id = type_id_iter->second; + + if (selector_id == type_id) { + // Recall that by convention, a result ID that is a type definition + // maps to itself. + return Diag(SPV_ERROR_INVALID_BINARY) + << "Invalid OpSwitch: selector id " << selector_id + << " is a type, not a value"; + } + if (auto error = SetNumericTypeInfoForType(&operand_, type_id)) + return error; + if (operand_.number_kind != SPV_NUMBER_UNSIGNED_INT && + operand_.number_kind != SPV_NUMBER_SIGNED_INT) { + return Diag(SPV_ERROR_INVALID_BINARY) + << "Invalid OpSwitch: selector id " << selector_id + << " is not a scalar integer"; + } + } else { + assert(opcode == SpvOpConstant || opcode == SpvOpSpecConstant); + // The literal number type is determined by the type Id for the + // constant. + assert(inst_.type_id); + if (auto error = SetNumericTypeInfoForType(&operand_, inst_.type_id)) + return error; + } + + if (auto error = DecodeLiteralNumber(operand_)) return error; + + break; + } + + case SPV_OPERAND_TYPE_LITERAL_STRING: + case SPV_OPERAND_TYPE_OPTIONAL_LITERAL_STRING: { + operand_.type = SPV_OPERAND_TYPE_LITERAL_STRING; + std::vector str; + auto* codec = model_->GetLiteralStringHuffmanCodec(inst_.opcode); + + if (codec) { + std::string decoded_string; + const bool huffman_result = + codec->DecodeFromStream(GetReadBitCallback(), &decoded_string); + assert(huffman_result); + if (!huffman_result) + return Diag(SPV_ERROR_INVALID_BINARY) + << "Failed to read literal string"; + + if (decoded_string != "kMarkvNoneOfTheAbove") { + std::copy(decoded_string.begin(), decoded_string.end(), + std::back_inserter(str)); + str.push_back('\0'); + } + } + + // The loop is expected to terminate once we encounter '\0' or exhaust + // the bit stream. + if (str.empty()) { + while (true) { + char ch = 0; + if (!reader_.ReadUnencoded(&ch)) + return Diag(SPV_ERROR_INVALID_BINARY) + << "Failed to read literal string"; + + str.push_back(ch); + + if (ch == '\0') break; + } + } + + while (str.size() % 4 != 0) str.push_back('\0'); + + inst_words_.resize(inst_words_.size() + str.size() / 4); + std::memcpy(&inst_words_[first_word_index], str.data(), str.size()); + + if (SpvOpExtInstImport == opcode) { + // Record the extended instruction type for the ID for this import. + // There is only one string literal argument to OpExtInstImport, + // so it's sufficient to guard this just on the opcode. + const spv_ext_inst_type_t ext_inst_type = + spvExtInstImportTypeGet(str.data()); + if (SPV_EXT_INST_TYPE_NONE == ext_inst_type) { + return Diag(SPV_ERROR_INVALID_BINARY) + << "Invalid extended instruction import '" << str.data() + << "'"; + } + // We must have parsed a valid result ID. It's a condition + // of the grammar, and we only accept non-zero result Ids. + assert(inst_.result_id); + const bool inserted = + import_id_to_ext_inst_type_.emplace(inst_.result_id, ext_inst_type) + .second; + (void)inserted; + assert(inserted); + } + break; + } + + case SPV_OPERAND_TYPE_CAPABILITY: + case SPV_OPERAND_TYPE_SOURCE_LANGUAGE: + case SPV_OPERAND_TYPE_EXECUTION_MODEL: + case SPV_OPERAND_TYPE_ADDRESSING_MODEL: + case SPV_OPERAND_TYPE_MEMORY_MODEL: + case SPV_OPERAND_TYPE_EXECUTION_MODE: + case SPV_OPERAND_TYPE_STORAGE_CLASS: + case SPV_OPERAND_TYPE_DIMENSIONALITY: + case SPV_OPERAND_TYPE_SAMPLER_ADDRESSING_MODE: + case SPV_OPERAND_TYPE_SAMPLER_FILTER_MODE: + case SPV_OPERAND_TYPE_SAMPLER_IMAGE_FORMAT: + case SPV_OPERAND_TYPE_FP_ROUNDING_MODE: + case SPV_OPERAND_TYPE_LINKAGE_TYPE: + case SPV_OPERAND_TYPE_ACCESS_QUALIFIER: + case SPV_OPERAND_TYPE_OPTIONAL_ACCESS_QUALIFIER: + case SPV_OPERAND_TYPE_FUNCTION_PARAMETER_ATTRIBUTE: + case SPV_OPERAND_TYPE_DECORATION: + case SPV_OPERAND_TYPE_BUILT_IN: + case SPV_OPERAND_TYPE_GROUP_OPERATION: + case SPV_OPERAND_TYPE_KERNEL_ENQ_FLAGS: + case SPV_OPERAND_TYPE_KERNEL_PROFILING_INFO: { + // A single word that is a plain enum value. + uint32_t word = 0; + const spv_result_t result = DecodeNonIdWord(&word); + if (result != SPV_SUCCESS) return result; + + inst_words_.push_back(word); + + // Map an optional operand type to its corresponding concrete type. + if (type == SPV_OPERAND_TYPE_OPTIONAL_ACCESS_QUALIFIER) + operand_.type = SPV_OPERAND_TYPE_ACCESS_QUALIFIER; + + spv_operand_desc entry; + if (grammar_.lookupOperand(type, word, &entry)) { + return Diag(SPV_ERROR_INVALID_BINARY) + << "Invalid " << spvOperandTypeStr(operand_.type) + << " operand: " << word; + } + + // Prepare to accept operands to this operand, if needed. + spvPushOperandTypes(entry->operandTypes, expected_operands); + break; + } + + case SPV_OPERAND_TYPE_FP_FAST_MATH_MODE: + case SPV_OPERAND_TYPE_FUNCTION_CONTROL: + case SPV_OPERAND_TYPE_LOOP_CONTROL: + case SPV_OPERAND_TYPE_IMAGE: + case SPV_OPERAND_TYPE_OPTIONAL_IMAGE: + case SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS: + case SPV_OPERAND_TYPE_SELECTION_CONTROL: { + // This operand is a mask. + uint32_t word = 0; + const spv_result_t result = DecodeNonIdWord(&word); + if (result != SPV_SUCCESS) return result; + + inst_words_.push_back(word); + + // Map an optional operand type to its corresponding concrete type. + if (type == SPV_OPERAND_TYPE_OPTIONAL_IMAGE) + operand_.type = SPV_OPERAND_TYPE_IMAGE; + else if (type == SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS) + operand_.type = SPV_OPERAND_TYPE_MEMORY_ACCESS; + + // Check validity of set mask bits. Also prepare for operands for those + // masks if they have any. To get operand order correct, scan from + // MSB to LSB since we can only prepend operands to a pattern. + // The only case in the grammar where you have more than one mask bit + // having an operand is for image operands. See SPIR-V 3.14 Image + // Operands. + uint32_t remaining_word = word; + for (uint32_t mask = (1u << 31); remaining_word; mask >>= 1) { + if (remaining_word & mask) { + spv_operand_desc entry; + if (grammar_.lookupOperand(type, mask, &entry)) { + return Diag(SPV_ERROR_INVALID_BINARY) + << "Invalid " << spvOperandTypeStr(operand_.type) + << " operand: " << word << " has invalid mask component " + << mask; + } + remaining_word ^= mask; + spvPushOperandTypes(entry->operandTypes, expected_operands); + } + } + if (word == 0) { + // An all-zeroes mask *might* also be valid. + spv_operand_desc entry; + if (SPV_SUCCESS == grammar_.lookupOperand(type, 0, &entry)) { + // Prepare for its operands, if any. + spvPushOperandTypes(entry->operandTypes, expected_operands); + } + } + break; + } + default: + return Diag(SPV_ERROR_INVALID_BINARY) + << "Internal error: Unhandled operand type: " << type; + } + + operand_.num_words = uint16_t(inst_words_.size() - first_word_index); + + assert(spvOperandIsConcrete(operand_.type)); + + parsed_operands_.push_back(operand_); + + return SPV_SUCCESS; +} + +spv_result_t MarkvDecoder::DecodeInstruction() { + parsed_operands_.clear(); + inst_words_.clear(); + + // Opcode/num_words placeholder, the word will be filled in later. + inst_words_.push_back(0); + + bool num_operands_still_unknown = true; + { + uint32_t opcode = 0; + uint32_t num_operands = 0; + + const spv_result_t opcode_decoding_result = + DecodeOpcodeAndNumberOfOperands(&opcode, &num_operands); + if (opcode_decoding_result < 0) return opcode_decoding_result; + + if (opcode_decoding_result == SPV_SUCCESS) { + inst_.num_operands = static_cast(num_operands); + num_operands_still_unknown = false; + } else { + if (!reader_.ReadVariableWidthU32(&opcode, + model_->opcode_chunk_length())) { + return Diag(SPV_ERROR_INVALID_BINARY) + << "Failed to read opcode of instruction"; + } + } + + inst_.opcode = static_cast(opcode); + } + + const SpvOp opcode = static_cast(inst_.opcode); + + spv_opcode_desc opcode_desc; + if (grammar_.lookupOpcode(opcode, &opcode_desc) != SPV_SUCCESS) { + return Diag(SPV_ERROR_INVALID_BINARY) << "Invalid opcode"; + } + + spv_operand_pattern_t expected_operands; + expected_operands.reserve(opcode_desc->numTypes); + for (auto i = 0; i < opcode_desc->numTypes; i++) { + expected_operands.push_back( + opcode_desc->operandTypes[opcode_desc->numTypes - i - 1]); + } + + if (num_operands_still_unknown) { + if (!OpcodeHasFixedNumberOfOperands(opcode)) { + if (!reader_.ReadVariableWidthU16(&inst_.num_operands, + model_->num_operands_chunk_length())) + return Diag(SPV_ERROR_INVALID_BINARY) + << "Failed to read num_operands of instruction"; + } else { + inst_.num_operands = static_cast(expected_operands.size()); + } + } + + for (operand_index_ = 0; + operand_index_ < static_cast(inst_.num_operands); + ++operand_index_) { + assert(!expected_operands.empty()); + const spv_operand_type_t type = + spvTakeFirstMatchableOperand(&expected_operands); + + const size_t operand_offset = inst_words_.size(); + + const spv_result_t decode_result = + DecodeOperand(operand_offset, type, &expected_operands); + + if (decode_result != SPV_SUCCESS) return decode_result; + } + + assert(inst_.num_operands == parsed_operands_.size()); + + // Only valid while inst_words_ and parsed_operands_ remain unchanged (until + // next DecodeInstruction call). + inst_.words = inst_words_.data(); + inst_.operands = parsed_operands_.empty() ? nullptr : parsed_operands_.data(); + inst_.num_words = static_cast(inst_words_.size()); + inst_words_[0] = spvOpcodeMake(inst_.num_words, SpvOp(inst_.opcode)); + + std::copy(inst_words_.begin(), inst_words_.end(), std::back_inserter(spirv_)); + + assert(inst_.num_words == + std::accumulate( + parsed_operands_.begin(), parsed_operands_.end(), 1, + [](int num_words, const spv_parsed_operand_t& operand) { + return num_words += operand.num_words; + }) && + "num_words in instruction doesn't correspond to the sum of num_words" + "in the operands"); + + RecordNumberType(); + ProcessCurInstruction(); + + if (!ReadToByteBreak(MarkvCodec::kByteBreakAfterInstIfLessThanUntilNextByte)) + return Diag(SPV_ERROR_INVALID_BINARY) << "Failed to read to byte break"; + + if (logger_) { + logger_->NewLine(); + std::stringstream ss; + ss << spvOpcodeString(opcode) << " "; + for (size_t index = 1; index < inst_words_.size(); ++index) + ss << inst_words_[index] << " "; + logger_->AppendText(ss.str()); + logger_->NewLine(); + logger_->NewLine(); + if (!logger_->DebugInstruction(inst_)) return SPV_REQUESTED_TERMINATION; + } + + return SPV_SUCCESS; +} + +spv_result_t MarkvDecoder::SetNumericTypeInfoForType( + spv_parsed_operand_t* parsed_operand, uint32_t type_id) { + assert(type_id != 0); + auto type_info_iter = type_id_to_number_type_info_.find(type_id); + if (type_info_iter == type_id_to_number_type_info_.end()) { + return Diag(SPV_ERROR_INVALID_BINARY) + << "Type Id " << type_id << " is not a type"; + } + + const NumberType& info = type_info_iter->second; + if (info.type == SPV_NUMBER_NONE) { + // This is a valid type, but for something other than a scalar number. + return Diag(SPV_ERROR_INVALID_BINARY) + << "Type Id " << type_id << " is not a scalar numeric type"; + } + + parsed_operand->number_kind = info.type; + parsed_operand->number_bit_width = info.bit_width; + // Round up the word count. + parsed_operand->num_words = static_cast((info.bit_width + 31) / 32); + return SPV_SUCCESS; +} + +void MarkvDecoder::RecordNumberType() { + const SpvOp opcode = static_cast(inst_.opcode); + if (spvOpcodeGeneratesType(opcode)) { + NumberType info = {SPV_NUMBER_NONE, 0}; + if (SpvOpTypeInt == opcode) { + info.bit_width = inst_.words[inst_.operands[1].offset]; + info.type = inst_.words[inst_.operands[2].offset] + ? SPV_NUMBER_SIGNED_INT + : SPV_NUMBER_UNSIGNED_INT; + } else if (SpvOpTypeFloat == opcode) { + info.bit_width = inst_.words[inst_.operands[1].offset]; + info.type = SPV_NUMBER_FLOATING; + } + // The *result* Id of a type generating instruction is the type Id. + type_id_to_number_type_info_[inst_.result_id] = info; + } +} + +} // namespace comp +} // namespace spvtools diff --git a/third_party/spirv-tools/source/comp/markv_decoder.h b/third_party/spirv-tools/source/comp/markv_decoder.h new file mode 100644 index 0000000000..4d8402b442 --- /dev/null +++ b/third_party/spirv-tools/source/comp/markv_decoder.h @@ -0,0 +1,175 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "source/comp/bit_stream.h" +#include "source/comp/markv.h" +#include "source/comp/markv_codec.h" +#include "source/comp/markv_logger.h" +#include "source/util/make_unique.h" + +#ifndef SOURCE_COMP_MARKV_DECODER_H_ +#define SOURCE_COMP_MARKV_DECODER_H_ + +namespace spvtools { +namespace comp { + +class MarkvLogger; + +// Decodes MARK-V buffers written by MarkvEncoder. +class MarkvDecoder : public MarkvCodec { + public: + // |model| is owned by the caller, must be not null and valid during the + // lifetime of MarkvEncoder. + MarkvDecoder(spv_const_context context, const std::vector& markv, + const MarkvCodecOptions& options, const MarkvModel* model) + : MarkvCodec(context, GetValidatorOptions(options), model), + options_(options), + reader_(markv) { + SetIdBound(1); + parsed_operands_.reserve(25); + inst_words_.reserve(25); + } + ~MarkvDecoder() = default; + + // Creates an internal logger which writes comments on the decoding process. + void CreateLogger(MarkvLogConsumer log_consumer, + MarkvDebugConsumer debug_consumer) { + logger_ = MakeUnique(log_consumer, debug_consumer); + } + + // Decodes SPIR-V from MARK-V and stores the words in |spirv_binary|. + // Can be called only once. Fails if data of wrong format or ends prematurely, + // of if validation fails. + spv_result_t DecodeModule(std::vector* spirv_binary); + + // Creates and returns validator options. Returned value owned by the caller. + static spv_validator_options GetValidatorOptions( + const MarkvCodecOptions& options) { + return options.validate_spirv_binary ? spvValidatorOptionsCreate() + : nullptr; + } + + private: + // Describes the format of a typed literal number. + struct NumberType { + spv_number_kind_t type; + uint32_t bit_width; + }; + + // Reads a single bit from reader_. The read bit is stored in |bit|. + // Returns false iff reader_ fails. + bool ReadBit(bool* bit) { + uint64_t bits = 0; + const bool result = reader_.ReadBits(&bits, 1); + if (result) *bit = bits ? true : false; + return result; + }; + + // Returns ReadBit bound to the class object. + std::function GetReadBitCallback() { + return std::bind(&MarkvDecoder::ReadBit, this, std::placeholders::_1); + } + + // Reads a single non-id word from bit stream. operand_.type determines if + // the word needs to be decoded and how. + spv_result_t DecodeNonIdWord(uint32_t* word); + + // Reads and decodes both opcode and num_operands as a single code. + // Returns SPV_UNSUPPORTED iff no suitable codec was found. + spv_result_t DecodeOpcodeAndNumberOfOperands(uint32_t* opcode, + uint32_t* num_operands); + + // Reads mtf rank from bit stream. |mtf| is used to determine the codec + // scheme. |fallback_method| is used if no codec defined for |mtf|. + spv_result_t DecodeMtfRankHuffman(uint64_t mtf, uint32_t fallback_method, + uint32_t* rank); + + // Reads id using coding based on mtf associated with the id descriptor. + // Returns SPV_UNSUPPORTED iff fallback method needs to be used. + spv_result_t DecodeIdWithDescriptor(uint32_t* id); + + // Reads id using coding based on the given |mtf|, which is expected to + // contain the needed |id|. + spv_result_t DecodeExistingId(uint64_t mtf, uint32_t* id); + + // Reads type id of the current instruction if can't be inferred. + spv_result_t DecodeTypeId(); + + // Reads result id of the current instruction if can't be inferred. + spv_result_t DecodeResultId(); + + // Reads id which is neither type nor result id. + spv_result_t DecodeRefId(uint32_t* id); + + // Reads and discards bits until the beginning of the next byte if the + // number of bits until the next byte is less than |byte_break_if_less_than|. + bool ReadToByteBreak(size_t byte_break_if_less_than); + + // Returns instruction words decoded up to this point. + const uint32_t* GetInstWords() const override { return inst_words_.data(); } + + // Reads a literal number as it is described in |operand| from the bit stream, + // decodes and writes it to spirv_. + spv_result_t DecodeLiteralNumber(const spv_parsed_operand_t& operand); + + // Reads instruction from bit stream, decodes and validates it. + // Decoded instruction is valid until the next call of DecodeInstruction(). + spv_result_t DecodeInstruction(); + + // Read operand from the stream decodes and validates it. + spv_result_t DecodeOperand(size_t operand_offset, + const spv_operand_type_t type, + spv_operand_pattern_t* expected_operands); + + // Records the numeric type for an operand according to the type information + // associated with the given non-zero type Id. This can fail if the type Id + // is not a type Id, or if the type Id does not reference a scalar numeric + // type. On success, return SPV_SUCCESS and populates the num_words, + // number_kind, and number_bit_width fields of parsed_operand. + spv_result_t SetNumericTypeInfoForType(spv_parsed_operand_t* parsed_operand, + uint32_t type_id); + + // Records the number type for the current instruction, if it generates a + // type. For types that aren't scalar numbers, record something with number + // kind SPV_NUMBER_NONE. + void RecordNumberType(); + + MarkvCodecOptions options_; + + // Temporary sink where decoded SPIR-V words are written. Once it contains the + // entire module, the container is moved and returned. + std::vector spirv_; + + // Bit stream containing encoded data. + BitReaderWord64 reader_; + + // Temporary storage for operands of the currently parsed instruction. + // Valid until next DecodeInstruction call. + std::vector parsed_operands_; + + // Temporary storage for current instruction words. + // Valid until next DecodeInstruction call. + std::vector inst_words_; + + // Maps a type ID to its number type description. + std::unordered_map type_id_to_number_type_info_; + + // Maps an ExtInstImport id to the extended instruction type. + std::unordered_map import_id_to_ext_inst_type_; +}; + +} // namespace comp +} // namespace spvtools + +#endif // SOURCE_COMP_MARKV_DECODER_H_ diff --git a/third_party/spirv-tools/source/comp/markv_encoder.cpp b/third_party/spirv-tools/source/comp/markv_encoder.cpp new file mode 100644 index 0000000000..1abd586460 --- /dev/null +++ b/third_party/spirv-tools/source/comp/markv_encoder.cpp @@ -0,0 +1,486 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "source/comp/markv_encoder.h" + +#include "source/binary.h" +#include "source/opcode.h" +#include "spirv-tools/libspirv.hpp" + +namespace spvtools { +namespace comp { +namespace { + +const size_t kCommentNumWhitespaces = 2; + +} // namespace + +spv_result_t MarkvEncoder::EncodeNonIdWord(uint32_t word) { + auto* codec = model_->GetNonIdWordHuffmanCodec(inst_.opcode, operand_index_); + + if (codec) { + uint64_t bits = 0; + size_t num_bits = 0; + if (codec->Encode(word, &bits, &num_bits)) { + // Encoding successful. + writer_.WriteBits(bits, num_bits); + return SPV_SUCCESS; + } else { + // Encoding failed, write kMarkvNoneOfTheAbove flag. + if (!codec->Encode(MarkvModel::GetMarkvNoneOfTheAbove(), &bits, + &num_bits)) + return Diag(SPV_ERROR_INTERNAL) + << "Non-id word Huffman table for " + << spvOpcodeString(SpvOp(inst_.opcode)) << " operand index " + << operand_index_ << " is missing kMarkvNoneOfTheAbove"; + writer_.WriteBits(bits, num_bits); + } + } + + // Fallback encoding. + const size_t chunk_length = + model_->GetOperandVariableWidthChunkLength(operand_.type); + if (chunk_length) { + writer_.WriteVariableWidthU32(word, chunk_length); + } else { + writer_.WriteUnencoded(word); + } + return SPV_SUCCESS; +} + +spv_result_t MarkvEncoder::EncodeOpcodeAndNumOperands(uint32_t opcode, + uint32_t num_operands) { + uint64_t bits = 0; + size_t num_bits = 0; + + const uint32_t word = opcode | (num_operands << 16); + + // First try to use the Markov chain codec. + auto* codec = + model_->GetOpcodeAndNumOperandsMarkovHuffmanCodec(GetPrevOpcode()); + if (codec) { + if (codec->Encode(word, &bits, &num_bits)) { + // The word was successfully encoded into bits/num_bits. + writer_.WriteBits(bits, num_bits); + return SPV_SUCCESS; + } else { + // The word is not in the Huffman table. Write kMarkvNoneOfTheAbove + // and use fallback encoding. + if (!codec->Encode(MarkvModel::GetMarkvNoneOfTheAbove(), &bits, + &num_bits)) + return Diag(SPV_ERROR_INTERNAL) + << "opcode_and_num_operands Huffman table for " + << spvOpcodeString(GetPrevOpcode()) + << "is missing kMarkvNoneOfTheAbove"; + writer_.WriteBits(bits, num_bits); + } + } + + // Fallback to base-rate codec. + codec = model_->GetOpcodeAndNumOperandsMarkovHuffmanCodec(SpvOpNop); + assert(codec); + if (codec->Encode(word, &bits, &num_bits)) { + // The word was successfully encoded into bits/num_bits. + writer_.WriteBits(bits, num_bits); + return SPV_SUCCESS; + } else { + // The word is not in the Huffman table. Write kMarkvNoneOfTheAbove + // and return false. + if (!codec->Encode(MarkvModel::GetMarkvNoneOfTheAbove(), &bits, &num_bits)) + return Diag(SPV_ERROR_INTERNAL) + << "Global opcode_and_num_operands Huffman table is missing " + << "kMarkvNoneOfTheAbove"; + writer_.WriteBits(bits, num_bits); + return SPV_UNSUPPORTED; + } +} + +spv_result_t MarkvEncoder::EncodeMtfRankHuffman(uint32_t rank, uint64_t mtf, + uint64_t fallback_method) { + const auto* codec = GetMtfHuffmanCodec(mtf); + if (!codec) { + assert(fallback_method != kMtfNone); + codec = GetMtfHuffmanCodec(fallback_method); + } + + if (!codec) return Diag(SPV_ERROR_INTERNAL) << "No codec to encode MTF rank"; + + uint64_t bits = 0; + size_t num_bits = 0; + if (rank < MarkvCodec::kMtfSmallestRankEncodedByValue) { + // Encode using Huffman coding. + if (!codec->Encode(rank, &bits, &num_bits)) + return Diag(SPV_ERROR_INTERNAL) + << "Failed to encode MTF rank with Huffman"; + + writer_.WriteBits(bits, num_bits); + } else { + // Encode by value. + if (!codec->Encode(MarkvCodec::kMtfRankEncodedByValueSignal, &bits, + &num_bits)) + return Diag(SPV_ERROR_INTERNAL) + << "Failed to encode kMtfRankEncodedByValueSignal"; + + writer_.WriteBits(bits, num_bits); + writer_.WriteVariableWidthU32( + rank - MarkvCodec::kMtfSmallestRankEncodedByValue, + model_->mtf_rank_chunk_length()); + } + return SPV_SUCCESS; +} + +spv_result_t MarkvEncoder::EncodeIdWithDescriptor(uint32_t id) { + // Get the descriptor for id. + const uint32_t long_descriptor = long_id_descriptors_.GetDescriptor(id); + auto* codec = + model_->GetIdDescriptorHuffmanCodec(inst_.opcode, operand_index_); + uint64_t bits = 0; + size_t num_bits = 0; + uint64_t mtf = kMtfNone; + if (long_descriptor && codec && + codec->Encode(long_descriptor, &bits, &num_bits)) { + // If the descriptor exists and is in the table, write the descriptor and + // proceed to encoding the rank. + writer_.WriteBits(bits, num_bits); + mtf = GetMtfLongIdDescriptor(long_descriptor); + } else { + if (codec) { + // The descriptor doesn't exist or we have no coding for it. Write + // kMarkvNoneOfTheAbove and go to fallback method. + if (!codec->Encode(MarkvModel::GetMarkvNoneOfTheAbove(), &bits, + &num_bits)) + return Diag(SPV_ERROR_INTERNAL) + << "Descriptor Huffman table for " + << spvOpcodeString(SpvOp(inst_.opcode)) << " operand index " + << operand_index_ << " is missing kMarkvNoneOfTheAbove"; + + writer_.WriteBits(bits, num_bits); + } + + if (model_->id_fallback_strategy() != + MarkvModel::IdFallbackStrategy::kShortDescriptor) { + return SPV_UNSUPPORTED; + } + + const uint32_t short_descriptor = short_id_descriptors_.GetDescriptor(id); + writer_.WriteBits(short_descriptor, MarkvCodec::kShortDescriptorNumBits); + + if (short_descriptor == 0) { + // Forward declared id. + return SPV_UNSUPPORTED; + } + + mtf = GetMtfShortIdDescriptor(short_descriptor); + } + + // Descriptor has been encoded. Now encode the rank of the id in the + // associated mtf sequence. + return EncodeExistingId(mtf, id); +} + +spv_result_t MarkvEncoder::EncodeExistingId(uint64_t mtf, uint32_t id) { + assert(multi_mtf_.GetSize(mtf) > 0); + if (multi_mtf_.GetSize(mtf) == 1) { + // If the sequence has only one element no need to write rank, the decoder + // would make the same decision. + return SPV_SUCCESS; + } + + uint32_t rank = 0; + if (!multi_mtf_.RankFromValue(mtf, id, &rank)) + return Diag(SPV_ERROR_INTERNAL) << "Id is not in the MTF sequence"; + + return EncodeMtfRankHuffman(rank, mtf, kMtfGenericNonZeroRank); +} + +spv_result_t MarkvEncoder::EncodeRefId(uint32_t id) { + { + // Try to encode using id descriptor mtfs. + const spv_result_t result = EncodeIdWithDescriptor(id); + if (result != SPV_UNSUPPORTED) return result; + // If can't be done continue with other methods. + } + + const bool can_forward_declare = spvOperandCanBeForwardDeclaredFunction( + SpvOp(inst_.opcode))(operand_index_); + uint32_t rank = 0; + + if (model_->id_fallback_strategy() == + MarkvModel::IdFallbackStrategy::kRuleBased) { + // Encode using rule-based mtf. + uint64_t mtf = GetRuleBasedMtf(); + + if (mtf != kMtfNone && !can_forward_declare) { + assert(multi_mtf_.HasValue(kMtfAll, id)); + return EncodeExistingId(mtf, id); + } + + if (mtf == kMtfNone) mtf = kMtfAll; + + if (!multi_mtf_.RankFromValue(mtf, id, &rank)) { + // This is the first occurrence of a forward declared id. + multi_mtf_.Insert(kMtfAll, id); + multi_mtf_.Insert(kMtfForwardDeclared, id); + if (mtf != kMtfAll) multi_mtf_.Insert(mtf, id); + rank = 0; + } + + return EncodeMtfRankHuffman(rank, mtf, kMtfAll); + } else { + assert(can_forward_declare); + + if (!multi_mtf_.RankFromValue(kMtfForwardDeclared, id, &rank)) { + // This is the first occurrence of a forward declared id. + multi_mtf_.Insert(kMtfForwardDeclared, id); + rank = 0; + } + + writer_.WriteVariableWidthU32(rank, model_->mtf_rank_chunk_length()); + return SPV_SUCCESS; + } +} + +spv_result_t MarkvEncoder::EncodeTypeId() { + if (inst_.opcode == SpvOpFunctionParameter) { + assert(!remaining_function_parameter_types_.empty()); + assert(inst_.type_id == remaining_function_parameter_types_.front()); + remaining_function_parameter_types_.pop_front(); + return SPV_SUCCESS; + } + + { + // Try to encode using id descriptor mtfs. + const spv_result_t result = EncodeIdWithDescriptor(inst_.type_id); + if (result != SPV_UNSUPPORTED) return result; + // If can't be done continue with other methods. + } + + assert(model_->id_fallback_strategy() == + MarkvModel::IdFallbackStrategy::kRuleBased); + + uint64_t mtf = GetRuleBasedMtf(); + assert(!spvOperandCanBeForwardDeclaredFunction(SpvOp(inst_.opcode))( + operand_index_)); + + if (mtf == kMtfNone) { + mtf = kMtfTypeNonFunction; + // Function types should have been handled by GetRuleBasedMtf. + assert(inst_.opcode != SpvOpFunction); + } + + return EncodeExistingId(mtf, inst_.type_id); +} + +spv_result_t MarkvEncoder::EncodeResultId() { + uint32_t rank = 0; + + const uint64_t num_still_forward_declared = + multi_mtf_.GetSize(kMtfForwardDeclared); + + if (num_still_forward_declared) { + // We write the rank only if kMtfForwardDeclared is not empty. If it is + // empty the decoder knows that there are no forward declared ids to expect. + if (multi_mtf_.RankFromValue(kMtfForwardDeclared, inst_.result_id, &rank)) { + // This is a definition of a forward declared id. We can remove the id + // from kMtfForwardDeclared. + if (!multi_mtf_.Remove(kMtfForwardDeclared, inst_.result_id)) + return Diag(SPV_ERROR_INTERNAL) + << "Failed to remove id from kMtfForwardDeclared"; + writer_.WriteBits(1, 1); + writer_.WriteVariableWidthU32(rank, model_->mtf_rank_chunk_length()); + } else { + rank = 0; + writer_.WriteBits(0, 1); + } + } + + if (model_->id_fallback_strategy() == + MarkvModel::IdFallbackStrategy::kRuleBased) { + if (!rank) { + multi_mtf_.Insert(kMtfAll, inst_.result_id); + } + } + + return SPV_SUCCESS; +} + +spv_result_t MarkvEncoder::EncodeLiteralNumber( + const spv_parsed_operand_t& operand) { + if (operand.number_bit_width <= 32) { + const uint32_t word = inst_.words[operand.offset]; + return EncodeNonIdWord(word); + } else { + assert(operand.number_bit_width <= 64); + const uint64_t word = uint64_t(inst_.words[operand.offset]) | + (uint64_t(inst_.words[operand.offset + 1]) << 32); + if (operand.number_kind == SPV_NUMBER_UNSIGNED_INT) { + writer_.WriteVariableWidthU64(word, model_->u64_chunk_length()); + } else if (operand.number_kind == SPV_NUMBER_SIGNED_INT) { + int64_t val = 0; + std::memcpy(&val, &word, 8); + writer_.WriteVariableWidthS64(val, model_->s64_chunk_length(), + model_->s64_block_exponent()); + } else if (operand.number_kind == SPV_NUMBER_FLOATING) { + writer_.WriteUnencoded(word); + } else { + return Diag(SPV_ERROR_INTERNAL) << "Unsupported bit length"; + } + } + return SPV_SUCCESS; +} + +void MarkvEncoder::AddByteBreak(size_t byte_break_if_less_than) { + const size_t num_bits_to_next_byte = + GetNumBitsToNextByte(writer_.GetNumBits()); + if (num_bits_to_next_byte == 0 || + num_bits_to_next_byte > byte_break_if_less_than) + return; + + if (logger_) { + logger_->AppendWhitespaces(kCommentNumWhitespaces); + logger_->AppendText(""); + } + + writer_.WriteBits(0, num_bits_to_next_byte); +} + +spv_result_t MarkvEncoder::EncodeInstruction( + const spv_parsed_instruction_t& inst) { + SpvOp opcode = SpvOp(inst.opcode); + inst_ = inst; + + LogDisassemblyInstruction(); + + const spv_result_t opcode_encodig_result = + EncodeOpcodeAndNumOperands(opcode, inst.num_operands); + if (opcode_encodig_result < 0) return opcode_encodig_result; + + if (opcode_encodig_result != SPV_SUCCESS) { + // Fallback encoding for opcode and num_operands. + writer_.WriteVariableWidthU32(opcode, model_->opcode_chunk_length()); + + if (!OpcodeHasFixedNumberOfOperands(opcode)) { + // If the opcode has a variable number of operands, encode the number of + // operands with the instruction. + + if (logger_) logger_->AppendWhitespaces(kCommentNumWhitespaces); + + writer_.WriteVariableWidthU16(inst.num_operands, + model_->num_operands_chunk_length()); + } + } + + // Write operands. + const uint32_t num_operands = inst_.num_operands; + for (operand_index_ = 0; operand_index_ < num_operands; ++operand_index_) { + operand_ = inst_.operands[operand_index_]; + + if (logger_) { + logger_->AppendWhitespaces(kCommentNumWhitespaces); + logger_->AppendText("<"); + logger_->AppendText(spvOperandTypeStr(operand_.type)); + logger_->AppendText(">"); + } + + switch (operand_.type) { + case SPV_OPERAND_TYPE_RESULT_ID: + case SPV_OPERAND_TYPE_TYPE_ID: + case SPV_OPERAND_TYPE_ID: + case SPV_OPERAND_TYPE_OPTIONAL_ID: + case SPV_OPERAND_TYPE_SCOPE_ID: + case SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID: { + const uint32_t id = inst_.words[operand_.offset]; + if (operand_.type == SPV_OPERAND_TYPE_TYPE_ID) { + const spv_result_t result = EncodeTypeId(); + if (result != SPV_SUCCESS) return result; + } else if (operand_.type == SPV_OPERAND_TYPE_RESULT_ID) { + const spv_result_t result = EncodeResultId(); + if (result != SPV_SUCCESS) return result; + } else { + const spv_result_t result = EncodeRefId(id); + if (result != SPV_SUCCESS) return result; + } + + PromoteIfNeeded(id); + break; + } + + case SPV_OPERAND_TYPE_LITERAL_INTEGER: { + const spv_result_t result = + EncodeNonIdWord(inst_.words[operand_.offset]); + if (result != SPV_SUCCESS) return result; + break; + } + + case SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER: { + const spv_result_t result = EncodeLiteralNumber(operand_); + if (result != SPV_SUCCESS) return result; + break; + } + + case SPV_OPERAND_TYPE_LITERAL_STRING: { + const char* src = + reinterpret_cast(&inst_.words[operand_.offset]); + + auto* codec = model_->GetLiteralStringHuffmanCodec(opcode); + if (codec) { + uint64_t bits = 0; + size_t num_bits = 0; + const std::string str = src; + if (codec->Encode(str, &bits, &num_bits)) { + writer_.WriteBits(bits, num_bits); + break; + } else { + bool result = + codec->Encode("kMarkvNoneOfTheAbove", &bits, &num_bits); + (void)result; + assert(result); + writer_.WriteBits(bits, num_bits); + } + } + + const size_t length = spv_strnlen_s(src, operand_.num_words * 4); + if (length == operand_.num_words * 4) + return Diag(SPV_ERROR_INVALID_BINARY) + << "Failed to find terminal character of literal string"; + for (size_t i = 0; i < length + 1; ++i) writer_.WriteUnencoded(src[i]); + break; + } + + default: { + for (int i = 0; i < operand_.num_words; ++i) { + const uint32_t word = inst_.words[operand_.offset + i]; + const spv_result_t result = EncodeNonIdWord(word); + if (result != SPV_SUCCESS) return result; + } + break; + } + } + } + + AddByteBreak(MarkvCodec::kByteBreakAfterInstIfLessThanUntilNextByte); + + if (logger_) { + logger_->NewLine(); + logger_->NewLine(); + if (!logger_->DebugInstruction(inst_)) return SPV_REQUESTED_TERMINATION; + } + + ProcessCurInstruction(); + + return SPV_SUCCESS; +} + +} // namespace comp +} // namespace spvtools diff --git a/third_party/spirv-tools/source/comp/markv_encoder.h b/third_party/spirv-tools/source/comp/markv_encoder.h new file mode 100644 index 0000000000..21843123f0 --- /dev/null +++ b/third_party/spirv-tools/source/comp/markv_encoder.h @@ -0,0 +1,167 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "source/comp/bit_stream.h" +#include "source/comp/markv.h" +#include "source/comp/markv_codec.h" +#include "source/comp/markv_logger.h" +#include "source/util/make_unique.h" + +#ifndef SOURCE_COMP_MARKV_ENCODER_H_ +#define SOURCE_COMP_MARKV_ENCODER_H_ + +#include + +namespace spvtools { +namespace comp { + +// SPIR-V to MARK-V encoder. Exposes functions EncodeHeader and +// EncodeInstruction which can be used as callback by spvBinaryParse. +// Encoded binary is written to an internally maintained bitstream. +// After the last instruction is encoded, the resulting MARK-V binary can be +// acquired by calling GetMarkvBinary(). +// +// The encoder uses SPIR-V validator to keep internal state, therefore +// SPIR-V binary needs to be able to pass validator checks. +// CreateCommentsLogger() can be used to enable the encoder to write comments +// on how encoding was done, which can later be accessed with GetComments(). +class MarkvEncoder : public MarkvCodec { + public: + // |model| is owned by the caller, must be not null and valid during the + // lifetime of MarkvEncoder. + MarkvEncoder(spv_const_context context, const MarkvCodecOptions& options, + const MarkvModel* model) + : MarkvCodec(context, GetValidatorOptions(options), model), + options_(options) {} + ~MarkvEncoder() override = default; + + // Writes data from SPIR-V header to MARK-V header. + spv_result_t EncodeHeader(spv_endianness_t /* endian */, uint32_t /* magic */, + uint32_t version, uint32_t generator, + uint32_t id_bound, uint32_t /* schema */) { + SetIdBound(id_bound); + header_.spirv_version = version; + header_.spirv_generator = generator; + return SPV_SUCCESS; + } + + // Creates an internal logger which writes comments on the encoding process. + void CreateLogger(MarkvLogConsumer log_consumer, + MarkvDebugConsumer debug_consumer) { + logger_ = MakeUnique(log_consumer, debug_consumer); + writer_.SetCallback( + [this](const std::string& str) { logger_->AppendBitSequence(str); }); + } + + // Encodes SPIR-V instruction to MARK-V and writes to bit stream. + // Operation can fail if the instruction fails to pass the validator or if + // the encoder stubmles on something unexpected. + spv_result_t EncodeInstruction(const spv_parsed_instruction_t& inst); + + // Concatenates MARK-V header and the bit stream with encoded instructions + // into a single buffer and returns it as spv_markv_binary. The returned + // value is owned by the caller and needs to be destroyed with + // spvMarkvBinaryDestroy(). + std::vector GetMarkvBinary() { + header_.markv_length_in_bits = + static_cast(sizeof(header_) * 8 + writer_.GetNumBits()); + header_.markv_model = + (model_->model_type() << 16) | model_->model_version(); + + const size_t num_bytes = sizeof(header_) + writer_.GetDataSizeBytes(); + std::vector markv(num_bytes); + + assert(writer_.GetData()); + std::memcpy(markv.data(), &header_, sizeof(header_)); + std::memcpy(markv.data() + sizeof(header_), writer_.GetData(), + writer_.GetDataSizeBytes()); + return markv; + } + + // Optionally adds disassembly to the comments. + // Disassembly should contain all instructions in the module separated by + // \n, and no header. + void SetDisassembly(std::string&& disassembly) { + disassembly_ = MakeUnique(std::move(disassembly)); + } + + // Extracts the next instruction line from the disassembly and logs it. + void LogDisassemblyInstruction() { + if (logger_ && disassembly_) { + std::string line; + std::getline(*disassembly_, line, '\n'); + logger_->AppendTextNewLine(line); + } + } + + private: + // Creates and returns validator options. Returned value owned by the caller. + static spv_validator_options GetValidatorOptions( + const MarkvCodecOptions& options) { + return options.validate_spirv_binary ? spvValidatorOptionsCreate() + : nullptr; + } + + // Writes a single word to bit stream. operand_.type determines if the word is + // encoded and how. + spv_result_t EncodeNonIdWord(uint32_t word); + + // Writes both opcode and num_operands as a single code. + // Returns SPV_UNSUPPORTED iff no suitable codec was found. + spv_result_t EncodeOpcodeAndNumOperands(uint32_t opcode, + uint32_t num_operands); + + // Writes mtf rank to bit stream. |mtf| is used to determine the codec + // scheme. |fallback_method| is used if no codec defined for |mtf|. + spv_result_t EncodeMtfRankHuffman(uint32_t rank, uint64_t mtf, + uint64_t fallback_method); + + // Writes id using coding based on mtf associated with the id descriptor. + // Returns SPV_UNSUPPORTED iff fallback method needs to be used. + spv_result_t EncodeIdWithDescriptor(uint32_t id); + + // Writes id using coding based on the given |mtf|, which is expected to + // contain the given |id|. + spv_result_t EncodeExistingId(uint64_t mtf, uint32_t id); + + // Writes type id of the current instruction if can't be inferred. + spv_result_t EncodeTypeId(); + + // Writes result id of the current instruction if can't be inferred. + spv_result_t EncodeResultId(); + + // Writes ids which are neither type nor result ids. + spv_result_t EncodeRefId(uint32_t id); + + // Writes bits to the stream until the beginning of the next byte if the + // number of bits until the next byte is less than |byte_break_if_less_than|. + void AddByteBreak(size_t byte_break_if_less_than); + + // Encodes a literal number operand and writes it to the bit stream. + spv_result_t EncodeLiteralNumber(const spv_parsed_operand_t& operand); + + MarkvCodecOptions options_; + + // Bit stream where encoded instructions are written. + BitWriterWord64 writer_; + + // If not nullptr, disassembled instruction lines will be written to comments. + // Format: \n separated instruction lines, no header. + std::unique_ptr disassembly_; +}; + +} // namespace comp +} // namespace spvtools + +#endif // SOURCE_COMP_MARKV_ENCODER_H_ diff --git a/third_party/spirv-tools/source/comp/markv_logger.h b/third_party/spirv-tools/source/comp/markv_logger.h new file mode 100644 index 0000000000..c07fe97b7a --- /dev/null +++ b/third_party/spirv-tools/source/comp/markv_logger.h @@ -0,0 +1,93 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SOURCE_COMP_MARKV_LOGGER_H_ +#define SOURCE_COMP_MARKV_LOGGER_H_ + +#include "source/comp/markv.h" + +namespace spvtools { +namespace comp { + +class MarkvLogger { + public: + MarkvLogger(MarkvLogConsumer log_consumer, MarkvDebugConsumer debug_consumer) + : log_consumer_(log_consumer), debug_consumer_(debug_consumer) {} + + void AppendText(const std::string& str) { + Append(str); + use_delimiter_ = false; + } + + void AppendTextNewLine(const std::string& str) { + Append(str); + Append("\n"); + use_delimiter_ = false; + } + + void AppendBitSequence(const std::string& str) { + if (debug_consumer_) instruction_bits_ << str; + if (use_delimiter_) Append("-"); + Append(str); + use_delimiter_ = true; + } + + void AppendWhitespaces(size_t num) { + Append(std::string(num, ' ')); + use_delimiter_ = false; + } + + void NewLine() { + Append("\n"); + use_delimiter_ = false; + } + + bool DebugInstruction(const spv_parsed_instruction_t& inst) { + bool result = true; + if (debug_consumer_) { + result = debug_consumer_( + std::vector(inst.words, inst.words + inst.num_words), + instruction_bits_.str(), instruction_comment_.str()); + instruction_bits_.str(std::string()); + instruction_comment_.str(std::string()); + } + return result; + } + + private: + MarkvLogger(const MarkvLogger&) = delete; + MarkvLogger(MarkvLogger&&) = delete; + MarkvLogger& operator=(const MarkvLogger&) = delete; + MarkvLogger& operator=(MarkvLogger&&) = delete; + + void Append(const std::string& str) { + if (log_consumer_) log_consumer_(str); + if (debug_consumer_) instruction_comment_ << str; + } + + MarkvLogConsumer log_consumer_; + MarkvDebugConsumer debug_consumer_; + + std::stringstream instruction_bits_; + std::stringstream instruction_comment_; + + // If true a delimiter will be appended before the next bit sequence. + // Used to generate outputs like: 1100-0 1110-1-1100-1-1111-0 110-0. + bool use_delimiter_ = false; +}; + +} // namespace comp +} // namespace spvtools + +#endif // SOURCE_COMP_MARKV_LOGGER_H_ diff --git a/third_party/spirv-tools/source/comp/markv_model.h b/third_party/spirv-tools/source/comp/markv_model.h old mode 100755 new mode 100644 index 852e58bedc..d03df02df9 --- a/third_party/spirv-tools/source/comp/markv_model.h +++ b/third_party/spirv-tools/source/comp/markv_model.h @@ -1,4 +1,4 @@ -// Copyright (c) 2017 Google Inc. +// Copyright (c) 2018 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,16 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_COMP_MARKV_MODEL_H_ -#define LIBSPIRV_COMP_MARKV_MODEL_H_ +#ifndef SOURCE_COMP_MARKV_MODEL_H_ +#define SOURCE_COMP_MARKV_MODEL_H_ -#include #include -#include -#include "latest_version_spirv_header.h" -#include "spirv-tools/libspirv.h" -#include "util/huffman_codec.h" +#include "source/comp/huffman_codec.h" +#include "source/latest_version_spirv_header.h" +#include "spirv-tools/libspirv.hpp" namespace spvtools { namespace comp { @@ -98,8 +96,8 @@ class MarkvModel { // Returns a codec for common opcode_and_num_operands words for the given // previous opcode. May return nullptr if the codec doesn't exist. - const utils::HuffmanCodec* - GetOpcodeAndNumOperandsMarkovHuffmanCodec(uint32_t prev_opcode) const { + const HuffmanCodec* GetOpcodeAndNumOperandsMarkovHuffmanCodec( + uint32_t prev_opcode) const { if (prev_opcode == SpvOpNop) return opcode_and_num_operands_huffman_codec_.get(); @@ -113,7 +111,7 @@ class MarkvModel { // Returns a codec for common non-id words used for given operand slot. // Operand slot is defined by the opcode and the operand index. // May return nullptr if the codec doesn't exist. - const utils::HuffmanCodec* GetNonIdWordHuffmanCodec( + const HuffmanCodec* GetNonIdWordHuffmanCodec( uint32_t opcode, uint32_t operand_index) const { const auto it = non_id_word_huffman_codecs_.find( std::pair(opcode, operand_index)); @@ -124,7 +122,7 @@ class MarkvModel { // Returns a codec for common id descriptos used for given operand slot. // Operand slot is defined by the opcode and the operand index. // May return nullptr if the codec doesn't exist. - const utils::HuffmanCodec* GetIdDescriptorHuffmanCodec( + const HuffmanCodec* GetIdDescriptorHuffmanCodec( uint32_t opcode, uint32_t operand_index) const { const auto it = id_descriptor_huffman_codecs_.find( std::pair(opcode, operand_index)); @@ -135,7 +133,7 @@ class MarkvModel { // Returns a codec for common strings used by the given opcode. // Operand slot is defined by the opcode and the operand index. // May return nullptr if the codec doesn't exist. - const utils::HuffmanCodec* GetLiteralStringHuffmanCodec( + const HuffmanCodec* GetLiteralStringHuffmanCodec( uint32_t opcode) const { const auto it = literal_string_huffman_codecs_.find(opcode); if (it == literal_string_huffman_codecs_.end()) return nullptr; @@ -179,23 +177,23 @@ class MarkvModel { protected: // Huffman codec for base-rate of opcode_and_num_operands. - std::unique_ptr> + std::unique_ptr> opcode_and_num_operands_huffman_codec_; // Huffman codecs for opcode_and_num_operands. The map key is previous opcode. - std::map>> + std::map>> opcode_and_num_operands_markov_huffman_codecs_; // Huffman codecs for non-id single-word operand values. // The map key is pair . std::map, - std::unique_ptr>> + std::unique_ptr>> non_id_word_huffman_codecs_; // Huffman codecs for id descriptors. The map key is pair // . std::map, - std::unique_ptr>> + std::unique_ptr>> id_descriptor_huffman_codecs_; // Set of all descriptors which have a coding scheme in any of @@ -206,7 +204,7 @@ class MarkvModel { // current instruction. This assumes, that there is no more than one literal // string operand per instruction, but would still work even if this is not // the case. Names and debug information strings are not collected. - std::map>> + std::map>> literal_string_huffman_codecs_; // Chunk lengths used for variable width encoding of operands (index is @@ -231,4 +229,4 @@ class MarkvModel { } // namespace comp } // namespace spvtools -#endif // LIBSPIRV_COMP_MARKV_MODEL_H_ +#endif // SOURCE_COMP_MARKV_MODEL_H_ diff --git a/third_party/spirv-tools/source/comp/move_to_front.cpp b/third_party/spirv-tools/source/comp/move_to_front.cpp new file mode 100644 index 0000000000..9d35a3f5b6 --- /dev/null +++ b/third_party/spirv-tools/source/comp/move_to_front.cpp @@ -0,0 +1,456 @@ +// Copyright (c) 2018 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "source/comp/move_to_front.h" + +#include +#include +#include +#include +#include +#include +#include + +namespace spvtools { +namespace comp { + +bool MoveToFront::Insert(uint32_t value) { + auto it = value_to_node_.find(value); + if (it != value_to_node_.end() && IsInTree(it->second)) return false; + + const uint32_t old_size = GetSize(); + (void)old_size; + + InsertNode(CreateNode(next_timestamp_++, value)); + + last_accessed_value_ = value; + last_accessed_value_valid_ = true; + + assert(value_to_node_.count(value)); + assert(old_size + 1 == GetSize()); + return true; +} + +bool MoveToFront::Remove(uint32_t value) { + auto it = value_to_node_.find(value); + if (it == value_to_node_.end()) return false; + + if (!IsInTree(it->second)) return false; + + if (last_accessed_value_ == value) last_accessed_value_valid_ = false; + + const uint32_t orphan = RemoveNode(it->second); + (void)orphan; + // The node of |value| is still alive but it's orphaned now. Can still be + // reused later. + assert(!IsInTree(orphan)); + assert(ValueOf(orphan) == value); + return true; +} + +bool MoveToFront::RankFromValue(uint32_t value, uint32_t* rank) { + if (last_accessed_value_valid_ && last_accessed_value_ == value) { + *rank = 1; + return true; + } + + const uint32_t old_size = GetSize(); + if (old_size == 1) { + if (ValueOf(root_) == value) { + *rank = 1; + return true; + } else { + return false; + } + } + + const auto it = value_to_node_.find(value); + if (it == value_to_node_.end()) { + return false; + } + + uint32_t target = it->second; + + if (!IsInTree(target)) { + return false; + } + + uint32_t node = target; + *rank = 1 + SizeOf(LeftOf(node)); + while (node) { + if (IsRightChild(node)) *rank += 1 + SizeOf(LeftOf(ParentOf(node))); + node = ParentOf(node); + } + + // Don't update timestamp if the node has rank 1. + if (*rank != 1) { + // Update timestamp and reposition the node. + target = RemoveNode(target); + assert(ValueOf(target) == value); + assert(old_size == GetSize() + 1); + MutableTimestampOf(target) = next_timestamp_++; + InsertNode(target); + assert(old_size == GetSize()); + } + + last_accessed_value_ = value; + last_accessed_value_valid_ = true; + return true; +} + +bool MoveToFront::HasValue(uint32_t value) const { + const auto it = value_to_node_.find(value); + if (it == value_to_node_.end()) { + return false; + } + + return IsInTree(it->second); +} + +bool MoveToFront::Promote(uint32_t value) { + if (last_accessed_value_valid_ && last_accessed_value_ == value) { + return true; + } + + const uint32_t old_size = GetSize(); + if (old_size == 1) return ValueOf(root_) == value; + + const auto it = value_to_node_.find(value); + if (it == value_to_node_.end()) { + return false; + } + + uint32_t target = it->second; + + if (!IsInTree(target)) { + return false; + } + + // Update timestamp and reposition the node. + target = RemoveNode(target); + assert(ValueOf(target) == value); + assert(old_size == GetSize() + 1); + + MutableTimestampOf(target) = next_timestamp_++; + InsertNode(target); + assert(old_size == GetSize()); + + last_accessed_value_ = value; + last_accessed_value_valid_ = true; + return true; +} + +bool MoveToFront::ValueFromRank(uint32_t rank, uint32_t* value) { + if (last_accessed_value_valid_ && rank == 1) { + *value = last_accessed_value_; + return true; + } + + const uint32_t old_size = GetSize(); + if (rank <= 0 || rank > old_size) { + return false; + } + + if (old_size == 1) { + *value = ValueOf(root_); + return true; + } + + const bool update_timestamp = (rank != 1); + + uint32_t node = root_; + while (node) { + const uint32_t left_subtree_num_nodes = SizeOf(LeftOf(node)); + if (rank == left_subtree_num_nodes + 1) { + // This is the node we are looking for. + // Don't update timestamp if the node has rank 1. + if (update_timestamp) { + node = RemoveNode(node); + assert(old_size == GetSize() + 1); + MutableTimestampOf(node) = next_timestamp_++; + InsertNode(node); + assert(old_size == GetSize()); + } + *value = ValueOf(node); + last_accessed_value_ = *value; + last_accessed_value_valid_ = true; + return true; + } + + if (rank < left_subtree_num_nodes + 1) { + // Descend into the left subtree. The rank is still valid. + node = LeftOf(node); + } else { + // Descend into the right subtree. We leave behind the left subtree and + // the current node, adjust the |rank| accordingly. + rank -= left_subtree_num_nodes + 1; + node = RightOf(node); + } + } + + assert(0); + return false; +} + +uint32_t MoveToFront::CreateNode(uint32_t timestamp, uint32_t value) { + uint32_t handle = static_cast(nodes_.size()); + const auto result = value_to_node_.emplace(value, handle); + if (result.second) { + // Create new node. + nodes_.emplace_back(Node()); + Node& node = nodes_.back(); + node.timestamp = timestamp; + node.value = value; + node.size = 1; + // Non-NIL nodes start with height 1 because their NIL children are + // leaves. + node.height = 1; + } else { + // Reuse old node. + handle = result.first->second; + assert(!IsInTree(handle)); + assert(ValueOf(handle) == value); + assert(SizeOf(handle) == 1); + assert(HeightOf(handle) == 1); + MutableTimestampOf(handle) = timestamp; + } + + return handle; +} + +void MoveToFront::InsertNode(uint32_t node) { + assert(!IsInTree(node)); + assert(SizeOf(node) == 1); + assert(HeightOf(node) == 1); + assert(TimestampOf(node)); + + if (!root_) { + root_ = node; + return; + } + + uint32_t iter = root_; + uint32_t parent = 0; + + // Will determine if |node| will become the right or left child after + // insertion (but before balancing). + bool right_child = true; + + // Find the node which will become |node|'s parent after insertion + // (but before balancing). + while (iter) { + parent = iter; + assert(TimestampOf(iter) != TimestampOf(node)); + right_child = TimestampOf(iter) > TimestampOf(node); + iter = right_child ? RightOf(iter) : LeftOf(iter); + } + + assert(parent); + + // Connect node and parent. + MutableParentOf(node) = parent; + if (right_child) + MutableRightOf(parent) = node; + else + MutableLeftOf(parent) = node; + + // Insertion is finished. Start the balancing process. + bool needs_rebalancing = true; + parent = ParentOf(node); + + while (parent) { + UpdateNode(parent); + + if (needs_rebalancing) { + const int parent_balance = BalanceOf(parent); + + if (RightOf(parent) == node) { + // Added node to the right subtree. + if (parent_balance > 1) { + // Parent is right heavy, rotate left. + if (BalanceOf(node) < 0) RotateRight(node); + parent = RotateLeft(parent); + } else if (parent_balance == 0 || parent_balance == -1) { + // Parent is balanced or left heavy, no need to balance further. + needs_rebalancing = false; + } + } else { + // Added node to the left subtree. + if (parent_balance < -1) { + // Parent is left heavy, rotate right. + if (BalanceOf(node) > 0) RotateLeft(node); + parent = RotateRight(parent); + } else if (parent_balance == 0 || parent_balance == 1) { + // Parent is balanced or right heavy, no need to balance further. + needs_rebalancing = false; + } + } + } + + assert(BalanceOf(parent) >= -1 && (BalanceOf(parent) <= 1)); + + node = parent; + parent = ParentOf(parent); + } +} + +uint32_t MoveToFront::RemoveNode(uint32_t node) { + if (LeftOf(node) && RightOf(node)) { + // If |node| has two children, then use another node as scapegoat and swap + // their contents. We pick the scapegoat on the side of the tree which has + // more nodes. + const uint32_t scapegoat = SizeOf(LeftOf(node)) >= SizeOf(RightOf(node)) + ? RightestDescendantOf(LeftOf(node)) + : LeftestDescendantOf(RightOf(node)); + assert(scapegoat); + std::swap(MutableValueOf(node), MutableValueOf(scapegoat)); + std::swap(MutableTimestampOf(node), MutableTimestampOf(scapegoat)); + value_to_node_[ValueOf(node)] = node; + value_to_node_[ValueOf(scapegoat)] = scapegoat; + node = scapegoat; + } + + // |node| may have only one child at this point. + assert(!RightOf(node) || !LeftOf(node)); + + uint32_t parent = ParentOf(node); + uint32_t child = RightOf(node) ? RightOf(node) : LeftOf(node); + + // Orphan |node| and reconnect parent and child. + if (child) MutableParentOf(child) = parent; + + if (parent) { + if (LeftOf(parent) == node) + MutableLeftOf(parent) = child; + else + MutableRightOf(parent) = child; + } + + MutableParentOf(node) = 0; + MutableLeftOf(node) = 0; + MutableRightOf(node) = 0; + UpdateNode(node); + const uint32_t orphan = node; + + if (root_ == node) root_ = child; + + // Removal is finished. Start the balancing process. + bool needs_rebalancing = true; + node = child; + + while (parent) { + UpdateNode(parent); + + if (needs_rebalancing) { + const int parent_balance = BalanceOf(parent); + + if (parent_balance == 1 || parent_balance == -1) { + // The height of the subtree was not changed. + needs_rebalancing = false; + } else { + if (RightOf(parent) == node) { + // Removed node from the right subtree. + if (parent_balance < -1) { + // Parent is left heavy, rotate right. + const uint32_t sibling = LeftOf(parent); + if (BalanceOf(sibling) > 0) RotateLeft(sibling); + parent = RotateRight(parent); + } + } else { + // Removed node from the left subtree. + if (parent_balance > 1) { + // Parent is right heavy, rotate left. + const uint32_t sibling = RightOf(parent); + if (BalanceOf(sibling) < 0) RotateRight(sibling); + parent = RotateLeft(parent); + } + } + } + } + + assert(BalanceOf(parent) >= -1 && (BalanceOf(parent) <= 1)); + + node = parent; + parent = ParentOf(parent); + } + + return orphan; +} + +uint32_t MoveToFront::RotateLeft(const uint32_t node) { + const uint32_t pivot = RightOf(node); + assert(pivot); + + // LeftOf(pivot) gets attached to node in place of pivot. + MutableRightOf(node) = LeftOf(pivot); + if (RightOf(node)) MutableParentOf(RightOf(node)) = node; + + // Pivot gets attached to ParentOf(node) in place of node. + MutableParentOf(pivot) = ParentOf(node); + if (!ParentOf(node)) + root_ = pivot; + else if (IsLeftChild(node)) + MutableLeftOf(ParentOf(node)) = pivot; + else + MutableRightOf(ParentOf(node)) = pivot; + + // Node is child of pivot. + MutableLeftOf(pivot) = node; + MutableParentOf(node) = pivot; + + // Update both node and pivot. Pivot is the new parent of node, so node should + // be updated first. + UpdateNode(node); + UpdateNode(pivot); + + return pivot; +} + +uint32_t MoveToFront::RotateRight(const uint32_t node) { + const uint32_t pivot = LeftOf(node); + assert(pivot); + + // RightOf(pivot) gets attached to node in place of pivot. + MutableLeftOf(node) = RightOf(pivot); + if (LeftOf(node)) MutableParentOf(LeftOf(node)) = node; + + // Pivot gets attached to ParentOf(node) in place of node. + MutableParentOf(pivot) = ParentOf(node); + if (!ParentOf(node)) + root_ = pivot; + else if (IsLeftChild(node)) + MutableLeftOf(ParentOf(node)) = pivot; + else + MutableRightOf(ParentOf(node)) = pivot; + + // Node is child of pivot. + MutableRightOf(pivot) = node; + MutableParentOf(node) = pivot; + + // Update both node and pivot. Pivot is the new parent of node, so node should + // be updated first. + UpdateNode(node); + UpdateNode(pivot); + + return pivot; +} + +void MoveToFront::UpdateNode(uint32_t node) { + MutableSizeOf(node) = 1 + SizeOf(LeftOf(node)) + SizeOf(RightOf(node)); + MutableHeightOf(node) = + 1 + std::max(HeightOf(LeftOf(node)), HeightOf(RightOf(node))); +} + +} // namespace comp +} // namespace spvtools diff --git a/third_party/spirv-tools/source/comp/move_to_front.h b/third_party/spirv-tools/source/comp/move_to_front.h new file mode 100644 index 0000000000..8752194ece --- /dev/null +++ b/third_party/spirv-tools/source/comp/move_to_front.h @@ -0,0 +1,384 @@ +// Copyright (c) 2017 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SOURCE_COMP_MOVE_TO_FRONT_H_ +#define SOURCE_COMP_MOVE_TO_FRONT_H_ + +#include +#include +#include +#include +#include +#include + +namespace spvtools { +namespace comp { + +// Log(n) move-to-front implementation. Implements the following functions: +// Insert - pushes value to the front of the mtf sequence +// (only unique values allowed). +// Remove - remove value from the sequence. +// ValueFromRank - access value by its 1-indexed rank in the sequence. +// RankFromValue - get the rank of the given value in the sequence. +// Accessing a value with ValueFromRank or RankFromValue moves the value to the +// front of the sequence (rank of 1). +// +// The implementation is based on an AVL-based order statistic tree. The tree +// is ordered by timestamps issued when values are inserted or accessed (recent +// values go to the left side of the tree, old values are gradually rotated to +// the right side). +// +// Terminology +// rank: 1-indexed rank showing how recently the value was inserted or accessed. +// node: handle used internally to access node data. +// size: size of the subtree of a node (including the node). +// height: distance from a node to the farthest leaf. +class MoveToFront { + public: + explicit MoveToFront(size_t reserve_capacity = 4) { + nodes_.reserve(reserve_capacity); + + // Create NIL node. + nodes_.emplace_back(Node()); + } + + virtual ~MoveToFront() = default; + + // Inserts value in the move-to-front sequence. Does nothing if the value is + // already in the sequence. Returns true if insertion was successful. + // The inserted value is placed at the front of the sequence (rank 1). + bool Insert(uint32_t value); + + // Removes value from move-to-front sequence. Returns false iff the value + // was not found. + bool Remove(uint32_t value); + + // Computes 1-indexed rank of value in the move-to-front sequence and moves + // the value to the front. Example: + // Before the call: 4 8 2 1 7 + // RankFromValue(8) returns 2 + // After the call: 8 4 2 1 7 + // Returns true iff the value was found in the sequence. + bool RankFromValue(uint32_t value, uint32_t* rank); + + // Returns value corresponding to a 1-indexed rank in the move-to-front + // sequence and moves the value to the front. Example: + // Before the call: 4 8 2 1 7 + // ValueFromRank(2) returns 8 + // After the call: 8 4 2 1 7 + // Returns true iff the rank is within bounds [1, GetSize()]. + bool ValueFromRank(uint32_t rank, uint32_t* value); + + // Moves the value to the front of the sequence. + // Returns false iff value is not in the sequence. + bool Promote(uint32_t value); + + // Returns true iff the move-to-front sequence contains the value. + bool HasValue(uint32_t value) const; + + // Returns the number of elements in the move-to-front sequence. + uint32_t GetSize() const { return SizeOf(root_); } + + protected: + // Internal tree data structure uses handles instead of pointers. Leaves and + // root parent reference a singleton under handle 0. Although dereferencing + // a null pointer is not possible, inappropriate access to handle 0 would + // cause an assertion. Handles are not garbage collected if value was + // deprecated + // with DeprecateValue(). But handles are recycled when a node is + // repositioned. + + // Internal tree data structure node. + struct Node { + // Timestamp from a logical clock which updates every time the element is + // accessed through ValueFromRank or RankFromValue. + uint32_t timestamp = 0; + // The size of the node's subtree, including the node. + // SizeOf(LeftOf(node)) + SizeOf(RightOf(node)) + 1. + uint32_t size = 0; + // Handles to connected nodes. + uint32_t left = 0; + uint32_t right = 0; + uint32_t parent = 0; + // Distance to the farthest leaf. + // Leaves have height 0, real nodes at least 1. + uint32_t height = 0; + // Stored value. + uint32_t value = 0; + }; + + // Creates node and sets correct values. Non-NIL nodes should be created only + // through this function. If the node with this value has been created + // previously + // and since orphaned, reuses the old node instead of creating a new one. + uint32_t CreateNode(uint32_t timestamp, uint32_t value); + + // Node accessor methods. Naming is designed to be similar to natural + // language as these functions tend to be used in sequences, for example: + // ParentOf(LeftestDescendentOf(RightOf(node))) + + // Returns value of the node referenced by |handle|. + uint32_t ValueOf(uint32_t node) const { return nodes_.at(node).value; } + + // Returns left child of |node|. + uint32_t LeftOf(uint32_t node) const { return nodes_.at(node).left; } + + // Returns right child of |node|. + uint32_t RightOf(uint32_t node) const { return nodes_.at(node).right; } + + // Returns parent of |node|. + uint32_t ParentOf(uint32_t node) const { return nodes_.at(node).parent; } + + // Returns timestamp of |node|. + uint32_t TimestampOf(uint32_t node) const { + assert(node); + return nodes_.at(node).timestamp; + } + + // Returns size of |node|. + uint32_t SizeOf(uint32_t node) const { return nodes_.at(node).size; } + + // Returns height of |node|. + uint32_t HeightOf(uint32_t node) const { return nodes_.at(node).height; } + + // Returns mutable reference to value of |node|. + uint32_t& MutableValueOf(uint32_t node) { + assert(node); + return nodes_.at(node).value; + } + + // Returns mutable reference to handle of left child of |node|. + uint32_t& MutableLeftOf(uint32_t node) { + assert(node); + return nodes_.at(node).left; + } + + // Returns mutable reference to handle of right child of |node|. + uint32_t& MutableRightOf(uint32_t node) { + assert(node); + return nodes_.at(node).right; + } + + // Returns mutable reference to handle of parent of |node|. + uint32_t& MutableParentOf(uint32_t node) { + assert(node); + return nodes_.at(node).parent; + } + + // Returns mutable reference to timestamp of |node|. + uint32_t& MutableTimestampOf(uint32_t node) { + assert(node); + return nodes_.at(node).timestamp; + } + + // Returns mutable reference to size of |node|. + uint32_t& MutableSizeOf(uint32_t node) { + assert(node); + return nodes_.at(node).size; + } + + // Returns mutable reference to height of |node|. + uint32_t& MutableHeightOf(uint32_t node) { + assert(node); + return nodes_.at(node).height; + } + + // Returns true iff |node| is left child of its parent. + bool IsLeftChild(uint32_t node) const { + assert(node); + return LeftOf(ParentOf(node)) == node; + } + + // Returns true iff |node| is right child of its parent. + bool IsRightChild(uint32_t node) const { + assert(node); + return RightOf(ParentOf(node)) == node; + } + + // Returns true iff |node| has no relatives. + bool IsOrphan(uint32_t node) const { + assert(node); + return !ParentOf(node) && !LeftOf(node) && !RightOf(node); + } + + // Returns true iff |node| is in the tree. + bool IsInTree(uint32_t node) const { + assert(node); + return node == root_ || !IsOrphan(node); + } + + // Returns the height difference between right and left subtrees. + int BalanceOf(uint32_t node) const { + return int(HeightOf(RightOf(node))) - int(HeightOf(LeftOf(node))); + } + + // Updates size and height of the node, assuming that the children have + // correct values. + void UpdateNode(uint32_t node); + + // Returns the most LeftOf(LeftOf(... descendent which is not leaf. + uint32_t LeftestDescendantOf(uint32_t node) const { + uint32_t parent = 0; + while (node) { + parent = node; + node = LeftOf(node); + } + return parent; + } + + // Returns the most RightOf(RightOf(... descendent which is not leaf. + uint32_t RightestDescendantOf(uint32_t node) const { + uint32_t parent = 0; + while (node) { + parent = node; + node = RightOf(node); + } + return parent; + } + + // Inserts node in the tree. The node must be an orphan. + void InsertNode(uint32_t node); + + // Removes node from the tree. May change value_to_node_ if removal uses a + // scapegoat. Returns the removed (orphaned) handle for recycling. The + // returned handle may not be equal to |node| if scapegoat was used. + uint32_t RemoveNode(uint32_t node); + + // Rotates |node| left, reassigns all connections and returns the node + // which takes place of the |node|. + uint32_t RotateLeft(const uint32_t node); + + // Rotates |node| right, reassigns all connections and returns the node + // which takes place of the |node|. + uint32_t RotateRight(const uint32_t node); + + // Root node handle. The tree is empty if root_ is 0. + uint32_t root_ = 0; + + // Incremented counters for next timestamp and value. + uint32_t next_timestamp_ = 1; + + // Holds all tree nodes. Indices of this vector are node handles. + std::vector nodes_; + + // Maps ids to node handles. + std::unordered_map value_to_node_; + + // Cache for the last accessed value in the sequence. + uint32_t last_accessed_value_ = 0; + bool last_accessed_value_valid_ = false; +}; + +class MultiMoveToFront { + public: + // Inserts |value| to sequence with handle |mtf|. + // Returns false if |mtf| already has |value|. + bool Insert(uint64_t mtf, uint32_t value) { + if (GetMtf(mtf).Insert(value)) { + val_to_mtfs_[value].insert(mtf); + return true; + } + return false; + } + + // Removes |value| from sequence with handle |mtf|. + // Returns false if |mtf| doesn't have |value|. + bool Remove(uint64_t mtf, uint32_t value) { + if (GetMtf(mtf).Remove(value)) { + val_to_mtfs_[value].erase(mtf); + return true; + } + assert(val_to_mtfs_[value].count(mtf) == 0); + return false; + } + + // Removes |value| from all sequences which have it. + void RemoveFromAll(uint32_t value) { + auto it = val_to_mtfs_.find(value); + if (it == val_to_mtfs_.end()) return; + + auto& mtfs_containing_value = it->second; + for (uint64_t mtf : mtfs_containing_value) { + GetMtf(mtf).Remove(value); + } + + val_to_mtfs_.erase(value); + } + + // Computes rank of |value| in sequence |mtf|. + // Returns false if |mtf| doesn't have |value|. + bool RankFromValue(uint64_t mtf, uint32_t value, uint32_t* rank) { + return GetMtf(mtf).RankFromValue(value, rank); + } + + // Finds |value| with |rank| in sequence |mtf|. + // Returns false if |rank| is out of bounds. + bool ValueFromRank(uint64_t mtf, uint32_t rank, uint32_t* value) { + return GetMtf(mtf).ValueFromRank(rank, value); + } + + // Returns size of |mtf| sequence. + uint32_t GetSize(uint64_t mtf) { return GetMtf(mtf).GetSize(); } + + // Promotes |value| in all sequences which have it. + void Promote(uint32_t value) { + const auto it = val_to_mtfs_.find(value); + if (it == val_to_mtfs_.end()) return; + + const auto& mtfs_containing_value = it->second; + for (uint64_t mtf : mtfs_containing_value) { + GetMtf(mtf).Promote(value); + } + } + + // Inserts |value| in sequence |mtf| or promotes if it's already there. + void InsertOrPromote(uint64_t mtf, uint32_t value) { + if (!Insert(mtf, value)) { + GetMtf(mtf).Promote(value); + } + } + + // Returns if |mtf| sequence has |value|. + bool HasValue(uint64_t mtf, uint32_t value) { + return GetMtf(mtf).HasValue(value); + } + + private: + // Returns actual MoveToFront object corresponding to |handle|. + // As multiple operations are often performed consecutively for the same + // sequence, the last returned value is cached. + MoveToFront& GetMtf(uint64_t handle) { + if (!cached_mtf_ || cached_handle_ != handle) { + cached_handle_ = handle; + cached_mtf_ = &mtfs_[handle]; + } + + return *cached_mtf_; + } + + // Container holding MoveToFront objects. Map key is sequence handle. + std::map mtfs_; + + // Container mapping value to sequences which contain that value. + std::unordered_map> val_to_mtfs_; + + // Cache for the last accessed sequence. + uint64_t cached_handle_ = 0; + MoveToFront* cached_mtf_ = nullptr; +}; + +} // namespace comp +} // namespace spvtools + +#endif // SOURCE_COMP_MOVE_TO_FRONT_H_ diff --git a/third_party/spirv-tools/source/diagnostic.cpp b/third_party/spirv-tools/source/diagnostic.cpp old mode 100755 new mode 100644 index ad9d3836ba..edc27c8fd9 --- a/third_party/spirv-tools/source/diagnostic.cpp +++ b/third_party/spirv-tools/source/diagnostic.cpp @@ -12,14 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "diagnostic.h" +#include "source/diagnostic.h" #include #include #include #include +#include -#include "table.h" +#include "source/table.h" // Diagnostic API @@ -57,14 +58,14 @@ spv_result_t spvDiagnosticPrint(const spv_diagnostic diagnostic) { << diagnostic->position.column + 1 << ": " << diagnostic->error << "\n"; return SPV_SUCCESS; - } else { - // NOTE: Assume this is a binary position - std::cerr << "error: "; - if (diagnostic->position.index > 0) - std::cerr << diagnostic->position.index << ": "; - std::cerr << diagnostic->error << "\n"; - return SPV_SUCCESS; } + + // NOTE: Assume this is a binary position + std::cerr << "error: "; + if (diagnostic->position.index > 0) + std::cerr << diagnostic->position.index << ": "; + std::cerr << diagnostic->error << "\n"; + return SPV_SUCCESS; } namespace spvtools { diff --git a/third_party/spirv-tools/source/diagnostic.h b/third_party/spirv-tools/source/diagnostic.h old mode 100755 new mode 100644 index 2b52bbc24f..22df961432 --- a/third_party/spirv-tools/source/diagnostic.h +++ b/third_party/spirv-tools/source/diagnostic.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_DIAGNOSTIC_H_ -#define LIBSPIRV_DIAGNOSTIC_H_ +#ifndef SOURCE_DIAGNOSTIC_H_ +#define SOURCE_DIAGNOSTIC_H_ #include #include @@ -76,4 +76,4 @@ std::string spvResultToString(spv_result_t res); } // namespace spvtools -#endif // LIBSPIRV_DIAGNOSTIC_H_ +#endif // SOURCE_DIAGNOSTIC_H_ diff --git a/third_party/spirv-tools/source/disassemble.cpp b/third_party/spirv-tools/source/disassemble.cpp old mode 100755 new mode 100644 index 7bd64a73fe..c116f50722 --- a/third_party/spirv-tools/source/disassemble.cpp +++ b/third_party/spirv-tools/source/disassemble.cpp @@ -21,20 +21,22 @@ #include #include #include +#include -#include "assembly_grammar.h" -#include "binary.h" -#include "diagnostic.h" -#include "disassemble.h" -#include "ext_inst.h" -#include "name_mapper.h" -#include "opcode.h" -#include "parsed_operand.h" -#include "print.h" +#include "source/assembly_grammar.h" +#include "source/binary.h" +#include "source/diagnostic.h" +#include "source/disassemble.h" +#include "source/ext_inst.h" +#include "source/name_mapper.h" +#include "source/opcode.h" +#include "source/parsed_operand.h" +#include "source/print.h" +#include "source/spirv_constant.h" +#include "source/spirv_endian.h" +#include "source/util/hex_float.h" +#include "source/util/make_unique.h" #include "spirv-tools/libspirv.h" -#include "spirv_constant.h" -#include "spirv_endian.h" -#include "util/hex_float.h" namespace { @@ -418,8 +420,8 @@ spv_result_t spvBinaryToText(const spv_const_context context, std::unique_ptr friendly_mapper; spvtools::NameMapper name_mapper = spvtools::GetTrivialNameMapper(); if (options & SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES) { - friendly_mapper.reset( - new spvtools::FriendlyNameMapper(&hijack_context, code, wordCount)); + friendly_mapper = spvtools::MakeUnique( + &hijack_context, code, wordCount); name_mapper = friendly_mapper->GetNameMapper(); } @@ -451,8 +453,8 @@ std::string spvtools::spvInstructionBinaryToText(const spv_target_env env, std::unique_ptr friendly_mapper; spvtools::NameMapper name_mapper = spvtools::GetTrivialNameMapper(); if (options & SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES) { - friendly_mapper.reset( - new spvtools::FriendlyNameMapper(context, code, wordCount)); + friendly_mapper = spvtools::MakeUnique( + context, code, wordCount); name_mapper = friendly_mapper->GetNameMapper(); } diff --git a/third_party/spirv-tools/source/disassemble.h b/third_party/spirv-tools/source/disassemble.h old mode 100755 new mode 100644 index b833dd07a1..ac3574272a --- a/third_party/spirv-tools/source/disassemble.h +++ b/third_party/spirv-tools/source/disassemble.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef SPIRV_TOOLS_DISASSEMBLE_H_ -#define SPIRV_TOOLS_DISASSEMBLE_H_ +#ifndef SOURCE_DISASSEMBLE_H_ +#define SOURCE_DISASSEMBLE_H_ #include @@ -35,4 +35,4 @@ std::string spvInstructionBinaryToText(const spv_target_env env, } // namespace spvtools -#endif // SPIRV_TOOLS_DISASSEMBLE_H_ +#endif // SOURCE_DISASSEMBLE_H_ diff --git a/third_party/spirv-tools/source/enum_set.h b/third_party/spirv-tools/source/enum_set.h old mode 100755 new mode 100644 index c4b69914a5..e4ef297cd7 --- a/third_party/spirv-tools/source/enum_set.h +++ b/third_party/spirv-tools/source/enum_set.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_ENUM_SET_H -#define LIBSPIRV_ENUM_SET_H +#ifndef SOURCE_ENUM_SET_H_ +#define SOURCE_ENUM_SET_H_ #include #include @@ -21,7 +21,8 @@ #include #include -#include "latest_version_spirv_header.h" +#include "source/latest_version_spirv_header.h" +#include "source/util/make_unique.h" namespace spvtools { @@ -152,7 +153,7 @@ class EnumSet { // allocated if one doesn't exist yet. Returns overflow_set_. OverflowSetType& Overflow() { if (overflow_.get() == nullptr) { - overflow_.reset(new OverflowSetType); + overflow_ = MakeUnique(); } return *overflow_; } @@ -169,4 +170,4 @@ using CapabilitySet = EnumSet; } // namespace spvtools -#endif // LIBSPIRV_ENUM_SET_H +#endif // SOURCE_ENUM_SET_H_ diff --git a/third_party/spirv-tools/source/enum_string_mapping.cpp b/third_party/spirv-tools/source/enum_string_mapping.cpp old mode 100755 new mode 100644 index 20bbdfc108..32361a08d3 --- a/third_party/spirv-tools/source/enum_string_mapping.cpp +++ b/third_party/spirv-tools/source/enum_string_mapping.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "enum_string_mapping.h" +#include "source/enum_string_mapping.h" #include #include @@ -20,7 +20,7 @@ #include #include -#include "extensions.h" +#include "source/extensions.h" namespace spvtools { diff --git a/third_party/spirv-tools/source/enum_string_mapping.h b/third_party/spirv-tools/source/enum_string_mapping.h old mode 100755 new mode 100644 index 4d18740c7a..af8f56b82a --- a/third_party/spirv-tools/source/enum_string_mapping.h +++ b/third_party/spirv-tools/source/enum_string_mapping.h @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_ENUM_STRING_MAPPING_H_ -#define LIBSPIRV_ENUM_STRING_MAPPING_H_ +#ifndef SOURCE_ENUM_STRING_MAPPING_H_ +#define SOURCE_ENUM_STRING_MAPPING_H_ #include -#include "extensions.h" -#include "latest_version_spirv_header.h" +#include "source/extensions.h" +#include "source/latest_version_spirv_header.h" namespace spvtools { @@ -33,4 +33,4 @@ const char* CapabilityToString(SpvCapability capability); } // namespace spvtools -#endif // LIBSPIRV_ENUM_STRING_MAPPING_H_ +#endif // SOURCE_ENUM_STRING_MAPPING_H_ diff --git a/third_party/spirv-tools/source/ext_inst.cpp b/third_party/spirv-tools/source/ext_inst.cpp old mode 100755 new mode 100644 index acc6dc658d..a4c00c2fff --- a/third_party/spirv-tools/source/ext_inst.cpp +++ b/third_party/spirv-tools/source/ext_inst.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "ext_inst.h" +#include "source/ext_inst.h" #include #include @@ -22,14 +22,14 @@ // TODO(dneto): DebugInfo.h should probably move to SPIRV-Headers. #include "DebugInfo.h" -#include "latest_version_glsl_std_450_header.h" -#include "latest_version_opencl_std_header.h" -#include "macro.h" -#include "spirv_definition.h" +#include "source/latest_version_glsl_std_450_header.h" +#include "source/latest_version_opencl_std_header.h" +#include "source/macro.h" +#include "source/spirv_definition.h" -#include "debuginfo.insts.inc" // defines opencl_entries -#include "glsl.std.450.insts.inc" // defines glsl_entries -#include "opencl.std.insts.inc" // defines opencl_entries +#include "debuginfo.insts.inc" +#include "glsl.std.450.insts.inc" +#include "opencl.std.insts.inc" #include "spv-amd-gcn-shader.insts.inc" #include "spv-amd-shader-ballot.insts.inc" diff --git a/third_party/spirv-tools/source/ext_inst.h b/third_party/spirv-tools/source/ext_inst.h old mode 100755 new mode 100644 index 1a16b4b2d4..a821cc2bc7 --- a/third_party/spirv-tools/source/ext_inst.h +++ b/third_party/spirv-tools/source/ext_inst.h @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_EXT_INST_H_ -#define LIBSPIRV_EXT_INST_H_ +#ifndef SOURCE_EXT_INST_H_ +#define SOURCE_EXT_INST_H_ +#include "source/table.h" #include "spirv-tools/libspirv.h" -#include "table.h" // Gets the type of the extended instruction set with the specified name. spv_ext_inst_type_t spvExtInstImportTypeGet(const char* name); @@ -37,4 +37,4 @@ spv_result_t spvExtInstTableValueLookup(const spv_ext_inst_table table, const uint32_t value, spv_ext_inst_desc* pEntry); -#endif // LIBSPIRV_EXT_INST_H_ +#endif // SOURCE_EXT_INST_H_ diff --git a/third_party/spirv-tools/source/extensions.cpp b/third_party/spirv-tools/source/extensions.cpp old mode 100755 new mode 100644 index bf3849cbff..a94db273e7 --- a/third_party/spirv-tools/source/extensions.cpp +++ b/third_party/spirv-tools/source/extensions.cpp @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "extensions.h" +#include "source/extensions.h" #include #include #include -#include "enum_string_mapping.h" +#include "source/enum_string_mapping.h" namespace spvtools { diff --git a/third_party/spirv-tools/source/extensions.h b/third_party/spirv-tools/source/extensions.h old mode 100755 new mode 100644 index 3957b1c03f..8023444c31 --- a/third_party/spirv-tools/source/extensions.h +++ b/third_party/spirv-tools/source/extensions.h @@ -12,12 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_EXTENSIONS_H_ -#define LIBSPIRV_EXTENSIONS_H_ +#ifndef SOURCE_EXTENSIONS_H_ +#define SOURCE_EXTENSIONS_H_ #include -#include "enum_set.h" +#include "source/enum_set.h" #include "spirv-tools/libspirv.h" namespace spvtools { @@ -37,4 +37,4 @@ std::string ExtensionSetToString(const ExtensionSet& extensions); } // namespace spvtools -#endif // LIBSPIRV_EXTENSIONS_H_ +#endif // SOURCE_EXTENSIONS_H_ diff --git a/third_party/spirv-tools/source/extinst.debuginfo.grammar.json b/third_party/spirv-tools/source/extinst.debuginfo.grammar.json old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/source/extinst.spv-amd-gcn-shader.grammar.json b/third_party/spirv-tools/source/extinst.spv-amd-gcn-shader.grammar.json old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/source/extinst.spv-amd-shader-ballot.grammar.json b/third_party/spirv-tools/source/extinst.spv-amd-shader-ballot.grammar.json old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/source/extinst.spv-amd-shader-explicit-vertex-parameter.grammar.json b/third_party/spirv-tools/source/extinst.spv-amd-shader-explicit-vertex-parameter.grammar.json old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/source/extinst.spv-amd-shader-trinary-minmax.grammar.json b/third_party/spirv-tools/source/extinst.spv-amd-shader-trinary-minmax.grammar.json old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/source/id_descriptor.cpp b/third_party/spirv-tools/source/id_descriptor.cpp old mode 100755 new mode 100644 index 9dd4327700..d44ed672c2 --- a/third_party/spirv-tools/source/id_descriptor.cpp +++ b/third_party/spirv-tools/source/id_descriptor.cpp @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "id_descriptor.h" +#include "source/id_descriptor.h" #include #include -#include "opcode.h" -#include "operand.h" +#include "source/opcode.h" +#include "source/operand.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/source/id_descriptor.h b/third_party/spirv-tools/source/id_descriptor.h old mode 100755 new mode 100644 index 8bde783e7e..add23343a1 --- a/third_party/spirv-tools/source/id_descriptor.h +++ b/third_party/spirv-tools/source/id_descriptor.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_ID_DESCRIPTOR_H_ -#define LIBSPIRV_ID_DESCRIPTOR_H_ +#ifndef SOURCE_ID_DESCRIPTOR_H_ +#define SOURCE_ID_DESCRIPTOR_H_ #include #include @@ -60,4 +60,4 @@ class IdDescriptorCollection { } // namespace spvtools -#endif // LIBSPIRV_ID_DESCRIPTOR_H_ +#endif // SOURCE_ID_DESCRIPTOR_H_ diff --git a/third_party/spirv-tools/source/instruction.h b/third_party/spirv-tools/source/instruction.h old mode 100755 new mode 100644 index 884276d7e4..9e7dccd03b --- a/third_party/spirv-tools/source/instruction.h +++ b/third_party/spirv-tools/source/instruction.h @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_INSTRUCTION_H_ -#define LIBSPIRV_INSTRUCTION_H_ +#ifndef SOURCE_INSTRUCTION_H_ +#define SOURCE_INSTRUCTION_H_ #include #include -#include "latest_version_spirv_header.h" +#include "source/latest_version_spirv_header.h" #include "spirv-tools/libspirv.h" // Describes an instruction. @@ -46,4 +46,4 @@ inline void spvInstructionAddWord(spv_instruction_t* inst, uint32_t value) { inst->words.push_back(value); } -#endif // LIBSPIRV_INSTRUCTION_H_ +#endif // SOURCE_INSTRUCTION_H_ diff --git a/third_party/spirv-tools/source/latest_version_glsl_std_450_header.h b/third_party/spirv-tools/source/latest_version_glsl_std_450_header.h old mode 100755 new mode 100644 index b9e9ae275c..bed1f2502e --- a/third_party/spirv-tools/source/latest_version_glsl_std_450_header.h +++ b/third_party/spirv-tools/source/latest_version_glsl_std_450_header.h @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_LATEST_VERSION_GLSL_STD_450_HEADER_H_ -#define LIBSPIRV_LATEST_VERSION_GLSL_STD_450_HEADER_H_ +#ifndef SOURCE_LATEST_VERSION_GLSL_STD_450_HEADER_H_ +#define SOURCE_LATEST_VERSION_GLSL_STD_450_HEADER_H_ #include "spirv/unified1/GLSL.std.450.h" -#endif // LIBSPIRV_LATEST_VERSION_GLSL_STD_450_HEADER_H_ +#endif // SOURCE_LATEST_VERSION_GLSL_STD_450_HEADER_H_ diff --git a/third_party/spirv-tools/source/latest_version_opencl_std_header.h b/third_party/spirv-tools/source/latest_version_opencl_std_header.h old mode 100755 new mode 100644 index 9bb6e5028c..90ff9c0336 --- a/third_party/spirv-tools/source/latest_version_opencl_std_header.h +++ b/third_party/spirv-tools/source/latest_version_opencl_std_header.h @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_LATEST_VERSION_OPENCL_STD_HEADER_H_ -#define LIBSPIRV_LATEST_VERSION_OPENCL_STD_HEADER_H_ +#ifndef SOURCE_LATEST_VERSION_OPENCL_STD_HEADER_H_ +#define SOURCE_LATEST_VERSION_OPENCL_STD_HEADER_H_ #include "spirv/unified1/OpenCL.std.h" -#endif // LIBSPIRV_LATEST_VERSION_OPENCL_STD_HEADER_H_ +#endif // SOURCE_LATEST_VERSION_OPENCL_STD_HEADER_H_ diff --git a/third_party/spirv-tools/source/latest_version_spirv_header.h b/third_party/spirv-tools/source/latest_version_spirv_header.h old mode 100755 new mode 100644 index c328b69764..e4f28e43e5 --- a/third_party/spirv-tools/source/latest_version_spirv_header.h +++ b/third_party/spirv-tools/source/latest_version_spirv_header.h @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_LATEST_VERSION_SPIRV_HEADER_H_ -#define LIBSPIRV_LATEST_VERSION_SPIRV_HEADER_H_ +#ifndef SOURCE_LATEST_VERSION_SPIRV_HEADER_H_ +#define SOURCE_LATEST_VERSION_SPIRV_HEADER_H_ #include "spirv/unified1/spirv.h" -#endif // LIBSPIRV_LATEST_VERSION_SPIRV_HEADER_H_ +#endif // SOURCE_LATEST_VERSION_SPIRV_HEADER_H_ diff --git a/third_party/spirv-tools/source/libspirv.cpp b/third_party/spirv-tools/source/libspirv.cpp old mode 100755 new mode 100644 index c9976ca4bf..cbbc4c9089 --- a/third_party/spirv-tools/source/libspirv.cpp +++ b/third_party/spirv-tools/source/libspirv.cpp @@ -14,7 +14,13 @@ #include "spirv-tools/libspirv.hpp" -#include "table.h" +#include + +#include +#include +#include + +#include "source/table.h" namespace spvtools { @@ -111,8 +117,15 @@ bool SpirvTools::Validate(const uint32_t* binary, bool SpirvTools::Validate(const uint32_t* binary, const size_t binary_size, const ValidatorOptions& options) const { spv_const_binary_t the_binary{binary, binary_size}; - return spvValidateWithOptions(impl_->context, options, &the_binary, - nullptr) == SPV_SUCCESS; + spv_diagnostic diagnostic = nullptr; + bool valid = spvValidateWithOptions(impl_->context, options, &the_binary, + &diagnostic) == SPV_SUCCESS; + if (!valid && impl_->context->consumer) { + impl_->context->consumer.operator()( + SPV_MSG_ERROR, nullptr, diagnostic->position, diagnostic->error); + } + spvDiagnosticDestroy(diagnostic); + return valid; } } // namespace spvtools diff --git a/third_party/spirv-tools/source/link/CMakeLists.txt b/third_party/spirv-tools/source/link/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/source/link/linker.cpp b/third_party/spirv-tools/source/link/linker.cpp old mode 100755 new mode 100644 index 4a7e8063d2..f28b7595aa --- a/third_party/spirv-tools/source/link/linker.cpp +++ b/third_party/spirv-tools/source/link/linker.cpp @@ -14,26 +14,28 @@ #include "spirv-tools/linker.hpp" +#include #include #include - -#include #include +#include +#include #include #include +#include #include -#include "assembly_grammar.h" -#include "diagnostic.h" -#include "opt/build_module.h" -#include "opt/compact_ids_pass.h" -#include "opt/decoration_manager.h" -#include "opt/ir_loader.h" -#include "opt/make_unique.h" -#include "opt/pass_manager.h" -#include "opt/remove_duplicates_pass.h" +#include "source/assembly_grammar.h" +#include "source/diagnostic.h" +#include "source/opt/build_module.h" +#include "source/opt/compact_ids_pass.h" +#include "source/opt/decoration_manager.h" +#include "source/opt/ir_loader.h" +#include "source/opt/pass_manager.h" +#include "source/opt/remove_duplicates_pass.h" +#include "source/spirv_target_env.h" +#include "source/util/make_unique.h" #include "spirv-tools/libspirv.hpp" -#include "spirv_target_env.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/source/macro.h b/third_party/spirv-tools/source/macro.h old mode 100755 new mode 100644 index 810db6e619..7219ffed1f --- a/third_party/spirv-tools/source/macro.h +++ b/third_party/spirv-tools/source/macro.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_MACRO_H_ -#define LIBSPIRV_MACRO_H_ +#ifndef SOURCE_MACRO_H_ +#define SOURCE_MACRO_H_ // Evaluates to the number of elements of array A. // @@ -22,4 +22,4 @@ // std::array::size. #define ARRAY_SIZE(A) (static_cast(sizeof(A) / sizeof(A[0]))) -#endif // LIBSPIRV_MACRO_H_ +#endif // SOURCE_MACRO_H_ diff --git a/third_party/spirv-tools/source/name_mapper.cpp b/third_party/spirv-tools/source/name_mapper.cpp old mode 100755 new mode 100644 index d41eb31ba5..43fdfb34b5 --- a/third_party/spirv-tools/source/name_mapper.cpp +++ b/third_party/spirv-tools/source/name_mapper.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "name_mapper.h" +#include "source/name_mapper.h" #include #include @@ -24,8 +24,8 @@ #include "spirv-tools/libspirv.h" -#include "latest_version_spirv_header.h" -#include "parsed_operand.h" +#include "source/latest_version_spirv_header.h" +#include "source/parsed_operand.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/source/name_mapper.h b/third_party/spirv-tools/source/name_mapper.h old mode 100755 new mode 100644 index cee322d197..6902141b19 --- a/third_party/spirv-tools/source/name_mapper.h +++ b/third_party/spirv-tools/source/name_mapper.h @@ -12,15 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_NAME_MAPPER_H_ -#define LIBSPIRV_NAME_MAPPER_H_ +#ifndef SOURCE_NAME_MAPPER_H_ +#define SOURCE_NAME_MAPPER_H_ #include #include #include #include -#include "assembly_grammar.h" +#include "source/assembly_grammar.h" #include "spirv-tools/libspirv.h" namespace spvtools { @@ -119,4 +119,4 @@ class FriendlyNameMapper { } // namespace spvtools -#endif // _LIBSPIRV_NAME_MAPPER_H_ +#endif // SOURCE_NAME_MAPPER_H_ diff --git a/third_party/spirv-tools/source/opcode.cpp b/third_party/spirv-tools/source/opcode.cpp old mode 100755 new mode 100644 index f03da6cf11..af34b64605 --- a/third_party/spirv-tools/source/opcode.cpp +++ b/third_party/spirv-tools/source/opcode.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "opcode.h" +#include "source/opcode.h" #include #include @@ -20,12 +20,12 @@ #include #include -#include "instruction.h" -#include "macro.h" +#include "source/instruction.h" +#include "source/macro.h" +#include "source/spirv_constant.h" +#include "source/spirv_endian.h" +#include "source/spirv_target_env.h" #include "spirv-tools/libspirv.h" -#include "spirv_constant.h" -#include "spirv_endian.h" -#include "spirv_target_env.h" namespace { struct OpcodeDescPtrLen { @@ -33,7 +33,7 @@ struct OpcodeDescPtrLen { uint32_t len; }; -#include "core.insts-unified1.inc" // defines kOpcodeTableEntries_1_3 +#include "core.insts-unified1.inc" static const spv_opcode_table_t kOpcodeTable = {ARRAY_SIZE(kOpcodeTableEntries), kOpcodeTableEntries}; diff --git a/third_party/spirv-tools/source/opcode.h b/third_party/spirv-tools/source/opcode.h old mode 100755 new mode 100644 index 5ab3d0ac1f..5643a64c8b --- a/third_party/spirv-tools/source/opcode.h +++ b/third_party/spirv-tools/source/opcode.h @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPCODE_H_ -#define LIBSPIRV_OPCODE_H_ +#ifndef SOURCE_OPCODE_H_ +#define SOURCE_OPCODE_H_ -#include "instruction.h" -#include "latest_version_spirv_header.h" +#include "source/instruction.h" +#include "source/latest_version_spirv_header.h" +#include "source/table.h" #include "spirv-tools/libspirv.h" -#include "table.h" // Returns the name of a registered SPIR-V generator as a null-terminated // string. If the generator is not known, then returns the string "Unknown". @@ -125,4 +125,4 @@ bool spvOpcodeIsNonUniformGroupOperation(SpvOp opcode); // Returns true if the opcode with vector inputs could be divided into a series // of independent scalar operations that would give the same result. bool spvOpcodeIsScalarizable(SpvOp opcode); -#endif // LIBSPIRV_OPCODE_H_ +#endif // SOURCE_OPCODE_H_ diff --git a/third_party/spirv-tools/source/operand.cpp b/third_party/spirv-tools/source/operand.cpp old mode 100755 new mode 100644 index 01e51d2f91..c97b13fc65 --- a/third_party/spirv-tools/source/operand.cpp +++ b/third_party/spirv-tools/source/operand.cpp @@ -12,15 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "operand.h" +#include "source/operand.h" #include #include #include -#include "macro.h" -#include "spirv_constant.h" -#include "spirv_target_env.h" +#include "source/macro.h" +#include "source/spirv_constant.h" +#include "source/spirv_target_env.h" // For now, assume unified1 contains up to SPIR-V 1.3 and no later // SPIR-V version. diff --git a/third_party/spirv-tools/source/operand.h b/third_party/spirv-tools/source/operand.h old mode 100755 new mode 100644 index d90f6bf83d..76f16f7ae5 --- a/third_party/spirv-tools/source/operand.h +++ b/third_party/spirv-tools/source/operand.h @@ -12,13 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPERAND_H_ -#define LIBSPIRV_OPERAND_H_ +#ifndef SOURCE_OPERAND_H_ +#define SOURCE_OPERAND_H_ #include +#include +#include "source/table.h" #include "spirv-tools/libspirv.h" -#include "table.h" // A sequence of operand types. // @@ -137,4 +138,4 @@ bool spvIsIdType(spv_operand_type_t type); std::function spvOperandCanBeForwardDeclaredFunction( SpvOp opcode); -#endif // LIBSPIRV_OPERAND_H_ +#endif // SOURCE_OPERAND_H_ diff --git a/third_party/spirv-tools/source/opt/CMakeLists.txt b/third_party/spirv-tools/source/opt/CMakeLists.txt old mode 100755 new mode 100644 index d9fc8c9f24..83f92fe886 --- a/third_party/spirv-tools/source/opt/CMakeLists.txt +++ b/third_party/spirv-tools/source/opt/CMakeLists.txt @@ -67,7 +67,6 @@ add_library(SPIRV-Tools-opt loop_unroller.h loop_utils.h loop_unswitch_pass.h - make_unique.h mem_pass.h merge_return_pass.h module.h diff --git a/third_party/spirv-tools/source/opt/aggressive_dead_code_elim_pass.cpp b/third_party/spirv-tools/source/opt/aggressive_dead_code_elim_pass.cpp old mode 100755 new mode 100644 index 54fc8d7177..39970a5634 --- a/third_party/spirv-tools/source/opt/aggressive_dead_code_elim_pass.cpp +++ b/third_party/spirv-tools/source/opt/aggressive_dead_code_elim_pass.cpp @@ -15,15 +15,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "aggressive_dead_code_elim_pass.h" - -#include "cfa.h" -#include "iterator.h" -#include "latest_version_glsl_std_450_header.h" -#include "reflect.h" +#include "source/opt/aggressive_dead_code_elim_pass.h" +#include #include +#include "source/cfa.h" +#include "source/latest_version_glsl_std_450_header.h" +#include "source/opt/iterator.h" +#include "source/opt/reflect.h" + namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/aggressive_dead_code_elim_pass.h b/third_party/spirv-tools/source/opt/aggressive_dead_code_elim_pass.h old mode 100755 new mode 100644 index 34481eb1ba..73457cee78 --- a/third_party/spirv-tools/source/opt/aggressive_dead_code_elim_pass.h +++ b/third_party/spirv-tools/source/opt/aggressive_dead_code_elim_pass.h @@ -14,21 +14,24 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_AGGRESSIVE_DCE_PASS_H_ -#define LIBSPIRV_OPT_AGGRESSIVE_DCE_PASS_H_ +#ifndef SOURCE_OPT_AGGRESSIVE_DEAD_CODE_ELIM_PASS_H_ +#define SOURCE_OPT_AGGRESSIVE_DEAD_CODE_ELIM_PASS_H_ -#include #include +#include #include #include +#include #include #include #include +#include -#include "basic_block.h" -#include "def_use_manager.h" -#include "mem_pass.h" -#include "module.h" +#include "source/opt/basic_block.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/mem_pass.h" +#include "source/opt/module.h" +#include "source/util/bit_vector.h" namespace spvtools { namespace opt { @@ -186,4 +189,4 @@ class AggressiveDCEPass : public MemPass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_AGGRESSIVE_DCE_PASS_H_ +#endif // SOURCE_OPT_AGGRESSIVE_DEAD_CODE_ELIM_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/basic_block.cpp b/third_party/spirv-tools/source/opt/basic_block.cpp old mode 100755 new mode 100644 index 9d101ba201..b18b114a5d --- a/third_party/spirv-tools/source/opt/basic_block.cpp +++ b/third_party/spirv-tools/source/opt/basic_block.cpp @@ -12,16 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "basic_block.h" -#include "function.h" -#include "ir_context.h" -#include "module.h" -#include "reflect.h" - -#include "make_unique.h" +#include "source/opt/basic_block.h" #include +#include "source/opt/function.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/reflect.h" +#include "source/util/make_unique.h" + namespace spvtools { namespace opt { namespace { diff --git a/third_party/spirv-tools/source/opt/basic_block.h b/third_party/spirv-tools/source/opt/basic_block.h old mode 100755 new mode 100644 index 1277c176bf..9e1706e14f --- a/third_party/spirv-tools/source/opt/basic_block.h +++ b/third_party/spirv-tools/source/opt/basic_block.h @@ -15,19 +15,20 @@ // This file defines the language constructs for representing a SPIR-V // module in memory. -#ifndef LIBSPIRV_OPT_BASIC_BLOCK_H_ -#define LIBSPIRV_OPT_BASIC_BLOCK_H_ +#ifndef SOURCE_OPT_BASIC_BLOCK_H_ +#define SOURCE_OPT_BASIC_BLOCK_H_ #include #include #include #include +#include #include #include -#include "instruction.h" -#include "instruction_list.h" -#include "iterator.h" +#include "source/opt/instruction.h" +#include "source/opt/instruction_list.h" +#include "source/opt/iterator.h" namespace spvtools { namespace opt { @@ -316,4 +317,4 @@ inline void BasicBlock::ForEachPhiInst( } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_BASIC_BLOCK_H_ +#endif // SOURCE_OPT_BASIC_BLOCK_H_ diff --git a/third_party/spirv-tools/source/opt/block_merge_pass.cpp b/third_party/spirv-tools/source/opt/block_merge_pass.cpp old mode 100755 new mode 100644 index 9d5bc5cde7..aa4c1bd924 --- a/third_party/spirv-tools/source/opt/block_merge_pass.cpp +++ b/third_party/spirv-tools/source/opt/block_merge_pass.cpp @@ -14,10 +14,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "block_merge_pass.h" +#include "source/opt/block_merge_pass.h" -#include "ir_context.h" -#include "iterator.h" +#include + +#include "source/opt/ir_context.h" +#include "source/opt/iterator.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/block_merge_pass.h b/third_party/spirv-tools/source/opt/block_merge_pass.h old mode 100755 new mode 100644 index d11e44b86a..0ecde48846 --- a/third_party/spirv-tools/source/opt/block_merge_pass.h +++ b/third_party/spirv-tools/source/opt/block_merge_pass.h @@ -14,8 +14,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_BLOCK_MERGE_PASS_H_ -#define LIBSPIRV_OPT_BLOCK_MERGE_PASS_H_ +#ifndef SOURCE_OPT_BLOCK_MERGE_PASS_H_ +#define SOURCE_OPT_BLOCK_MERGE_PASS_H_ #include #include @@ -24,11 +24,11 @@ #include #include -#include "basic_block.h" -#include "def_use_manager.h" -#include "ir_context.h" -#include "module.h" -#include "pass.h" +#include "source/opt/basic_block.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" namespace spvtools { namespace opt { @@ -68,4 +68,4 @@ class BlockMergePass : public Pass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_BLOCK_MERGE_PASS_H_ +#endif // SOURCE_OPT_BLOCK_MERGE_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/build_module.cpp b/third_party/spirv-tools/source/opt/build_module.cpp old mode 100755 new mode 100644 index e0b2ce1b31..fc76a3c29d --- a/third_party/spirv-tools/source/opt/build_module.cpp +++ b/third_party/spirv-tools/source/opt/build_module.cpp @@ -12,12 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "build_module.h" +#include "source/opt/build_module.h" -#include "ir_context.h" -#include "ir_loader.h" -#include "make_unique.h" -#include "table.h" +#include +#include + +#include "source/opt/ir_context.h" +#include "source/opt/ir_loader.h" +#include "source/table.h" +#include "source/util/make_unique.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/source/opt/build_module.h b/third_party/spirv-tools/source/opt/build_module.h old mode 100755 new mode 100644 index aca7b24298..c9d1cf2e45 --- a/third_party/spirv-tools/source/opt/build_module.h +++ b/third_party/spirv-tools/source/opt/build_module.h @@ -12,14 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef SPIRV_TOOLS_OPT_BUILD_MODULE_H_ -#define SPIRV_TOOLS_OPT_BUILD_MODULE_H_ +#ifndef SOURCE_OPT_BUILD_MODULE_H_ +#define SOURCE_OPT_BUILD_MODULE_H_ #include #include -#include "ir_context.h" -#include "module.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" #include "spirv-tools/libspirv.hpp" namespace spvtools { @@ -43,4 +43,4 @@ std::unique_ptr BuildModule( } // namespace spvtools -#endif // SPIRV_TOOLS_OPT_BUILD_MODULE_H_ +#endif // SOURCE_OPT_BUILD_MODULE_H_ diff --git a/third_party/spirv-tools/source/opt/ccp_pass.cpp b/third_party/spirv-tools/source/opt/ccp_pass.cpp old mode 100755 new mode 100644 index 570d2022b0..a8411d9fe1 --- a/third_party/spirv-tools/source/opt/ccp_pass.cpp +++ b/third_party/spirv-tools/source/opt/ccp_pass.cpp @@ -16,13 +16,16 @@ // // Constant propagation with conditional branches, // Wegman and Zadeck, ACM TOPLAS 13(2):181-210. -#include "ccp_pass.h" -#include "fold.h" -#include "function.h" -#include "module.h" -#include "propagator.h" + +#include "source/opt/ccp_pass.h" #include +#include + +#include "source/opt/fold.h" +#include "source/opt/function.h" +#include "source/opt/module.h" +#include "source/opt/propagator.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/ccp_pass.h b/third_party/spirv-tools/source/opt/ccp_pass.h old mode 100755 new mode 100644 index 1f5d0468eb..178fd1281d --- a/third_party/spirv-tools/source/opt/ccp_pass.h +++ b/third_party/spirv-tools/source/opt/ccp_pass.h @@ -12,15 +12,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_CCP_PASS_H_ -#define LIBSPIRV_OPT_CCP_PASS_H_ +#ifndef SOURCE_OPT_CCP_PASS_H_ +#define SOURCE_OPT_CCP_PASS_H_ -#include "constants.h" -#include "function.h" -#include "ir_context.h" -#include "mem_pass.h" -#include "module.h" -#include "propagator.h" +#include +#include + +#include "source/opt/constants.h" +#include "source/opt/function.h" +#include "source/opt/ir_context.h" +#include "source/opt/mem_pass.h" +#include "source/opt/module.h" +#include "source/opt/propagator.h" namespace spvtools { namespace opt { @@ -106,4 +109,4 @@ class CCPPass : public MemPass { } // namespace opt } // namespace spvtools -#endif +#endif // SOURCE_OPT_CCP_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/cfg.cpp b/third_party/spirv-tools/source/opt/cfg.cpp old mode 100755 new mode 100644 index fa3e50f335..dcf2b573ff --- a/third_party/spirv-tools/source/opt/cfg.cpp +++ b/third_party/spirv-tools/source/opt/cfg.cpp @@ -12,11 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "cfg.h" -#include "cfa.h" -#include "ir_builder.h" -#include "ir_context.h" -#include "module.h" +#include "source/opt/cfg.h" + +#include +#include + +#include "source/cfa.h" +#include "source/opt/ir_builder.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/cfg.h b/third_party/spirv-tools/source/opt/cfg.h old mode 100755 new mode 100644 index c472f2cdf4..375d09c5c7 --- a/third_party/spirv-tools/source/opt/cfg.h +++ b/third_party/spirv-tools/source/opt/cfg.h @@ -12,15 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_CFG_H_ -#define LIBSPIRV_OPT_CFG_H_ - -#include "basic_block.h" +#ifndef SOURCE_OPT_CFG_H_ +#define SOURCE_OPT_CFG_H_ #include #include #include #include +#include + +#include "source/opt/basic_block.h" namespace spvtools { namespace opt { @@ -167,4 +168,4 @@ class CFG { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_CFG_H_ +#endif // SOURCE_OPT_CFG_H_ diff --git a/third_party/spirv-tools/source/opt/cfg_cleanup_pass.cpp b/third_party/spirv-tools/source/opt/cfg_cleanup_pass.cpp old mode 100755 new mode 100644 index ac99135eca..2d548462b4 --- a/third_party/spirv-tools/source/opt/cfg_cleanup_pass.cpp +++ b/third_party/spirv-tools/source/opt/cfg_cleanup_pass.cpp @@ -19,10 +19,10 @@ #include #include -#include "cfg_cleanup_pass.h" +#include "source/opt/cfg_cleanup_pass.h" -#include "function.h" -#include "module.h" +#include "source/opt/function.h" +#include "source/opt/module.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/cfg_cleanup_pass.h b/third_party/spirv-tools/source/opt/cfg_cleanup_pass.h old mode 100755 new mode 100644 index 27589bfae3..afbc67c09f --- a/third_party/spirv-tools/source/opt/cfg_cleanup_pass.h +++ b/third_party/spirv-tools/source/opt/cfg_cleanup_pass.h @@ -12,12 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_CFG_CLEANUP_PASS_H_ -#define LIBSPIRV_OPT_CFG_CLEANUP_PASS_H_ +#ifndef SOURCE_OPT_CFG_CLEANUP_PASS_H_ +#define SOURCE_OPT_CFG_CLEANUP_PASS_H_ -#include "function.h" -#include "mem_pass.h" -#include "module.h" +#include "source/opt/function.h" +#include "source/opt/mem_pass.h" +#include "source/opt/module.h" namespace spvtools { namespace opt { @@ -37,4 +37,4 @@ class CFGCleanupPass : public MemPass { } // namespace opt } // namespace spvtools -#endif +#endif // SOURCE_OPT_CFG_CLEANUP_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/combine_access_chains.cpp b/third_party/spirv-tools/source/opt/combine_access_chains.cpp index ccefb25809..facfc24b6c 100644 --- a/third_party/spirv-tools/source/opt/combine_access_chains.cpp +++ b/third_party/spirv-tools/source/opt/combine_access_chains.cpp @@ -12,11 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "combine_access_chains.h" +#include "source/opt/combine_access_chains.h" -#include "constants.h" -#include "ir_builder.h" -#include "ir_context.h" +#include + +#include "source/opt/constants.h" +#include "source/opt/ir_builder.h" +#include "source/opt/ir_context.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/combine_access_chains.h b/third_party/spirv-tools/source/opt/combine_access_chains.h index 63027f12ee..75885dadaf 100644 --- a/third_party/spirv-tools/source/opt/combine_access_chains.h +++ b/third_party/spirv-tools/source/opt/combine_access_chains.h @@ -12,10 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_COMBINE_ACCESS_CHAINS_H_ -#define LIBSPIRV_OPT_COMBINE_ACCESS_CHAINS_H_ +#ifndef SOURCE_OPT_COMBINE_ACCESS_CHAINS_H_ +#define SOURCE_OPT_COMBINE_ACCESS_CHAINS_H_ -#include "pass.h" +#include + +#include "source/opt/pass.h" namespace spvtools { namespace opt { @@ -77,4 +79,4 @@ class CombineAccessChains : public Pass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_COMBINE_ACCESS_CHAINS_H_ +#endif // SOURCE_OPT_COMBINE_ACCESS_CHAINS_H_ diff --git a/third_party/spirv-tools/source/opt/common_uniform_elim_pass.cpp b/third_party/spirv-tools/source/opt/common_uniform_elim_pass.cpp old mode 100755 new mode 100644 index e6a2b1c822..e6426a555d --- a/third_party/spirv-tools/source/opt/common_uniform_elim_pass.cpp +++ b/third_party/spirv-tools/source/opt/common_uniform_elim_pass.cpp @@ -14,9 +14,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "common_uniform_elim_pass.h" -#include "cfa.h" -#include "ir_context.h" +#include "source/opt/common_uniform_elim_pass.h" +#include "source/cfa.h" +#include "source/opt/ir_context.h" namespace spvtools { namespace opt { @@ -284,7 +284,7 @@ bool CommonUniformElimPass::UniformAccessChainConvert(Function* func) { inst = ReplaceAndDeleteLoad(inst, replId, ptrInst); inst = inst->InsertBefore(std::move(newInsts)); modified = true; - }; + } } return modified; } diff --git a/third_party/spirv-tools/source/opt/common_uniform_elim_pass.h b/third_party/spirv-tools/source/opt/common_uniform_elim_pass.h old mode 100755 new mode 100644 index d234a9dada..e6ef69c5dc --- a/third_party/spirv-tools/source/opt/common_uniform_elim_pass.h +++ b/third_party/spirv-tools/source/opt/common_uniform_elim_pass.h @@ -14,22 +14,26 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_COMMON_UNIFORM_ELIM_PASS_H_ -#define LIBSPIRV_OPT_COMMON_UNIFORM_ELIM_PASS_H_ +#ifndef SOURCE_OPT_COMMON_UNIFORM_ELIM_PASS_H_ +#define SOURCE_OPT_COMMON_UNIFORM_ELIM_PASS_H_ #include +#include #include +#include #include +#include #include #include #include +#include -#include "basic_block.h" -#include "decoration_manager.h" -#include "def_use_manager.h" -#include "ir_context.h" -#include "module.h" -#include "pass.h" +#include "source/opt/basic_block.h" +#include "source/opt/decoration_manager.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" namespace spvtools { namespace opt { @@ -206,4 +210,4 @@ class CommonUniformElimPass : public Pass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_SSAMEM_PASS_H_ +#endif // SOURCE_OPT_COMMON_UNIFORM_ELIM_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/compact_ids_pass.cpp b/third_party/spirv-tools/source/opt/compact_ids_pass.cpp old mode 100755 new mode 100644 index 7fe58228b4..68b940f1d4 --- a/third_party/spirv-tools/source/opt/compact_ids_pass.cpp +++ b/third_party/spirv-tools/source/opt/compact_ids_pass.cpp @@ -12,12 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "compact_ids_pass.h" -#include "ir_context.h" +#include "source/opt/compact_ids_pass.h" #include #include +#include "source/opt/ir_context.h" + namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/compact_ids_pass.h b/third_party/spirv-tools/source/opt/compact_ids_pass.h old mode 100755 new mode 100644 index 987dc945fc..d97ae0fa49 --- a/third_party/spirv-tools/source/opt/compact_ids_pass.h +++ b/third_party/spirv-tools/source/opt/compact_ids_pass.h @@ -12,12 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_COMPACT_IDS_PASS_H_ -#define LIBSPIRV_OPT_COMPACT_IDS_PASS_H_ +#ifndef SOURCE_OPT_COMPACT_IDS_PASS_H_ +#define SOURCE_OPT_COMPACT_IDS_PASS_H_ -#include "ir_context.h" -#include "module.h" -#include "pass.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" namespace spvtools { namespace opt { @@ -39,4 +39,4 @@ class CompactIdsPass : public Pass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_COMPACT_IDS_PASS_H_ +#endif // SOURCE_OPT_COMPACT_IDS_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/composite.cpp b/third_party/spirv-tools/source/opt/composite.cpp old mode 100755 new mode 100644 index 8d35d05b32..2b4dca2579 --- a/third_party/spirv-tools/source/opt/composite.cpp +++ b/third_party/spirv-tools/source/opt/composite.cpp @@ -14,14 +14,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "composite.h" - -#include "ir_context.h" -#include "iterator.h" -#include "spirv/1.2/GLSL.std.450.h" +#include "source/opt/composite.h" #include +#include "source/opt/ir_context.h" +#include "source/opt/iterator.h" +#include "spirv/1.2/GLSL.std.450.h" + namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/composite.h b/third_party/spirv-tools/source/opt/composite.h old mode 100755 new mode 100644 index c64fdc594b..3cc036e4d7 --- a/third_party/spirv-tools/source/opt/composite.h +++ b/third_party/spirv-tools/source/opt/composite.h @@ -14,19 +14,20 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_UTIL_COMPOSITE_PASS_H_ -#define LIBSPIRV_UTIL_COMPOSITE_PASS_H_ +#ifndef SOURCE_OPT_COMPOSITE_H_ +#define SOURCE_OPT_COMPOSITE_H_ #include #include #include #include #include +#include -#include "basic_block.h" -#include "def_use_manager.h" -#include "ir_context.h" -#include "module.h" +#include "source/opt/basic_block.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" namespace spvtools { namespace opt { @@ -47,4 +48,4 @@ bool ExtInsConflict(const std::vector& extIndices, } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_UTIL_COMPOSITE_PASS_H_ +#endif // SOURCE_OPT_COMPOSITE_H_ diff --git a/third_party/spirv-tools/source/opt/const_folding_rules.cpp b/third_party/spirv-tools/source/opt/const_folding_rules.cpp old mode 100755 new mode 100644 index 6b94986e93..f6013a3d71 --- a/third_party/spirv-tools/source/opt/const_folding_rules.cpp +++ b/third_party/spirv-tools/source/opt/const_folding_rules.cpp @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "const_folding_rules.h" +#include "source/opt/const_folding_rules.h" -#include "ir_context.h" +#include "source/opt/ir_context.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/const_folding_rules.h b/third_party/spirv-tools/source/opt/const_folding_rules.h old mode 100755 new mode 100644 index 11fb1e6026..c1865792bc --- a/third_party/spirv-tools/source/opt/const_folding_rules.h +++ b/third_party/spirv-tools/source/opt/const_folding_rules.h @@ -12,12 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_CONST_FOLDING_RULES_H_ -#define LIBSPIRV_OPT_CONST_FOLDING_RULES_H_ +#ifndef SOURCE_OPT_CONST_FOLDING_RULES_H_ +#define SOURCE_OPT_CONST_FOLDING_RULES_H_ +#include #include -#include "constants.h" +#include "source/opt/constants.h" namespace spvtools { namespace opt { @@ -76,4 +77,4 @@ class ConstantFoldingRules { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_CONST_FOLDING_RULES_H_ +#endif // SOURCE_OPT_CONST_FOLDING_RULES_H_ diff --git a/third_party/spirv-tools/source/opt/constants.cpp b/third_party/spirv-tools/source/opt/constants.cpp old mode 100755 new mode 100644 index ba7fc6b876..b1e4bee40e --- a/third_party/spirv-tools/source/opt/constants.cpp +++ b/third_party/spirv-tools/source/opt/constants.cpp @@ -12,12 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "constants.h" -#include "ir_context.h" +#include "source/opt/constants.h" #include #include +#include "source/opt/ir_context.h" + namespace spvtools { namespace opt { namespace analysis { diff --git a/third_party/spirv-tools/source/opt/constants.h b/third_party/spirv-tools/source/opt/constants.h old mode 100755 new mode 100644 index 401fcde350..2833b845b1 --- a/third_party/spirv-tools/source/opt/constants.h +++ b/third_party/spirv-tools/source/opt/constants.h @@ -12,21 +12,22 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_CONSTANTS_H_ -#define LIBSPIRV_OPT_CONSTANTS_H_ +#ifndef SOURCE_OPT_CONSTANTS_H_ +#define SOURCE_OPT_CONSTANTS_H_ #include +#include #include #include #include #include #include -#include "make_unique.h" -#include "module.h" -#include "type_manager.h" -#include "types.h" -#include "util/hex_float.h" +#include "source/opt/module.h" +#include "source/opt/type_manager.h" +#include "source/opt/types.h" +#include "source/util/hex_float.h" +#include "source/util/make_unique.h" namespace spvtools { namespace opt { @@ -116,7 +117,7 @@ class Constant { int64_t GetS64() const; // Returns true if the constant is a zero or a composite containing 0s. - virtual bool IsZero() const { return false; }; + virtual bool IsZero() const { return false; } const Type* type() const { return type_; } @@ -480,10 +481,11 @@ struct ConstantEqual { const auto& composite2 = c2->AsCompositeConstant(); return composite2 && composite1->GetComponents() == composite2->GetComponents(); - } else if (c1->AsNullConstant()) + } else if (c1->AsNullConstant()) { return c2->AsNullConstant() != nullptr; - else + } else { assert(false && "Tried to compare two invalid Constant instances."); + } return false; } }; @@ -684,4 +686,4 @@ class ConstantManager { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_CONSTANTS_H_ +#endif // SOURCE_OPT_CONSTANTS_H_ diff --git a/third_party/spirv-tools/source/opt/copy_prop_arrays.cpp b/third_party/spirv-tools/source/opt/copy_prop_arrays.cpp old mode 100755 new mode 100644 index 6fa232feaf..028b237d73 --- a/third_party/spirv-tools/source/opt/copy_prop_arrays.cpp +++ b/third_party/spirv-tools/source/opt/copy_prop_arrays.cpp @@ -12,8 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "copy_prop_arrays.h" -#include "ir_builder.h" +#include "source/opt/copy_prop_arrays.h" + +#include + +#include "source/opt/ir_builder.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/copy_prop_arrays.h b/third_party/spirv-tools/source/opt/copy_prop_arrays.h old mode 100755 new mode 100644 index 82ae21e2cd..abc07165f4 --- a/third_party/spirv-tools/source/opt/copy_prop_arrays.h +++ b/third_party/spirv-tools/source/opt/copy_prop_arrays.h @@ -12,10 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_COPY_PROP_H_ -#define LIBSPIRV_OPT_COPY_PROP_H_ +#ifndef SOURCE_OPT_COPY_PROP_ARRAYS_H_ +#define SOURCE_OPT_COPY_PROP_ARRAYS_H_ -#include "mem_pass.h" +#include +#include + +#include "source/opt/mem_pass.h" namespace spvtools { namespace opt { @@ -225,4 +228,4 @@ class CopyPropagateArrays : public MemPass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_COPY_PROP_H_ +#endif // SOURCE_OPT_COPY_PROP_ARRAYS_H_ diff --git a/third_party/spirv-tools/source/opt/dead_branch_elim_pass.cpp b/third_party/spirv-tools/source/opt/dead_branch_elim_pass.cpp old mode 100755 new mode 100644 index b0a7ab6331..55bf52fbd8 --- a/third_party/spirv-tools/source/opt/dead_branch_elim_pass.cpp +++ b/third_party/spirv-tools/source/opt/dead_branch_elim_pass.cpp @@ -15,12 +15,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "dead_branch_elim_pass.h" +#include "source/opt/dead_branch_elim_pass.h" -#include "cfa.h" -#include "ir_context.h" -#include "iterator.h" -#include "make_unique.h" +#include +#include +#include + +#include "source/cfa.h" +#include "source/opt/ir_context.h" +#include "source/opt/iterator.h" +#include "source/util/make_unique.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/dead_branch_elim_pass.h b/third_party/spirv-tools/source/opt/dead_branch_elim_pass.h old mode 100755 new mode 100644 index cc94f60a99..4c6fb5c95d --- a/third_party/spirv-tools/source/opt/dead_branch_elim_pass.h +++ b/third_party/spirv-tools/source/opt/dead_branch_elim_pass.h @@ -14,8 +14,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_DEAD_BRANCH_ELIM_PASS_H_ -#define LIBSPIRV_OPT_DEAD_BRANCH_ELIM_PASS_H_ +#ifndef SOURCE_OPT_DEAD_BRANCH_ELIM_PASS_H_ +#define SOURCE_OPT_DEAD_BRANCH_ELIM_PASS_H_ #include #include @@ -23,11 +23,12 @@ #include #include #include +#include -#include "basic_block.h" -#include "def_use_manager.h" -#include "mem_pass.h" -#include "module.h" +#include "source/opt/basic_block.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/mem_pass.h" +#include "source/opt/module.h" namespace spvtools { namespace opt { @@ -134,4 +135,4 @@ class DeadBranchElimPass : public MemPass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_DEAD_BRANCH_ELIM_PASS_H_ +#endif // SOURCE_OPT_DEAD_BRANCH_ELIM_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/dead_insert_elim_pass.cpp b/third_party/spirv-tools/source/opt/dead_insert_elim_pass.cpp old mode 100755 new mode 100644 index 53bdad4eb7..b42588ff73 --- a/third_party/spirv-tools/source/opt/dead_insert_elim_pass.cpp +++ b/third_party/spirv-tools/source/opt/dead_insert_elim_pass.cpp @@ -14,15 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "dead_insert_elim_pass.h" +#include "source/opt/dead_insert_elim_pass.h" -#include "composite.h" -#include "ir_context.h" -#include "iterator.h" +#include "source/opt/composite.h" +#include "source/opt/ir_context.h" +#include "source/opt/iterator.h" #include "spirv/1.2/GLSL.std.450.h" -#include - namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/dead_insert_elim_pass.h b/third_party/spirv-tools/source/opt/dead_insert_elim_pass.h old mode 100755 new mode 100644 index aef449066d..0b111d02c0 --- a/third_party/spirv-tools/source/opt/dead_insert_elim_pass.h +++ b/third_party/spirv-tools/source/opt/dead_insert_elim_pass.h @@ -14,20 +14,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_DEAD_INSERT_ELIM_PASS_H_ -#define LIBSPIRV_OPT_DEAD_INSERT_ELIM_PASS_H_ +#ifndef SOURCE_OPT_DEAD_INSERT_ELIM_PASS_H_ +#define SOURCE_OPT_DEAD_INSERT_ELIM_PASS_H_ #include #include #include #include #include +#include -#include "basic_block.h" -#include "def_use_manager.h" -#include "ir_context.h" -#include "mem_pass.h" -#include "module.h" +#include "source/opt/basic_block.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/ir_context.h" +#include "source/opt/mem_pass.h" +#include "source/opt/module.h" namespace spvtools { namespace opt { @@ -85,4 +86,4 @@ class DeadInsertElimPass : public MemPass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_DEAD_INSERT_ELIM_PASS_H_ +#endif // SOURCE_OPT_DEAD_INSERT_ELIM_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/dead_variable_elimination.cpp b/third_party/spirv-tools/source/opt/dead_variable_elimination.cpp old mode 100755 new mode 100644 index bdd97083b7..2837106840 --- a/third_party/spirv-tools/source/opt/dead_variable_elimination.cpp +++ b/third_party/spirv-tools/source/opt/dead_variable_elimination.cpp @@ -12,10 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "dead_variable_elimination.h" +#include "source/opt/dead_variable_elimination.h" -#include "ir_context.h" -#include "reflect.h" +#include + +#include "source/opt/ir_context.h" +#include "source/opt/reflect.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/dead_variable_elimination.h b/third_party/spirv-tools/source/opt/dead_variable_elimination.h old mode 100755 new mode 100644 index dc8d76ec50..052a754b97 --- a/third_party/spirv-tools/source/opt/dead_variable_elimination.h +++ b/third_party/spirv-tools/source/opt/dead_variable_elimination.h @@ -12,14 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef SPIRV_TOOLS_DEAD_VARIABLE_ELIMINATION_H -#define SPIRV_TOOLS_DEAD_VARIABLE_ELIMINATION_H +#ifndef SOURCE_OPT_DEAD_VARIABLE_ELIMINATION_H_ +#define SOURCE_OPT_DEAD_VARIABLE_ELIMINATION_H_ #include #include -#include "decoration_manager.h" -#include "mem_pass.h" +#include "source/opt/decoration_manager.h" +#include "source/opt/mem_pass.h" namespace spvtools { namespace opt { @@ -52,4 +52,4 @@ class DeadVariableElimination : public MemPass { } // namespace opt } // namespace spvtools -#endif // SPIRV_TOOLS_DEAD_VARIABLE_ELIMINATION_H +#endif // SOURCE_OPT_DEAD_VARIABLE_ELIMINATION_H_ diff --git a/third_party/spirv-tools/source/opt/decoration_manager.cpp b/third_party/spirv-tools/source/opt/decoration_manager.cpp old mode 100755 new mode 100644 index f218e149bf..aeddb88c11 --- a/third_party/spirv-tools/source/opt/decoration_manager.cpp +++ b/third_party/spirv-tools/source/opt/decoration_manager.cpp @@ -12,13 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "decoration_manager.h" +#include "source/opt/decoration_manager.h" #include +#include #include #include +#include -#include "ir_context.h" +#include "source/opt/ir_context.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/decoration_manager.h b/third_party/spirv-tools/source/opt/decoration_manager.h old mode 100755 new mode 100644 index 1118200193..4561bfa816 --- a/third_party/spirv-tools/source/opt/decoration_manager.h +++ b/third_party/spirv-tools/source/opt/decoration_manager.h @@ -12,16 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_DECORATION_MANAGER_H_ -#define LIBSPIRV_OPT_DECORATION_MANAGER_H_ +#ifndef SOURCE_OPT_DECORATION_MANAGER_H_ +#define SOURCE_OPT_DECORATION_MANAGER_H_ #include #include #include #include -#include "instruction.h" -#include "module.h" +#include "source/opt/instruction.h" +#include "source/opt/module.h" namespace spvtools { namespace opt { @@ -133,4 +133,4 @@ class DecorationManager { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_DECORATION_MANAGER_H_ +#endif // SOURCE_OPT_DECORATION_MANAGER_H_ diff --git a/third_party/spirv-tools/source/opt/def_use_manager.cpp b/third_party/spirv-tools/source/opt/def_use_manager.cpp old mode 100755 new mode 100644 index c581e39980..4e36493825 --- a/third_party/spirv-tools/source/opt/def_use_manager.cpp +++ b/third_party/spirv-tools/source/opt/def_use_manager.cpp @@ -12,12 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "def_use_manager.h" +#include "source/opt/def_use_manager.h" #include -#include "log.h" -#include "reflect.h" +#include "source/opt/log.h" +#include "source/opt/reflect.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/def_use_manager.h b/third_party/spirv-tools/source/opt/def_use_manager.h old mode 100755 new mode 100644 index cc09198a75..0499e82b54 --- a/third_party/spirv-tools/source/opt/def_use_manager.h +++ b/third_party/spirv-tools/source/opt/def_use_manager.h @@ -12,16 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_DEF_USE_MANAGER_H_ -#define LIBSPIRV_OPT_DEF_USE_MANAGER_H_ +#ifndef SOURCE_OPT_DEF_USE_MANAGER_H_ +#define SOURCE_OPT_DEF_USE_MANAGER_H_ #include #include #include +#include #include -#include "instruction.h" -#include "module.h" +#include "source/opt/instruction.h" +#include "source/opt/module.h" #include "spirv-tools/libspirv.hpp" namespace spvtools { @@ -252,4 +253,4 @@ class DefUseManager { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_DEF_USE_MANAGER_H_ +#endif // SOURCE_OPT_DEF_USE_MANAGER_H_ diff --git a/third_party/spirv-tools/source/opt/dominator_analysis.cpp b/third_party/spirv-tools/source/opt/dominator_analysis.cpp old mode 100755 new mode 100644 index f045ee46c7..aef43e69fa --- a/third_party/spirv-tools/source/opt/dominator_analysis.cpp +++ b/third_party/spirv-tools/source/opt/dominator_analysis.cpp @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "dominator_analysis.h" +#include "source/opt/dominator_analysis.h" #include -#include "ir_context.h" +#include "source/opt/ir_context.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/dominator_analysis.h b/third_party/spirv-tools/source/opt/dominator_analysis.h old mode 100755 new mode 100644 index 6b7a904f74..a94120a55f --- a/third_party/spirv-tools/source/opt/dominator_analysis.h +++ b/third_party/spirv-tools/source/opt/dominator_analysis.h @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_DOMINATOR_ANALYSIS_PASS_H_ -#define LIBSPIRV_OPT_DOMINATOR_ANALYSIS_PASS_H_ +#ifndef SOURCE_OPT_DOMINATOR_ANALYSIS_H_ +#define SOURCE_OPT_DOMINATOR_ANALYSIS_H_ #include #include -#include "dominator_tree.h" +#include "source/opt/dominator_tree.h" namespace spvtools { namespace opt { @@ -135,4 +135,4 @@ class PostDominatorAnalysis : public DominatorAnalysisBase { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_DOMINATOR_ANALYSIS_PASS_H_ +#endif // SOURCE_OPT_DOMINATOR_ANALYSIS_H_ diff --git a/third_party/spirv-tools/source/opt/dominator_tree.cpp b/third_party/spirv-tools/source/opt/dominator_tree.cpp old mode 100755 new mode 100644 index df3aae6df8..c9346e1c53 --- a/third_party/spirv-tools/source/opt/dominator_tree.cpp +++ b/third_party/spirv-tools/source/opt/dominator_tree.cpp @@ -16,9 +16,9 @@ #include #include -#include "cfa.h" -#include "dominator_tree.h" -#include "ir_context.h" +#include "source/cfa.h" +#include "source/opt/dominator_tree.h" +#include "source/opt/ir_context.h" // Calculates the dominator or postdominator tree for a given function. // 1 - Compute the successors and predecessors for each BasicBlock. We add a @@ -278,8 +278,9 @@ DominatorTreeNode* DominatorTree::GetOrInsertNode(BasicBlock* bb) { if (node_iter == nodes_.end()) { dtn = &nodes_.emplace(std::make_pair(bb->id(), DominatorTreeNode{bb})) .first->second; - } else + } else { dtn = &node_iter->second; + } return dtn; } diff --git a/third_party/spirv-tools/source/opt/dominator_tree.h b/third_party/spirv-tools/source/opt/dominator_tree.h old mode 100755 new mode 100644 index 2e2f6f5828..0024bc508a --- a/third_party/spirv-tools/source/opt/dominator_tree.h +++ b/third_party/spirv-tools/source/opt/dominator_tree.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_DOMINATOR_ANALYSIS_TREE_H_ -#define LIBSPIRV_OPT_DOMINATOR_ANALYSIS_TREE_H_ +#ifndef SOURCE_OPT_DOMINATOR_TREE_H_ +#define SOURCE_OPT_DOMINATOR_TREE_H_ #include #include @@ -21,8 +21,8 @@ #include #include -#include "cfg.h" -#include "tree_iterator.h" +#include "source/opt/cfg.h" +#include "source/opt/tree_iterator.h" namespace spvtools { namespace opt { @@ -302,4 +302,4 @@ class DominatorTree { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_DOMINATOR_ANALYSIS_TREE_H_ +#endif // SOURCE_OPT_DOMINATOR_TREE_H_ diff --git a/third_party/spirv-tools/source/opt/eliminate_dead_constant_pass.cpp b/third_party/spirv-tools/source/opt/eliminate_dead_constant_pass.cpp old mode 100755 new mode 100644 index 28b84caf11..d368bd1453 --- a/third_party/spirv-tools/source/opt/eliminate_dead_constant_pass.cpp +++ b/third_party/spirv-tools/source/opt/eliminate_dead_constant_pass.cpp @@ -12,16 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "eliminate_dead_constant_pass.h" +#include "source/opt/eliminate_dead_constant_pass.h" #include #include #include +#include -#include "def_use_manager.h" -#include "ir_context.h" -#include "log.h" -#include "reflect.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/ir_context.h" +#include "source/opt/log.h" +#include "source/opt/reflect.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/eliminate_dead_constant_pass.h b/third_party/spirv-tools/source/opt/eliminate_dead_constant_pass.h old mode 100755 new mode 100644 index bb55f9adb1..01692dbf46 --- a/third_party/spirv-tools/source/opt/eliminate_dead_constant_pass.h +++ b/third_party/spirv-tools/source/opt/eliminate_dead_constant_pass.h @@ -12,12 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_ELIMINATE_DEAD_CONSTANT_PASS_H_ -#define LIBSPIRV_OPT_ELIMINATE_DEAD_CONSTANT_PASS_H_ +#ifndef SOURCE_OPT_ELIMINATE_DEAD_CONSTANT_PASS_H_ +#define SOURCE_OPT_ELIMINATE_DEAD_CONSTANT_PASS_H_ -#include "ir_context.h" -#include "module.h" -#include "pass.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" namespace spvtools { namespace opt { @@ -32,4 +32,4 @@ class EliminateDeadConstantPass : public Pass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_ELIMINATE_DEAD_CONSTANT_PASS_H_ +#endif // SOURCE_OPT_ELIMINATE_DEAD_CONSTANT_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/eliminate_dead_functions_pass.cpp b/third_party/spirv-tools/source/opt/eliminate_dead_functions_pass.cpp old mode 100755 new mode 100644 index 383c267a6b..5be983a58f --- a/third_party/spirv-tools/source/opt/eliminate_dead_functions_pass.cpp +++ b/third_party/spirv-tools/source/opt/eliminate_dead_functions_pass.cpp @@ -12,11 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "eliminate_dead_functions_pass.h" -#include "ir_context.h" +#include "source/opt/eliminate_dead_functions_pass.h" #include +#include "source/opt/ir_context.h" + namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/eliminate_dead_functions_pass.h b/third_party/spirv-tools/source/opt/eliminate_dead_functions_pass.h old mode 100755 new mode 100644 index ad4b04cc6a..165e9a6b5d --- a/third_party/spirv-tools/source/opt/eliminate_dead_functions_pass.h +++ b/third_party/spirv-tools/source/opt/eliminate_dead_functions_pass.h @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_ELIMINATE_DEAD_FUNCTIONS_PASS_H_ -#define LIBSPIRV_OPT_ELIMINATE_DEAD_FUNCTIONS_PASS_H_ +#ifndef SOURCE_OPT_ELIMINATE_DEAD_FUNCTIONS_PASS_H_ +#define SOURCE_OPT_ELIMINATE_DEAD_FUNCTIONS_PASS_H_ -#include "def_use_manager.h" -#include "function.h" -#include "mem_pass.h" -#include "module.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/function.h" +#include "source/opt/mem_pass.h" +#include "source/opt/module.h" namespace spvtools { namespace opt { @@ -40,4 +40,4 @@ class EliminateDeadFunctionsPass : public MemPass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_ELIMINATE_DEAD_FUNCTIONS_PASS_H_ +#endif // SOURCE_OPT_ELIMINATE_DEAD_FUNCTIONS_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/feature_manager.cpp b/third_party/spirv-tools/source/opt/feature_manager.cpp old mode 100755 new mode 100644 index 15739f3a30..b7fc16a50d --- a/third_party/spirv-tools/source/opt/feature_manager.cpp +++ b/third_party/spirv-tools/source/opt/feature_manager.cpp @@ -12,11 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "feature_manager.h" +#include "source/opt/feature_manager.h" + #include #include +#include -#include "enum_string_mapping.h" +#include "source/enum_string_mapping.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/feature_manager.h b/third_party/spirv-tools/source/opt/feature_manager.h old mode 100755 new mode 100644 index a907d76af4..80b2cccf63 --- a/third_party/spirv-tools/source/opt/feature_manager.h +++ b/third_party/spirv-tools/source/opt/feature_manager.h @@ -12,12 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_FEATURE_MANAGER_H_ -#define LIBSPIRV_OPT_FEATURE_MANAGER_H_ +#ifndef SOURCE_OPT_FEATURE_MANAGER_H_ +#define SOURCE_OPT_FEATURE_MANAGER_H_ -#include "assembly_grammar.h" -#include "extensions.h" -#include "module.h" +#include "source/assembly_grammar.h" +#include "source/extensions.h" +#include "source/opt/module.h" namespace spvtools { namespace opt { @@ -75,4 +75,4 @@ class FeatureManager { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_FEATURE_MANAGER_H_ +#endif // SOURCE_OPT_FEATURE_MANAGER_H_ diff --git a/third_party/spirv-tools/source/opt/flatten_decoration_pass.cpp b/third_party/spirv-tools/source/opt/flatten_decoration_pass.cpp old mode 100755 new mode 100644 index 74c25fcb6a..f4de9116f9 --- a/third_party/spirv-tools/source/opt/flatten_decoration_pass.cpp +++ b/third_party/spirv-tools/source/opt/flatten_decoration_pass.cpp @@ -12,14 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "flatten_decoration_pass.h" -#include "ir_context.h" +#include "source/opt/flatten_decoration_pass.h" #include +#include #include #include +#include #include +#include "source/opt/ir_context.h" + namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/flatten_decoration_pass.h b/third_party/spirv-tools/source/opt/flatten_decoration_pass.h old mode 100755 new mode 100644 index cb9ea9c01d..c59821dc25 --- a/third_party/spirv-tools/source/opt/flatten_decoration_pass.h +++ b/third_party/spirv-tools/source/opt/flatten_decoration_pass.h @@ -12,12 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_FLATTEN_DECORATION_PASS_H_ -#define LIBSPIRV_OPT_FLATTEN_DECORATION_PASS_H_ +#ifndef SOURCE_OPT_FLATTEN_DECORATION_PASS_H_ +#define SOURCE_OPT_FLATTEN_DECORATION_PASS_H_ -#include "ir_context.h" -#include "module.h" -#include "pass.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" namespace spvtools { namespace opt { @@ -32,4 +32,4 @@ class FlattenDecorationPass : public Pass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_FLATTEN_DECORATION_PASS_H_ +#endif // SOURCE_OPT_FLATTEN_DECORATION_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/fold.cpp b/third_party/spirv-tools/source/opt/fold.cpp old mode 100755 new mode 100644 index 2007138363..09d7e51224 --- a/third_party/spirv-tools/source/opt/fold.cpp +++ b/third_party/spirv-tools/source/opt/fold.cpp @@ -12,17 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "fold.h" +#include "source/opt/fold.h" #include #include #include -#include "const_folding_rules.h" -#include "def_use_manager.h" -#include "folding_rules.h" -#include "ir_builder.h" -#include "ir_context.h" +#include "source/opt/const_folding_rules.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/folding_rules.h" +#include "source/opt/ir_builder.h" +#include "source/opt/ir_context.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/fold.h b/third_party/spirv-tools/source/opt/fold.h old mode 100755 new mode 100644 index 143182f386..0dc7c0ebbe --- a/third_party/spirv-tools/source/opt/fold.h +++ b/third_party/spirv-tools/source/opt/fold.h @@ -12,16 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_UTIL_FOLD_H_ -#define LIBSPIRV_UTIL_FOLD_H_ +#ifndef SOURCE_OPT_FOLD_H_ +#define SOURCE_OPT_FOLD_H_ #include #include -#include "const_folding_rules.h" -#include "constants.h" -#include "def_use_manager.h" -#include "folding_rules.h" +#include "source/opt/const_folding_rules.h" +#include "source/opt/constants.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/folding_rules.h" namespace spvtools { namespace opt { @@ -168,4 +168,4 @@ class InstructionFolder { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_UTIL_FOLD_H_ +#endif // SOURCE_OPT_FOLD_H_ diff --git a/third_party/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.cpp b/third_party/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.cpp old mode 100755 new mode 100644 index 3f394e748d..d43053e771 --- a/third_party/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.cpp +++ b/third_party/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.cpp @@ -12,16 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "fold_spec_constant_op_and_composite_pass.h" +#include "source/opt/fold_spec_constant_op_and_composite_pass.h" #include #include #include -#include "constants.h" -#include "fold.h" -#include "ir_context.h" -#include "make_unique.h" +#include "source/opt/constants.h" +#include "source/opt/fold.h" +#include "source/opt/ir_context.h" +#include "source/util/make_unique.h" namespace spvtools { namespace opt { @@ -302,9 +302,9 @@ bool IsValidTypeForComponentWiseOperation(const analysis::Type* type) { } else if (auto* it = type->AsInteger()) { if (it->width() == 32) return true; } else if (auto* vt = type->AsVector()) { - if (vt->element_type()->AsBool()) + if (vt->element_type()->AsBool()) { return true; - else if (auto* vit = vt->element_type()->AsInteger()) { + } else if (auto* vit = vt->element_type()->AsInteger()) { if (vit->width() == 32) return true; } } diff --git a/third_party/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.h b/third_party/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.h old mode 100755 new mode 100644 index ab27a62987..16271251f4 --- a/third_party/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.h +++ b/third_party/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.h @@ -12,19 +12,19 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_FOLD_SPEC_CONSTANT_OP_AND_COMPOSITE_PASS_H_ -#define LIBSPIRV_OPT_FOLD_SPEC_CONSTANT_OP_AND_COMPOSITE_PASS_H_ +#ifndef SOURCE_OPT_FOLD_SPEC_CONSTANT_OP_AND_COMPOSITE_PASS_H_ +#define SOURCE_OPT_FOLD_SPEC_CONSTANT_OP_AND_COMPOSITE_PASS_H_ #include #include #include -#include "constants.h" -#include "def_use_manager.h" -#include "ir_context.h" -#include "module.h" -#include "pass.h" -#include "type_manager.h" +#include "source/opt/constants.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" +#include "source/opt/type_manager.h" namespace spvtools { namespace opt { @@ -81,4 +81,4 @@ class FoldSpecConstantOpAndCompositePass : public Pass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_FOLD_SPEC_CONSTANT_OP_AND_COMPOSITE_PASS_H_ +#endif // SOURCE_OPT_FOLD_SPEC_CONSTANT_OP_AND_COMPOSITE_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/folding_rules.cpp b/third_party/spirv-tools/source/opt/folding_rules.cpp old mode 100755 new mode 100644 index 7faa3610a7..c64cedfb19 --- a/third_party/spirv-tools/source/opt/folding_rules.cpp +++ b/third_party/spirv-tools/source/opt/folding_rules.cpp @@ -12,12 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "folding_rules.h" +#include "source/opt/folding_rules.h" #include +#include +#include -#include "ir_context.h" -#include "latest_version_glsl_std_450_header.h" +#include "source/latest_version_glsl_std_450_header.h" +#include "source/opt/ir_context.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/folding_rules.h b/third_party/spirv-tools/source/opt/folding_rules.h old mode 100755 new mode 100644 index efb58ec553..33fdbffe94 --- a/third_party/spirv-tools/source/opt/folding_rules.h +++ b/third_party/spirv-tools/source/opt/folding_rules.h @@ -12,13 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_UTIL_FOLDING_RULES_H_ -#define LIBSPIRV_UTIL_FOLDING_RULES_H_ +#ifndef SOURCE_OPT_FOLDING_RULES_H_ +#define SOURCE_OPT_FOLDING_RULES_H_ #include +#include #include -#include "constants.h" +#include "source/opt/constants.h" namespace spvtools { namespace opt { @@ -75,4 +76,4 @@ class FoldingRules { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_UTIL_FOLDING_RULES_H_ +#endif // SOURCE_OPT_FOLDING_RULES_H_ diff --git a/third_party/spirv-tools/source/opt/freeze_spec_constant_value_pass.cpp b/third_party/spirv-tools/source/opt/freeze_spec_constant_value_pass.cpp old mode 100755 new mode 100644 index 60de4b2b6c..10e98fd8b7 --- a/third_party/spirv-tools/source/opt/freeze_spec_constant_value_pass.cpp +++ b/third_party/spirv-tools/source/opt/freeze_spec_constant_value_pass.cpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "freeze_spec_constant_value_pass.h" -#include "ir_context.h" +#include "source/opt/freeze_spec_constant_value_pass.h" +#include "source/opt/ir_context.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/freeze_spec_constant_value_pass.h b/third_party/spirv-tools/source/opt/freeze_spec_constant_value_pass.h old mode 100755 new mode 100644 index 1082bef4f7..0663adf401 --- a/third_party/spirv-tools/source/opt/freeze_spec_constant_value_pass.h +++ b/third_party/spirv-tools/source/opt/freeze_spec_constant_value_pass.h @@ -12,12 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_FREEZE_SPEC_CONSTANT_VALUE_PASS_H_ -#define LIBSPIRV_OPT_FREEZE_SPEC_CONSTANT_VALUE_PASS_H_ +#ifndef SOURCE_OPT_FREEZE_SPEC_CONSTANT_VALUE_PASS_H_ +#define SOURCE_OPT_FREEZE_SPEC_CONSTANT_VALUE_PASS_H_ -#include "ir_context.h" -#include "module.h" -#include "pass.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" namespace spvtools { namespace opt { @@ -32,4 +32,4 @@ class FreezeSpecConstantValuePass : public Pass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_FREEZE_SPEC_CONSTANT_VALUE_PASS_H_ +#endif // SOURCE_OPT_FREEZE_SPEC_CONSTANT_VALUE_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/function.cpp b/third_party/spirv-tools/source/opt/function.cpp old mode 100755 new mode 100644 index 0fbf1e9f85..c6894c6810 --- a/third_party/spirv-tools/source/opt/function.cpp +++ b/third_party/spirv-tools/source/opt/function.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "function.h" +#include "source/opt/function.h" #include #include diff --git a/third_party/spirv-tools/source/opt/function.h b/third_party/spirv-tools/source/opt/function.h old mode 100755 new mode 100644 index 3c5cc9290b..4dc5d25a69 --- a/third_party/spirv-tools/source/opt/function.h +++ b/third_party/spirv-tools/source/opt/function.h @@ -12,18 +12,19 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_CONSTRUCTS_H_ -#define LIBSPIRV_OPT_CONSTRUCTS_H_ +#ifndef SOURCE_OPT_FUNCTION_H_ +#define SOURCE_OPT_FUNCTION_H_ #include #include #include +#include #include #include -#include "basic_block.h" -#include "instruction.h" -#include "iterator.h" +#include "source/opt/basic_block.h" +#include "source/opt/instruction.h" +#include "source/opt/iterator.h" namespace spvtools { namespace opt { @@ -186,4 +187,4 @@ inline void Function::SetFunctionEnd(std::unique_ptr end_inst) { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_CONSTRUCTS_H_ +#endif // SOURCE_OPT_FUNCTION_H_ diff --git a/third_party/spirv-tools/source/opt/if_conversion.cpp b/third_party/spirv-tools/source/opt/if_conversion.cpp old mode 100755 new mode 100644 index 2e59951927..7a3717f985 --- a/third_party/spirv-tools/source/opt/if_conversion.cpp +++ b/third_party/spirv-tools/source/opt/if_conversion.cpp @@ -12,9 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "if_conversion.h" +#include "source/opt/if_conversion.h" -#include "value_number_table.h" +#include +#include + +#include "source/opt/value_number_table.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/if_conversion.h b/third_party/spirv-tools/source/opt/if_conversion.h old mode 100755 new mode 100644 index 18b8bc5b84..609bdf3926 --- a/third_party/spirv-tools/source/opt/if_conversion.h +++ b/third_party/spirv-tools/source/opt/if_conversion.h @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_IF_CONVERSION_H_ -#define LIBSPIRV_OPT_IF_CONVERSION_H_ +#ifndef SOURCE_OPT_IF_CONVERSION_H_ +#define SOURCE_OPT_IF_CONVERSION_H_ -#include "basic_block.h" -#include "ir_builder.h" -#include "pass.h" -#include "types.h" +#include "source/opt/basic_block.h" +#include "source/opt/ir_builder.h" +#include "source/opt/pass.h" +#include "source/opt/types.h" namespace spvtools { namespace opt { @@ -85,4 +85,4 @@ class IfConversion : public Pass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_IF_CONVERSION_H_ +#endif // SOURCE_OPT_IF_CONVERSION_H_ diff --git a/third_party/spirv-tools/source/opt/inline_exhaustive_pass.cpp b/third_party/spirv-tools/source/opt/inline_exhaustive_pass.cpp old mode 100755 new mode 100644 index a5399f7e38..5714cd867d --- a/third_party/spirv-tools/source/opt/inline_exhaustive_pass.cpp +++ b/third_party/spirv-tools/source/opt/inline_exhaustive_pass.cpp @@ -14,7 +14,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "inline_exhaustive_pass.h" +#include "source/opt/inline_exhaustive_pass.h" + +#include namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/inline_exhaustive_pass.h b/third_party/spirv-tools/source/opt/inline_exhaustive_pass.h old mode 100755 new mode 100644 index 532facb45f..103e091e00 --- a/third_party/spirv-tools/source/opt/inline_exhaustive_pass.h +++ b/third_party/spirv-tools/source/opt/inline_exhaustive_pass.h @@ -14,8 +14,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_INLINE_EXHAUSTIVE_PASS_H_ -#define LIBSPIRV_OPT_INLINE_EXHAUSTIVE_PASS_H_ +#ifndef SOURCE_OPT_INLINE_EXHAUSTIVE_PASS_H_ +#define SOURCE_OPT_INLINE_EXHAUSTIVE_PASS_H_ #include #include @@ -23,9 +23,9 @@ #include #include -#include "def_use_manager.h" -#include "inline_pass.h" -#include "module.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/inline_pass.h" +#include "source/opt/module.h" namespace spvtools { namespace opt { @@ -50,4 +50,4 @@ class InlineExhaustivePass : public InlinePass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_INLINE_EXHAUSTIVE_PASS_H_ +#endif // SOURCE_OPT_INLINE_EXHAUSTIVE_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/inline_opaque_pass.cpp b/third_party/spirv-tools/source/opt/inline_opaque_pass.cpp old mode 100755 new mode 100644 index 03d74a9fd5..c2c3719fe0 --- a/third_party/spirv-tools/source/opt/inline_opaque_pass.cpp +++ b/third_party/spirv-tools/source/opt/inline_opaque_pass.cpp @@ -14,11 +14,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "inline_opaque_pass.h" +#include "source/opt/inline_opaque_pass.h" + +#include namespace spvtools { namespace opt { - namespace { const uint32_t kTypePointerTypeIdInIdx = 1; diff --git a/third_party/spirv-tools/source/opt/inline_opaque_pass.h b/third_party/spirv-tools/source/opt/inline_opaque_pass.h old mode 100755 new mode 100644 index 493cd16578..aad43fd6a3 --- a/third_party/spirv-tools/source/opt/inline_opaque_pass.h +++ b/third_party/spirv-tools/source/opt/inline_opaque_pass.h @@ -14,8 +14,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_INLINE_OPAQUE_PASS_H_ -#define LIBSPIRV_OPT_INLINE_OPAQUE_PASS_H_ +#ifndef SOURCE_OPT_INLINE_OPAQUE_PASS_H_ +#define SOURCE_OPT_INLINE_OPAQUE_PASS_H_ #include #include @@ -23,9 +23,9 @@ #include #include -#include "def_use_manager.h" -#include "inline_pass.h" -#include "module.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/inline_pass.h" +#include "source/opt/module.h" namespace spvtools { namespace opt { @@ -57,4 +57,4 @@ class InlineOpaquePass : public InlinePass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_INLINE_OPAQUE_PASS_H_ +#endif // SOURCE_OPT_INLINE_OPAQUE_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/inline_pass.cpp b/third_party/spirv-tools/source/opt/inline_pass.cpp old mode 100755 new mode 100644 index 665f3a7b6a..5a88ef5d3f --- a/third_party/spirv-tools/source/opt/inline_pass.cpp +++ b/third_party/spirv-tools/source/opt/inline_pass.cpp @@ -14,9 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "inline_pass.h" +#include "source/opt/inline_pass.h" -#include "cfa.h" +#include +#include + +#include "source/cfa.h" +#include "source/util/make_unique.h" // Indices of operands in SPIR-V instructions @@ -333,7 +337,7 @@ void InlinePass::GenInlineCode( firstBlock = true; } // Create first/next block. - new_blk_ptr.reset(new BasicBlock(NewLabel(labelId))); + new_blk_ptr = MakeUnique(NewLabel(labelId)); if (firstBlock) { // Copy contents of original caller block up to call instruction. for (auto cii = call_block_itr->begin(); cii != call_inst_itr; @@ -359,7 +363,7 @@ void InlinePass::GenInlineCode( AddBranch(guard_block_id, &new_blk_ptr); new_blocks->push_back(std::move(new_blk_ptr)); // Start the next block. - new_blk_ptr.reset(new BasicBlock(NewLabel(guard_block_id))); + new_blk_ptr = MakeUnique(NewLabel(guard_block_id)); // Reset the mapping of the callee's entry block to point to // the guard block. Do this so we can fix up phis later on to // satisfy dominance. @@ -380,14 +384,15 @@ void InlinePass::GenInlineCode( singleTripLoopHeaderId = this->TakeNextId(); AddBranch(singleTripLoopHeaderId, &new_blk_ptr); new_blocks->push_back(std::move(new_blk_ptr)); - new_blk_ptr.reset(new BasicBlock(NewLabel(singleTripLoopHeaderId))); + new_blk_ptr = + MakeUnique(NewLabel(singleTripLoopHeaderId)); returnLabelId = this->TakeNextId(); singleTripLoopContinueId = this->TakeNextId(); AddLoopMerge(returnLabelId, singleTripLoopContinueId, &new_blk_ptr); uint32_t postHeaderId = this->TakeNextId(); AddBranch(postHeaderId, &new_blk_ptr); new_blocks->push_back(std::move(new_blk_ptr)); - new_blk_ptr.reset(new BasicBlock(NewLabel(postHeaderId))); + new_blk_ptr = MakeUnique(NewLabel(postHeaderId)); multiBlocks = true; // Reset the mapping of the callee's entry block to point to // the post-header block. Do this so we can fix up phis later @@ -429,14 +434,14 @@ void InlinePass::GenInlineCode( // to accommodate multiple returns, insert the continue // target block now, with a false branch back to the loop header. new_blocks->push_back(std::move(new_blk_ptr)); - new_blk_ptr.reset( - new BasicBlock(NewLabel(singleTripLoopContinueId))); + new_blk_ptr = + MakeUnique(NewLabel(singleTripLoopContinueId)); AddBranchCond(GetFalseId(), singleTripLoopHeaderId, returnLabelId, &new_blk_ptr); } // Generate the return block. new_blocks->push_back(std::move(new_blk_ptr)); - new_blk_ptr.reset(new BasicBlock(NewLabel(returnLabelId))); + new_blk_ptr = MakeUnique(NewLabel(returnLabelId)); multiBlocks = true; } // Load return value into result id of call, if it exists. diff --git a/third_party/spirv-tools/source/opt/inline_pass.h b/third_party/spirv-tools/source/opt/inline_pass.h old mode 100755 new mode 100644 index dc60de5fb7..55369c98cb --- a/third_party/spirv-tools/source/opt/inline_pass.h +++ b/third_party/spirv-tools/source/opt/inline_pass.h @@ -14,18 +14,19 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_INLINE_PASS_H_ -#define LIBSPIRV_OPT_INLINE_PASS_H_ +#ifndef SOURCE_OPT_INLINE_PASS_H_ +#define SOURCE_OPT_INLINE_PASS_H_ #include #include #include +#include #include #include -#include "decoration_manager.h" -#include "module.h" -#include "pass.h" +#include "source/opt/decoration_manager.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" namespace spvtools { namespace opt { @@ -185,4 +186,4 @@ class InlinePass : public Pass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_INLINE_PASS_H_ +#endif // SOURCE_OPT_INLINE_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/instruction.cpp b/third_party/spirv-tools/source/opt/instruction.cpp old mode 100755 new mode 100644 index ea75657fd6..4cfa41d8e4 --- a/third_party/spirv-tools/source/opt/instruction.cpp +++ b/third_party/spirv-tools/source/opt/instruction.cpp @@ -12,14 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "instruction.h" +#include "source/opt/instruction.h" #include -#include "disassemble.h" -#include "fold.h" -#include "ir_context.h" -#include "reflect.h" +#include "source/disassemble.h" +#include "source/opt/fold.h" +#include "source/opt/ir_context.h" +#include "source/opt/reflect.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/instruction.h b/third_party/spirv-tools/source/opt/instruction.h old mode 100755 new mode 100644 index 105c4a328f..2533ba2723 --- a/third_party/spirv-tools/source/opt/instruction.h +++ b/third_party/spirv-tools/source/opt/instruction.h @@ -12,22 +12,24 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_INSTRUCTION_H_ -#define LIBSPIRV_OPT_INSTRUCTION_H_ +#ifndef SOURCE_OPT_INSTRUCTION_H_ +#define SOURCE_OPT_INSTRUCTION_H_ #include #include +#include +#include #include #include -#include "opcode.h" -#include "operand.h" -#include "util/ilist_node.h" -#include "util/small_vector.h" +#include "source/opcode.h" +#include "source/operand.h" +#include "source/util/ilist_node.h" +#include "source/util/small_vector.h" -#include "latest_version_glsl_std_450_header.h" -#include "latest_version_spirv_header.h" -#include "reflect.h" +#include "source/latest_version_glsl_std_450_header.h" +#include "source/latest_version_spirv_header.h" +#include "source/opt/reflect.h" #include "spirv-tools/libspirv.h" namespace spvtools { @@ -730,4 +732,4 @@ bool Instruction::IsConstant() const { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_INSTRUCTION_H_ +#endif // SOURCE_OPT_INSTRUCTION_H_ diff --git a/third_party/spirv-tools/source/opt/instruction_list.cpp b/third_party/spirv-tools/source/opt/instruction_list.cpp old mode 100755 new mode 100644 index dfaaba4df4..385a136ec7 --- a/third_party/spirv-tools/source/opt/instruction_list.cpp +++ b/third_party/spirv-tools/source/opt/instruction_list.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "instruction_list.h" +#include "source/opt/instruction_list.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/instruction_list.h b/third_party/spirv-tools/source/opt/instruction_list.h old mode 100755 new mode 100644 index 1fb4d874c6..ea1cc7c46c --- a/third_party/spirv-tools/source/opt/instruction_list.h +++ b/third_party/spirv-tools/source/opt/instruction_list.h @@ -13,19 +13,19 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_INSTRUCTION_LIST_H_ -#define LIBSPIRV_OPT_INSTRUCTION_LIST_H_ +#ifndef SOURCE_OPT_INSTRUCTION_LIST_H_ +#define SOURCE_OPT_INSTRUCTION_LIST_H_ #include #include +#include #include #include -#include "instruction.h" -#include "operand.h" -#include "util/ilist.h" - -#include "latest_version_spirv_header.h" +#include "source/latest_version_spirv_header.h" +#include "source/operand.h" +#include "source/opt/instruction.h" +#include "source/util/ilist.h" #include "spirv-tools/libspirv.h" namespace spvtools { @@ -127,4 +127,4 @@ void InstructionList::clear() { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_INSTRUCTION_LIST_H_ +#endif // SOURCE_OPT_INSTRUCTION_LIST_H_ diff --git a/third_party/spirv-tools/source/opt/ir_builder.h b/third_party/spirv-tools/source/opt/ir_builder.h old mode 100755 new mode 100644 index 9a10540850..2dab76e52a --- a/third_party/spirv-tools/source/opt/ir_builder.h +++ b/third_party/spirv-tools/source/opt/ir_builder.h @@ -12,13 +12,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_IR_BUILDER_H_ -#define LIBSPIRV_OPT_IR_BUILDER_H_ +#ifndef SOURCE_OPT_IR_BUILDER_H_ +#define SOURCE_OPT_IR_BUILDER_H_ -#include "opt/basic_block.h" -#include "opt/constants.h" -#include "opt/instruction.h" -#include "opt/ir_context.h" +#include +#include +#include +#include + +#include "source/opt/basic_block.h" +#include "source/opt/constants.h" +#include "source/opt/instruction.h" +#include "source/opt/ir_context.h" namespace spvtools { namespace opt { @@ -413,4 +418,4 @@ class InstructionBuilder { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_IR_BUILDER_H_ +#endif // SOURCE_OPT_IR_BUILDER_H_ diff --git a/third_party/spirv-tools/source/opt/ir_context.cpp b/third_party/spirv-tools/source/opt/ir_context.cpp old mode 100755 new mode 100644 index ad0cad77f9..742ac1f626 --- a/third_party/spirv-tools/source/opt/ir_context.cpp +++ b/third_party/spirv-tools/source/opt/ir_context.cpp @@ -12,14 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "ir_context.h" -#include "latest_version_glsl_std_450_header.h" -#include "log.h" -#include "mem_pass.h" -#include "reflect.h" +#include "source/opt/ir_context.h" #include +#include "source/latest_version_glsl_std_450_header.h" +#include "source/opt/log.h" +#include "source/opt/mem_pass.h" +#include "source/opt/reflect.h" + namespace spvtools { namespace opt { @@ -191,7 +192,7 @@ bool IRContext::ReplaceAllUsesWith(uint32_t before, uint32_t after) { user->SetInOperand(in_operand_pos, {after}); } AnalyzeUses(user); - }; + } return true; } diff --git a/third_party/spirv-tools/source/opt/ir_context.h b/third_party/spirv-tools/source/opt/ir_context.h old mode 100755 new mode 100644 index 00b72dc83a..a9d892fa2f --- a/third_party/spirv-tools/source/opt/ir_context.h +++ b/third_party/spirv-tools/source/opt/ir_context.h @@ -12,28 +12,34 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef SPIRV_TOOLS_IR_CONTEXT_H -#define SPIRV_TOOLS_IR_CONTEXT_H - -#include "assembly_grammar.h" -#include "cfg.h" -#include "constants.h" -#include "decoration_manager.h" -#include "def_use_manager.h" -#include "dominator_analysis.h" -#include "feature_manager.h" -#include "fold.h" -#include "loop_descriptor.h" -#include "module.h" -#include "register_pressure.h" -#include "scalar_analysis.h" -#include "type_manager.h" -#include "value_number_table.h" +#ifndef SOURCE_OPT_IR_CONTEXT_H_ +#define SOURCE_OPT_IR_CONTEXT_H_ #include #include #include +#include +#include +#include #include +#include +#include + +#include "source/assembly_grammar.h" +#include "source/opt/cfg.h" +#include "source/opt/constants.h" +#include "source/opt/decoration_manager.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/dominator_analysis.h" +#include "source/opt/feature_manager.h" +#include "source/opt/fold.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/module.h" +#include "source/opt/register_pressure.h" +#include "source/opt/scalar_analysis.h" +#include "source/opt/type_manager.h" +#include "source/opt/value_number_table.h" +#include "source/util/make_unique.h" namespace spvtools { namespace opt { @@ -262,14 +268,14 @@ class IRContext { BuildDecorationManager(); } return decoration_mgr_.get(); - }; + } // Returns a pointer to the constant manager. If no constant manager has been // created yet, it creates one. NOTE: Once created, the constant manager // remains active and it is never re-built. analysis::ConstantManager* get_constant_mgr() { if (!constant_mgr_) - constant_mgr_.reset(new analysis::ConstantManager(this)); + constant_mgr_ = MakeUnique(this); return constant_mgr_.get(); } @@ -278,7 +284,7 @@ class IRContext { // is never re-built. analysis::TypeManager* get_type_mgr() { if (!type_mgr_) - type_mgr_.reset(new analysis::TypeManager(consumer(), this)); + type_mgr_ = MakeUnique(consumer(), this); return type_mgr_.get(); } @@ -445,7 +451,7 @@ class IRContext { const InstructionFolder& get_instruction_folder() { if (!inst_folder_) { - inst_folder_.reset(new InstructionFolder(this)); + inst_folder_ = MakeUnique(this); } return *inst_folder_; } @@ -453,7 +459,7 @@ class IRContext { private: // Builds the def-use manager from scratch, even if it was already valid. void BuildDefUseManager() { - def_use_mgr_.reset(new analysis::DefUseManager(module())); + def_use_mgr_ = MakeUnique(module()); valid_analyses_ = valid_analyses_ | kAnalysisDefUse; } @@ -471,30 +477,30 @@ class IRContext { } void BuildDecorationManager() { - decoration_mgr_.reset(new analysis::DecorationManager(module())); + decoration_mgr_ = MakeUnique(module()); valid_analyses_ = valid_analyses_ | kAnalysisDecorations; } void BuildCFG() { - cfg_.reset(new CFG(module())); + cfg_ = MakeUnique(module()); valid_analyses_ = valid_analyses_ | kAnalysisCFG; } void BuildScalarEvolutionAnalysis() { - scalar_evolution_analysis_.reset(new ScalarEvolutionAnalysis(this)); + scalar_evolution_analysis_ = MakeUnique(this); valid_analyses_ = valid_analyses_ | kAnalysisScalarEvolution; } // Builds the liveness analysis from scratch, even if it was already valid. void BuildRegPressureAnalysis() { - reg_pressure_.reset(new LivenessAnalysis(this)); + reg_pressure_ = MakeUnique(this); valid_analyses_ = valid_analyses_ | kAnalysisRegisterPressure; } // Builds the value number table analysis from scratch, even if it was already // valid. void BuildValueNumberTable() { - vn_table_.reset(new ValueNumberTable(this)); + vn_table_ = MakeUnique(this); valid_analyses_ = valid_analyses_ | kAnalysisValueNumberTable; } @@ -516,7 +522,7 @@ class IRContext { // Analyzes the features in the owned module. Builds the manager if required. void AnalyzeFeatures() { - feature_mgr_.reset(new FeatureManager(grammar_)); + feature_mgr_ = MakeUnique(grammar_); feature_mgr_->Analyze(module()); } @@ -827,7 +833,7 @@ void IRContext::UpdateDefUse(Instruction* inst) { } void IRContext::BuildIdToNameMap() { - id_to_name_.reset(new std::multimap()); + id_to_name_ = MakeUnique>(); for (Instruction& debug_inst : debugs2()) { if (debug_inst.opcode() == SpvOpMemberName || debug_inst.opcode() == SpvOpName) { @@ -849,4 +855,4 @@ IRContext::GetNames(uint32_t id) { } // namespace opt } // namespace spvtools -#endif // SPIRV_TOOLS_IR_CONTEXT_H +#endif // SOURCE_OPT_IR_CONTEXT_H_ diff --git a/third_party/spirv-tools/source/opt/ir_loader.cpp b/third_party/spirv-tools/source/opt/ir_loader.cpp old mode 100755 new mode 100644 index b12ebbe829..46e2bee427 --- a/third_party/spirv-tools/source/opt/ir_loader.cpp +++ b/third_party/spirv-tools/source/opt/ir_loader.cpp @@ -12,10 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "ir_loader.h" +#include "source/opt/ir_loader.h" -#include "log.h" -#include "reflect.h" +#include + +#include "source/opt/log.h" +#include "source/opt/reflect.h" +#include "source/util/make_unique.h" namespace spvtools { namespace opt { @@ -48,7 +51,7 @@ bool IrLoader::AddInstruction(const spv_parsed_instruction_t* inst) { Error(consumer_, src, loc, "function inside function"); return false; } - function_.reset(new Function(std::move(spv_inst))); + function_ = MakeUnique(std::move(spv_inst)); } else if (opcode == SpvOpFunctionEnd) { if (function_ == nullptr) { Error(consumer_, src, loc, @@ -71,7 +74,7 @@ bool IrLoader::AddInstruction(const spv_parsed_instruction_t* inst) { Error(consumer_, src, loc, "OpLabel inside basic block"); return false; } - block_.reset(new BasicBlock(std::move(spv_inst))); + block_ = MakeUnique(std::move(spv_inst)); } else if (IsTerminatorInst(opcode)) { if (function_ == nullptr) { Error(consumer_, src, loc, "terminator instruction outside function"); diff --git a/third_party/spirv-tools/source/opt/ir_loader.h b/third_party/spirv-tools/source/opt/ir_loader.h old mode 100755 new mode 100644 index 8bf0edbafa..940d7b0db0 --- a/third_party/spirv-tools/source/opt/ir_loader.h +++ b/third_party/spirv-tools/source/opt/ir_loader.h @@ -12,14 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_IR_LOADER_H_ -#define LIBSPIRV_OPT_IR_LOADER_H_ +#ifndef SOURCE_OPT_IR_LOADER_H_ +#define SOURCE_OPT_IR_LOADER_H_ #include +#include +#include -#include "basic_block.h" -#include "instruction.h" -#include "module.h" +#include "source/opt/basic_block.h" +#include "source/opt/instruction.h" +#include "source/opt/module.h" #include "spirv-tools/libspirv.hpp" namespace spvtools { @@ -81,4 +83,4 @@ class IrLoader { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_IR_LOADER_H_ +#endif // SOURCE_OPT_IR_LOADER_H_ diff --git a/third_party/spirv-tools/source/opt/iterator.h b/third_party/spirv-tools/source/opt/iterator.h old mode 100755 new mode 100644 index 2f011b30d1..444d457c5c --- a/third_party/spirv-tools/source/opt/iterator.h +++ b/third_party/spirv-tools/source/opt/iterator.h @@ -12,13 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_ITERATOR_H_ -#define LIBSPIRV_OPT_ITERATOR_H_ +#ifndef SOURCE_OPT_ITERATOR_H_ +#define SOURCE_OPT_ITERATOR_H_ #include // for ptrdiff_t #include #include #include +#include #include namespace spvtools { @@ -354,4 +355,4 @@ inline } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_ITERATOR_H_ +#endif // SOURCE_OPT_ITERATOR_H_ diff --git a/third_party/spirv-tools/source/opt/licm_pass.cpp b/third_party/spirv-tools/source/opt/licm_pass.cpp old mode 100755 new mode 100644 index 84871138ff..d8256679e3 --- a/third_party/spirv-tools/source/opt/licm_pass.cpp +++ b/third_party/spirv-tools/source/opt/licm_pass.cpp @@ -12,13 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "opt/licm_pass.h" -#include "opt/module.h" -#include "opt/pass.h" +#include "source/opt/licm_pass.h" #include #include +#include "source/opt/module.h" +#include "source/opt/pass.h" + namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/licm_pass.h b/third_party/spirv-tools/source/opt/licm_pass.h old mode 100755 new mode 100644 index c7d6bc6ea6..a17450043a --- a/third_party/spirv-tools/source/opt/licm_pass.h +++ b/third_party/spirv-tools/source/opt/licm_pass.h @@ -15,12 +15,13 @@ #ifndef SOURCE_OPT_LICM_PASS_H_ #define SOURCE_OPT_LICM_PASS_H_ -#include "opt/basic_block.h" -#include "opt/instruction.h" -#include "opt/loop_descriptor.h" -#include "opt/pass.h" - #include +#include + +#include "source/opt/basic_block.h" +#include "source/opt/instruction.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/pass.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/local_access_chain_convert_pass.cpp b/third_party/spirv-tools/source/opt/local_access_chain_convert_pass.cpp old mode 100755 new mode 100644 index 26108a729a..6d540751df --- a/third_party/spirv-tools/source/opt/local_access_chain_convert_pass.cpp +++ b/third_party/spirv-tools/source/opt/local_access_chain_convert_pass.cpp @@ -14,8 +14,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "local_access_chain_convert_pass.h" +#include "source/opt/local_access_chain_convert_pass.h" +#include "ir_builder.h" #include "ir_context.h" #include "iterator.h" @@ -69,24 +70,29 @@ void LocalAccessChainConvertPass::AppendConstantOperands( }); } -uint32_t LocalAccessChainConvertPass::GenAccessChainLoadReplacement( - const Instruction* ptrInst, - std::vector>* newInsts) { +void LocalAccessChainConvertPass::ReplaceAccessChainLoad( + const Instruction* address_inst, Instruction* original_load) { // Build and append load of variable in ptrInst + std::vector> new_inst; uint32_t varId; uint32_t varPteTypeId; const uint32_t ldResultId = - BuildAndAppendVarLoad(ptrInst, &varId, &varPteTypeId, newInsts); + BuildAndAppendVarLoad(address_inst, &varId, &varPteTypeId, &new_inst); + original_load->InsertBefore(std::move(new_inst)); - // Build and append Extract - const uint32_t extResultId = TakeNextId(); - const uint32_t ptrPteTypeId = GetPointeeTypeId(ptrInst); - std::vector ext_in_opnds = { - {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {ldResultId}}}; - AppendConstantOperands(ptrInst, &ext_in_opnds); - BuildAndAppendInst(SpvOpCompositeExtract, ptrPteTypeId, extResultId, - ext_in_opnds, newInsts); - return extResultId; + // Rewrite |original_load| into an extract. + Instruction::OperandList new_operands; + + // copy the result id and the type id to the new operand list. + new_operands.emplace_back(original_load->GetOperand(0)); + new_operands.emplace_back(original_load->GetOperand(1)); + + new_operands.emplace_back( + Operand({spv_operand_type_t::SPV_OPERAND_TYPE_ID, {ldResultId}})); + AppendConstantOperands(address_inst, &new_operands); + original_load->SetOpcode(SpvOpCompositeExtract); + original_load->ReplaceOperands(new_operands); + context()->UpdateDefUse(original_load); } void LocalAccessChainConvertPass::GenAccessChainStoreReplacement( @@ -200,13 +206,7 @@ bool LocalAccessChainConvertPass::ConvertLocalAccessChains(Function* func) { if (!IsNonPtrAccessChain(ptrInst->opcode())) break; if (!IsTargetVar(varId)) break; std::vector> newInsts; - uint32_t replId = GenAccessChainLoadReplacement(ptrInst, &newInsts); - context()->KillNamesAndDecorates(&*ii); - context()->ReplaceAllUsesWith(ii->result_id(), replId); - dead_instructions.push_back(&*ii); - ++ii; - ii = ii.InsertBefore(std::move(newInsts)); - ++ii; + ReplaceAccessChainLoad(ptrInst, &*ii); modified = true; } break; case SpvOpStore: { diff --git a/third_party/spirv-tools/source/opt/local_access_chain_convert_pass.h b/third_party/spirv-tools/source/opt/local_access_chain_convert_pass.h old mode 100755 new mode 100644 index a57c30223c..9d06890bfd --- a/third_party/spirv-tools/source/opt/local_access_chain_convert_pass.h +++ b/third_party/spirv-tools/source/opt/local_access_chain_convert_pass.h @@ -14,20 +14,23 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_LOCAL_ACCESS_CHAIN_CONVERT_PASS_H_ -#define LIBSPIRV_OPT_LOCAL_ACCESS_CHAIN_CONVERT_PASS_H_ +#ifndef SOURCE_OPT_LOCAL_ACCESS_CHAIN_CONVERT_PASS_H_ +#define SOURCE_OPT_LOCAL_ACCESS_CHAIN_CONVERT_PASS_H_ #include #include +#include #include +#include #include #include #include +#include -#include "basic_block.h" -#include "def_use_manager.h" -#include "mem_pass.h" -#include "module.h" +#include "source/opt/basic_block.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/mem_pass.h" +#include "source/opt/module.h" namespace spvtools { namespace opt { @@ -83,11 +86,12 @@ class LocalAccessChainConvertPass : public MemPass { const Instruction* ptrInst, uint32_t valId, std::vector>* newInsts); - // For the (constant index) access chain |ptrInst|, create an - // equivalent load and extract. Append to |newInsts|. - uint32_t GenAccessChainLoadReplacement( - const Instruction* ptrInst, - std::vector>* newInsts); + // For the (constant index) access chain |address_inst|, create an + // equivalent load and extract that replaces |original_load|. The result id + // of the extract will be the same as the original result id of + // |original_load|. + void ReplaceAccessChainLoad(const Instruction* address_inst, + Instruction* original_load); // Return true if all indices of access chain |acp| are OpConstant integers bool IsConstantIndexAccessChain(const Instruction* acp) const; @@ -123,4 +127,4 @@ class LocalAccessChainConvertPass : public MemPass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_LOCAL_ACCESS_CHAIN_CONVERT_PASS_H_ +#endif // SOURCE_OPT_LOCAL_ACCESS_CHAIN_CONVERT_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/local_redundancy_elimination.cpp b/third_party/spirv-tools/source/opt/local_redundancy_elimination.cpp old mode 100755 new mode 100644 index 85c1a083a6..9539e65566 --- a/third_party/spirv-tools/source/opt/local_redundancy_elimination.cpp +++ b/third_party/spirv-tools/source/opt/local_redundancy_elimination.cpp @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "local_redundancy_elimination.h" +#include "source/opt/local_redundancy_elimination.h" -#include "value_number_table.h" +#include "source/opt/value_number_table.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/local_redundancy_elimination.h b/third_party/spirv-tools/source/opt/local_redundancy_elimination.h old mode 100755 new mode 100644 index 8ec3538a94..9f55c8bfea --- a/third_party/spirv-tools/source/opt/local_redundancy_elimination.h +++ b/third_party/spirv-tools/source/opt/local_redundancy_elimination.h @@ -12,12 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_LOCAL_REDUNDANCY_ELIMINATION_H_ -#define LIBSPIRV_OPT_LOCAL_REDUNDANCY_ELIMINATION_H_ +#ifndef SOURCE_OPT_LOCAL_REDUNDANCY_ELIMINATION_H_ +#define SOURCE_OPT_LOCAL_REDUNDANCY_ELIMINATION_H_ -#include "ir_context.h" -#include "pass.h" -#include "value_number_table.h" +#include + +#include "source/opt/ir_context.h" +#include "source/opt/pass.h" +#include "source/opt/value_number_table.h" namespace spvtools { namespace opt { @@ -62,4 +64,4 @@ class LocalRedundancyEliminationPass : public Pass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_LOCAL_REDUNDANCY_ELIMINATION_H_ +#endif // SOURCE_OPT_LOCAL_REDUNDANCY_ELIMINATION_H_ diff --git a/third_party/spirv-tools/source/opt/local_single_block_elim_pass.cpp b/third_party/spirv-tools/source/opt/local_single_block_elim_pass.cpp old mode 100755 new mode 100644 index 5a2ec8cd06..bb909f4aa9 --- a/third_party/spirv-tools/source/opt/local_single_block_elim_pass.cpp +++ b/third_party/spirv-tools/source/opt/local_single_block_elim_pass.cpp @@ -14,13 +14,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "local_single_block_elim_pass.h" +#include "source/opt/local_single_block_elim_pass.h" -#include "iterator.h" +#include + +#include "source/opt/iterator.h" namespace spvtools { namespace opt { - namespace { const uint32_t kStoreValIdInIdx = 1; @@ -77,6 +78,7 @@ bool LocalSingleBlockLoadStoreElimPass::LocalSingleBlockLoadStoreElim( if (prev_store != var2store_.end() && instructions_to_save.count(prev_store->second) == 0) { instructions_to_kill.push_back(prev_store->second); + modified = true; } bool kill_store = false; diff --git a/third_party/spirv-tools/source/opt/local_single_block_elim_pass.h b/third_party/spirv-tools/source/opt/local_single_block_elim_pass.h old mode 100755 new mode 100644 index faaf1d8902..3dead98347 --- a/third_party/spirv-tools/source/opt/local_single_block_elim_pass.h +++ b/third_party/spirv-tools/source/opt/local_single_block_elim_pass.h @@ -14,20 +14,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_LOCAL_SINGLE_BLOCK_ELIM_PASS_H_ -#define LIBSPIRV_OPT_LOCAL_SINGLE_BLOCK_ELIM_PASS_H_ +#ifndef SOURCE_OPT_LOCAL_SINGLE_BLOCK_ELIM_PASS_H_ +#define SOURCE_OPT_LOCAL_SINGLE_BLOCK_ELIM_PASS_H_ #include #include #include +#include #include #include #include -#include "basic_block.h" -#include "def_use_manager.h" -#include "mem_pass.h" -#include "module.h" +#include "source/opt/basic_block.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/mem_pass.h" +#include "source/opt/module.h" namespace spvtools { namespace opt { @@ -101,4 +102,4 @@ class LocalSingleBlockLoadStoreElimPass : public MemPass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_LOCAL_SINGLE_BLOCK_ELIM_PASS_H_ +#endif // SOURCE_OPT_LOCAL_SINGLE_BLOCK_ELIM_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/local_single_store_elim_pass.cpp b/third_party/spirv-tools/source/opt/local_single_store_elim_pass.cpp old mode 100755 new mode 100644 index 66c1505e35..4c837fc73f --- a/third_party/spirv-tools/source/opt/local_single_store_elim_pass.cpp +++ b/third_party/spirv-tools/source/opt/local_single_store_elim_pass.cpp @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "local_single_store_elim_pass.h" +#include "source/opt/local_single_store_elim_pass.h" -#include "cfa.h" -#include "iterator.h" -#include "latest_version_glsl_std_450_header.h" +#include "source/cfa.h" +#include "source/latest_version_glsl_std_450_header.h" +#include "source/opt/iterator.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/local_single_store_elim_pass.h b/third_party/spirv-tools/source/opt/local_single_store_elim_pass.h old mode 100755 new mode 100644 index 8d59b16262..d3d64b829a --- a/third_party/spirv-tools/source/opt/local_single_store_elim_pass.h +++ b/third_party/spirv-tools/source/opt/local_single_store_elim_pass.h @@ -14,20 +14,22 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_LOCAL_SINGLE_STORE_ELIM_PASS_H_ -#define LIBSPIRV_OPT_LOCAL_SINGLE_STORE_ELIM_PASS_H_ +#ifndef SOURCE_OPT_LOCAL_SINGLE_STORE_ELIM_PASS_H_ +#define SOURCE_OPT_LOCAL_SINGLE_STORE_ELIM_PASS_H_ #include #include #include +#include #include #include #include +#include -#include "basic_block.h" -#include "def_use_manager.h" -#include "mem_pass.h" -#include "module.h" +#include "source/opt/basic_block.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/mem_pass.h" +#include "source/opt/module.h" namespace spvtools { namespace opt { @@ -96,4 +98,4 @@ class LocalSingleStoreElimPass : public Pass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_LOCAL_SINGLE_STORE_ELIM_PASS_H_ +#endif // SOURCE_OPT_LOCAL_SINGLE_STORE_ELIM_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/local_ssa_elim_pass.cpp b/third_party/spirv-tools/source/opt/local_ssa_elim_pass.cpp old mode 100755 new mode 100644 index 872d26b3e0..ec7326ed0e --- a/third_party/spirv-tools/source/opt/local_ssa_elim_pass.cpp +++ b/third_party/spirv-tools/source/opt/local_ssa_elim_pass.cpp @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "local_ssa_elim_pass.h" +#include "source/opt/local_ssa_elim_pass.h" -#include "cfa.h" -#include "iterator.h" -#include "ssa_rewrite_pass.h" +#include "source/cfa.h" +#include "source/opt/iterator.h" +#include "source/opt/ssa_rewrite_pass.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/local_ssa_elim_pass.h b/third_party/spirv-tools/source/opt/local_ssa_elim_pass.h old mode 100755 new mode 100644 index c9d9cb9642..63d3c33bac --- a/third_party/spirv-tools/source/opt/local_ssa_elim_pass.h +++ b/third_party/spirv-tools/source/opt/local_ssa_elim_pass.h @@ -14,20 +14,22 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_LOCAL_SSA_ELIM_PASS_H_ -#define LIBSPIRV_OPT_LOCAL_SSA_ELIM_PASS_H_ +#ifndef SOURCE_OPT_LOCAL_SSA_ELIM_PASS_H_ +#define SOURCE_OPT_LOCAL_SSA_ELIM_PASS_H_ #include #include #include +#include #include #include #include +#include -#include "basic_block.h" -#include "def_use_manager.h" -#include "mem_pass.h" -#include "module.h" +#include "source/opt/basic_block.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/mem_pass.h" +#include "source/opt/module.h" namespace spvtools { namespace opt { @@ -65,4 +67,4 @@ class LocalMultiStoreElimPass : public MemPass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_LOCAL_SSA_ELIM_PASS_H_ +#endif // SOURCE_OPT_LOCAL_SSA_ELIM_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/log.h b/third_party/spirv-tools/source/opt/log.h old mode 100755 new mode 100644 index 70ae223c07..f87cbf3817 --- a/third_party/spirv-tools/source/opt/log.h +++ b/third_party/spirv-tools/source/opt/log.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef SPIRV_TOOLS_LOG_H_ -#define SPIRV_TOOLS_LOG_H_ +#ifndef SOURCE_OPT_LOG_H_ +#define SOURCE_OPT_LOG_H_ #include #include @@ -228,4 +228,4 @@ static_assert(PP_NARGS(0, 0, 0, 0, 0) == 5, "PP_NARGS macro error"); static_assert(PP_NARGS(1 + 1, 2, 3 / 3) == 3, "PP_NARGS macro error"); static_assert(PP_NARGS((1, 1), 2, (3, 3)) == 3, "PP_NARGS macro error"); -#endif // SPIRV_TOOLS_LOG_H_ +#endif // SOURCE_OPT_LOG_H_ diff --git a/third_party/spirv-tools/source/opt/loop_dependence.cpp b/third_party/spirv-tools/source/opt/loop_dependence.cpp index 82dbd1c05c..d8de699bf7 100644 --- a/third_party/spirv-tools/source/opt/loop_dependence.cpp +++ b/third_party/spirv-tools/source/opt/loop_dependence.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "opt/loop_dependence.h" +#include "source/opt/loop_dependence.h" #include #include @@ -21,9 +21,9 @@ #include #include -#include "opt/instruction.h" -#include "opt/scalar_analysis.h" -#include "opt/scalar_analysis_nodes.h" +#include "source/opt/instruction.h" +#include "source/opt/scalar_analysis.h" +#include "source/opt/scalar_analysis_nodes.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/loop_dependence.h b/third_party/spirv-tools/source/opt/loop_dependence.h index 2d2d20a047..582c8d0acb 100644 --- a/third_party/spirv-tools/source/opt/loop_dependence.h +++ b/third_party/spirv-tools/source/opt/loop_dependence.h @@ -26,10 +26,10 @@ #include #include -#include "opt/instruction.h" -#include "opt/ir_context.h" -#include "opt/loop_descriptor.h" -#include "opt/scalar_analysis.h" +#include "source/opt/instruction.h" +#include "source/opt/ir_context.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/scalar_analysis.h" namespace spvtools { namespace opt { @@ -555,4 +555,4 @@ class LoopDependenceAnalysis { } // namespace opt } // namespace spvtools -#endif // SOURCE_OPT_LOOP_DEPENDENCE_H__ +#endif // SOURCE_OPT_LOOP_DEPENDENCE_H_ diff --git a/third_party/spirv-tools/source/opt/loop_dependence_helpers.cpp b/third_party/spirv-tools/source/opt/loop_dependence_helpers.cpp index 979d03a8e1..de27a0a724 100644 --- a/third_party/spirv-tools/source/opt/loop_dependence_helpers.cpp +++ b/third_party/spirv-tools/source/opt/loop_dependence_helpers.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "opt/loop_dependence.h" +#include "source/opt/loop_dependence.h" #include #include @@ -21,10 +21,10 @@ #include #include -#include "opt/basic_block.h" -#include "opt/instruction.h" -#include "opt/scalar_analysis.h" -#include "opt/scalar_analysis_nodes.h" +#include "source/opt/basic_block.h" +#include "source/opt/instruction.h" +#include "source/opt/scalar_analysis.h" +#include "source/opt/scalar_analysis_nodes.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/loop_descriptor.cpp b/third_party/spirv-tools/source/opt/loop_descriptor.cpp old mode 100755 new mode 100644 index ec05ba6be9..efc56bdba6 --- a/third_party/spirv-tools/source/opt/loop_descriptor.cpp +++ b/third_party/spirv-tools/source/opt/loop_descriptor.cpp @@ -12,21 +12,24 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "opt/loop_descriptor.h" +#include "source/opt/loop_descriptor.h" + #include #include +#include +#include #include #include #include -#include "constants.h" -#include "opt/cfg.h" -#include "opt/dominator_tree.h" -#include "opt/ir_builder.h" -#include "opt/ir_context.h" -#include "opt/iterator.h" -#include "opt/make_unique.h" -#include "opt/tree_iterator.h" +#include "source/opt/cfg.h" +#include "source/opt/constants.h" +#include "source/opt/dominator_tree.h" +#include "source/opt/ir_builder.h" +#include "source/opt/ir_context.h" +#include "source/opt/iterator.h" +#include "source/opt/tree_iterator.h" +#include "source/util/make_unique.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/loop_descriptor.h b/third_party/spirv-tools/source/opt/loop_descriptor.h old mode 100755 new mode 100644 index 21e5bf4929..45a175a0ca --- a/third_party/spirv-tools/source/opt/loop_descriptor.h +++ b/third_party/spirv-tools/source/opt/loop_descriptor.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_LOOP_DESCRIPTORS_H_ -#define LIBSPIRV_OPT_LOOP_DESCRIPTORS_H_ +#ifndef SOURCE_OPT_LOOP_DESCRIPTOR_H_ +#define SOURCE_OPT_LOOP_DESCRIPTOR_H_ #include #include @@ -21,12 +21,13 @@ #include #include #include +#include #include -#include "opt/basic_block.h" -#include "opt/dominator_analysis.h" -#include "opt/module.h" -#include "opt/tree_iterator.h" +#include "source/opt/basic_block.h" +#include "source/opt/dominator_analysis.h" +#include "source/opt/module.h" +#include "source/opt/tree_iterator.h" namespace spvtools { namespace opt { @@ -568,4 +569,4 @@ class LoopDescriptor { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_LOOP_DESCRIPTORS_H_ +#endif // SOURCE_OPT_LOOP_DESCRIPTOR_H_ diff --git a/third_party/spirv-tools/source/opt/loop_fission.cpp b/third_party/spirv-tools/source/opt/loop_fission.cpp index 7657ad6a4e..0052406dd7 100644 --- a/third_party/spirv-tools/source/opt/loop_fission.cpp +++ b/third_party/spirv-tools/source/opt/loop_fission.cpp @@ -12,8 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "opt/loop_fission.h" -#include "opt/register_pressure.h" +#include "source/opt/loop_fission.h" + +#include + +#include "source/opt/register_pressure.h" // Implement loop fission with an optional parameter to split only // if the register pressure in a given loop meets a certain criteria. This is diff --git a/third_party/spirv-tools/source/opt/loop_fission.h b/third_party/spirv-tools/source/opt/loop_fission.h index 841d4d582b..ef886c9655 100644 --- a/third_party/spirv-tools/source/opt/loop_fission.h +++ b/third_party/spirv-tools/source/opt/loop_fission.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_LOOP_FISSION_H_ -#define LIBSPIRV_OPT_LOOP_FISSION_H_ +#ifndef SOURCE_OPT_LOOP_FISSION_H_ +#define SOURCE_OPT_LOOP_FISSION_H_ #include #include @@ -21,12 +21,12 @@ #include #include -#include "cfg.h" -#include "module.h" -#include "opt/loop_dependence.h" -#include "opt/loop_utils.h" -#include "pass.h" -#include "tree_iterator.h" +#include "source/opt/cfg.h" +#include "source/opt/loop_dependence.h" +#include "source/opt/loop_utils.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" +#include "source/opt/tree_iterator.h" namespace spvtools { namespace opt { @@ -75,4 +75,4 @@ class LoopFissionPass : public Pass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_LOOP_FISSION_H_ +#endif // SOURCE_OPT_LOOP_FISSION_H_ diff --git a/third_party/spirv-tools/source/opt/loop_fusion.cpp b/third_party/spirv-tools/source/opt/loop_fusion.cpp index 350b27b87a..07d171a0af 100644 --- a/third_party/spirv-tools/source/opt/loop_fusion.cpp +++ b/third_party/spirv-tools/source/opt/loop_fusion.cpp @@ -12,14 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "opt/loop_fusion.h" +#include "source/opt/loop_fusion.h" #include #include -#include "opt/ir_context.h" -#include "opt/loop_dependence.h" -#include "opt/loop_descriptor.h" +#include "source/opt/ir_context.h" +#include "source/opt/loop_dependence.h" +#include "source/opt/loop_descriptor.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/loop_fusion.h b/third_party/spirv-tools/source/opt/loop_fusion.h index 343e023ba8..d61d6783c8 100644 --- a/third_party/spirv-tools/source/opt/loop_fusion.h +++ b/third_party/spirv-tools/source/opt/loop_fusion.h @@ -17,12 +17,13 @@ #include #include +#include #include -#include "opt/ir_context.h" -#include "opt/loop_descriptor.h" -#include "opt/loop_utils.h" -#include "opt/scalar_analysis.h" +#include "source/opt/ir_context.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/loop_utils.h" +#include "source/opt/scalar_analysis.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/loop_fusion_pass.cpp b/third_party/spirv-tools/source/opt/loop_fusion_pass.cpp index 46bfdc67ca..bd8444ae56 100644 --- a/third_party/spirv-tools/source/opt/loop_fusion_pass.cpp +++ b/third_party/spirv-tools/source/opt/loop_fusion_pass.cpp @@ -12,12 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "opt/loop_fusion_pass.h" +#include "source/opt/loop_fusion_pass.h" -#include "opt/ir_context.h" -#include "opt/loop_descriptor.h" -#include "opt/loop_fusion.h" -#include "opt/register_pressure.h" +#include "source/opt/ir_context.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/loop_fusion.h" +#include "source/opt/register_pressure.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/loop_fusion_pass.h b/third_party/spirv-tools/source/opt/loop_fusion_pass.h index 99dd67d725..3a0be60004 100644 --- a/third_party/spirv-tools/source/opt/loop_fusion_pass.h +++ b/third_party/spirv-tools/source/opt/loop_fusion_pass.h @@ -15,7 +15,7 @@ #ifndef SOURCE_OPT_LOOP_FUSION_PASS_H_ #define SOURCE_OPT_LOOP_FUSION_PASS_H_ -#include "opt/pass.h" +#include "source/opt/pass.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/loop_peeling.cpp b/third_party/spirv-tools/source/opt/loop_peeling.cpp old mode 100755 new mode 100644 index 274aa66d09..7d27480ae2 --- a/third_party/spirv-tools/source/opt/loop_peeling.cpp +++ b/third_party/spirv-tools/source/opt/loop_peeling.cpp @@ -19,13 +19,13 @@ #include #include -#include "ir_builder.h" -#include "ir_context.h" -#include "loop_descriptor.h" -#include "loop_peeling.h" -#include "loop_utils.h" -#include "scalar_analysis.h" -#include "scalar_analysis_nodes.h" +#include "source/opt/ir_builder.h" +#include "source/opt/ir_context.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/loop_peeling.h" +#include "source/opt/loop_utils.h" +#include "source/opt/scalar_analysis.h" +#include "source/opt/scalar_analysis_nodes.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/loop_peeling.h b/third_party/spirv-tools/source/opt/loop_peeling.h old mode 100755 new mode 100644 index 08af223b25..413f896f25 --- a/third_party/spirv-tools/source/opt/loop_peeling.h +++ b/third_party/spirv-tools/source/opt/loop_peeling.h @@ -18,16 +18,17 @@ #include #include #include +#include #include #include #include #include -#include "opt/ir_context.h" -#include "opt/loop_descriptor.h" -#include "opt/loop_utils.h" -#include "opt/pass.h" -#include "opt/scalar_analysis.h" +#include "source/opt/ir_context.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/loop_utils.h" +#include "source/opt/pass.h" +#include "source/opt/scalar_analysis.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/loop_unroller.cpp b/third_party/spirv-tools/source/opt/loop_unroller.cpp old mode 100755 new mode 100644 index 16bde30708..587615edf3 --- a/third_party/spirv-tools/source/opt/loop_unroller.cpp +++ b/third_party/spirv-tools/source/opt/loop_unroller.cpp @@ -12,12 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "opt/loop_unroller.h" +#include "source/opt/loop_unroller.h" + +#include #include #include +#include #include -#include "opt/ir_builder.h" -#include "opt/loop_utils.h" +#include + +#include "source/opt/ir_builder.h" +#include "source/opt/loop_utils.h" // Implements loop util unrolling functionality for fully and partially // unrolling loops. Given a factor it will duplicate the loop that many times, diff --git a/third_party/spirv-tools/source/opt/loop_unroller.h b/third_party/spirv-tools/source/opt/loop_unroller.h old mode 100755 new mode 100644 index 080a1dfd57..98f4d475eb --- a/third_party/spirv-tools/source/opt/loop_unroller.h +++ b/third_party/spirv-tools/source/opt/loop_unroller.h @@ -14,7 +14,8 @@ #ifndef SOURCE_OPT_LOOP_UNROLLER_H_ #define SOURCE_OPT_LOOP_UNROLLER_H_ -#include "opt/pass.h" + +#include "source/opt/pass.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/loop_unswitch_pass.cpp b/third_party/spirv-tools/source/opt/loop_unswitch_pass.cpp old mode 100755 new mode 100644 index b9eb61bc15..59a0cbcd37 --- a/third_party/spirv-tools/source/opt/loop_unswitch_pass.cpp +++ b/third_party/spirv-tools/source/opt/loop_unswitch_pass.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "loop_unswitch_pass.h" +#include "source/opt/loop_unswitch_pass.h" #include #include @@ -23,16 +23,16 @@ #include #include -#include "basic_block.h" -#include "dominator_tree.h" -#include "fold.h" -#include "function.h" -#include "instruction.h" -#include "ir_builder.h" -#include "ir_context.h" -#include "loop_descriptor.h" +#include "source/opt/basic_block.h" +#include "source/opt/dominator_tree.h" +#include "source/opt/fold.h" +#include "source/opt/function.h" +#include "source/opt/instruction.h" +#include "source/opt/ir_builder.h" +#include "source/opt/ir_context.h" +#include "source/opt/loop_descriptor.h" -#include "loop_utils.h" +#include "source/opt/loop_utils.h" namespace spvtools { namespace opt { @@ -731,8 +731,10 @@ class LoopUnswitch { context_->KillInst(merge); } dead_loops[loop] = loop->GetParent(); - } else + } else { dead_loops[loop] = loop; + } + // For each loop, check if we killed it. If we did, find a suitable parent // for its children. for (Loop& sub_loop : diff --git a/third_party/spirv-tools/source/opt/loop_unswitch_pass.h b/third_party/spirv-tools/source/opt/loop_unswitch_pass.h old mode 100755 new mode 100644 index b18519039f..3ecdd61162 --- a/third_party/spirv-tools/source/opt/loop_unswitch_pass.h +++ b/third_party/spirv-tools/source/opt/loop_unswitch_pass.h @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_LOOP_UNSWITCH_PASS_H_ -#define LIBSPIRV_OPT_LOOP_UNSWITCH_PASS_H_ +#ifndef SOURCE_OPT_LOOP_UNSWITCH_PASS_H_ +#define SOURCE_OPT_LOOP_UNSWITCH_PASS_H_ -#include "opt/loop_descriptor.h" -#include "opt/pass.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/pass.h" namespace spvtools { namespace opt { @@ -40,4 +40,4 @@ class LoopUnswitchPass : public Pass { } // namespace opt } // namespace spvtools -#endif // !LIBSPIRV_OPT_LOOP_UNSWITCH_PASS_H_ +#endif // SOURCE_OPT_LOOP_UNSWITCH_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/loop_utils.cpp b/third_party/spirv-tools/source/opt/loop_utils.cpp old mode 100755 new mode 100644 index 96644b5d6d..482335f3bf --- a/third_party/spirv-tools/source/opt/loop_utils.cpp +++ b/third_party/spirv-tools/source/opt/loop_utils.cpp @@ -16,14 +16,15 @@ #include #include #include +#include #include -#include "cfa.h" -#include "opt/cfg.h" -#include "opt/ir_builder.h" -#include "opt/ir_context.h" -#include "opt/loop_descriptor.h" -#include "opt/loop_utils.h" +#include "source/cfa.h" +#include "source/opt/cfg.h" +#include "source/opt/ir_builder.h" +#include "source/opt/ir_context.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/loop_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/loop_utils.h b/third_party/spirv-tools/source/opt/loop_utils.h old mode 100755 new mode 100644 index 45cffd4bf0..a4e61900bc --- a/third_party/spirv-tools/source/opt/loop_utils.h +++ b/third_party/spirv-tools/source/opt/loop_utils.h @@ -14,11 +14,14 @@ #ifndef SOURCE_OPT_LOOP_UTILS_H_ #define SOURCE_OPT_LOOP_UTILS_H_ + #include #include +#include #include -#include "opt/ir_context.h" -#include "opt/loop_descriptor.h" + +#include "source/opt/ir_context.h" +#include "source/opt/loop_descriptor.h" namespace spvtools { diff --git a/third_party/spirv-tools/source/opt/mem_pass.cpp b/third_party/spirv-tools/source/opt/mem_pass.cpp old mode 100755 new mode 100644 index 41c29d64f5..c65e04938a --- a/third_party/spirv-tools/source/opt/mem_pass.cpp +++ b/third_party/spirv-tools/source/opt/mem_pass.cpp @@ -14,13 +14,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "mem_pass.h" +#include "source/opt/mem_pass.h" -#include "basic_block.h" -#include "cfa.h" -#include "dominator_analysis.h" -#include "ir_context.h" -#include "iterator.h" +#include +#include +#include + +#include "source/cfa.h" +#include "source/opt/basic_block.h" +#include "source/opt/dominator_analysis.h" +#include "source/opt/ir_context.h" +#include "source/opt/iterator.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/mem_pass.h b/third_party/spirv-tools/source/opt/mem_pass.h old mode 100755 new mode 100644 index a142df535c..67ce26b139 --- a/third_party/spirv-tools/source/opt/mem_pass.h +++ b/third_party/spirv-tools/source/opt/mem_pass.h @@ -14,8 +14,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_MEM_PASS_H_ -#define LIBSPIRV_OPT_MEM_PASS_H_ +#ifndef SOURCE_OPT_MEM_PASS_H_ +#define SOURCE_OPT_MEM_PASS_H_ #include #include @@ -25,11 +25,11 @@ #include #include -#include "basic_block.h" -#include "def_use_manager.h" -#include "dominator_analysis.h" -#include "module.h" -#include "pass.h" +#include "source/opt/basic_block.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/dominator_analysis.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" namespace spvtools { namespace opt { @@ -160,4 +160,4 @@ class MemPass : public Pass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_MEM_PASS_H_ +#endif // SOURCE_OPT_MEM_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/merge_return_pass.cpp b/third_party/spirv-tools/source/opt/merge_return_pass.cpp old mode 100755 new mode 100644 index 82ded202eb..4ad7b36af5 --- a/third_party/spirv-tools/source/opt/merge_return_pass.cpp +++ b/third_party/spirv-tools/source/opt/merge_return_pass.cpp @@ -12,13 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "merge_return_pass.h" +#include "source/opt/merge_return_pass.h" -#include "instruction.h" -#include "ir_builder.h" -#include "ir_context.h" -#include "make_unique.h" -#include "reflect.h" +#include +#include +#include + +#include "source/opt/instruction.h" +#include "source/opt/ir_builder.h" +#include "source/opt/ir_context.h" +#include "source/opt/reflect.h" +#include "source/util/make_unique.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/merge_return_pass.h b/third_party/spirv-tools/source/opt/merge_return_pass.h old mode 100755 new mode 100644 index d36f7c4b4f..0c7a3b48aa --- a/third_party/spirv-tools/source/opt/merge_return_pass.h +++ b/third_party/spirv-tools/source/opt/merge_return_pass.h @@ -12,16 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_MERGE_RETURN_PASS_H_ -#define LIBSPIRV_OPT_MERGE_RETURN_PASS_H_ - -#include "basic_block.h" -#include "function.h" -#include "mem_pass.h" +#ifndef SOURCE_OPT_MERGE_RETURN_PASS_H_ +#define SOURCE_OPT_MERGE_RETURN_PASS_H_ +#include #include #include +#include "source/opt/basic_block.h" +#include "source/opt/function.h" +#include "source/opt/mem_pass.h" + namespace spvtools { namespace opt { @@ -302,4 +303,4 @@ class MergeReturnPass : public MemPass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_MERGE_RETURN_PASS_H_ +#endif // SOURCE_OPT_MERGE_RETURN_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/module.cpp b/third_party/spirv-tools/source/opt/module.cpp old mode 100755 new mode 100644 index 924d983788..6d024b5bcb --- a/third_party/spirv-tools/source/opt/module.cpp +++ b/third_party/spirv-tools/source/opt/module.cpp @@ -12,14 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "module.h" +#include "source/opt/module.h" #include #include #include -#include "operand.h" -#include "reflect.h" +#include "source/operand.h" +#include "source/opt/reflect.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/module.h b/third_party/spirv-tools/source/opt/module.h old mode 100755 new mode 100644 index 7571c9b8bd..eca8cc7798 --- a/third_party/spirv-tools/source/opt/module.h +++ b/third_party/spirv-tools/source/opt/module.h @@ -12,17 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_MODULE_H_ -#define LIBSPIRV_OPT_MODULE_H_ +#ifndef SOURCE_OPT_MODULE_H_ +#define SOURCE_OPT_MODULE_H_ #include #include #include #include -#include "function.h" -#include "instruction.h" -#include "iterator.h" +#include "source/opt/function.h" +#include "source/opt/instruction.h" +#include "source/opt/iterator.h" namespace spvtools { namespace opt { @@ -473,4 +473,4 @@ inline Module::const_iterator Module::cend() const { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_MODULE_H_ +#endif // SOURCE_OPT_MODULE_H_ diff --git a/third_party/spirv-tools/source/opt/null_pass.h b/third_party/spirv-tools/source/opt/null_pass.h old mode 100755 new mode 100644 index 3805ce588e..2b5974fb9b --- a/third_party/spirv-tools/source/opt/null_pass.h +++ b/third_party/spirv-tools/source/opt/null_pass.h @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_NULL_PASS_H_ -#define LIBSPIRV_OPT_NULL_PASS_H_ +#ifndef SOURCE_OPT_NULL_PASS_H_ +#define SOURCE_OPT_NULL_PASS_H_ -#include "module.h" -#include "pass.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" namespace spvtools { namespace opt { @@ -31,4 +31,4 @@ class NullPass : public Pass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_NULL_PASS_H_ +#endif // SOURCE_OPT_NULL_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/optimizer.cpp b/third_party/spirv-tools/source/opt/optimizer.cpp old mode 100755 new mode 100644 index 60791ca071..fc7d266e46 --- a/third_party/spirv-tools/source/opt/optimizer.cpp +++ b/third_party/spirv-tools/source/opt/optimizer.cpp @@ -14,13 +14,19 @@ #include "spirv-tools/optimizer.hpp" -#include "build_module.h" -#include "log.h" -#include "make_unique.h" -#include "pass_manager.h" -#include "passes.h" -#include "reduce_load_size.h" -#include "simplification_pass.h" +#include +#include +#include +#include +#include + +#include "source/opt/build_module.h" +#include "source/opt/log.h" +#include "source/opt/pass_manager.h" +#include "source/opt/passes.h" +#include "source/opt/reduce_load_size.h" +#include "source/opt/simplification_pass.h" +#include "source/util/make_unique.h" namespace spvtools { @@ -442,6 +448,22 @@ bool Optimizer::RegisterPassFromFlag(const std::string& flag) { bool Optimizer::Run(const uint32_t* original_binary, const size_t original_binary_size, std::vector* optimized_binary) const { + return Run(original_binary, original_binary_size, optimized_binary, + ValidatorOptions()); +} + +bool Optimizer::Run(const uint32_t* original_binary, + const size_t original_binary_size, + std::vector* optimized_binary, + const ValidatorOptions& options, + bool skip_validation) const { + spvtools::SpirvTools tools(impl_->target_env); + tools.SetMessageConsumer(impl_->pass_manager.consumer()); + if (!skip_validation && + !tools.Validate(original_binary, original_binary_size, options)) { + return false; + } + std::unique_ptr context = BuildModule( impl_->target_env, consumer(), original_binary, original_binary_size); if (context == nullptr) return false; diff --git a/third_party/spirv-tools/source/opt/pass.cpp b/third_party/spirv-tools/source/opt/pass.cpp old mode 100755 new mode 100644 index c346ac4425..4c4a232c6c --- a/third_party/spirv-tools/source/opt/pass.cpp +++ b/third_party/spirv-tools/source/opt/pass.cpp @@ -14,9 +14,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "pass.h" +#include "source/opt/pass.h" -#include "iterator.h" +#include "source/opt/iterator.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/pass.h b/third_party/spirv-tools/source/opt/pass.h old mode 100755 new mode 100644 index 6889567e8e..df1745099d --- a/third_party/spirv-tools/source/opt/pass.h +++ b/third_party/spirv-tools/source/opt/pass.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_PASS_H_ -#define LIBSPIRV_OPT_PASS_H_ +#ifndef SOURCE_OPT_PASS_H_ +#define SOURCE_OPT_PASS_H_ #include #include @@ -22,10 +22,10 @@ #include #include -#include "basic_block.h" -#include "def_use_manager.h" -#include "ir_context.h" -#include "module.h" +#include "source/opt/basic_block.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" #include "spirv-tools/libspirv.hpp" namespace spvtools { @@ -162,4 +162,4 @@ class Pass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_PASS_H_ +#endif // SOURCE_OPT_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/pass_manager.cpp b/third_party/spirv-tools/source/opt/pass_manager.cpp old mode 100755 new mode 100644 index c02faeeaf9..fa1e1d8a81 --- a/third_party/spirv-tools/source/opt/pass_manager.cpp +++ b/third_party/spirv-tools/source/opt/pass_manager.cpp @@ -12,14 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "pass_manager.h" +#include "source/opt/pass_manager.h" #include +#include #include -#include "ir_context.h" +#include "source/opt/ir_context.h" +#include "source/util/timer.h" #include "spirv-tools/libspirv.hpp" -#include "util/timer.h" namespace spvtools { diff --git a/third_party/spirv-tools/source/opt/pass_manager.h b/third_party/spirv-tools/source/opt/pass_manager.h old mode 100755 new mode 100644 index eb339290f0..ed88aa17c8 --- a/third_party/spirv-tools/source/opt/pass_manager.h +++ b/third_party/spirv-tools/source/opt/pass_manager.h @@ -12,18 +12,19 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_PASS_MANAGER_H_ -#define LIBSPIRV_OPT_PASS_MANAGER_H_ +#ifndef SOURCE_OPT_PASS_MANAGER_H_ +#define SOURCE_OPT_PASS_MANAGER_H_ #include #include +#include #include -#include "log.h" -#include "module.h" -#include "pass.h" +#include "source/opt/log.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" -#include "ir_context.h" +#include "source/opt/ir_context.h" #include "spirv-tools/libspirv.hpp" namespace spvtools { @@ -127,4 +128,4 @@ inline const MessageConsumer& PassManager::consumer() const { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_PASS_MANAGER_H_ +#endif // SOURCE_OPT_PASS_MANAGER_H_ diff --git a/third_party/spirv-tools/source/opt/passes.h b/third_party/spirv-tools/source/opt/passes.h old mode 100755 new mode 100644 index 8931b47ac8..42106c8f7b --- a/third_party/spirv-tools/source/opt/passes.h +++ b/third_party/spirv-tools/source/opt/passes.h @@ -12,55 +12,56 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_PASSES_H_ -#define LIBSPIRV_OPT_PASSES_H_ +#ifndef SOURCE_OPT_PASSES_H_ +#define SOURCE_OPT_PASSES_H_ // A single header to include all passes. -#include "aggressive_dead_code_elim_pass.h" -#include "block_merge_pass.h" -#include "ccp_pass.h" -#include "cfg_cleanup_pass.h" -#include "combine_access_chains.h" -#include "common_uniform_elim_pass.h" -#include "compact_ids_pass.h" -#include "copy_prop_arrays.h" -#include "dead_branch_elim_pass.h" -#include "dead_insert_elim_pass.h" -#include "dead_variable_elimination.h" -#include "eliminate_dead_constant_pass.h" -#include "eliminate_dead_functions_pass.h" -#include "flatten_decoration_pass.h" -#include "fold_spec_constant_op_and_composite_pass.h" -#include "freeze_spec_constant_value_pass.h" -#include "if_conversion.h" -#include "inline_exhaustive_pass.h" -#include "inline_opaque_pass.h" -#include "licm_pass.h" -#include "local_access_chain_convert_pass.h" -#include "local_redundancy_elimination.h" -#include "local_single_block_elim_pass.h" -#include "local_single_store_elim_pass.h" -#include "local_ssa_elim_pass.h" -#include "loop_fission.h" -#include "loop_fusion_pass.h" -#include "loop_peeling.h" -#include "loop_unroller.h" -#include "loop_unswitch_pass.h" -#include "merge_return_pass.h" -#include "null_pass.h" -#include "private_to_local_pass.h" -#include "reduce_load_size.h" -#include "redundancy_elimination.h" -#include "remove_duplicates_pass.h" -#include "replace_invalid_opc.h" -#include "scalar_replacement_pass.h" -#include "set_spec_constant_default_value_pass.h" -#include "ssa_rewrite_pass.h" -#include "strength_reduction_pass.h" -#include "strip_debug_info_pass.h" -#include "strip_reflect_info_pass.h" -#include "unify_const_pass.h" -#include "vector_dce.h" -#include "workaround1209.h" -#endif // LIBSPIRV_OPT_PASSES_H_ +#include "source/opt/aggressive_dead_code_elim_pass.h" +#include "source/opt/block_merge_pass.h" +#include "source/opt/ccp_pass.h" +#include "source/opt/cfg_cleanup_pass.h" +#include "source/opt/combine_access_chains.h" +#include "source/opt/common_uniform_elim_pass.h" +#include "source/opt/compact_ids_pass.h" +#include "source/opt/copy_prop_arrays.h" +#include "source/opt/dead_branch_elim_pass.h" +#include "source/opt/dead_insert_elim_pass.h" +#include "source/opt/dead_variable_elimination.h" +#include "source/opt/eliminate_dead_constant_pass.h" +#include "source/opt/eliminate_dead_functions_pass.h" +#include "source/opt/flatten_decoration_pass.h" +#include "source/opt/fold_spec_constant_op_and_composite_pass.h" +#include "source/opt/freeze_spec_constant_value_pass.h" +#include "source/opt/if_conversion.h" +#include "source/opt/inline_exhaustive_pass.h" +#include "source/opt/inline_opaque_pass.h" +#include "source/opt/licm_pass.h" +#include "source/opt/local_access_chain_convert_pass.h" +#include "source/opt/local_redundancy_elimination.h" +#include "source/opt/local_single_block_elim_pass.h" +#include "source/opt/local_single_store_elim_pass.h" +#include "source/opt/local_ssa_elim_pass.h" +#include "source/opt/loop_fission.h" +#include "source/opt/loop_fusion_pass.h" +#include "source/opt/loop_peeling.h" +#include "source/opt/loop_unroller.h" +#include "source/opt/loop_unswitch_pass.h" +#include "source/opt/merge_return_pass.h" +#include "source/opt/null_pass.h" +#include "source/opt/private_to_local_pass.h" +#include "source/opt/reduce_load_size.h" +#include "source/opt/redundancy_elimination.h" +#include "source/opt/remove_duplicates_pass.h" +#include "source/opt/replace_invalid_opc.h" +#include "source/opt/scalar_replacement_pass.h" +#include "source/opt/set_spec_constant_default_value_pass.h" +#include "source/opt/ssa_rewrite_pass.h" +#include "source/opt/strength_reduction_pass.h" +#include "source/opt/strip_debug_info_pass.h" +#include "source/opt/strip_reflect_info_pass.h" +#include "source/opt/unify_const_pass.h" +#include "source/opt/vector_dce.h" +#include "source/opt/workaround1209.h" + +#endif // SOURCE_OPT_PASSES_H_ diff --git a/third_party/spirv-tools/source/opt/private_to_local_pass.cpp b/third_party/spirv-tools/source/opt/private_to_local_pass.cpp old mode 100755 new mode 100644 index 9f498d513c..02909a72b5 --- a/third_party/spirv-tools/source/opt/private_to_local_pass.cpp +++ b/third_party/spirv-tools/source/opt/private_to_local_pass.cpp @@ -12,17 +12,22 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "private_to_local_pass.h" +#include "source/opt/private_to_local_pass.h" -#include "ir_context.h" +#include +#include +#include -namespace { -const uint32_t kVariableStorageClassInIdx = 0; -const uint32_t kSpvTypePointerTypeIdInIdx = 1; -} // namespace +#include "source/opt/ir_context.h" namespace spvtools { namespace opt { +namespace { + +const uint32_t kVariableStorageClassInIdx = 0; +const uint32_t kSpvTypePointerTypeIdInIdx = 1; + +} // namespace Pass::Status PrivateToLocalPass::Process() { bool modified = false; diff --git a/third_party/spirv-tools/source/opt/private_to_local_pass.h b/third_party/spirv-tools/source/opt/private_to_local_pass.h old mode 100755 new mode 100644 index 0b716c8ae3..f706e6e91a --- a/third_party/spirv-tools/source/opt/private_to_local_pass.h +++ b/third_party/spirv-tools/source/opt/private_to_local_pass.h @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_PRIVATE_TO_LOCAL_PASS_H_ -#define LIBSPIRV_OPT_PRIVATE_TO_LOCAL_PASS_H_ +#ifndef SOURCE_OPT_PRIVATE_TO_LOCAL_PASS_H_ +#define SOURCE_OPT_PRIVATE_TO_LOCAL_PASS_H_ -#include "ir_context.h" -#include "pass.h" +#include "source/opt/ir_context.h" +#include "source/opt/pass.h" namespace spvtools { namespace opt { @@ -69,4 +69,4 @@ class PrivateToLocalPass : public Pass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_PRIVATE_TO_LOCAL_PASS_H_ +#endif // SOURCE_OPT_PRIVATE_TO_LOCAL_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/propagator.cpp b/third_party/spirv-tools/source/opt/propagator.cpp old mode 100755 new mode 100644 index bfaa811b5e..6a1f1aafbc --- a/third_party/spirv-tools/source/opt/propagator.cpp +++ b/third_party/spirv-tools/source/opt/propagator.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "propagator.h" +#include "source/opt/propagator.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/propagator.h b/third_party/spirv-tools/source/opt/propagator.h old mode 100755 new mode 100644 index aef21de4d9..ac7c0e7eac --- a/third_party/spirv-tools/source/opt/propagator.h +++ b/third_party/spirv-tools/source/opt/propagator.h @@ -12,18 +12,19 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_PROPAGATOR_H_ -#define LIBSPIRV_OPT_PROPAGATOR_H_ +#ifndef SOURCE_OPT_PROPAGATOR_H_ +#define SOURCE_OPT_PROPAGATOR_H_ #include #include #include #include #include +#include #include -#include "ir_context.h" -#include "module.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" namespace spvtools { namespace opt { @@ -313,4 +314,4 @@ std::ostream& operator<<(std::ostream& str, } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_PROPAGATOR_H_ +#endif // SOURCE_OPT_PROPAGATOR_H_ diff --git a/third_party/spirv-tools/source/opt/reduce_load_size.cpp b/third_party/spirv-tools/source/opt/reduce_load_size.cpp index e82a9e285b..b692c6b544 100644 --- a/third_party/spirv-tools/source/opt/reduce_load_size.cpp +++ b/third_party/spirv-tools/source/opt/reduce_load_size.cpp @@ -12,18 +12,23 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "reduce_load_size.h" -#include +#include "source/opt/reduce_load_size.h" -#include "instruction.h" -#include "ir_builder.h" -#include "ir_context.h" +#include +#include + +#include "source/opt/instruction.h" +#include "source/opt/ir_builder.h" +#include "source/opt/ir_context.h" +#include "source/util/bit_vector.h" namespace { + const uint32_t kExtractCompositeIdInIdx = 0; const uint32_t kVariableStorageClassInIdx = 0; const uint32_t kLoadPointerInIdx = 0; const double kThreshold = 0.9; + } // namespace namespace spvtools { diff --git a/third_party/spirv-tools/source/opt/reduce_load_size.h b/third_party/spirv-tools/source/opt/reduce_load_size.h index d2402116e3..724a430bbf 100644 --- a/third_party/spirv-tools/source/opt/reduce_load_size.h +++ b/third_party/spirv-tools/source/opt/reduce_load_size.h @@ -12,12 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_REDUCE_LOAD_SIZE_H_ -#define LIBSPIRV_OPT_REDUCE_LOAD_SIZE_H_ +#ifndef SOURCE_OPT_REDUCE_LOAD_SIZE_H_ +#define SOURCE_OPT_REDUCE_LOAD_SIZE_H_ -#include "ir_context.h" -#include "module.h" -#include "pass.h" +#include + +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" namespace spvtools { namespace opt { @@ -59,4 +61,4 @@ class ReduceLoadSize : public Pass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_REDUCE_LOAD_SIZE_H_ +#endif // SOURCE_OPT_REDUCE_LOAD_SIZE_H_ diff --git a/third_party/spirv-tools/source/opt/redundancy_elimination.cpp b/third_party/spirv-tools/source/opt/redundancy_elimination.cpp old mode 100755 new mode 100644 index 294b84d534..362e54dc6b --- a/third_party/spirv-tools/source/opt/redundancy_elimination.cpp +++ b/third_party/spirv-tools/source/opt/redundancy_elimination.cpp @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "redundancy_elimination.h" +#include "source/opt/redundancy_elimination.h" -#include "value_number_table.h" +#include "source/opt/value_number_table.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/redundancy_elimination.h b/third_party/spirv-tools/source/opt/redundancy_elimination.h old mode 100755 new mode 100644 index 2ea7d46411..91809b5d57 --- a/third_party/spirv-tools/source/opt/redundancy_elimination.h +++ b/third_party/spirv-tools/source/opt/redundancy_elimination.h @@ -12,13 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_REDUNDANCY_ELIMINATION_H_ -#define LIBSPIRV_OPT_REDUNDANCY_ELIMINATION_H_ +#ifndef SOURCE_OPT_REDUNDANCY_ELIMINATION_H_ +#define SOURCE_OPT_REDUNDANCY_ELIMINATION_H_ -#include "ir_context.h" -#include "local_redundancy_elimination.h" -#include "pass.h" -#include "value_number_table.h" +#include + +#include "source/opt/ir_context.h" +#include "source/opt/local_redundancy_elimination.h" +#include "source/opt/pass.h" +#include "source/opt/value_number_table.h" namespace spvtools { namespace opt { @@ -51,4 +53,4 @@ class RedundancyEliminationPass : public LocalRedundancyEliminationPass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_REDUNDANCY_ELIMINATION_H_ +#endif // SOURCE_OPT_REDUNDANCY_ELIMINATION_H_ diff --git a/third_party/spirv-tools/source/opt/reflect.h b/third_party/spirv-tools/source/opt/reflect.h old mode 100755 new mode 100644 index f6ea50abc1..fb2de7b151 --- a/third_party/spirv-tools/source/opt/reflect.h +++ b/third_party/spirv-tools/source/opt/reflect.h @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_REFLECT_H_ -#define LIBSPIRV_OPT_REFLECT_H_ +#ifndef SOURCE_OPT_REFLECT_H_ +#define SOURCE_OPT_REFLECT_H_ -#include "latest_version_spirv_header.h" +#include "source/latest_version_spirv_header.h" namespace spvtools { namespace opt { @@ -62,4 +62,4 @@ inline bool IsTerminatorInst(SpvOp opcode) { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_REFLECT_H_ +#endif // SOURCE_OPT_REFLECT_H_ diff --git a/third_party/spirv-tools/source/opt/register_pressure.cpp b/third_party/spirv-tools/source/opt/register_pressure.cpp index 729755c29c..34dac1d7b1 100644 --- a/third_party/spirv-tools/source/opt/register_pressure.cpp +++ b/third_party/spirv-tools/source/opt/register_pressure.cpp @@ -12,16 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "register_pressure.h" +#include "source/opt/register_pressure.h" +#include #include -#include "cfg.h" -#include "def_use_manager.h" -#include "dominator_tree.h" -#include "function.h" -#include "ir_context.h" -#include "iterator.h" +#include "source/opt/cfg.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/dominator_tree.h" +#include "source/opt/function.h" +#include "source/opt/ir_context.h" +#include "source/opt/iterator.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/register_pressure.h b/third_party/spirv-tools/source/opt/register_pressure.h index 96892272cd..cb3d2e2703 100644 --- a/third_party/spirv-tools/source/opt/register_pressure.h +++ b/third_party/spirv-tools/source/opt/register_pressure.h @@ -12,16 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_REGISTER_PRESSURE_H_ -#define LIBSPIRV_OPT_REGISTER_PRESSURE_H_ +#ifndef SOURCE_OPT_REGISTER_PRESSURE_H_ +#define SOURCE_OPT_REGISTER_PRESSURE_H_ #include #include #include #include -#include "function.h" -#include "types.h" +#include "source/opt/function.h" +#include "source/opt/types.h" namespace spvtools { namespace opt { @@ -193,4 +193,4 @@ class LivenessAnalysis { } // namespace opt } // namespace spvtools -#endif // ! LIBSPIRV_OPT_REGISTER_PRESSURE_H_ +#endif // SOURCE_OPT_REGISTER_PRESSURE_H_ diff --git a/third_party/spirv-tools/source/opt/remove_duplicates_pass.cpp b/third_party/spirv-tools/source/opt/remove_duplicates_pass.cpp old mode 100755 new mode 100644 index bfbab4d671..a37e9df9e7 --- a/third_party/spirv-tools/source/opt/remove_duplicates_pass.cpp +++ b/third_party/spirv-tools/source/opt/remove_duplicates_pass.cpp @@ -12,20 +12,20 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "remove_duplicates_pass.h" - -#include +#include "source/opt/remove_duplicates_pass.h" #include +#include #include +#include #include #include #include -#include "decoration_manager.h" -#include "ir_context.h" -#include "opcode.h" -#include "reflect.h" +#include "source/opcode.h" +#include "source/opt/decoration_manager.h" +#include "source/opt/ir_context.h" +#include "source/opt/reflect.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/remove_duplicates_pass.h b/third_party/spirv-tools/source/opt/remove_duplicates_pass.h old mode 100755 new mode 100644 index b252fdc26b..8554a987dc --- a/third_party/spirv-tools/source/opt/remove_duplicates_pass.h +++ b/third_party/spirv-tools/source/opt/remove_duplicates_pass.h @@ -12,16 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_REMOVE_DUPLICATES_PASS_H_ -#define LIBSPIRV_OPT_REMOVE_DUPLICATES_PASS_H_ +#ifndef SOURCE_OPT_REMOVE_DUPLICATES_PASS_H_ +#define SOURCE_OPT_REMOVE_DUPLICATES_PASS_H_ #include +#include -#include "decoration_manager.h" -#include "def_use_manager.h" -#include "ir_context.h" -#include "module.h" -#include "pass.h" +#include "source/opt/decoration_manager.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" namespace spvtools { namespace opt { @@ -63,4 +64,4 @@ class RemoveDuplicatesPass : public Pass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_REMOVE_DUPLICATES_PASS_H_ +#endif // SOURCE_OPT_REMOVE_DUPLICATES_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/replace_invalid_opc.cpp b/third_party/spirv-tools/source/opt/replace_invalid_opc.cpp old mode 100755 new mode 100644 index 711405fb6f..4e0f24f467 --- a/third_party/spirv-tools/source/opt/replace_invalid_opc.cpp +++ b/third_party/spirv-tools/source/opt/replace_invalid_opc.cpp @@ -12,9 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "replace_invalid_opc.h" +#include "source/opt/replace_invalid_opc.h" #include +#include namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/replace_invalid_opc.h b/third_party/spirv-tools/source/opt/replace_invalid_opc.h old mode 100755 new mode 100644 index 9c8499f6a2..4d46405821 --- a/third_party/spirv-tools/source/opt/replace_invalid_opc.h +++ b/third_party/spirv-tools/source/opt/replace_invalid_opc.h @@ -12,10 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_REPLACE_INVALID_OPC_H_ -#define LIBSPIRV_OPT_REPLACE_INVALID_OPC_H_ +#ifndef SOURCE_OPT_REPLACE_INVALID_OPC_H_ +#define SOURCE_OPT_REPLACE_INVALID_OPC_H_ -#include "pass.h" +#include + +#include "source/opt/pass.h" namespace spvtools { namespace opt { @@ -62,4 +64,4 @@ class ReplaceInvalidOpcodePass : public Pass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_REPLACE_INVALID_OPC_H_ +#endif // SOURCE_OPT_REPLACE_INVALID_OPC_H_ diff --git a/third_party/spirv-tools/source/opt/scalar_analysis.cpp b/third_party/spirv-tools/source/opt/scalar_analysis.cpp old mode 100755 new mode 100644 index c124a3ffa0..38555e649e --- a/third_party/spirv-tools/source/opt/scalar_analysis.cpp +++ b/third_party/spirv-tools/source/opt/scalar_analysis.cpp @@ -12,14 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "opt/scalar_analysis.h" +#include "source/opt/scalar_analysis.h" #include #include #include #include -#include "opt/ir_context.h" +#include "source/opt/ir_context.h" // Transforms a given scalar operation instruction into a DAG representation. // diff --git a/third_party/spirv-tools/source/opt/scalar_analysis.h b/third_party/spirv-tools/source/opt/scalar_analysis.h old mode 100755 new mode 100644 index 6f5c761554..fb6d631f56 --- a/third_party/spirv-tools/source/opt/scalar_analysis.h +++ b/third_party/spirv-tools/source/opt/scalar_analysis.h @@ -20,11 +20,12 @@ #include #include #include +#include #include -#include "opt/basic_block.h" -#include "opt/instruction.h" -#include "opt/scalar_analysis_nodes.h" +#include "source/opt/basic_block.h" +#include "source/opt/instruction.h" +#include "source/opt/scalar_analysis_nodes.h" namespace spvtools { namespace opt { @@ -310,4 +311,4 @@ inline std::pair operator/(SENode* lhs, SExpression rhs) { } // namespace opt } // namespace spvtools -#endif // SOURCE_OPT_SCALAR_ANALYSIS_H__ +#endif // SOURCE_OPT_SCALAR_ANALYSIS_H_ diff --git a/third_party/spirv-tools/source/opt/scalar_analysis_nodes.h b/third_party/spirv-tools/source/opt/scalar_analysis_nodes.h old mode 100755 new mode 100644 index 59cd725b1f..450522ec3f --- a/third_party/spirv-tools/source/opt/scalar_analysis_nodes.h +++ b/third_party/spirv-tools/source/opt/scalar_analysis_nodes.h @@ -19,7 +19,8 @@ #include #include #include -#include "opt/tree_iterator.h" + +#include "source/opt/tree_iterator.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/scalar_analysis_simplification.cpp b/third_party/spirv-tools/source/opt/scalar_analysis_simplification.cpp old mode 100755 new mode 100644 index 58b08ea7c4..52f2d6ad90 --- a/third_party/spirv-tools/source/opt/scalar_analysis_simplification.cpp +++ b/third_party/spirv-tools/source/opt/scalar_analysis_simplification.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "opt/scalar_analysis.h" +#include "source/opt/scalar_analysis.h" #include #include diff --git a/third_party/spirv-tools/source/opt/scalar_replacement_pass.cpp b/third_party/spirv-tools/source/opt/scalar_replacement_pass.cpp old mode 100755 new mode 100644 index b3e9c52c1b..d51dd8ef2c --- a/third_party/spirv-tools/source/opt/scalar_replacement_pass.cpp +++ b/third_party/spirv-tools/source/opt/scalar_replacement_pass.cpp @@ -12,16 +12,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "scalar_replacement_pass.h" - -#include "enum_string_mapping.h" -#include "extensions.h" -#include "make_unique.h" -#include "reflect.h" -#include "types.h" +#include "source/opt/scalar_replacement_pass.h" +#include #include #include +#include + +#include "source/enum_string_mapping.h" +#include "source/extensions.h" +#include "source/opt/reflect.h" +#include "source/opt/types.h" +#include "source/util/make_unique.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/scalar_replacement_pass.h b/third_party/spirv-tools/source/opt/scalar_replacement_pass.h old mode 100755 new mode 100644 index df08b85994..c89bbc4015 --- a/third_party/spirv-tools/source/opt/scalar_replacement_pass.h +++ b/third_party/spirv-tools/source/opt/scalar_replacement_pass.h @@ -12,16 +12,19 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_SCALAR_REPLACEMENT_PASS_H_ -#define LIBSPIRV_OPT_SCALAR_REPLACEMENT_PASS_H_ +#ifndef SOURCE_OPT_SCALAR_REPLACEMENT_PASS_H_ +#define SOURCE_OPT_SCALAR_REPLACEMENT_PASS_H_ #include - -#include "function.h" -#include "pass.h" -#include "type_manager.h" - +#include #include +#include +#include +#include + +#include "source/opt/function.h" +#include "source/opt/pass.h" +#include "source/opt/type_manager.h" namespace spvtools { namespace opt { @@ -226,4 +229,4 @@ class ScalarReplacementPass : public Pass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_SCALAR_REPLACEMENT_PASS_H_ +#endif // SOURCE_OPT_SCALAR_REPLACEMENT_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/set_spec_constant_default_value_pass.cpp b/third_party/spirv-tools/source/opt/set_spec_constant_default_value_pass.cpp old mode 100755 new mode 100644 index fe97582b79..4c8d116f76 --- a/third_party/spirv-tools/source/opt/set_spec_constant_default_value_pass.cpp +++ b/third_party/spirv-tools/source/opt/set_spec_constant_default_value_pass.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "set_spec_constant_default_value_pass.h" +#include "source/opt/set_spec_constant_default_value_pass.h" #include #include @@ -20,13 +20,13 @@ #include #include -#include "def_use_manager.h" -#include "ir_context.h" -#include "make_unique.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/ir_context.h" +#include "source/opt/type_manager.h" +#include "source/opt/types.h" +#include "source/util/make_unique.h" +#include "source/util/parse_number.h" #include "spirv-tools/libspirv.h" -#include "type_manager.h" -#include "types.h" -#include "util/parse_number.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/set_spec_constant_default_value_pass.h b/third_party/spirv-tools/source/opt/set_spec_constant_default_value_pass.h old mode 100755 new mode 100644 index d048f42c5a..8bd1787cc2 --- a/third_party/spirv-tools/source/opt/set_spec_constant_default_value_pass.h +++ b/third_party/spirv-tools/source/opt/set_spec_constant_default_value_pass.h @@ -12,16 +12,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_SET_SPEC_CONSTANT_DEFAULT_VALUE_PASS_H_ -#define LIBSPIRV_OPT_SET_SPEC_CONSTANT_DEFAULT_VALUE_PASS_H_ +#ifndef SOURCE_OPT_SET_SPEC_CONSTANT_DEFAULT_VALUE_PASS_H_ +#define SOURCE_OPT_SET_SPEC_CONSTANT_DEFAULT_VALUE_PASS_H_ #include #include #include +#include +#include -#include "ir_context.h" -#include "module.h" -#include "pass.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" namespace spvtools { namespace opt { @@ -109,4 +111,4 @@ class SetSpecConstantDefaultValuePass : public Pass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_SET_SPEC_CONSTANT_DEFAULT_VALUE_PASS_H_ +#endif // SOURCE_OPT_SET_SPEC_CONSTANT_DEFAULT_VALUE_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/simplification_pass.cpp b/third_party/spirv-tools/source/opt/simplification_pass.cpp old mode 100755 new mode 100644 index 81ceb8657b..5fbafbdd1c --- a/third_party/spirv-tools/source/opt/simplification_pass.cpp +++ b/third_party/spirv-tools/source/opt/simplification_pass.cpp @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "simplification_pass.h" +#include "source/opt/simplification_pass.h" #include #include #include -#include "fold.h" +#include "source/opt/fold.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/simplification_pass.h b/third_party/spirv-tools/source/opt/simplification_pass.h old mode 100755 new mode 100644 index f4c5e4f6b2..348c96a033 --- a/third_party/spirv-tools/source/opt/simplification_pass.h +++ b/third_party/spirv-tools/source/opt/simplification_pass.h @@ -12,12 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_SIMPLIFICATION_PASS_H_ -#define LIBSPIRV_OPT_SIMPLIFICATION_PASS_H_ +#ifndef SOURCE_OPT_SIMPLIFICATION_PASS_H_ +#define SOURCE_OPT_SIMPLIFICATION_PASS_H_ -#include "function.h" -#include "ir_context.h" -#include "pass.h" +#include "source/opt/function.h" +#include "source/opt/ir_context.h" +#include "source/opt/pass.h" namespace spvtools { namespace opt { @@ -46,4 +46,4 @@ class SimplificationPass : public Pass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_SIMPLIFICATION_PASS_H_ +#endif // SOURCE_OPT_SIMPLIFICATION_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/ssa_rewrite_pass.cpp b/third_party/spirv-tools/source/opt/ssa_rewrite_pass.cpp old mode 100755 new mode 100644 index 995b750c22..6903f27c74 --- a/third_party/spirv-tools/source/opt/ssa_rewrite_pass.cpp +++ b/third_party/spirv-tools/source/opt/ssa_rewrite_pass.cpp @@ -39,14 +39,16 @@ // some Phi instructions may be dead // (https://en.wikipedia.org/wiki/Static_single_assignment_form). -#include "ssa_rewrite_pass.h" -#include "cfg.h" -#include "make_unique.h" -#include "mem_pass.h" -#include "opcode.h" +#include "source/opt/ssa_rewrite_pass.h" +#include #include +#include "source/opcode.h" +#include "source/opt/cfg.h" +#include "source/opt/mem_pass.h" +#include "source/util/make_unique.h" + // Debug logging (0: Off, 1-N: Verbosity level). Replace this with the // implementation done for // https://github.com/KhronosGroup/SPIRV-Tools/issues/1351 diff --git a/third_party/spirv-tools/source/opt/ssa_rewrite_pass.h b/third_party/spirv-tools/source/opt/ssa_rewrite_pass.h old mode 100755 new mode 100644 index d1a99cba49..c0373dc067 --- a/third_party/spirv-tools/source/opt/ssa_rewrite_pass.h +++ b/third_party/spirv-tools/source/opt/ssa_rewrite_pass.h @@ -12,14 +12,19 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_SSA_REWRITE_PASS_H_ -#define LIBSPIRV_OPT_SSA_REWRITE_PASS_H_ - -#include "basic_block.h" -#include "ir_context.h" -#include "mem_pass.h" +#ifndef SOURCE_OPT_SSA_REWRITE_PASS_H_ +#define SOURCE_OPT_SSA_REWRITE_PASS_H_ +#include +#include #include +#include +#include +#include + +#include "source/opt/basic_block.h" +#include "source/opt/ir_context.h" +#include "source/opt/mem_pass.h" namespace spvtools { namespace opt { @@ -296,4 +301,4 @@ class SSARewritePass : public MemPass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_SSA_REWRITE_PASS_H_ +#endif // SOURCE_OPT_SSA_REWRITE_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/strength_reduction_pass.cpp b/third_party/spirv-tools/source/opt/strength_reduction_pass.cpp old mode 100755 new mode 100644 index fa4b32177f..ab7c4eb8dd --- a/third_party/spirv-tools/source/opt/strength_reduction_pass.cpp +++ b/third_party/spirv-tools/source/opt/strength_reduction_pass.cpp @@ -12,18 +12,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "strength_reduction_pass.h" +#include "source/opt/strength_reduction_pass.h" #include #include #include +#include #include #include +#include +#include -#include "def_use_manager.h" -#include "ir_context.h" -#include "log.h" -#include "reflect.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/ir_context.h" +#include "source/opt/log.h" +#include "source/opt/reflect.h" namespace { // Count the number of trailing zeros in the binary representation of diff --git a/third_party/spirv-tools/source/opt/strength_reduction_pass.h b/third_party/spirv-tools/source/opt/strength_reduction_pass.h old mode 100755 new mode 100644 index 59987da15a..8dfeb307bf --- a/third_party/spirv-tools/source/opt/strength_reduction_pass.h +++ b/third_party/spirv-tools/source/opt/strength_reduction_pass.h @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_STRENGTH_REDUCTION_PASS_H_ -#define LIBSPIRV_OPT_STRENGTH_REDUCTION_PASS_H_ +#ifndef SOURCE_OPT_STRENGTH_REDUCTION_PASS_H_ +#define SOURCE_OPT_STRENGTH_REDUCTION_PASS_H_ -#include "def_use_manager.h" -#include "ir_context.h" -#include "module.h" -#include "pass.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" namespace spvtools { namespace opt { @@ -62,4 +62,4 @@ class StrengthReductionPass : public Pass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_STRENGTH_REDUCTION_PASS_H_ +#endif // SOURCE_OPT_STRENGTH_REDUCTION_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/strip_debug_info_pass.cpp b/third_party/spirv-tools/source/opt/strip_debug_info_pass.cpp old mode 100755 new mode 100644 index c98a227455..5d9c5fec8a --- a/third_party/spirv-tools/source/opt/strip_debug_info_pass.cpp +++ b/third_party/spirv-tools/source/opt/strip_debug_info_pass.cpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "strip_debug_info_pass.h" -#include "ir_context.h" +#include "source/opt/strip_debug_info_pass.h" +#include "source/opt/ir_context.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/strip_debug_info_pass.h b/third_party/spirv-tools/source/opt/strip_debug_info_pass.h old mode 100755 new mode 100644 index 6ac50f01d2..47a2cd4090 --- a/third_party/spirv-tools/source/opt/strip_debug_info_pass.h +++ b/third_party/spirv-tools/source/opt/strip_debug_info_pass.h @@ -12,12 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_STRIP_DEBUG_INFO_PASS_H_ -#define LIBSPIRV_OPT_STRIP_DEBUG_INFO_PASS_H_ +#ifndef SOURCE_OPT_STRIP_DEBUG_INFO_PASS_H_ +#define SOURCE_OPT_STRIP_DEBUG_INFO_PASS_H_ -#include "ir_context.h" -#include "module.h" -#include "pass.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" namespace spvtools { namespace opt { @@ -32,4 +32,4 @@ class StripDebugInfoPass : public Pass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_STRIP_DEBUG_INFO_PASS_H_ +#endif // SOURCE_OPT_STRIP_DEBUG_INFO_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/strip_reflect_info_pass.cpp b/third_party/spirv-tools/source/opt/strip_reflect_info_pass.cpp old mode 100755 new mode 100644 index fab2e3d872..14ce31ff32 --- a/third_party/spirv-tools/source/opt/strip_reflect_info_pass.cpp +++ b/third_party/spirv-tools/source/opt/strip_reflect_info_pass.cpp @@ -12,12 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "strip_reflect_info_pass.h" +#include "source/opt/strip_reflect_info_pass.h" #include +#include -#include "instruction.h" -#include "ir_context.h" +#include "source/opt/instruction.h" +#include "source/opt/ir_context.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/strip_reflect_info_pass.h b/third_party/spirv-tools/source/opt/strip_reflect_info_pass.h old mode 100755 new mode 100644 index f4697d50af..935a605e39 --- a/third_party/spirv-tools/source/opt/strip_reflect_info_pass.h +++ b/third_party/spirv-tools/source/opt/strip_reflect_info_pass.h @@ -12,12 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_STRIP_REFLECT_INFO_PASS_H_ -#define LIBSPIRV_OPT_STRIP_REFLECT_INFO_PASS_H_ +#ifndef SOURCE_OPT_STRIP_REFLECT_INFO_PASS_H_ +#define SOURCE_OPT_STRIP_REFLECT_INFO_PASS_H_ -#include "ir_context.h" -#include "module.h" -#include "pass.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" namespace spvtools { namespace opt { @@ -40,4 +40,4 @@ class StripReflectInfoPass : public Pass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_STRIP_REFLECT_INFO_PASS_H_ +#endif // SOURCE_OPT_STRIP_REFLECT_INFO_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/tree_iterator.h b/third_party/spirv-tools/source/opt/tree_iterator.h old mode 100755 new mode 100644 index ba724dfa54..05f42bc5bd --- a/third_party/spirv-tools/source/opt/tree_iterator.h +++ b/third_party/spirv-tools/source/opt/tree_iterator.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_TREE_ITERATOR_H_ -#define LIBSPIRV_OPT_TREE_ITERATOR_H_ +#ifndef SOURCE_OPT_TREE_ITERATOR_H_ +#define SOURCE_OPT_TREE_ITERATOR_H_ #include #include @@ -243,4 +243,4 @@ class PostOrderTreeDFIterator { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_TREE_ITERATOR_H_ +#endif // SOURCE_OPT_TREE_ITERATOR_H_ diff --git a/third_party/spirv-tools/source/opt/type_manager.cpp b/third_party/spirv-tools/source/opt/type_manager.cpp old mode 100755 new mode 100644 index 7f615a28ac..bd5221b043 --- a/third_party/spirv-tools/source/opt/type_manager.cpp +++ b/third_party/spirv-tools/source/opt/type_manager.cpp @@ -12,16 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "type_manager.h" +#include "source/opt/type_manager.h" +#include #include #include #include -#include "ir_context.h" -#include "log.h" -#include "make_unique.h" -#include "reflect.h" +#include "source/opt/ir_context.h" +#include "source/opt/log.h" +#include "source/opt/reflect.h" +#include "source/util/make_unique.h" namespace spvtools { namespace opt { @@ -205,10 +206,10 @@ uint32_t TypeManager::GetTypeInstruction(const Type* type) { id = context()->TakeNextId(); RegisterType(id, *type); switch (type->kind()) { -#define DefineParameterlessCase(kind) \ - case Type::k##kind: \ - typeInst.reset(new Instruction(context(), SpvOpType##kind, 0, id, \ - std::initializer_list{})); \ +#define DefineParameterlessCase(kind) \ + case Type::k##kind: \ + typeInst = MakeUnique(context(), SpvOpType##kind, 0, id, \ + std::initializer_list{}); \ break; DefineParameterlessCase(Void); DefineParameterlessCase(Bool); @@ -221,43 +222,43 @@ uint32_t TypeManager::GetTypeInstruction(const Type* type) { DefineParameterlessCase(NamedBarrier); #undef DefineParameterlessCase case Type::kInteger: - typeInst.reset(new Instruction( + typeInst = MakeUnique( context(), SpvOpTypeInt, 0, id, std::initializer_list{ {SPV_OPERAND_TYPE_LITERAL_INTEGER, {type->AsInteger()->width()}}, {SPV_OPERAND_TYPE_LITERAL_INTEGER, - {(type->AsInteger()->IsSigned() ? 1u : 0u)}}})); + {(type->AsInteger()->IsSigned() ? 1u : 0u)}}}); break; case Type::kFloat: - typeInst.reset(new Instruction( + typeInst = MakeUnique( context(), SpvOpTypeFloat, 0, id, std::initializer_list{ - {SPV_OPERAND_TYPE_LITERAL_INTEGER, {type->AsFloat()->width()}}})); + {SPV_OPERAND_TYPE_LITERAL_INTEGER, {type->AsFloat()->width()}}}); break; case Type::kVector: { uint32_t subtype = GetTypeInstruction(type->AsVector()->element_type()); - typeInst.reset( - new Instruction(context(), SpvOpTypeVector, 0, id, - std::initializer_list{ - {SPV_OPERAND_TYPE_ID, {subtype}}, - {SPV_OPERAND_TYPE_LITERAL_INTEGER, - {type->AsVector()->element_count()}}})); + typeInst = + MakeUnique(context(), SpvOpTypeVector, 0, id, + std::initializer_list{ + {SPV_OPERAND_TYPE_ID, {subtype}}, + {SPV_OPERAND_TYPE_LITERAL_INTEGER, + {type->AsVector()->element_count()}}}); break; } case Type::kMatrix: { uint32_t subtype = GetTypeInstruction(type->AsMatrix()->element_type()); - typeInst.reset( - new Instruction(context(), SpvOpTypeMatrix, 0, id, - std::initializer_list{ - {SPV_OPERAND_TYPE_ID, {subtype}}, - {SPV_OPERAND_TYPE_LITERAL_INTEGER, - {type->AsMatrix()->element_count()}}})); + typeInst = + MakeUnique(context(), SpvOpTypeMatrix, 0, id, + std::initializer_list{ + {SPV_OPERAND_TYPE_ID, {subtype}}, + {SPV_OPERAND_TYPE_LITERAL_INTEGER, + {type->AsMatrix()->element_count()}}}); break; } case Type::kImage: { const Image* image = type->AsImage(); uint32_t subtype = GetTypeInstruction(image->sampled_type()); - typeInst.reset(new Instruction( + typeInst = MakeUnique( context(), SpvOpTypeImage, 0, id, std::initializer_list{ {SPV_OPERAND_TYPE_ID, {subtype}}, @@ -272,32 +273,32 @@ uint32_t TypeManager::GetTypeInstruction(const Type* type) { {SPV_OPERAND_TYPE_SAMPLER_IMAGE_FORMAT, {static_cast(image->format())}}, {SPV_OPERAND_TYPE_ACCESS_QUALIFIER, - {static_cast(image->access_qualifier())}}})); + {static_cast(image->access_qualifier())}}}); break; } case Type::kSampledImage: { uint32_t subtype = GetTypeInstruction(type->AsSampledImage()->image_type()); - typeInst.reset(new Instruction( + typeInst = MakeUnique( context(), SpvOpTypeSampledImage, 0, id, - std::initializer_list{{SPV_OPERAND_TYPE_ID, {subtype}}})); + std::initializer_list{{SPV_OPERAND_TYPE_ID, {subtype}}}); break; } case Type::kArray: { uint32_t subtype = GetTypeInstruction(type->AsArray()->element_type()); - typeInst.reset(new Instruction( + typeInst = MakeUnique( context(), SpvOpTypeArray, 0, id, std::initializer_list{ {SPV_OPERAND_TYPE_ID, {subtype}}, - {SPV_OPERAND_TYPE_ID, {type->AsArray()->LengthId()}}})); + {SPV_OPERAND_TYPE_ID, {type->AsArray()->LengthId()}}}); break; } case Type::kRuntimeArray: { uint32_t subtype = GetTypeInstruction(type->AsRuntimeArray()->element_type()); - typeInst.reset(new Instruction( + typeInst = MakeUnique( context(), SpvOpTypeRuntimeArray, 0, id, - std::initializer_list{{SPV_OPERAND_TYPE_ID, {subtype}}})); + std::initializer_list{{SPV_OPERAND_TYPE_ID, {subtype}}}); break; } case Type::kStruct: { @@ -306,7 +307,8 @@ uint32_t TypeManager::GetTypeInstruction(const Type* type) { for (auto ty : structTy->element_types()) { ops.push_back(Operand(SPV_OPERAND_TYPE_ID, {GetTypeInstruction(ty)})); } - typeInst.reset(new Instruction(context(), SpvOpTypeStruct, 0, id, ops)); + typeInst = + MakeUnique(context(), SpvOpTypeStruct, 0, id, ops); break; } case Type::kOpaque: { @@ -316,21 +318,21 @@ uint32_t TypeManager::GetTypeInstruction(const Type* type) { std::vector words(size / 4 + 1, 0); char* dst = reinterpret_cast(words.data()); strncpy(dst, opaque->name().c_str(), size); - typeInst.reset( - new Instruction(context(), SpvOpTypeOpaque, 0, id, - std::initializer_list{ - {SPV_OPERAND_TYPE_LITERAL_STRING, words}})); + typeInst = MakeUnique( + context(), SpvOpTypeOpaque, 0, id, + std::initializer_list{ + {SPV_OPERAND_TYPE_LITERAL_STRING, words}}); break; } case Type::kPointer: { const Pointer* pointer = type->AsPointer(); uint32_t subtype = GetTypeInstruction(pointer->pointee_type()); - typeInst.reset(new Instruction( + typeInst = MakeUnique( context(), SpvOpTypePointer, 0, id, std::initializer_list{ {SPV_OPERAND_TYPE_STORAGE_CLASS, {static_cast(pointer->storage_class())}}, - {SPV_OPERAND_TYPE_ID, {subtype}}})); + {SPV_OPERAND_TYPE_ID, {subtype}}}); break; } case Type::kFunction: { @@ -341,24 +343,25 @@ uint32_t TypeManager::GetTypeInstruction(const Type* type) { for (auto ty : function->param_types()) { ops.push_back(Operand(SPV_OPERAND_TYPE_ID, {GetTypeInstruction(ty)})); } - typeInst.reset(new Instruction(context(), SpvOpTypeFunction, 0, id, ops)); + typeInst = + MakeUnique(context(), SpvOpTypeFunction, 0, id, ops); break; } case Type::kPipe: - typeInst.reset(new Instruction( + typeInst = MakeUnique( context(), SpvOpTypePipe, 0, id, std::initializer_list{ {SPV_OPERAND_TYPE_ACCESS_QUALIFIER, - {static_cast(type->AsPipe()->access_qualifier())}}})); + {static_cast(type->AsPipe()->access_qualifier())}}}); break; case Type::kForwardPointer: - typeInst.reset(new Instruction( + typeInst = MakeUnique( context(), SpvOpTypeForwardPointer, 0, 0, std::initializer_list{ {SPV_OPERAND_TYPE_ID, {type->AsForwardPointer()->target_id()}}, {SPV_OPERAND_TYPE_STORAGE_CLASS, {static_cast( - type->AsForwardPointer()->storage_class())}}})); + type->AsForwardPointer()->storage_class())}}}); break; default: assert(false && "Unexpected type"); @@ -447,7 +450,8 @@ Type* TypeManager::RebuildType(const Type& type) { #define DefineNoSubtypeCase(kind) \ case Type::k##kind: \ rebuilt_ty.reset(type.Clone().release()); \ - break; + return type_pool_.insert(std::move(rebuilt_ty)).first->get(); + DefineNoSubtypeCase(Void); DefineNoSubtypeCase(Bool); DefineNoSubtypeCase(Integer); @@ -465,45 +469,44 @@ Type* TypeManager::RebuildType(const Type& type) { case Type::kVector: { const Vector* vec_ty = type.AsVector(); const Type* ele_ty = vec_ty->element_type(); - rebuilt_ty.reset( - new Vector(RebuildType(*ele_ty), vec_ty->element_count())); + rebuilt_ty = + MakeUnique(RebuildType(*ele_ty), vec_ty->element_count()); break; } case Type::kMatrix: { const Matrix* mat_ty = type.AsMatrix(); const Type* ele_ty = mat_ty->element_type(); - rebuilt_ty.reset( - new Matrix(RebuildType(*ele_ty), mat_ty->element_count())); + rebuilt_ty = + MakeUnique(RebuildType(*ele_ty), mat_ty->element_count()); break; } case Type::kImage: { const Image* image_ty = type.AsImage(); const Type* ele_ty = image_ty->sampled_type(); - rebuilt_ty.reset(new Image(RebuildType(*ele_ty), image_ty->dim(), - image_ty->depth(), image_ty->is_arrayed(), - image_ty->is_multisampled(), - image_ty->sampled(), image_ty->format(), - image_ty->access_qualifier())); + rebuilt_ty = + MakeUnique(RebuildType(*ele_ty), image_ty->dim(), + image_ty->depth(), image_ty->is_arrayed(), + image_ty->is_multisampled(), image_ty->sampled(), + image_ty->format(), image_ty->access_qualifier()); break; } case Type::kSampledImage: { const SampledImage* image_ty = type.AsSampledImage(); const Type* ele_ty = image_ty->image_type(); - rebuilt_ty.reset( - - new SampledImage(RebuildType(*ele_ty))); + rebuilt_ty = MakeUnique(RebuildType(*ele_ty)); break; } case Type::kArray: { const Array* array_ty = type.AsArray(); const Type* ele_ty = array_ty->element_type(); - rebuilt_ty.reset(new Array(RebuildType(*ele_ty), array_ty->LengthId())); + rebuilt_ty = + MakeUnique(RebuildType(*ele_ty), array_ty->LengthId()); break; } case Type::kRuntimeArray: { const RuntimeArray* array_ty = type.AsRuntimeArray(); const Type* ele_ty = array_ty->element_type(); - rebuilt_ty.reset(new RuntimeArray(RebuildType(*ele_ty))); + rebuilt_ty = MakeUnique(RebuildType(*ele_ty)); break; } case Type::kStruct: { @@ -513,7 +516,7 @@ Type* TypeManager::RebuildType(const Type& type) { for (const auto* ele_ty : struct_ty->element_types()) { subtypes.push_back(RebuildType(*ele_ty)); } - rebuilt_ty.reset(new Struct(subtypes)); + rebuilt_ty = MakeUnique(subtypes); Struct* rebuilt_struct = rebuilt_ty->AsStruct(); for (auto pair : struct_ty->element_decorations()) { uint32_t index = pair.first; @@ -528,8 +531,8 @@ Type* TypeManager::RebuildType(const Type& type) { case Type::kPointer: { const Pointer* pointer_ty = type.AsPointer(); const Type* ele_ty = pointer_ty->pointee_type(); - rebuilt_ty.reset( - new Pointer(RebuildType(*ele_ty), pointer_ty->storage_class())); + rebuilt_ty = MakeUnique(RebuildType(*ele_ty), + pointer_ty->storage_class()); break; } case Type::kFunction: { @@ -540,13 +543,13 @@ Type* TypeManager::RebuildType(const Type& type) { for (const auto* param_ty : function_ty->param_types()) { param_types.push_back(RebuildType(*param_ty)); } - rebuilt_ty.reset(new Function(RebuildType(*ret_ty), param_types)); + rebuilt_ty = MakeUnique(RebuildType(*ret_ty), param_types); break; } case Type::kForwardPointer: { const ForwardPointer* forward_ptr_ty = type.AsForwardPointer(); - rebuilt_ty.reset(new ForwardPointer(forward_ptr_ty->target_id(), - forward_ptr_ty->storage_class())); + rebuilt_ty = MakeUnique(forward_ptr_ty->target_id(), + forward_ptr_ty->storage_class()); const Pointer* target_ptr = forward_ptr_ty->target_pointer(); if (target_ptr) { rebuilt_ty->AsForwardPointer()->SetTargetPointer( diff --git a/third_party/spirv-tools/source/opt/type_manager.h b/third_party/spirv-tools/source/opt/type_manager.h old mode 100755 new mode 100644 index 7e124e9f91..c44969e84f --- a/third_party/spirv-tools/source/opt/type_manager.h +++ b/third_party/spirv-tools/source/opt/type_manager.h @@ -12,17 +12,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_TYPE_MANAGER_H_ -#define LIBSPIRV_OPT_TYPE_MANAGER_H_ +#ifndef SOURCE_OPT_TYPE_MANAGER_H_ +#define SOURCE_OPT_TYPE_MANAGER_H_ #include #include #include +#include #include -#include "module.h" +#include "source/opt/module.h" +#include "source/opt/types.h" #include "spirv-tools/libspirv.hpp" -#include "types.h" namespace spvtools { namespace opt { @@ -214,4 +215,4 @@ class TypeManager { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_TYPE_MANAGER_H_ +#endif // SOURCE_OPT_TYPE_MANAGER_H_ diff --git a/third_party/spirv-tools/source/opt/types.cpp b/third_party/spirv-tools/source/opt/types.cpp old mode 100755 new mode 100644 index e5d90d09eb..15cff54864 --- a/third_party/spirv-tools/source/opt/types.cpp +++ b/third_party/spirv-tools/source/opt/types.cpp @@ -18,7 +18,8 @@ #include #include -#include "types.h" +#include "source/opt/types.h" +#include "source/util/make_unique.h" namespace spvtools { namespace opt { @@ -95,9 +96,9 @@ bool Type::IsUniqueType(bool allowVariablePointers) const { std::unique_ptr Type::Clone() const { std::unique_ptr type; switch (kind_) { -#define DeclareKindCase(kind) \ - case k##kind: \ - type.reset(new kind(*this->As##kind())); \ +#define DeclareKindCase(kind) \ + case k##kind: \ + type = MakeUnique(*this->As##kind()); \ break; DeclareKindCase(Void); DeclareKindCase(Bool); diff --git a/third_party/spirv-tools/source/opt/types.h b/third_party/spirv-tools/source/opt/types.h old mode 100755 new mode 100644 index 8fee05cd92..625f342a68 --- a/third_party/spirv-tools/source/opt/types.h +++ b/third_party/spirv-tools/source/opt/types.h @@ -14,8 +14,8 @@ // This file provides a class hierarchy for representing SPIR-V types. -#ifndef LIBSPIRV_OPT_TYPES_H_ -#define LIBSPIRV_OPT_TYPES_H_ +#ifndef SOURCE_OPT_TYPES_H_ +#define SOURCE_OPT_TYPES_H_ #include #include @@ -23,9 +23,10 @@ #include #include #include +#include #include -#include "latest_version_spirv_header.h" +#include "source/latest_version_spirv_header.h" #include "spirv-tools/libspirv.h" namespace spvtools { @@ -599,4 +600,4 @@ DefineParameterlessType(NamedBarrier, named_barrier); } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_TYPES_H_ +#endif // SOURCE_OPT_TYPES_H_ diff --git a/third_party/spirv-tools/source/opt/unify_const_pass.cpp b/third_party/spirv-tools/source/opt/unify_const_pass.cpp old mode 100755 new mode 100644 index 83bd6c0fa6..227fd61da2 --- a/third_party/spirv-tools/source/opt/unify_const_pass.cpp +++ b/third_party/spirv-tools/source/opt/unify_const_pass.cpp @@ -12,14 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "unify_const_pass.h" +#include "source/opt/unify_const_pass.h" +#include #include #include +#include -#include "def_use_manager.h" -#include "ir_context.h" -#include "make_unique.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/ir_context.h" +#include "source/util/make_unique.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/unify_const_pass.h b/third_party/spirv-tools/source/opt/unify_const_pass.h old mode 100755 new mode 100644 index 3f24d29683..f2b7897ccd --- a/third_party/spirv-tools/source/opt/unify_const_pass.h +++ b/third_party/spirv-tools/source/opt/unify_const_pass.h @@ -12,12 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_UNIFY_CONSTANT_PASS_H_ -#define LIBSPIRV_OPT_UNIFY_CONSTANT_PASS_H_ +#ifndef SOURCE_OPT_UNIFY_CONST_PASS_H_ +#define SOURCE_OPT_UNIFY_CONST_PASS_H_ -#include "ir_context.h" -#include "module.h" -#include "pass.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" namespace spvtools { namespace opt { @@ -32,4 +32,4 @@ class UnifyConstantPass : public Pass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_UNIFY_CONSTANT_PASS_H_ +#endif // SOURCE_OPT_UNIFY_CONST_PASS_H_ diff --git a/third_party/spirv-tools/source/opt/value_number_table.cpp b/third_party/spirv-tools/source/opt/value_number_table.cpp old mode 100755 new mode 100644 index 165540f534..1bac63fabe --- a/third_party/spirv-tools/source/opt/value_number_table.cpp +++ b/third_party/spirv-tools/source/opt/value_number_table.cpp @@ -12,12 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "value_number_table.h" +#include "source/opt/value_number_table.h" #include -#include "cfg.h" -#include "ir_context.h" +#include "source/opt/cfg.h" +#include "source/opt/ir_context.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/value_number_table.h b/third_party/spirv-tools/source/opt/value_number_table.h old mode 100755 new mode 100644 index ec25099e2b..39129ffa35 --- a/third_party/spirv-tools/source/opt/value_number_table.h +++ b/third_party/spirv-tools/source/opt/value_number_table.h @@ -12,12 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_VALUE_NUMBER_TABLE_H_ -#define LIBSPIRV_OPT_VALUE_NUMBER_TABLE_H_ +#ifndef SOURCE_OPT_VALUE_NUMBER_TABLE_H_ +#define SOURCE_OPT_VALUE_NUMBER_TABLE_H_ #include #include -#include "instruction.h" + +#include "source/opt/instruction.h" namespace spvtools { namespace opt { @@ -87,4 +88,4 @@ class ValueNumberTable { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_VALUE_NUMBER_TABLE_H_ +#endif // SOURCE_OPT_VALUE_NUMBER_TABLE_H_ diff --git a/third_party/spirv-tools/source/opt/vector_dce.cpp b/third_party/spirv-tools/source/opt/vector_dce.cpp index 8738fccf96..911242e058 100644 --- a/third_party/spirv-tools/source/opt/vector_dce.cpp +++ b/third_party/spirv-tools/source/opt/vector_dce.cpp @@ -12,16 +12,19 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "vector_dce.h" +#include "source/opt/vector_dce.h" -namespace { -const uint32_t kExtractCompositeIdInIdx = 0; -const uint32_t kInsertObjectIdInIdx = 0; -const uint32_t kInsertCompositeIdInIdx = 1; -} // namespace +#include namespace spvtools { namespace opt { +namespace { + +const uint32_t kExtractCompositeIdInIdx = 0; +const uint32_t kInsertObjectIdInIdx = 0; +const uint32_t kInsertCompositeIdInIdx = 1; + +} // namespace Pass::Status VectorDCE::Process() { bool modified = false; diff --git a/third_party/spirv-tools/source/opt/vector_dce.h b/third_party/spirv-tools/source/opt/vector_dce.h index b7d8bd2508..48886998da 100644 --- a/third_party/spirv-tools/source/opt/vector_dce.h +++ b/third_party/spirv-tools/source/opt/vector_dce.h @@ -12,11 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_VECTOR_DCE_H_ -#define LIBSPIRV_OPT_VECTOR_DCE_H_ +#ifndef SOURCE_OPT_VECTOR_DCE_H_ +#define SOURCE_OPT_VECTOR_DCE_H_ -#include -#include "mem_pass.h" +#include +#include + +#include "source/opt/mem_pass.h" +#include "source/util/bit_vector.h" namespace spvtools { namespace opt { @@ -143,4 +146,4 @@ class VectorDCE : public MemPass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_VECTOR_DCE_H_ +#endif // SOURCE_OPT_VECTOR_DCE_H_ diff --git a/third_party/spirv-tools/source/opt/workaround1209.cpp b/third_party/spirv-tools/source/opt/workaround1209.cpp old mode 100755 new mode 100644 index fae08b8360..d6e9d2cf72 --- a/third_party/spirv-tools/source/opt/workaround1209.cpp +++ b/third_party/spirv-tools/source/opt/workaround1209.cpp @@ -12,10 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "workaround1209.h" +#include "source/opt/workaround1209.h" #include +#include #include +#include namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/source/opt/workaround1209.h b/third_party/spirv-tools/source/opt/workaround1209.h old mode 100755 new mode 100644 index 6656ff4bda..9a1f88d93c --- a/third_party/spirv-tools/source/opt/workaround1209.h +++ b/third_party/spirv-tools/source/opt/workaround1209.h @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_WORKAROUND1209_H_ -#define LIBSPIRV_OPT_WORKAROUND1209_H_ +#ifndef SOURCE_OPT_WORKAROUND1209_H_ +#define SOURCE_OPT_WORKAROUND1209_H_ -#include "pass.h" +#include "source/opt/pass.h" namespace spvtools { namespace opt { @@ -38,4 +38,4 @@ class Workaround1209 : public Pass { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_OPT_WORKAROUND1209_H_ +#endif // SOURCE_OPT_WORKAROUND1209_H_ diff --git a/third_party/spirv-tools/source/parsed_operand.cpp b/third_party/spirv-tools/source/parsed_operand.cpp old mode 100755 new mode 100644 index 3f10d822ea..7ad369cdb2 --- a/third_party/spirv-tools/source/parsed_operand.cpp +++ b/third_party/spirv-tools/source/parsed_operand.cpp @@ -14,19 +14,21 @@ // This file contains utility functions for spv_parsed_operand_t. -#include "parsed_operand.h" +#include "source/parsed_operand.h" #include -#include "util/hex_float.h" +#include "source/util/hex_float.h" namespace spvtools { void EmitNumericLiteral(std::ostream* out, const spv_parsed_instruction_t& inst, const spv_parsed_operand_t& operand) { - assert(operand.type == SPV_OPERAND_TYPE_LITERAL_INTEGER || - operand.type == SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER); - assert(1 <= operand.num_words); - assert(operand.num_words <= 2); + if (operand.type != SPV_OPERAND_TYPE_LITERAL_INTEGER && + operand.type != SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER) + return; + if (operand.num_words < 1) return; + // TODO(dneto): Support more than 64-bits at a time. + if (operand.num_words > 2) return; const uint32_t word = inst.words[operand.offset]; if (operand.num_words == 1) { @@ -47,7 +49,7 @@ void EmitNumericLiteral(std::ostream* out, const spv_parsed_instruction_t& inst, } break; default: - assert(false && "Unreachable"); + break; } } else if (operand.num_words == 2) { // Multi-word numbers are presented with lower order words first. @@ -65,11 +67,8 @@ void EmitNumericLiteral(std::ostream* out, const spv_parsed_instruction_t& inst, *out << spvtools::utils::FloatProxy(bits); break; default: - assert(false && "Unreachable"); + break; } - } else { - // TODO(dneto): Support more than 64-bits at a time. - assert(false && "Unhandled"); } } } // namespace spvtools diff --git a/third_party/spirv-tools/source/parsed_operand.h b/third_party/spirv-tools/source/parsed_operand.h old mode 100755 new mode 100644 index b5697bb3a1..bab8611077 --- a/third_party/spirv-tools/source/parsed_operand.h +++ b/third_party/spirv-tools/source/parsed_operand.h @@ -12,10 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_PARSED_OPERAND_H_ -#define LIBSPIRV_PARSED_OPERAND_H_ +#ifndef SOURCE_PARSED_OPERAND_H_ +#define SOURCE_PARSED_OPERAND_H_ #include + #include "spirv-tools/libspirv.h" namespace spvtools { @@ -29,4 +30,4 @@ void EmitNumericLiteral(std::ostream* out, const spv_parsed_instruction_t& inst, } // namespace spvtools -#endif // LIBSPIRV_BINARY_H_ +#endif // SOURCE_PARSED_OPERAND_H_ diff --git a/third_party/spirv-tools/source/print.cpp b/third_party/spirv-tools/source/print.cpp old mode 100755 new mode 100644 index f03c2d6892..f75e2d4573 --- a/third_party/spirv-tools/source/print.cpp +++ b/third_party/spirv-tools/source/print.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "print.h" +#include "source/print.h" #if defined(SPIRV_ANDROID) || defined(SPIRV_LINUX) || defined(SPIRV_MAC) || \ defined(SPIRV_FREEBSD) diff --git a/third_party/spirv-tools/source/print.h b/third_party/spirv-tools/source/print.h old mode 100755 new mode 100644 index f955f412d2..f31ba38e70 --- a/third_party/spirv-tools/source/print.h +++ b/third_party/spirv-tools/source/print.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_PRINT_H_ -#define LIBSPIRV_PRINT_H_ +#ifndef SOURCE_PRINT_H_ +#define SOURCE_PRINT_H_ #include #include @@ -72,4 +72,4 @@ struct blue { } // namespace spvtools -#endif // LIBSPIRV_PRINT_H_ +#endif // SOURCE_PRINT_H_ diff --git a/third_party/spirv-tools/source/software_version.cpp b/third_party/spirv-tools/source/software_version.cpp old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/source/spirv_constant.h b/third_party/spirv-tools/source/spirv_constant.h old mode 100755 new mode 100644 index 8eb6572bc2..39771ccb26 --- a/third_party/spirv-tools/source/spirv_constant.h +++ b/third_party/spirv-tools/source/spirv_constant.h @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_SPIRV_CONSTANT_H_ -#define LIBSPIRV_SPIRV_CONSTANT_H_ +#ifndef SOURCE_SPIRV_CONSTANT_H_ +#define SOURCE_SPIRV_CONSTANT_H_ -#include "latest_version_spirv_header.h" +#include "source/latest_version_spirv_header.h" #include "spirv-tools/libspirv.h" // Version number macros. @@ -97,4 +97,4 @@ typedef enum spv_generator_t { // Returns the misc part of the generator word. #define SPV_GENERATOR_MISC_PART(WORD) (uint32_t(WORD) & 0xFFFF) -#endif // LIBSPIRV_SPIRV_CONSTANT_H_ +#endif // SOURCE_SPIRV_CONSTANT_H_ diff --git a/third_party/spirv-tools/source/spirv_definition.h b/third_party/spirv-tools/source/spirv_definition.h old mode 100755 new mode 100644 index 9e22108fa3..63a4ef0db2 --- a/third_party/spirv-tools/source/spirv_definition.h +++ b/third_party/spirv-tools/source/spirv_definition.h @@ -12,12 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_SPIRV_DEFINITION_H_ -#define LIBSPIRV_SPIRV_DEFINITION_H_ +#ifndef SOURCE_SPIRV_DEFINITION_H_ +#define SOURCE_SPIRV_DEFINITION_H_ #include -#include "latest_version_spirv_header.h" +#include "source/latest_version_spirv_header.h" #define spvIsInBitfield(value, bitfield) ((value) == ((value)&bitfield)) @@ -30,4 +30,4 @@ typedef struct spv_header_t { const uint32_t* instructions; // NOTE: Unfixed pointer to instruciton stream } spv_header_t; -#endif // LIBSPIRV_SPIRV_DEFINITION_H_ +#endif // SOURCE_SPIRV_DEFINITION_H_ diff --git a/third_party/spirv-tools/source/spirv_endian.cpp b/third_party/spirv-tools/source/spirv_endian.cpp old mode 100755 new mode 100644 index 56eaac855f..1d77091784 --- a/third_party/spirv-tools/source/spirv_endian.cpp +++ b/third_party/spirv-tools/source/spirv_endian.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "spirv_endian.h" +#include "source/spirv_endian.h" #include diff --git a/third_party/spirv-tools/source/spirv_endian.h b/third_party/spirv-tools/source/spirv_endian.h old mode 100755 new mode 100644 index c64b338197..c2540bec92 --- a/third_party/spirv-tools/source/spirv_endian.h +++ b/third_party/spirv-tools/source/spirv_endian.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_SPIRV_ENDIAN_H_ -#define LIBSPIRV_SPIRV_ENDIAN_H_ +#ifndef SOURCE_SPIRV_ENDIAN_H_ +#define SOURCE_SPIRV_ENDIAN_H_ #include "spirv-tools/libspirv.h" @@ -34,4 +34,4 @@ spv_result_t spvBinaryEndianness(const spv_const_binary binary, // Returns true if the given endianness matches the host's native endiannes. bool spvIsHostEndian(spv_endianness_t endian); -#endif // LIBSPIRV_SPIRV_ENDIAN_H_ +#endif // SOURCE_SPIRV_ENDIAN_H_ diff --git a/third_party/spirv-tools/source/spirv_target_env.cpp b/third_party/spirv-tools/source/spirv_target_env.cpp old mode 100755 new mode 100644 index 3a8766d7bb..7a11630c72 --- a/third_party/spirv-tools/source/spirv_target_env.cpp +++ b/third_party/spirv-tools/source/spirv_target_env.cpp @@ -12,11 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "source/spirv_target_env.h" + #include #include +#include "source/spirv_constant.h" #include "spirv-tools/libspirv.h" -#include "spirv_constant.h" const char* spvTargetEnvDescription(spv_target_env env) { switch (env) { diff --git a/third_party/spirv-tools/source/spirv_target_env.h b/third_party/spirv-tools/source/spirv_target_env.h old mode 100755 new mode 100644 index 315dbbe918..7dc7be1d87 --- a/third_party/spirv-tools/source/spirv_target_env.h +++ b/third_party/spirv-tools/source/spirv_target_env.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_SPIRV_TARGET_ENV_H_ -#define LIBSPIRV_SPIRV_TARGET_ENV_H_ +#ifndef SOURCE_SPIRV_TARGET_ENV_H_ +#define SOURCE_SPIRV_TARGET_ENV_H_ #include "spirv-tools/libspirv.h" @@ -27,4 +27,4 @@ bool spvIsVulkanEnv(spv_target_env env); // Returns the version number for the given SPIR-V target environment. uint32_t spvVersionForTargetEnv(spv_target_env env); -#endif // LIBSPIRV_SPIRV_TARGET_ENV_H_ +#endif // SOURCE_SPIRV_TARGET_ENV_H_ diff --git a/third_party/spirv-tools/source/spirv_validator_options.cpp b/third_party/spirv-tools/source/spirv_validator_options.cpp old mode 100755 new mode 100644 index daa53ebd13..0c06253649 --- a/third_party/spirv-tools/source/spirv_validator_options.cpp +++ b/third_party/spirv-tools/source/spirv_validator_options.cpp @@ -15,7 +15,7 @@ #include #include -#include "spirv_validator_options.h" +#include "source/spirv_validator_options.h" bool spvParseUniversalLimitsOptions(const char* s, spv_validator_limit* type) { auto match = [s](const char* b) { diff --git a/third_party/spirv-tools/source/spirv_validator_options.h b/third_party/spirv-tools/source/spirv_validator_options.h old mode 100755 new mode 100644 index 46f24ead46..d264a7e0b0 --- a/third_party/spirv-tools/source/spirv_validator_options.h +++ b/third_party/spirv-tools/source/spirv_validator_options.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_SPIRV_VALIDATOR_OPTIONS_H_ -#define LIBSPIRV_SPIRV_VALIDATOR_OPTIONS_H_ +#ifndef SOURCE_SPIRV_VALIDATOR_OPTIONS_H_ +#define SOURCE_SPIRV_VALIDATOR_OPTIONS_H_ #include "spirv-tools/libspirv.h" @@ -51,4 +51,4 @@ struct spv_validator_options_t { bool skip_block_layout; }; -#endif // LIBSPIRV_SPIRV_VALIDATOR_OPTIONS_H_ +#endif // SOURCE_SPIRV_VALIDATOR_OPTIONS_H_ diff --git a/third_party/spirv-tools/source/table.cpp b/third_party/spirv-tools/source/table.cpp old mode 100755 new mode 100644 index 9f8be8621e..b10d776da4 --- a/third_party/spirv-tools/source/table.cpp +++ b/third_party/spirv-tools/source/table.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "table.h" +#include "source/table.h" #include diff --git a/third_party/spirv-tools/source/table.h b/third_party/spirv-tools/source/table.h old mode 100755 new mode 100644 index d8c60ec497..64d73dbb96 --- a/third_party/spirv-tools/source/table.h +++ b/third_party/spirv-tools/source/table.h @@ -12,13 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_TABLE_H_ -#define LIBSPIRV_TABLE_H_ +#ifndef SOURCE_TABLE_H_ +#define SOURCE_TABLE_H_ -#include "latest_version_spirv_header.h" +#include "source/latest_version_spirv_header.h" -#include "extensions.h" -#include "message.h" +#include "source/extensions.h" #include "spirv-tools/libspirv.hpp" typedef struct spv_opcode_desc_t { @@ -130,4 +129,4 @@ spv_result_t spvOperandTableGet(spv_operand_table* table, spv_target_env env); // Populates *table with entries for env. spv_result_t spvExtInstTableGet(spv_ext_inst_table* table, spv_target_env env); -#endif // LIBSPIRV_TABLE_H_ +#endif // SOURCE_TABLE_H_ diff --git a/third_party/spirv-tools/source/text.cpp b/third_party/spirv-tools/source/text.cpp old mode 100755 new mode 100644 index d16e2f47a5..adaf796520 --- a/third_party/spirv-tools/source/text.cpp +++ b/third_party/spirv-tools/source/text.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "text.h" +#include "source/text.h" #include #include @@ -21,26 +21,27 @@ #include #include #include +#include #include #include #include +#include #include -#include "assembly_grammar.h" -#include "binary.h" -#include "diagnostic.h" -#include "ext_inst.h" -#include "instruction.h" -#include "message.h" -#include "opcode.h" -#include "operand.h" +#include "source/assembly_grammar.h" +#include "source/binary.h" +#include "source/diagnostic.h" +#include "source/ext_inst.h" +#include "source/instruction.h" +#include "source/opcode.h" +#include "source/operand.h" +#include "source/spirv_constant.h" +#include "source/spirv_target_env.h" +#include "source/table.h" +#include "source/text_handler.h" +#include "source/util/bitutils.h" +#include "source/util/parse_number.h" #include "spirv-tools/libspirv.h" -#include "spirv_constant.h" -#include "spirv_target_env.h" -#include "table.h" -#include "text_handler.h" -#include "util/bitutils.h" -#include "util/parse_number.h" bool spvIsValidIDCharacter(const char value) { return value == '_' || 0 != ::isalnum(value); diff --git a/third_party/spirv-tools/source/text.h b/third_party/spirv-tools/source/text.h old mode 100755 new mode 100644 index 19990cc937..fa34ee16be --- a/third_party/spirv-tools/source/text.h +++ b/third_party/spirv-tools/source/text.h @@ -12,14 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_TEXT_H_ -#define LIBSPIRV_TEXT_H_ +#ifndef SOURCE_TEXT_H_ +#define SOURCE_TEXT_H_ #include -#include "operand.h" +#include "source/operand.h" +#include "source/spirv_constant.h" #include "spirv-tools/libspirv.h" -#include "spirv_constant.h" typedef enum spv_literal_type_t { SPV_LITERAL_TYPE_INT_32, @@ -50,4 +50,4 @@ typedef struct spv_literal_t { // which are then stripped. spv_result_t spvTextToLiteral(const char* text, spv_literal_t* literal); -#endif // LIBSPIRV_TEXT_H_ +#endif // SOURCE_TEXT_H_ diff --git a/third_party/spirv-tools/source/text_handler.cpp b/third_party/spirv-tools/source/text_handler.cpp old mode 100755 new mode 100644 index 49a1675a97..5f6e8c41f1 --- a/third_party/spirv-tools/source/text_handler.cpp +++ b/third_party/spirv-tools/source/text_handler.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "text_handler.h" +#include "source/text_handler.h" #include #include @@ -20,15 +20,15 @@ #include #include -#include "assembly_grammar.h" -#include "binary.h" -#include "ext_inst.h" -#include "instruction.h" -#include "opcode.h" -#include "text.h" -#include "util/bitutils.h" -#include "util/hex_float.h" -#include "util/parse_number.h" +#include "source/assembly_grammar.h" +#include "source/binary.h" +#include "source/ext_inst.h" +#include "source/instruction.h" +#include "source/opcode.h" +#include "source/text.h" +#include "source/util/bitutils.h" +#include "source/util/hex_float.h" +#include "source/util/parse_number.h" namespace spvtools { namespace { @@ -107,9 +107,9 @@ spv_result_t getWord(spv_text text, spv_position position, std::string* word) { return SPV_SUCCESS; } const char ch = text->str[position->index]; - if (ch == '\\') + if (ch == '\\') { escaping = !escaping; - else { + } else { switch (ch) { case '"': if (!escaping) quoting = !quoting; diff --git a/third_party/spirv-tools/source/text_handler.h b/third_party/spirv-tools/source/text_handler.h old mode 100755 new mode 100644 index 1573306971..19972e9519 --- a/third_party/spirv-tools/source/text_handler.h +++ b/third_party/spirv-tools/source/text_handler.h @@ -12,19 +12,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_TEXT_HANDLER_H_ -#define LIBSPIRV_TEXT_HANDLER_H_ +#ifndef SOURCE_TEXT_HANDLER_H_ +#define SOURCE_TEXT_HANDLER_H_ #include +#include #include +#include #include #include +#include -#include "diagnostic.h" -#include "instruction.h" -#include "message.h" +#include "source/diagnostic.h" +#include "source/instruction.h" +#include "source/text.h" #include "spirv-tools/libspirv.h" -#include "text.h" namespace spvtools { @@ -259,4 +261,4 @@ class AssemblyContext { } // namespace spvtools -#endif // _LIBSPIRV_TEXT_HANDLER_H_ +#endif // SOURCE_TEXT_HANDLER_H_ diff --git a/third_party/spirv-tools/source/util/bit_vector.cpp b/third_party/spirv-tools/source/util/bit_vector.cpp index 6151657908..47e275bf46 100644 --- a/third_party/spirv-tools/source/util/bit_vector.cpp +++ b/third_party/spirv-tools/source/util/bit_vector.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "bit_vector.h" +#include "source/util/bit_vector.h" #include #include diff --git a/third_party/spirv-tools/source/util/bit_vector.h b/third_party/spirv-tools/source/util/bit_vector.h index 2f16111fa4..3e189cb10d 100644 --- a/third_party/spirv-tools/source/util/bit_vector.h +++ b/third_party/spirv-tools/source/util/bit_vector.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_UTILS_BIT_VECTOR_H_ -#define LIBSPIRV_UTILS_BIT_VECTOR_H_ +#ifndef SOURCE_UTIL_BIT_VECTOR_H_ +#define SOURCE_UTIL_BIT_VECTOR_H_ #include #include @@ -116,4 +116,4 @@ class BitVector { } // namespace utils } // namespace spvtools -#endif // LIBSPIRV_UTILS_BIT_VECTOR_H_ +#endif // SOURCE_UTIL_BIT_VECTOR_H_ diff --git a/third_party/spirv-tools/source/util/bitutils.h b/third_party/spirv-tools/source/util/bitutils.h old mode 100755 new mode 100644 index 3f60a1926d..17d61df90a --- a/third_party/spirv-tools/source/util/bitutils.h +++ b/third_party/spirv-tools/source/util/bitutils.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_UTIL_BITUTILS_H_ -#define LIBSPIRV_UTIL_BITUTILS_H_ +#ifndef SOURCE_UTIL_BITUTILS_H_ +#define SOURCE_UTIL_BITUTILS_H_ #include #include @@ -93,4 +93,4 @@ size_t CountSetBits(T word) { } // namespace utils } // namespace spvtools -#endif // LIBSPIRV_UTIL_BITUTILS_H_ +#endif // SOURCE_UTIL_BITUTILS_H_ diff --git a/third_party/spirv-tools/source/util/hex_float.h b/third_party/spirv-tools/source/util/hex_float.h old mode 100755 new mode 100644 index cd3dc5f246..b7baf093b4 --- a/third_party/spirv-tools/source/util/hex_float.h +++ b/third_party/spirv-tools/source/util/hex_float.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_UTIL_HEX_FLOAT_H_ -#define LIBSPIRV_UTIL_HEX_FLOAT_H_ +#ifndef SOURCE_UTIL_HEX_FLOAT_H_ +#define SOURCE_UTIL_HEX_FLOAT_H_ #include #include @@ -24,7 +24,7 @@ #include #include -#include "bitutils.h" +#include "source/util/bitutils.h" #ifndef __GNUC__ #define GCC_VERSION 0 @@ -1147,4 +1147,4 @@ inline std::ostream& operator<<(std::ostream& os, } // namespace utils } // namespace spvtools -#endif // LIBSPIRV_UTIL_HEX_FLOAT_H_ +#endif // SOURCE_UTIL_HEX_FLOAT_H_ diff --git a/third_party/spirv-tools/source/util/ilist.h b/third_party/spirv-tools/source/util/ilist.h old mode 100755 new mode 100644 index c4287d248f..9837b09b32 --- a/third_party/spirv-tools/source/util/ilist.h +++ b/third_party/spirv-tools/source/util/ilist.h @@ -12,15 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_ILIST_H_ -#define LIBSPIRV_OPT_ILIST_H_ +#ifndef SOURCE_UTIL_ILIST_H_ +#define SOURCE_UTIL_ILIST_H_ #include #include #include #include -#include "ilist_node.h" +#include "source/util/ilist_node.h" namespace spvtools { namespace utils { @@ -362,4 +362,4 @@ void IntrusiveList::Check(NodeType* start) { } // namespace utils } // namespace spvtools -#endif // LIBSPIRV_OPT_ILIST_H_ +#endif // SOURCE_UTIL_ILIST_H_ diff --git a/third_party/spirv-tools/source/util/ilist_node.h b/third_party/spirv-tools/source/util/ilist_node.h old mode 100755 new mode 100644 index 8c2f4f5cab..0579534b89 --- a/third_party/spirv-tools/source/util/ilist_node.h +++ b/third_party/spirv-tools/source/util/ilist_node.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_ILIST_NODE_H_ -#define LIBSPIRV_OPT_ILIST_NODE_H_ +#ifndef SOURCE_UTIL_ILIST_NODE_H_ +#define SOURCE_UTIL_ILIST_NODE_H_ #include @@ -262,4 +262,4 @@ bool IntrusiveNodeBase::IsEmptyList() { } // namespace utils } // namespace spvtools -#endif // LIBSPIRV_OPT_ILIST_NODE_H_ +#endif // SOURCE_UTIL_ILIST_NODE_H_ diff --git a/third_party/spirv-tools/source/opt/make_unique.h b/third_party/spirv-tools/source/util/make_unique.h old mode 100755 new mode 100644 similarity index 88% rename from third_party/spirv-tools/source/opt/make_unique.h rename to third_party/spirv-tools/source/util/make_unique.h index f6b8aae28d..ad7976c349 --- a/third_party/spirv-tools/source/opt/make_unique.h +++ b/third_party/spirv-tools/source/util/make_unique.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_OPT_MAKE_UNIQUE_H_ -#define LIBSPIRV_OPT_MAKE_UNIQUE_H_ +#ifndef SOURCE_UTIL_MAKE_UNIQUE_H_ +#define SOURCE_UTIL_MAKE_UNIQUE_H_ #include #include @@ -27,4 +27,4 @@ std::unique_ptr MakeUnique(Args&&... args) { } // namespace spvtools -#endif // LIBSPIRV_OPT_MAKE_UNIQUE_H_ +#endif // SOURCE_UTIL_MAKE_UNIQUE_H_ diff --git a/third_party/spirv-tools/source/util/move_to_front.h b/third_party/spirv-tools/source/util/move_to_front.h deleted file mode 100755 index 2546218f7a..0000000000 --- a/third_party/spirv-tools/source/util/move_to_front.h +++ /dev/null @@ -1,827 +0,0 @@ -// Copyright (c) 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef LIBSPIRV_UTIL_MOVE_TO_FRONT_H_ -#define LIBSPIRV_UTIL_MOVE_TO_FRONT_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace spvtools { -namespace utils { - -// Log(n) move-to-front implementation. Implements the following functions: -// Insert - pushes value to the front of the mtf sequence -// (only unique values allowed). -// Remove - remove value from the sequence. -// ValueFromRank - access value by its 1-indexed rank in the sequence. -// RankFromValue - get the rank of the given value in the sequence. -// Accessing a value with ValueFromRank or RankFromValue moves the value to the -// front of the sequence (rank of 1). -// -// The implementation is based on an AVL-based order statistic tree. The tree -// is ordered by timestamps issued when values are inserted or accessed (recent -// values go to the left side of the tree, old values are gradually rotated to -// the right side). -// -// Terminology -// rank: 1-indexed rank showing how recently the value was inserted or accessed. -// node: handle used internally to access node data. -// size: size of the subtree of a node (including the node). -// height: distance from a node to the farthest leaf. -template -class MoveToFront { - public: - explicit MoveToFront(size_t reserve_capacity = 4) { - nodes_.reserve(reserve_capacity); - - // Create NIL node. - nodes_.emplace_back(Node()); - } - - virtual ~MoveToFront() {} - - // Inserts value in the move-to-front sequence. Does nothing if the value is - // already in the sequence. Returns true if insertion was successful. - // The inserted value is placed at the front of the sequence (rank 1). - bool Insert(const Val& value); - - // Removes value from move-to-front sequence. Returns false iff the value - // was not found. - bool Remove(const Val& value); - - // Computes 1-indexed rank of value in the move-to-front sequence and moves - // the value to the front. Example: - // Before the call: 4 8 2 1 7 - // RankFromValue(8) returns 2 - // After the call: 8 4 2 1 7 - // Returns true iff the value was found in the sequence. - bool RankFromValue(const Val& value, uint32_t* rank); - - // Returns value corresponding to a 1-indexed rank in the move-to-front - // sequence and moves the value to the front. Example: - // Before the call: 4 8 2 1 7 - // ValueFromRank(2) returns 8 - // After the call: 8 4 2 1 7 - // Returns true iff the rank is within bounds [1, GetSize()]. - bool ValueFromRank(uint32_t rank, Val* value); - - // Moves the value to the front of the sequence. - // Returns false iff value is not in the sequence. - bool Promote(const Val& value); - - // Returns true iff the move-to-front sequence contains the value. - bool HasValue(const Val& value) const; - - // Returns the number of elements in the move-to-front sequence. - uint32_t GetSize() const { return SizeOf(root_); } - - protected: - // Internal tree data structure uses handles instead of pointers. Leaves and - // root parent reference a singleton under handle 0. Although dereferencing - // a null pointer is not possible, inappropriate access to handle 0 would - // cause an assertion. Handles are not garbage collected if value was - // deprecated - // with DeprecateValue(). But handles are recycled when a node is - // repositioned. - - // Internal tree data structure node. - struct Node { - // Timestamp from a logical clock which updates every time the element is - // accessed through ValueFromRank or RankFromValue. - uint32_t timestamp = 0; - // The size of the node's subtree, including the node. - // SizeOf(LeftOf(node)) + SizeOf(RightOf(node)) + 1. - uint32_t size = 0; - // Handles to connected nodes. - uint32_t left = 0; - uint32_t right = 0; - uint32_t parent = 0; - // Distance to the farthest leaf. - // Leaves have height 0, real nodes at least 1. - uint32_t height = 0; - // Stored value. - Val value = Val(); - }; - - // Creates node and sets correct values. Non-NIL nodes should be created only - // through this function. If the node with this value has been created - // previously - // and since orphaned, reuses the old node instead of creating a new one. - uint32_t CreateNode(uint32_t timestamp, const Val& value) { - uint32_t handle = static_cast(nodes_.size()); - const auto result = value_to_node_.emplace(value, handle); - if (result.second) { - // Create new node. - nodes_.emplace_back(Node()); - Node& node = nodes_.back(); - node.timestamp = timestamp; - node.value = value; - node.size = 1; - // Non-NIL nodes start with height 1 because their NIL children are - // leaves. - node.height = 1; - } else { - // Reuse old node. - handle = result.first->second; - assert(!IsInTree(handle)); - assert(ValueOf(handle) == value); - assert(SizeOf(handle) == 1); - assert(HeightOf(handle) == 1); - MutableTimestampOf(handle) = timestamp; - } - - return handle; - } - - // Node accessor methods. Naming is designed to be similar to natural - // language as these functions tend to be used in sequences, for example: - // ParentOf(LeftestDescendentOf(RightOf(node))) - - // Returns value of the node referenced by |handle|. - Val ValueOf(uint32_t node) const { return nodes_.at(node).value; } - - // Returns left child of |node|. - uint32_t LeftOf(uint32_t node) const { return nodes_.at(node).left; } - - // Returns right child of |node|. - uint32_t RightOf(uint32_t node) const { return nodes_.at(node).right; } - - // Returns parent of |node|. - uint32_t ParentOf(uint32_t node) const { return nodes_.at(node).parent; } - - // Returns timestamp of |node|. - uint32_t TimestampOf(uint32_t node) const { - assert(node); - return nodes_.at(node).timestamp; - } - - // Returns size of |node|. - uint32_t SizeOf(uint32_t node) const { return nodes_.at(node).size; } - - // Returns height of |node|. - uint32_t HeightOf(uint32_t node) const { return nodes_.at(node).height; } - - // Returns mutable reference to value of |node|. - Val& MutableValueOf(uint32_t node) { - assert(node); - return nodes_.at(node).value; - } - - // Returns mutable reference to handle of left child of |node|. - uint32_t& MutableLeftOf(uint32_t node) { - assert(node); - return nodes_.at(node).left; - } - - // Returns mutable reference to handle of right child of |node|. - uint32_t& MutableRightOf(uint32_t node) { - assert(node); - return nodes_.at(node).right; - } - - // Returns mutable reference to handle of parent of |node|. - uint32_t& MutableParentOf(uint32_t node) { - assert(node); - return nodes_.at(node).parent; - } - - // Returns mutable reference to timestamp of |node|. - uint32_t& MutableTimestampOf(uint32_t node) { - assert(node); - return nodes_.at(node).timestamp; - } - - // Returns mutable reference to size of |node|. - uint32_t& MutableSizeOf(uint32_t node) { - assert(node); - return nodes_.at(node).size; - } - - // Returns mutable reference to height of |node|. - uint32_t& MutableHeightOf(uint32_t node) { - assert(node); - return nodes_.at(node).height; - } - - // Returns true iff |node| is left child of its parent. - bool IsLeftChild(uint32_t node) const { - assert(node); - return LeftOf(ParentOf(node)) == node; - } - - // Returns true iff |node| is right child of its parent. - bool IsRightChild(uint32_t node) const { - assert(node); - return RightOf(ParentOf(node)) == node; - } - - // Returns true iff |node| has no relatives. - bool IsOrphan(uint32_t node) const { - assert(node); - return !ParentOf(node) && !LeftOf(node) && !RightOf(node); - } - - // Returns true iff |node| is in the tree. - bool IsInTree(uint32_t node) const { - assert(node); - return node == root_ || !IsOrphan(node); - } - - // Returns the height difference between right and left subtrees. - int BalanceOf(uint32_t node) const { - return int(HeightOf(RightOf(node))) - int(HeightOf(LeftOf(node))); - } - - // Updates size and height of the node, assuming that the children have - // correct values. - void UpdateNode(uint32_t node); - - // Returns the most LeftOf(LeftOf(... descendent which is not leaf. - uint32_t LeftestDescendantOf(uint32_t node) const { - uint32_t parent = 0; - while (node) { - parent = node; - node = LeftOf(node); - } - return parent; - } - - // Returns the most RightOf(RightOf(... descendent which is not leaf. - uint32_t RightestDescendantOf(uint32_t node) const { - uint32_t parent = 0; - while (node) { - parent = node; - node = RightOf(node); - } - return parent; - } - - // Inserts node in the tree. The node must be an orphan. - void InsertNode(uint32_t node); - - // Removes node from the tree. May change value_to_node_ if removal uses a - // scapegoat. Returns the removed (orphaned) handle for recycling. The - // returned handle may not be equal to |node| if scapegoat was used. - uint32_t RemoveNode(uint32_t node); - - // Rotates |node| left, reassigns all connections and returns the node - // which takes place of the |node|. - uint32_t RotateLeft(const uint32_t node); - - // Rotates |node| right, reassigns all connections and returns the node - // which takes place of the |node|. - uint32_t RotateRight(const uint32_t node); - - // Root node handle. The tree is empty if root_ is 0. - uint32_t root_ = 0; - - // Incremented counters for next timestamp and value. - uint32_t next_timestamp_ = 1; - - // Holds all tree nodes. Indices of this vector are node handles. - std::vector nodes_; - - // Maps ids to node handles. - std::unordered_map value_to_node_; - - // Cache for the last accessed value in the sequence. - Val last_accessed_value_ = Val(); - bool last_accessed_value_valid_ = false; -}; - -template -class MultiMoveToFront { - public: - // Inserts |value| to sequence with handle |mtf|. - // Returns false if |mtf| already has |value|. - bool Insert(uint64_t mtf, const Val& value) { - if (GetMtf(mtf).Insert(value)) { - val_to_mtfs_[value].insert(mtf); - return true; - } - return false; - } - - // Removes |value| from sequence with handle |mtf|. - // Returns false if |mtf| doesn't have |value|. - bool Remove(uint64_t mtf, const Val& value) { - if (GetMtf(mtf).Remove(value)) { - val_to_mtfs_[value].erase(mtf); - return true; - } - assert(val_to_mtfs_[value].count(mtf) == 0); - return false; - } - - // Removes |value| from all sequences which have it. - void RemoveFromAll(const Val& value) { - auto it = val_to_mtfs_.find(value); - if (it == val_to_mtfs_.end()) return; - - auto& mtfs_containing_value = it->second; - for (uint64_t mtf : mtfs_containing_value) { - GetMtf(mtf).Remove(value); - } - - val_to_mtfs_.erase(value); - } - - // Computes rank of |value| in sequence |mtf|. - // Returns false if |mtf| doesn't have |value|. - bool RankFromValue(uint64_t mtf, const Val& value, uint32_t* rank) { - return GetMtf(mtf).RankFromValue(value, rank); - } - - // Finds |value| with |rank| in sequence |mtf|. - // Returns false if |rank| is out of bounds. - bool ValueFromRank(uint64_t mtf, uint32_t rank, Val* value) { - return GetMtf(mtf).ValueFromRank(rank, value); - } - - // Returns size of |mtf| sequence. - uint32_t GetSize(uint64_t mtf) { return GetMtf(mtf).GetSize(); } - - // Promotes |value| in all sequences which have it. - void Promote(const Val& value) { - const auto it = val_to_mtfs_.find(value); - if (it == val_to_mtfs_.end()) return; - - const auto& mtfs_containing_value = it->second; - for (uint64_t mtf : mtfs_containing_value) { - GetMtf(mtf).Promote(value); - } - } - - // Inserts |value| in sequence |mtf| or promotes if it's already there. - void InsertOrPromote(uint64_t mtf, const Val& value) { - if (!Insert(mtf, value)) { - GetMtf(mtf).Promote(value); - } - } - - // Returns if |mtf| sequence has |value|. - bool HasValue(uint64_t mtf, const Val& value) { - return GetMtf(mtf).HasValue(value); - } - - private: - // Returns actual MoveToFront object corresponding to |handle|. - // As multiple operations are often performed consecutively for the same - // sequence, the last returned value is cached. - MoveToFront& GetMtf(uint64_t handle) { - if (!cached_mtf_ || cached_handle_ != handle) { - cached_handle_ = handle; - cached_mtf_ = &mtfs_[handle]; - } - - return *cached_mtf_; - } - - // Container holding MoveToFront objects. Map key is sequence handle. - std::map> mtfs_; - - // Container mapping value to sequences which contain that value. - std::unordered_map> val_to_mtfs_; - - // Cache for the last accessed sequence. - uint64_t cached_handle_ = 0; - MoveToFront* cached_mtf_ = nullptr; -}; - -template -bool MoveToFront::Insert(const Val& value) { - auto it = value_to_node_.find(value); - if (it != value_to_node_.end() && IsInTree(it->second)) return false; - - const uint32_t old_size = GetSize(); - (void)old_size; - - InsertNode(CreateNode(next_timestamp_++, value)); - - last_accessed_value_ = value; - last_accessed_value_valid_ = true; - - assert(value_to_node_.count(value)); - assert(old_size + 1 == GetSize()); - return true; -} - -template -bool MoveToFront::Remove(const Val& value) { - auto it = value_to_node_.find(value); - if (it == value_to_node_.end()) return false; - - if (!IsInTree(it->second)) return false; - - if (last_accessed_value_ == value) last_accessed_value_valid_ = false; - - const uint32_t orphan = RemoveNode(it->second); - (void)orphan; - // The node of |value| is still alive but it's orphaned now. Can still be - // reused later. - assert(!IsInTree(orphan)); - assert(ValueOf(orphan) == value); - return true; -} - -template -bool MoveToFront::RankFromValue(const Val& value, uint32_t* rank) { - if (last_accessed_value_valid_ && last_accessed_value_ == value) { - *rank = 1; - return true; - } - - const uint32_t old_size = GetSize(); - if (old_size == 1) { - if (ValueOf(root_) == value) { - *rank = 1; - return true; - } else { - return false; - } - } - - const auto it = value_to_node_.find(value); - if (it == value_to_node_.end()) { - return false; - } - - uint32_t target = it->second; - - if (!IsInTree(target)) { - return false; - } - - uint32_t node = target; - *rank = 1 + SizeOf(LeftOf(node)); - while (node) { - if (IsRightChild(node)) *rank += 1 + SizeOf(LeftOf(ParentOf(node))); - node = ParentOf(node); - } - - // Don't update timestamp if the node has rank 1. - if (*rank != 1) { - // Update timestamp and reposition the node. - target = RemoveNode(target); - assert(ValueOf(target) == value); - assert(old_size == GetSize() + 1); - MutableTimestampOf(target) = next_timestamp_++; - InsertNode(target); - assert(old_size == GetSize()); - } - - last_accessed_value_ = value; - last_accessed_value_valid_ = true; - return true; -} - -template -bool MoveToFront::HasValue(const Val& value) const { - const auto it = value_to_node_.find(value); - if (it == value_to_node_.end()) { - return false; - } - - return IsInTree(it->second); -} - -template -bool MoveToFront::Promote(const Val& value) { - if (last_accessed_value_valid_ && last_accessed_value_ == value) { - return true; - } - - const uint32_t old_size = GetSize(); - if (old_size == 1) return ValueOf(root_) == value; - - const auto it = value_to_node_.find(value); - if (it == value_to_node_.end()) { - return false; - } - - uint32_t target = it->second; - - if (!IsInTree(target)) { - return false; - } - - // Update timestamp and reposition the node. - target = RemoveNode(target); - assert(ValueOf(target) == value); - assert(old_size == GetSize() + 1); - MutableTimestampOf(target) = next_timestamp_++; - InsertNode(target); - assert(old_size == GetSize()); - - last_accessed_value_ = value; - last_accessed_value_valid_ = true; - return true; -} - -template -bool MoveToFront::ValueFromRank(uint32_t rank, Val* value) { - if (last_accessed_value_valid_ && rank == 1) { - *value = last_accessed_value_; - return true; - } - - const uint32_t old_size = GetSize(); - if (rank <= 0 || rank > old_size) { - return false; - } - - if (old_size == 1) { - *value = ValueOf(root_); - return true; - } - - const bool update_timestamp = (rank != 1); - - uint32_t node = root_; - while (node) { - const uint32_t left_subtree_num_nodes = SizeOf(LeftOf(node)); - if (rank == left_subtree_num_nodes + 1) { - // This is the node we are looking for. - // Don't update timestamp if the node has rank 1. - if (update_timestamp) { - node = RemoveNode(node); - assert(old_size == GetSize() + 1); - MutableTimestampOf(node) = next_timestamp_++; - InsertNode(node); - assert(old_size == GetSize()); - } - *value = ValueOf(node); - last_accessed_value_ = *value; - last_accessed_value_valid_ = true; - return true; - } - - if (rank < left_subtree_num_nodes + 1) { - // Descend into the left subtree. The rank is still valid. - node = LeftOf(node); - } else { - // Descend into the right subtree. We leave behind the left subtree and - // the current node, adjust the |rank| accordingly. - rank -= left_subtree_num_nodes + 1; - node = RightOf(node); - } - } - - assert(0); - return false; -} - -template -void MoveToFront::InsertNode(uint32_t node) { - assert(!IsInTree(node)); - assert(SizeOf(node) == 1); - assert(HeightOf(node) == 1); - assert(TimestampOf(node)); - - if (!root_) { - root_ = node; - return; - } - - uint32_t iter = root_; - uint32_t parent = 0; - - // Will determine if |node| will become the right or left child after - // insertion (but before balancing). - bool right_child = true; - - // Find the node which will become |node|'s parent after insertion - // (but before balancing). - while (iter) { - parent = iter; - assert(TimestampOf(iter) != TimestampOf(node)); - right_child = TimestampOf(iter) > TimestampOf(node); - iter = right_child ? RightOf(iter) : LeftOf(iter); - } - - assert(parent); - - // Connect node and parent. - MutableParentOf(node) = parent; - if (right_child) - MutableRightOf(parent) = node; - else - MutableLeftOf(parent) = node; - - // Insertion is finished. Start the balancing process. - bool needs_rebalancing = true; - parent = ParentOf(node); - - while (parent) { - UpdateNode(parent); - - if (needs_rebalancing) { - const int parent_balance = BalanceOf(parent); - - if (RightOf(parent) == node) { - // Added node to the right subtree. - if (parent_balance > 1) { - // Parent is right heavy, rotate left. - if (BalanceOf(node) < 0) RotateRight(node); - parent = RotateLeft(parent); - } else if (parent_balance == 0 || parent_balance == -1) { - // Parent is balanced or left heavy, no need to balance further. - needs_rebalancing = false; - } - } else { - // Added node to the left subtree. - if (parent_balance < -1) { - // Parent is left heavy, rotate right. - if (BalanceOf(node) > 0) RotateLeft(node); - parent = RotateRight(parent); - } else if (parent_balance == 0 || parent_balance == 1) { - // Parent is balanced or right heavy, no need to balance further. - needs_rebalancing = false; - } - } - } - - assert(BalanceOf(parent) >= -1 && (BalanceOf(parent) <= 1)); - - node = parent; - parent = ParentOf(parent); - } -} - -template -uint32_t MoveToFront::RemoveNode(uint32_t node) { - if (LeftOf(node) && RightOf(node)) { - // If |node| has two children, then use another node as scapegoat and swap - // their contents. We pick the scapegoat on the side of the tree which has - // more nodes. - const uint32_t scapegoat = SizeOf(LeftOf(node)) >= SizeOf(RightOf(node)) - ? RightestDescendantOf(LeftOf(node)) - : LeftestDescendantOf(RightOf(node)); - assert(scapegoat); - std::swap(MutableValueOf(node), MutableValueOf(scapegoat)); - std::swap(MutableTimestampOf(node), MutableTimestampOf(scapegoat)); - value_to_node_[ValueOf(node)] = node; - value_to_node_[ValueOf(scapegoat)] = scapegoat; - node = scapegoat; - } - - // |node| may have only one child at this point. - assert(!RightOf(node) || !LeftOf(node)); - - uint32_t parent = ParentOf(node); - uint32_t child = RightOf(node) ? RightOf(node) : LeftOf(node); - - // Orphan |node| and reconnect parent and child. - if (child) MutableParentOf(child) = parent; - - if (parent) { - if (LeftOf(parent) == node) - MutableLeftOf(parent) = child; - else - MutableRightOf(parent) = child; - } - - MutableParentOf(node) = 0; - MutableLeftOf(node) = 0; - MutableRightOf(node) = 0; - UpdateNode(node); - const uint32_t orphan = node; - - if (root_ == node) root_ = child; - - // Removal is finished. Start the balancing process. - bool needs_rebalancing = true; - node = child; - - while (parent) { - UpdateNode(parent); - - if (needs_rebalancing) { - const int parent_balance = BalanceOf(parent); - - if (parent_balance == 1 || parent_balance == -1) { - // The height of the subtree was not changed. - needs_rebalancing = false; - } else { - if (RightOf(parent) == node) { - // Removed node from the right subtree. - if (parent_balance < -1) { - // Parent is left heavy, rotate right. - const uint32_t sibling = LeftOf(parent); - if (BalanceOf(sibling) > 0) RotateLeft(sibling); - parent = RotateRight(parent); - } - } else { - // Removed node from the left subtree. - if (parent_balance > 1) { - // Parent is right heavy, rotate left. - const uint32_t sibling = RightOf(parent); - if (BalanceOf(sibling) < 0) RotateRight(sibling); - parent = RotateLeft(parent); - } - } - } - } - - assert(BalanceOf(parent) >= -1 && (BalanceOf(parent) <= 1)); - - node = parent; - parent = ParentOf(parent); - } - - return orphan; -} - -template -uint32_t MoveToFront::RotateLeft(const uint32_t node) { - const uint32_t pivot = RightOf(node); - assert(pivot); - - // LeftOf(pivot) gets attached to node in place of pivot. - MutableRightOf(node) = LeftOf(pivot); - if (RightOf(node)) MutableParentOf(RightOf(node)) = node; - - // Pivot gets attached to ParentOf(node) in place of node. - MutableParentOf(pivot) = ParentOf(node); - if (!ParentOf(node)) - root_ = pivot; - else if (IsLeftChild(node)) - MutableLeftOf(ParentOf(node)) = pivot; - else - MutableRightOf(ParentOf(node)) = pivot; - - // Node is child of pivot. - MutableLeftOf(pivot) = node; - MutableParentOf(node) = pivot; - - // Update both node and pivot. Pivot is the new parent of node, so node should - // be updated first. - UpdateNode(node); - UpdateNode(pivot); - - return pivot; -} - -template -uint32_t MoveToFront::RotateRight(const uint32_t node) { - const uint32_t pivot = LeftOf(node); - assert(pivot); - - // RightOf(pivot) gets attached to node in place of pivot. - MutableLeftOf(node) = RightOf(pivot); - if (LeftOf(node)) MutableParentOf(LeftOf(node)) = node; - - // Pivot gets attached to ParentOf(node) in place of node. - MutableParentOf(pivot) = ParentOf(node); - if (!ParentOf(node)) - root_ = pivot; - else if (IsLeftChild(node)) - MutableLeftOf(ParentOf(node)) = pivot; - else - MutableRightOf(ParentOf(node)) = pivot; - - // Node is child of pivot. - MutableRightOf(pivot) = node; - MutableParentOf(node) = pivot; - - // Update both node and pivot. Pivot is the new parent of node, so node should - // be updated first. - UpdateNode(node); - UpdateNode(pivot); - - return pivot; -} - -template -void MoveToFront::UpdateNode(uint32_t node) { - MutableSizeOf(node) = 1 + SizeOf(LeftOf(node)) + SizeOf(RightOf(node)); - MutableHeightOf(node) = - 1 + std::max(HeightOf(LeftOf(node)), HeightOf(RightOf(node))); -} - -} // namespace utils -} // namespace spvtools - -#endif // LIBSPIRV_UTIL_MOVE_TO_FRONT_H_ diff --git a/third_party/spirv-tools/source/util/parse_number.cpp b/third_party/spirv-tools/source/util/parse_number.cpp old mode 100755 new mode 100644 index e983072fbf..c3351c2365 --- a/third_party/spirv-tools/source/util/parse_number.cpp +++ b/third_party/spirv-tools/source/util/parse_number.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "util/parse_number.h" +#include "source/util/parse_number.h" #include #include @@ -21,7 +21,8 @@ #include #include -#include "util/hex_float.h" +#include "source/util/hex_float.h" +#include "source/util/make_unique.h" namespace spvtools { namespace utils { @@ -34,7 +35,7 @@ class ErrorMsgStream { public: explicit ErrorMsgStream(std::string* error_msg_sink) : error_msg_sink_(error_msg_sink) { - if (error_msg_sink_) stream_.reset(new std::ostringstream()); + if (error_msg_sink_) stream_ = MakeUnique(); } ~ErrorMsgStream() { if (error_msg_sink_ && stream_) *error_msg_sink_ = stream_->str(); diff --git a/third_party/spirv-tools/source/util/parse_number.h b/third_party/spirv-tools/source/util/parse_number.h old mode 100755 new mode 100644 index 84314e38b5..729aac54bf --- a/third_party/spirv-tools/source/util/parse_number.h +++ b/third_party/spirv-tools/source/util/parse_number.h @@ -12,15 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_UTIL_PARSE_NUMBER_H_ -#define LIBSPIRV_UTIL_PARSE_NUMBER_H_ +#ifndef SOURCE_UTIL_PARSE_NUMBER_H_ +#define SOURCE_UTIL_PARSE_NUMBER_H_ #include #include #include +#include "source/util/hex_float.h" #include "spirv-tools/libspirv.h" -#include "util/hex_float.h" namespace spvtools { namespace utils { @@ -249,4 +249,4 @@ EncodeNumberStatus ParseAndEncodeNumber(const char* text, } // namespace utils } // namespace spvtools -#endif // LIBSPIRV_UTIL_PARSE_NUMBER_H_ +#endif // SOURCE_UTIL_PARSE_NUMBER_H_ diff --git a/third_party/spirv-tools/source/util/small_vector.h b/third_party/spirv-tools/source/util/small_vector.h index 7811968750..f2c1147bed 100644 --- a/third_party/spirv-tools/source/util/small_vector.h +++ b/third_party/spirv-tools/source/util/small_vector.h @@ -12,14 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_UTILS_SMALL_VECTOR_H_ -#define LIBSPIRV_UTILS_SMALL_VECTOR_H_ +#ifndef SOURCE_UTIL_SMALL_VECTOR_H_ +#define SOURCE_UTIL_SMALL_VECTOR_H_ #include #include +#include +#include #include -#include "opt/make_unique.h" +#include "source/util/make_unique.h" namespace spvtools { namespace utils { @@ -53,7 +55,7 @@ class SmallVector { SmallVector(const std::vector& vec) : SmallVector() { if (vec.size() > small_size) { - large_data_.reset(new std::vector(vec)); + large_data_ = MakeUnique>(vec); } else { size_ = vec.size(); for (uint32_t i = 0; i < size_; i++) { @@ -64,7 +66,7 @@ class SmallVector { SmallVector(std::vector&& vec) : SmallVector() { if (vec.size() > small_size) { - large_data_.reset(new std::vector(std::move(vec))); + large_data_ = MakeUnique>(std::move(vec)); } else { size_ = vec.size(); for (uint32_t i = 0; i < size_; i++) { @@ -80,7 +82,7 @@ class SmallVector { new (small_data_ + (size_++)) T(std::move(*it)); } } else { - large_data_.reset(new std::vector(std::move(init_list))); + large_data_ = MakeUnique>(std::move(init_list)); } } @@ -98,7 +100,7 @@ class SmallVector { if (large_data_) { *large_data_ = *that.large_data_; } else { - large_data_.reset(new std::vector(*that.large_data_)); + large_data_ = MakeUnique>(*that.large_data_); } } else { large_data_.reset(nullptr); @@ -424,7 +426,7 @@ class SmallVector { // be access through |large_data|. void MoveToLargeData() { assert(!large_data_); - large_data_.reset(new std::vector()); + large_data_ = MakeUnique>(); for (size_t i = 0; i < size_; ++i) { large_data_->emplace_back(std::move(small_data_[i])); } @@ -461,4 +463,4 @@ class SmallVector { } // namespace utils } // namespace spvtools -#endif // LIBSPIRV_UTILS_SMALL_VECTOR_H_ +#endif // SOURCE_UTIL_SMALL_VECTOR_H_ diff --git a/third_party/spirv-tools/source/util/string_utils.cpp b/third_party/spirv-tools/source/util/string_utils.cpp old mode 100755 new mode 100644 index 435bbe178b..29ce2aa4a9 --- a/third_party/spirv-tools/source/util/string_utils.cpp +++ b/third_party/spirv-tools/source/util/string_utils.cpp @@ -16,7 +16,7 @@ #include #include -#include "util/string_utils.h" +#include "source/util/string_utils.h" namespace spvtools { namespace utils { diff --git a/third_party/spirv-tools/source/util/string_utils.h b/third_party/spirv-tools/source/util/string_utils.h old mode 100755 new mode 100644 index b91a2706eb..322c574fb6 --- a/third_party/spirv-tools/source/util/string_utils.h +++ b/third_party/spirv-tools/source/util/string_utils.h @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_UTIL_STRING_UTILS_H_ -#define LIBSPIRV_UTIL_STRING_UTILS_H_ +#ifndef SOURCE_UTIL_STRING_UTILS_H_ +#define SOURCE_UTIL_STRING_UTILS_H_ #include #include -#include "util/string_utils.h" +#include "source/util/string_utils.h" namespace spvtools { namespace utils { @@ -40,4 +40,4 @@ std::string CardinalToOrdinal(size_t cardinal); } // namespace utils } // namespace spvtools -#endif // LIBSPIRV_UTIL_STRING_UTILS_H_ +#endif // SOURCE_UTIL_STRING_UTILS_H_ diff --git a/third_party/spirv-tools/source/util/timer.cpp b/third_party/spirv-tools/source/util/timer.cpp old mode 100755 new mode 100644 index a90e41a255..c8b8d5b61f --- a/third_party/spirv-tools/source/util/timer.cpp +++ b/third_party/spirv-tools/source/util/timer.cpp @@ -14,7 +14,7 @@ #if defined(SPIRV_TIMER_ENABLED) -#include "util/timer.h" +#include "source/util/timer.h" #include #include diff --git a/third_party/spirv-tools/source/util/timer.h b/third_party/spirv-tools/source/util/timer.h old mode 100755 new mode 100644 index 29ee53f2bc..fc4b747b98 --- a/third_party/spirv-tools/source/util/timer.h +++ b/third_party/spirv-tools/source/util/timer.h @@ -14,8 +14,8 @@ // Contains utils for getting resource utilization -#ifndef LIBSPIRV_UTIL_TIMER_H_ -#define LIBSPIRV_UTIL_TIMER_H_ +#ifndef SOURCE_UTIL_TIMER_H_ +#define SOURCE_UTIL_TIMER_H_ #if defined(SPIRV_TIMER_ENABLED) @@ -389,4 +389,4 @@ class CumulativeTimer : public Timer { #endif // defined(SPIRV_TIMER_ENABLED) -#endif // LIBSPIRV_UTIL_TIMER_H_ +#endif // SOURCE_UTIL_TIMER_H_ diff --git a/third_party/spirv-tools/source/val/basic_block.cpp b/third_party/spirv-tools/source/val/basic_block.cpp old mode 100755 new mode 100644 index ce1a3b5139..a53103c8a6 --- a/third_party/spirv-tools/source/val/basic_block.cpp +++ b/third_party/spirv-tools/source/val/basic_block.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "val/basic_block.h" +#include "source/val/basic_block.h" #include #include diff --git a/third_party/spirv-tools/source/val/basic_block.h b/third_party/spirv-tools/source/val/basic_block.h old mode 100755 new mode 100644 index 8c7312f3b4..efbd243b67 --- a/third_party/spirv-tools/source/val/basic_block.h +++ b/third_party/spirv-tools/source/val/basic_block.h @@ -12,18 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_VAL_BASICBLOCK_H_ -#define LIBSPIRV_VAL_BASICBLOCK_H_ - -#include "latest_version_spirv_header.h" +#ifndef SOURCE_VAL_BASIC_BLOCK_H_ +#define SOURCE_VAL_BASIC_BLOCK_H_ #include - #include #include #include #include +#include "source/latest_version_spirv_header.h" + namespace spvtools { namespace val { @@ -245,4 +244,4 @@ bool operator!=(const BasicBlock::DominatorIterator& lhs, } // namespace val } // namespace spvtools -#endif /// LIBSPIRV_VAL_BASICBLOCK_H_ +#endif // SOURCE_VAL_BASIC_BLOCK_H_ diff --git a/third_party/spirv-tools/source/val/construct.cpp b/third_party/spirv-tools/source/val/construct.cpp old mode 100755 new mode 100644 index 6a70ab258a..c11a065b7f --- a/third_party/spirv-tools/source/val/construct.cpp +++ b/third_party/spirv-tools/source/val/construct.cpp @@ -12,13 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "val/construct.h" -#include "val/function.h" +#include "source/val/construct.h" #include #include #include +#include "source/val/function.h" + namespace spvtools { namespace val { diff --git a/third_party/spirv-tools/source/val/construct.h b/third_party/spirv-tools/source/val/construct.h old mode 100755 new mode 100644 index 0de63f6539..c7e7a780d6 --- a/third_party/spirv-tools/source/val/construct.h +++ b/third_party/spirv-tools/source/val/construct.h @@ -12,15 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_VAL_CONSTRUCT_H_ -#define LIBSPIRV_VAL_CONSTRUCT_H_ - -#include "val/basic_block.h" +#ifndef SOURCE_VAL_CONSTRUCT_H_ +#define SOURCE_VAL_CONSTRUCT_H_ #include #include #include +#include "source/val/basic_block.h" + namespace spvtools { namespace val { @@ -148,4 +148,4 @@ class Construct { } // namespace val } // namespace spvtools -#endif /// LIBSPIRV_VAL_CONSTRUCT_H_ +#endif // SOURCE_VAL_CONSTRUCT_H_ diff --git a/third_party/spirv-tools/source/val/decoration.h b/third_party/spirv-tools/source/val/decoration.h old mode 100755 new mode 100644 index 1c5a57acd2..ed3320f87a --- a/third_party/spirv-tools/source/val/decoration.h +++ b/third_party/spirv-tools/source/val/decoration.h @@ -12,14 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_VAL_DECORATION_H_ -#define LIBSPIRV_VAL_DECORATION_H_ +#ifndef SOURCE_VAL_DECORATION_H_ +#define SOURCE_VAL_DECORATION_H_ #include #include #include -#include "latest_version_spirv_header.h" +#include "source/latest_version_spirv_header.h" namespace spvtools { namespace val { @@ -86,4 +86,4 @@ class Decoration { } // namespace val } // namespace spvtools -#endif /// LIBSPIRV_VAL_DECORATION_H_ +#endif // SOURCE_VAL_DECORATION_H_ diff --git a/third_party/spirv-tools/source/val/function.cpp b/third_party/spirv-tools/source/val/function.cpp old mode 100755 new mode 100644 index d1599b716c..f638fb5b4e --- a/third_party/spirv-tools/source/val/function.cpp +++ b/third_party/spirv-tools/source/val/function.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "val/function.h" +#include "source/val/function.h" #include @@ -22,10 +22,10 @@ #include #include -#include "cfa.h" -#include "val/basic_block.h" -#include "val/construct.h" -#include "validate.h" +#include "source/cfa.h" +#include "source/val/basic_block.h" +#include "source/val/construct.h" +#include "source/val/validate.h" namespace spvtools { namespace val { diff --git a/third_party/spirv-tools/source/val/function.h b/third_party/spirv-tools/source/val/function.h old mode 100755 new mode 100644 index 61f9888d45..a052bbda0b --- a/third_party/spirv-tools/source/val/function.h +++ b/third_party/spirv-tools/source/val/function.h @@ -12,21 +12,23 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_VAL_FUNCTION_H_ -#define LIBSPIRV_VAL_FUNCTION_H_ +#ifndef SOURCE_VAL_FUNCTION_H_ +#define SOURCE_VAL_FUNCTION_H_ #include #include #include #include +#include #include #include +#include #include -#include "latest_version_spirv_header.h" +#include "source/latest_version_spirv_header.h" +#include "source/val/basic_block.h" +#include "source/val/construct.h" #include "spirv-tools/libspirv.h" -#include "val/basic_block.h" -#include "val/construct.h" namespace spvtools { namespace val { @@ -355,4 +357,4 @@ class Function { } // namespace val } // namespace spvtools -#endif /// LIBSPIRV_VAL_FUNCTION_H_ +#endif // SOURCE_VAL_FUNCTION_H_ diff --git a/third_party/spirv-tools/source/val/instruction.cpp b/third_party/spirv-tools/source/val/instruction.cpp old mode 100755 new mode 100644 index 7284eb6dda..b9155898ac --- a/third_party/spirv-tools/source/val/instruction.cpp +++ b/third_party/spirv-tools/source/val/instruction.cpp @@ -12,41 +12,34 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "val/instruction.h" +#include "source/val/instruction.h" #include namespace spvtools { namespace val { -#define OPERATOR(OP) \ - bool operator OP(const Instruction& lhs, const Instruction& rhs) { \ - return lhs.id() OP rhs.id(); \ - } \ - bool operator OP(const Instruction& lhs, uint32_t rhs) { \ - return lhs.id() OP rhs; \ - } - -OPERATOR(<) -OPERATOR(==) -#undef OPERATOR - -Instruction::Instruction(const spv_parsed_instruction_t* inst, - Function* defining_function, - BasicBlock* defining_block) +Instruction::Instruction(const spv_parsed_instruction_t* inst) : words_(inst->words, inst->words + inst->num_words), operands_(inst->operands, inst->operands + inst->num_operands), inst_({words_.data(), inst->num_words, inst->opcode, inst->ext_inst_type, inst->type_id, inst->result_id, operands_.data(), - inst->num_operands}), - line_num_(0), - function_(defining_function), - block_(defining_block), - uses_() {} + inst->num_operands}) {} void Instruction::RegisterUse(const Instruction* inst, uint32_t index) { uses_.push_back(std::make_pair(inst, index)); } +bool operator<(const Instruction& lhs, const Instruction& rhs) { + return lhs.id() < rhs.id(); +} +bool operator<(const Instruction& lhs, uint32_t rhs) { return lhs.id() < rhs; } +bool operator==(const Instruction& lhs, const Instruction& rhs) { + return lhs.id() == rhs.id(); +} +bool operator==(const Instruction& lhs, uint32_t rhs) { + return lhs.id() == rhs; +} + } // namespace val } // namespace spvtools diff --git a/third_party/spirv-tools/source/val/instruction.h b/third_party/spirv-tools/source/val/instruction.h old mode 100755 new mode 100644 index db3a8abcc2..1fa855fca9 --- a/third_party/spirv-tools/source/val/instruction.h +++ b/third_party/spirv-tools/source/val/instruction.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_VAL_INSTRUCTION_H_ -#define LIBSPIRV_VAL_INSTRUCTION_H_ +#ifndef SOURCE_VAL_INSTRUCTION_H_ +#define SOURCE_VAL_INSTRUCTION_H_ #include #include @@ -21,8 +21,8 @@ #include #include +#include "source/table.h" #include "spirv-tools/libspirv.h" -#include "table.h" namespace spvtools { namespace val { @@ -34,9 +34,7 @@ class Function; /// instruction's result id class Instruction { public: - explicit Instruction(const spv_parsed_instruction_t* inst, - Function* defining_function = nullptr, - BasicBlock* defining_block = nullptr); + explicit Instruction(const spv_parsed_instruction_t* inst); /// Registers the use of the Instruction in instruction \p inst at \p index void RegisterUse(const Instruction* inst, uint32_t index); @@ -48,10 +46,12 @@ class Instruction { /// Returns the Function where the instruction was defined. nullptr if it was /// defined outside of a Function const Function* function() const { return function_; } + void set_function(Function* func) { function_ = func; } /// Returns the BasicBlock where the instruction was defined. nullptr if it /// was defined outside of a BasicBlock const BasicBlock* block() const { return block_; } + void set_block(BasicBlock* b) { block_ = b; } /// Returns a vector of pairs of all references to this instruction's result /// id. The first element is the instruction in which this result id was @@ -101,13 +101,13 @@ class Instruction { const std::vector words_; const std::vector operands_; spv_parsed_instruction_t inst_; - size_t line_num_; + size_t line_num_ = 0; /// The function in which this instruction was declared - Function* function_; + Function* function_ = nullptr; /// The basic block in which this instruction was declared - BasicBlock* block_; + BasicBlock* block_ = nullptr; /// This is a vector of pairs of all references to this instruction's result /// id. The first element is the instruction in which this result id was @@ -116,13 +116,10 @@ class Instruction { std::vector> uses_; }; -#define OPERATOR(OP) \ - bool operator OP(const Instruction& lhs, const Instruction& rhs); \ - bool operator OP(const Instruction& lhs, uint32_t rhs) - -OPERATOR(<); -OPERATOR(==); -#undef OPERATOR +bool operator<(const Instruction& lhs, const Instruction& rhs); +bool operator<(const Instruction& lhs, uint32_t rhs); +bool operator==(const Instruction& lhs, const Instruction& rhs); +bool operator==(const Instruction& lhs, uint32_t rhs); } // namespace val } // namespace spvtools @@ -140,4 +137,4 @@ struct hash { } // namespace std -#endif // LIBSPIRV_VAL_INSTRUCTION_H_ +#endif // SOURCE_VAL_INSTRUCTION_H_ diff --git a/third_party/spirv-tools/source/val/validate.cpp b/third_party/spirv-tools/source/val/validate.cpp index b1587c2b63..2260686ef4 100644 --- a/third_party/spirv-tools/source/val/validate.cpp +++ b/third_party/spirv-tools/source/val/validate.cpp @@ -107,47 +107,10 @@ spv_result_t ProcessExtensions(void* user_data, spv_result_t ProcessInstruction(void* user_data, const spv_parsed_instruction_t* inst) { ValidationState_t& _ = *(reinterpret_cast(user_data)); - if (static_cast(inst->opcode) == SpvOpEntryPoint) { - const auto entry_point = inst->words[2]; - const SpvExecutionModel execution_model = SpvExecutionModel(inst->words[1]); - const char* str = - reinterpret_cast(inst->words + inst->operands[2].offset); - ValidationState_t::EntryPointDescription desc; - desc.name = str; - std::vector interfaces; - for (int i = 3; i < inst->num_operands; ++i) { - desc.interfaces.push_back(inst->words[inst->operands[i].offset]); - } - _.RegisterEntryPoint(entry_point, execution_model, std::move(desc)); - } - if (static_cast(inst->opcode) == SpvOpFunctionCall) { - _.AddFunctionCallTarget(inst->words[3]); - } auto* instruction = _.AddOrderedInstruction(inst); _.RegisterDebugInstruction(instruction); - if (auto error = CapabilityPass(_, instruction)) return error; - if (auto error = IdPass(_, instruction)) return error; - if (auto error = DataRulesPass(_, instruction)) return error; - if (auto error = ModuleLayoutPass(_, instruction)) return error; - if (auto error = CfgPass(_, instruction)) return error; - if (auto error = InstructionPass(_, instruction)) return error; - if (auto error = TypeUniquePass(_, instruction)) return error; - if (auto error = ArithmeticsPass(_, instruction)) return error; - if (auto error = CompositesPass(_, instruction)) return error; - if (auto error = ConversionPass(_, instruction)) return error; - if (auto error = DerivativesPass(_, instruction)) return error; - if (auto error = LogicalsPass(_, instruction)) return error; - if (auto error = BitwisePass(_, instruction)) return error; - if (auto error = ExtInstPass(_, instruction)) return error; - if (auto error = ImagePass(_, instruction)) return error; - if (auto error = AtomicsPass(_, instruction)) return error; - if (auto error = BarriersPass(_, instruction)) return error; - if (auto error = PrimitivesPass(_, instruction)) return error; - if (auto error = LiteralsPass(_, instruction)) return error; - if (auto error = NonUniformPass(_, instruction)) return error; - return SPV_SUCCESS; } @@ -193,6 +156,49 @@ UNUSED(void PrintDotGraph(ValidationState_t& _, Function func)) { } } +spv_result_t ValidateForwardDecls(ValidationState_t& _) { + if (_.unresolved_forward_id_count() == 0) return SPV_SUCCESS; + + std::stringstream ss; + std::vector ids = _.UnresolvedForwardIds(); + + std::transform( + std::begin(ids), std::end(ids), + std::ostream_iterator(ss, " "), + bind(&ValidationState_t::getIdName, std::ref(_), std::placeholders::_1)); + + auto id_str = ss.str(); + return _.diag(SPV_ERROR_INVALID_ID, nullptr) + << "The following forward referenced IDs have not been defined:\n" + << id_str.substr(0, id_str.size() - 1); +} + +// Entry point validation. Based on 2.16.1 (Universal Validation Rules) of the +// SPIRV spec: +// * There is at least one OpEntryPoint instruction, unless the Linkage +// capability is being used. +// * No function can be targeted by both an OpEntryPoint instruction and an +// OpFunctionCall instruction. +spv_result_t ValidateEntryPoints(ValidationState_t& _) { + _.ComputeFunctionToEntryPointMapping(); + + if (_.entry_points().empty() && !_.HasCapability(SpvCapabilityLinkage)) { + return _.diag(SPV_ERROR_INVALID_BINARY, nullptr) + << "No OpEntryPoint instruction was found. This is only allowed if " + "the Linkage capability is being used."; + } + for (const auto& entry_point : _.entry_points()) { + if (_.IsFunctionCallTarget(entry_point)) { + return _.diag(SPV_ERROR_INVALID_BINARY, _.FindDef(entry_point)) + << "A function (" << entry_point + << ") may not be targeted by both an OpEntryPoint instruction and " + "an OpFunctionCall instruction."; + } + } + + return SPV_SUCCESS; +} + spv_result_t ValidateBinaryUsingContextAndValidationState( const spv_context_t& context, const uint32_t* words, const size_t num_words, spv_diagnostic* pDiagnostic, ValidationState_t* vstate) { @@ -236,16 +242,61 @@ spv_result_t ValidateBinaryUsingContextAndValidationState( return error; } - for (size_t i = 0; i < vstate->ordered_instructions().size(); ++i) { - const auto& instruction = vstate->ordered_instructions()[i]; + for (auto& instruction : vstate->ordered_instructions()) { + { + // In order to do this work outside of Process Instruction we need to be + // able to, briefly, de-const the instruction. + Instruction* inst = const_cast(&instruction); + if (inst->opcode() == SpvOpEntryPoint) { + const auto entry_point = inst->GetOperandAs(1); + const auto execution_model = inst->GetOperandAs(0); + const char* str = reinterpret_cast( + inst->words().data() + inst->operand(2).offset); + + ValidationState_t::EntryPointDescription desc; + desc.name = str; + + std::vector interfaces; + for (size_t j = 3; j < inst->operands().size(); ++j) + desc.interfaces.push_back(inst->word(inst->operand(j).offset)); + + vstate->RegisterEntryPoint(entry_point, execution_model, + std::move(desc)); + } + if (inst->opcode() == SpvOpFunctionCall) { + if (!vstate->in_function_body()) { + return vstate->diag(SPV_ERROR_INVALID_LAYOUT, &instruction) + << "A FunctionCall must happen within a function body."; + } + + vstate->AddFunctionCallTarget(inst->GetOperandAs(2)); + } + + if (vstate->in_function_body()) { + inst->set_function(&(vstate->current_function())); + inst->set_block(vstate->current_function().current_block()); + + if (vstate->in_block() && spvOpcodeIsBlockTerminator(inst->opcode())) { + vstate->current_function().current_block()->set_terminator(inst); + } + } + + if (auto error = IdPass(*vstate, inst)) return error; + } + + if (auto error = CapabilityPass(*vstate, &instruction)) return error; + if (auto error = DataRulesPass(*vstate, &instruction)) return error; + if (auto error = ModuleLayoutPass(*vstate, &instruction)) return error; + if (auto error = CfgPass(*vstate, &instruction)) return error; + if (auto error = InstructionPass(*vstate, &instruction)) return error; + + // Now that all of the checks are done, update the state. + { + Instruction* inst = const_cast(&instruction); + vstate->RegisterInstruction(inst); + } if (auto error = UpdateIdUse(*vstate, &instruction)) return error; - if (auto error = ValidateMemoryInstructions(*vstate, &instruction)) - return error; - - // Validate the preconditions involving adjacent instructions. e.g. SpvOpPhi - // must only be preceeded by SpvOpLabel, SpvOpPhi, or SpvOpLine. - if (auto error = ValidateAdjacency(*vstate, i)) return error; } if (!vstate->has_memory_model_specified()) @@ -256,54 +307,61 @@ spv_result_t ValidateBinaryUsingContextAndValidationState( return vstate->diag(SPV_ERROR_INVALID_LAYOUT, nullptr) << "Missing OpFunctionEnd at end of module."; - // TODO(umar): Add validation checks which require the parsing of the entire - // module. Use the information from the ProcessInstruction pass to make the - // checks. - if (vstate->unresolved_forward_id_count() > 0) { - std::stringstream ss; - std::vector ids = vstate->UnresolvedForwardIds(); + // Catch undefined forward references before performing further checks. + if (auto error = ValidateForwardDecls(*vstate)) return error; - transform(std::begin(ids), std::end(ids), - std::ostream_iterator(ss, " "), - bind(&ValidationState_t::getIdName, std::ref(*vstate), - std::placeholders::_1)); + // Validate individual opcodes. + for (size_t i = 0; i < vstate->ordered_instructions().size(); ++i) { + auto& instruction = vstate->ordered_instructions()[i]; - auto id_str = ss.str(); - return vstate->diag(SPV_ERROR_INVALID_ID, nullptr) - << "The following forward referenced IDs have not been defined:\n" - << id_str.substr(0, id_str.size() - 1); + // Keep these passes in the order they appear in the SPIR-V specification + // sections to maintain test consistency. + // Miscellaneous + if (auto error = DebugPass(*vstate, &instruction)) return error; + if (auto error = AnnotationPass(*vstate, &instruction)) return error; + if (auto error = ExtInstPass(*vstate, &instruction)) return error; + if (auto error = ModeSettingPass(*vstate, &instruction)) return error; + if (auto error = TypePass(*vstate, &instruction)) return error; + // Constants + if (auto error = ValidateMemoryInstructions(*vstate, &instruction)) + return error; + if (auto error = FunctionPass(*vstate, &instruction)) return error; + if (auto error = ImagePass(*vstate, &instruction)) return error; + if (auto error = ConversionPass(*vstate, &instruction)) return error; + if (auto error = CompositesPass(*vstate, &instruction)) return error; + if (auto error = ArithmeticsPass(*vstate, &instruction)) return error; + if (auto error = BitwisePass(*vstate, &instruction)) return error; + if (auto error = LogicalsPass(*vstate, &instruction)) return error; + if (auto error = ControlFlowPass(*vstate, &instruction)) return error; + if (auto error = DerivativesPass(*vstate, &instruction)) return error; + if (auto error = AtomicsPass(*vstate, &instruction)) return error; + if (auto error = PrimitivesPass(*vstate, &instruction)) return error; + if (auto error = BarriersPass(*vstate, &instruction)) return error; + // Group + // Device-Side Enqueue + // Pipe + if (auto error = NonUniformPass(*vstate, &instruction)) return error; + + if (auto error = LiteralsPass(*vstate, &instruction)) return error; + // Validate the preconditions involving adjacent instructions. e.g. SpvOpPhi + // must only be preceeded by SpvOpLabel, SpvOpPhi, or SpvOpLine. + if (auto error = ValidateAdjacency(*vstate, i)) return error; } - vstate->ComputeFunctionToEntryPointMapping(); - + if (auto error = ValidateEntryPoints(*vstate)) return error; // CFG checks are performed after the binary has been parsed // and the CFGPass has collected information about the control flow if (auto error = PerformCfgChecks(*vstate)) return error; if (auto error = CheckIdDefinitionDominateUse(*vstate)) return error; if (auto error = ValidateDecorations(*vstate)) return error; if (auto error = ValidateInterfaces(*vstate)) return error; + // TODO(dsinclair): Restructure ValidateBuiltins so we can move into the + // for() above as it loops over all ordered_instructions internally. if (auto error = ValidateBuiltIns(*vstate)) return error; - - // Entry point validation. Based on 2.16.1 (Universal Validation Rules) of the - // SPIRV spec: - // * There is at least one OpEntryPoint instruction, unless the Linkage - // capability is being used. - // * No function can be targeted by both an OpEntryPoint instruction and an - // OpFunctionCall instruction. - if (vstate->entry_points().empty() && - !vstate->HasCapability(SpvCapabilityLinkage)) { - return vstate->diag(SPV_ERROR_INVALID_BINARY, nullptr) - << "No OpEntryPoint instruction was found. This is only allowed if " - "the Linkage capability is being used."; - } - for (const auto& entry_point : vstate->entry_points()) { - if (vstate->IsFunctionCallTarget(entry_point)) { - return vstate->diag(SPV_ERROR_INVALID_BINARY, - vstate->FindDef(entry_point)) - << "A function (" << entry_point - << ") may not be targeted by both an OpEntryPoint instruction and " - "an OpFunctionCall instruction."; - } + // These checks must be performed after individual opcode checks because + // those checks register the limitation checked here. + for (const auto inst : vstate->ordered_instructions()) { + if (auto error = ValidateExecutionLimitations(*vstate, &inst)) return error; } // NOTE: Copy each instruction for easier processing diff --git a/third_party/spirv-tools/source/val/validate.h b/third_party/spirv-tools/source/val/validate.h index 45709c9c7b..fd8bcd3522 100644 --- a/third_party/spirv-tools/source/val/validate.h +++ b/third_party/spirv-tools/source/val/validate.h @@ -16,11 +16,11 @@ #define SOURCE_VAL_VALIDATE_H_ #include +#include #include #include #include "source/instruction.h" -#include "source/message.h" #include "source/table.h" #include "spirv-tools/libspirv.h" @@ -115,9 +115,12 @@ void printDominatorList(BasicBlock& block); /// spec. spv_result_t ModuleLayoutPass(ValidationState_t& _, const Instruction* inst); -/// Performs Control Flow Graph validation of a module +/// Performs Control Flow Graph validation and construction. spv_result_t CfgPass(ValidationState_t& _, const Instruction* inst); +/// Validates Control Flow Graph instructions. +spv_result_t ControlFlowPass(ValidationState_t& _, const Instruction* inst); + /// Performs Id and SSA validation of a module spv_result_t IdPass(ValidationState_t& _, Instruction* inst); @@ -135,10 +138,8 @@ spv_result_t ValidateDecorations(ValidationState_t& _); /// Performs validation of built-in variables. spv_result_t ValidateBuiltIns(const ValidationState_t& _); -/// Validates that type declarations are unique, unless multiple declarations -/// of the same data type are allowed by the specification. -/// (see section 2.8 Types and Variables) -spv_result_t TypeUniquePass(ValidationState_t& _, const Instruction* inst); +/// Validates type instructions. +spv_result_t TypePass(ValidationState_t& _, const Instruction* inst); /// Validates correctness of arithmetic instructions. spv_result_t ArithmeticsPass(ValidationState_t& _, const Instruction* inst); @@ -173,9 +174,15 @@ spv_result_t LiteralsPass(ValidationState_t& _, const Instruction* inst); /// Validates correctness of ExtInst instructions. spv_result_t ExtInstPass(ValidationState_t& _, const Instruction* inst); +/// Validates correctness of annotation instructions. +spv_result_t AnnotationPass(ValidationState_t& _, const Instruction* inst); + /// Validates correctness of non-uniform group instructions. spv_result_t NonUniformPass(ValidationState_t& _, const Instruction* inst); +/// Validates correctness of debug instructions. +spv_result_t DebugPass(ValidationState_t& _, const Instruction* inst); + // Validates that capability declarations use operands allowed in the current // context. spv_result_t CapabilityPass(ValidationState_t& _, const Instruction* inst); @@ -183,6 +190,18 @@ spv_result_t CapabilityPass(ValidationState_t& _, const Instruction* inst); /// Validates correctness of primitive instructions. spv_result_t PrimitivesPass(ValidationState_t& _, const Instruction* inst); +/// Validates correctness of mode setting instructions. +spv_result_t ModeSettingPass(ValidationState_t& _, const Instruction* inst); + +/// Validates correctness of function instructions. +spv_result_t FunctionPass(ValidationState_t& _, const Instruction* inst); + +/// Validates execution limitations. +/// +/// Verifies execution models are allowed for all functionality they contain. +spv_result_t ValidateExecutionLimitations(ValidationState_t& _, + const Instruction* inst); + /// @brief Validate the ID usage of the instruction stream /// /// @param[in] pInsts stream of instructions diff --git a/third_party/spirv-tools/source/val/validate_annotation.cpp b/third_party/spirv-tools/source/val/validate_annotation.cpp new file mode 100644 index 0000000000..f1758391d8 --- /dev/null +++ b/third_party/spirv-tools/source/val/validate_annotation.cpp @@ -0,0 +1,158 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "source/val/validate.h" + +#include "source/opcode.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { +namespace { + +spv_result_t ValidateDecorate(ValidationState_t& _, const Instruction* inst) { + const auto decoration = inst->GetOperandAs(1); + if (decoration == SpvDecorationSpecId) { + const auto target_id = inst->GetOperandAs(0); + const auto target = _.FindDef(target_id); + if (!target || !spvOpcodeIsScalarSpecConstant(target->opcode())) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpDecorate SpecId decoration target '" + << _.getIdName(decoration) + << "' is not a scalar specialization constant."; + } + } + // TODO: Add validations for all decorations. + return SPV_SUCCESS; +} + +spv_result_t ValidateMemberDecorate(ValidationState_t& _, + const Instruction* inst) { + const auto struct_type_id = inst->GetOperandAs(0); + const auto struct_type = _.FindDef(struct_type_id); + if (!struct_type || SpvOpTypeStruct != struct_type->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpMemberDecorate Structure type '" + << _.getIdName(struct_type_id) << "' is not a struct type."; + } + const auto member = inst->GetOperandAs(1); + const auto member_count = + static_cast(struct_type->words().size() - 2); + if (member_count < member) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Index " << member + << " provided in OpMemberDecorate for struct " + << _.getIdName(struct_type_id) + << " is out of bounds. The structure has " << member_count + << " members. Largest valid index is " << member_count - 1 << "."; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateDecorationGroup(ValidationState_t& _, + const Instruction* inst) { + const auto decoration_group_id = inst->GetOperandAs(0); + const auto decoration_group = _.FindDef(decoration_group_id); + for (auto pair : decoration_group->uses()) { + auto use = pair.first; + if (use->opcode() != SpvOpDecorate && use->opcode() != SpvOpGroupDecorate && + use->opcode() != SpvOpGroupMemberDecorate && + use->opcode() != SpvOpName) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Result id of OpDecorationGroup can only " + << "be targeted by OpName, OpGroupDecorate, " + << "OpDecorate, and OpGroupMemberDecorate"; + } + } + return SPV_SUCCESS; +} + +spv_result_t ValidateGroupDecorate(ValidationState_t& _, + const Instruction* inst) { + const auto decoration_group_id = inst->GetOperandAs(0); + auto decoration_group = _.FindDef(decoration_group_id); + if (!decoration_group || SpvOpDecorationGroup != decoration_group->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpGroupDecorate Decoration group '" + << _.getIdName(decoration_group_id) + << "' is not a decoration group."; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateGroupMemberDecorate(ValidationState_t& _, + const Instruction* inst) { + const auto decoration_group_id = inst->GetOperandAs(0); + const auto decoration_group = _.FindDef(decoration_group_id); + if (!decoration_group || SpvOpDecorationGroup != decoration_group->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpGroupMemberDecorate Decoration group '" + << _.getIdName(decoration_group_id) + << "' is not a decoration group."; + } + // Grammar checks ensures that the number of arguments to this instruction + // is an odd number: 1 decoration group + (id,literal) pairs. + for (size_t i = 1; i + 1 < inst->operands().size(); i += 2) { + const uint32_t struct_id = inst->GetOperandAs(i); + const uint32_t index = inst->GetOperandAs(i + 1); + auto struct_instr = _.FindDef(struct_id); + if (!struct_instr || SpvOpTypeStruct != struct_instr->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpGroupMemberDecorate Structure type '" + << _.getIdName(struct_id) << "' is not a struct type."; + } + const uint32_t num_struct_members = + static_cast(struct_instr->words().size() - 2); + if (index >= num_struct_members) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Index " << index + << " provided in OpGroupMemberDecorate for struct " + << _.getIdName(struct_id) + << " is out of bounds. The structure has " << num_struct_members + << " members. Largest valid index is " << num_struct_members - 1 + << "."; + } + } + return SPV_SUCCESS; +} + +} // namespace + +spv_result_t AnnotationPass(ValidationState_t& _, const Instruction* inst) { + switch (inst->opcode()) { + case SpvOpDecorate: + if (auto error = ValidateDecorate(_, inst)) return error; + break; + case SpvOpMemberDecorate: + if (auto error = ValidateMemberDecorate(_, inst)) return error; + break; + case SpvOpDecorationGroup: + if (auto error = ValidateDecorationGroup(_, inst)) return error; + break; + case SpvOpGroupDecorate: + if (auto error = ValidateGroupDecorate(_, inst)) return error; + break; + case SpvOpGroupMemberDecorate: + if (auto error = ValidateGroupMemberDecorate(_, inst)) return error; + break; + default: + break; + } + + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/third_party/spirv-tools/source/val/validate_arithmetics.cpp b/third_party/spirv-tools/source/val/validate_arithmetics.cpp index df85276d83..2314e7dfcb 100644 --- a/third_party/spirv-tools/source/val/validate_arithmetics.cpp +++ b/third_party/spirv-tools/source/val/validate_arithmetics.cpp @@ -16,6 +16,8 @@ #include "source/val/validate.h" +#include + #include "source/diagnostic.h" #include "source/opcode.h" #include "source/val/instruction.h" diff --git a/third_party/spirv-tools/source/val/validate_barriers.cpp b/third_party/spirv-tools/source/val/validate_barriers.cpp index dfeb9937cf..0771f2d28a 100644 --- a/third_party/spirv-tools/source/val/validate_barriers.cpp +++ b/third_party/spirv-tools/source/val/validate_barriers.cpp @@ -16,6 +16,8 @@ #include "source/val/validate.h" +#include + #include "source/diagnostic.h" #include "source/opcode.h" #include "source/spirv_constant.h" @@ -56,8 +58,9 @@ spv_result_t ValidateExecutionScope(ValidationState_t& _, if (_.context()->target_env != SPV_ENV_VULKAN_1_0 && value != SpvScopeSubgroup) { - _.current_function().RegisterExecutionModelLimitation( - [](SpvExecutionModel model, std::string* message) { + _.function(inst->function()->id()) + ->RegisterExecutionModelLimitation([](SpvExecutionModel model, + std::string* message) { if (model == SpvExecutionModelFragment || model == SpvExecutionModelVertex || model == SpvExecutionModelGeometry || @@ -198,21 +201,22 @@ spv_result_t BarriersPass(ValidationState_t& _, const Instruction* inst) { case SpvOpControlBarrier: { if (spvVersionForTargetEnv(_.context()->target_env) < SPV_SPIRV_VERSION_WORD(1, 3)) { - _.current_function().RegisterExecutionModelLimitation( - [](SpvExecutionModel model, std::string* message) { - if (model != SpvExecutionModelTessellationControl && - model != SpvExecutionModelGLCompute && - model != SpvExecutionModelKernel) { - if (message) { - *message = - "OpControlBarrier requires one of the following " - "Execution " - "Models: TessellationControl, GLCompute or Kernel"; - } - return false; - } - return true; - }); + _.function(inst->function()->id()) + ->RegisterExecutionModelLimitation( + [](SpvExecutionModel model, std::string* message) { + if (model != SpvExecutionModelTessellationControl && + model != SpvExecutionModelGLCompute && + model != SpvExecutionModelKernel) { + if (message) { + *message = + "OpControlBarrier requires one of the following " + "Execution " + "Models: TessellationControl, GLCompute or Kernel"; + } + return false; + } + return true; + }); } const uint32_t execution_scope = inst->word(1); diff --git a/third_party/spirv-tools/source/val/validate_builtins.cpp b/third_party/spirv-tools/source/val/validate_builtins.cpp index 6c885021b3..c791e428fb 100644 --- a/third_party/spirv-tools/source/val/validate_builtins.cpp +++ b/third_party/spirv-tools/source/val/validate_builtins.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include diff --git a/third_party/spirv-tools/source/val/validate_capability.cpp b/third_party/spirv-tools/source/val/validate_capability.cpp index bb97ded2cc..4724b9f79d 100644 --- a/third_party/spirv-tools/source/val/validate_capability.cpp +++ b/third_party/spirv-tools/source/val/validate_capability.cpp @@ -17,6 +17,7 @@ #include "source/val/validate.h" #include +#include #include #include "source/diagnostic.h" diff --git a/third_party/spirv-tools/source/val/validate_cfg.cpp b/third_party/spirv-tools/source/val/validate_cfg.cpp index e369d06eb9..167f227358 100644 --- a/third_party/spirv-tools/source/val/validate_cfg.cpp +++ b/third_party/spirv-tools/source/val/validate_cfg.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -27,6 +28,7 @@ #include #include "source/cfa.h" +#include "source/opcode.h" #include "source/spirv_validator_options.h" #include "source/val/basic_block.h" #include "source/val/construct.h" @@ -35,6 +37,158 @@ namespace spvtools { namespace val { +namespace { + +spv_result_t ValidatePhi(ValidationState_t& _, const Instruction* inst) { + SpvOp type_op = _.GetIdOpcode(inst->type_id()); + if (!spvOpcodeGeneratesType(type_op)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpPhi's type " << _.getIdName(inst->type_id()) + << " is not a type instruction."; + } + + auto block = inst->block(); + size_t num_in_ops = inst->words().size() - 3; + if (num_in_ops % 2 != 0) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpPhi does not have an equal number of incoming values and " + "basic blocks."; + } + + // Create a uniqued vector of predecessor ids for comparison against + // incoming values. OpBranchConditional %cond %label %label produces two + // predecessors in the CFG. + std::vector pred_ids; + std::transform(block->predecessors()->begin(), block->predecessors()->end(), + std::back_inserter(pred_ids), + [](const BasicBlock* b) { return b->id(); }); + std::sort(pred_ids.begin(), pred_ids.end()); + pred_ids.erase(std::unique(pred_ids.begin(), pred_ids.end()), pred_ids.end()); + + size_t num_edges = num_in_ops / 2; + if (num_edges != pred_ids.size()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpPhi's number of incoming blocks (" << num_edges + << ") does not match block's predecessor count (" + << block->predecessors()->size() << ")."; + } + + for (size_t i = 3; i < inst->words().size(); ++i) { + auto inc_id = inst->word(i); + if (i % 2 == 1) { + // Incoming value type must match the phi result type. + auto inc_type_id = _.GetTypeId(inc_id); + if (inst->type_id() != inc_type_id) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpPhi's result type " << _.getIdName(inst->type_id()) + << " does not match incoming value " << _.getIdName(inc_id) + << " type " << _.getIdName(inc_type_id) << "."; + } + } else { + if (_.GetIdOpcode(inc_id) != SpvOpLabel) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpPhi's incoming basic block " << _.getIdName(inc_id) + << " is not an OpLabel."; + } + + // Incoming basic block must be an immediate predecessor of the phi's + // block. + if (!std::binary_search(pred_ids.begin(), pred_ids.end(), inc_id)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpPhi's incoming basic block " << _.getIdName(inc_id) + << " is not a predecessor of " << _.getIdName(block->id()) + << "."; + } + } + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateBranchConditional(ValidationState_t& _, + const Instruction* inst) { + // num_operands is either 3 or 5 --- if 5, the last two need to be literal + // integers + const auto num_operands = inst->operands().size(); + if (num_operands != 3 && num_operands != 5) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpBranchConditional requires either 3 or 5 parameters"; + } + + // grab the condition operand and check that it is a bool + const auto cond_id = inst->GetOperandAs(0); + const auto cond_op = _.FindDef(cond_id); + if (!cond_op || !_.IsBoolScalarType(cond_op->type_id())) { + return _.diag(SPV_ERROR_INVALID_ID, inst) << "Condition operand for " + "OpBranchConditional must be " + "of boolean type"; + } + + // target operands must be OpLabel + // note that we don't need to check that the target labels are in the same + // function, + // PerformCfgChecks already checks for that + const auto true_id = inst->GetOperandAs(1); + const auto true_target = _.FindDef(true_id); + if (!true_target || SpvOpLabel != true_target->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "The 'True Label' operand for OpBranchConditional must be the " + "ID of an OpLabel instruction"; + } + + const auto false_id = inst->GetOperandAs(2); + const auto false_target = _.FindDef(false_id); + if (!false_target || SpvOpLabel != false_target->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "The 'False Label' operand for OpBranchConditional must be the " + "ID of an OpLabel instruction"; + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateReturnValue(ValidationState_t& _, + const Instruction* inst) { + const auto value_id = inst->GetOperandAs(0); + const auto value = _.FindDef(value_id); + if (!value || !value->type_id()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpReturnValue Value '" << _.getIdName(value_id) + << "' does not represent a value."; + } + auto value_type = _.FindDef(value->type_id()); + if (!value_type || SpvOpTypeVoid == value_type->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpReturnValue value's type '" + << _.getIdName(value->type_id()) << "' is missing or void."; + } + + const bool uses_variable_pointer = + _.features().variable_pointers || + _.features().variable_pointers_storage_buffer; + + if (_.addressing_model() == SpvAddressingModelLogical && + SpvOpTypePointer == value_type->opcode() && !uses_variable_pointer && + !_.options()->relax_logical_pointer) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpReturnValue value's type '" + << _.getIdName(value->type_id()) + << "' is a pointer, which is invalid in the Logical addressing " + "model."; + } + + const auto function = inst->function(); + const auto return_type = _.FindDef(function->GetResultTypeId()); + if (!return_type || return_type->id() != value_type->id()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpReturnValue Value '" << _.getIdName(value_id) + << "'s type does not match OpFunction's return type."; + } + + return SPV_SUCCESS; +} + +} // namespace void printDominatorList(const BasicBlock& b) { std::cout << b.id() << " is dominated by: "; @@ -596,5 +750,23 @@ spv_result_t CfgPass(ValidationState_t& _, const Instruction* inst) { return SPV_SUCCESS; } +spv_result_t ControlFlowPass(ValidationState_t& _, const Instruction* inst) { + switch (inst->opcode()) { + case SpvOpPhi: + if (auto error = ValidatePhi(_, inst)) return error; + break; + case SpvOpBranchConditional: + if (auto error = ValidateBranchConditional(_, inst)) return error; + break; + case SpvOpReturnValue: + if (auto error = ValidateReturnValue(_, inst)) return error; + break; + default: + break; + } + + return SPV_SUCCESS; +} + } // namespace val } // namespace spvtools diff --git a/third_party/spirv-tools/source/val/validate_debug.cpp b/third_party/spirv-tools/source/val/validate_debug.cpp new file mode 100644 index 0000000000..d84ed3801f --- /dev/null +++ b/third_party/spirv-tools/source/val/validate_debug.cpp @@ -0,0 +1,72 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "source/val/validate.h" + +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { +namespace { + +spv_result_t ValidateMemberName(ValidationState_t& _, const Instruction* inst) { + const auto type_id = inst->GetOperandAs(0); + const auto type = _.FindDef(type_id); + if (!type || SpvOpTypeStruct != type->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpMemberName Type '" << _.getIdName(type_id) + << "' is not a struct type."; + } + const auto member_id = inst->GetOperandAs(1); + const auto member_count = (uint32_t)(type->words().size() - 2); + if (member_count <= member_id) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpMemberName Member '" << _.getIdName(member_id) + << "' index is larger than Type '" << _.getIdName(type->id()) + << "'s member count."; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateLine(ValidationState_t& _, const Instruction* inst) { + const auto file_id = inst->GetOperandAs(0); + const auto file = _.FindDef(file_id); + if (!file || SpvOpString != file->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpLine Target '" << _.getIdName(file_id) + << "' is not an OpString."; + } + return SPV_SUCCESS; +} + +} // namespace + +spv_result_t DebugPass(ValidationState_t& _, const Instruction* inst) { + switch (inst->opcode()) { + case SpvOpMemberName: + if (auto error = ValidateMemberName(_, inst)) return error; + break; + case SpvOpLine: + if (auto error = ValidateLine(_, inst)) return error; + break; + default: + break; + } + + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/third_party/spirv-tools/source/val/validate_decorations.cpp b/third_party/spirv-tools/source/val/validate_decorations.cpp index 2f0d007d9c..980e64c210 100644 --- a/third_party/spirv-tools/source/val/validate_decorations.cpp +++ b/third_party/spirv-tools/source/val/validate_decorations.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include "source/diagnostic.h" #include "source/opcode.h" @@ -599,21 +600,14 @@ spv_result_t CheckDecorationsOfEntryPoints(ValidationState_t& vstate) { for (const auto& desc : descs) { for (auto interface : desc.interfaces) { Instruction* var_instr = vstate.FindDef(interface); - if (SpvOpVariable != var_instr->opcode()) { + if (!var_instr || SpvOpVariable != var_instr->opcode()) { return vstate.diag(SPV_ERROR_INVALID_ID, var_instr) << "Interfaces passed to OpEntryPoint must be of type " "OpTypeVariable. Found Op" << spvOpcodeString(var_instr->opcode()) << "."; } - const uint32_t ptr_id = var_instr->word(1); - Instruction* ptr_instr = vstate.FindDef(ptr_id); - // It is guaranteed (by validator ID checks) that ptr_instr is - // OpTypePointer. Word 3 of this instruction is the type being pointed - // to. - const uint32_t type_id = ptr_instr->word(3); - Instruction* type_instr = vstate.FindDef(type_id); - const auto storage_class = - static_cast(var_instr->word(3)); + const SpvStorageClass storage_class = + var_instr->GetOperandAs(2); if (storage_class != SpvStorageClassInput && storage_class != SpvStorageClassOutput) { return vstate.diag(SPV_ERROR_INVALID_ID, var_instr) @@ -623,6 +617,14 @@ spv_result_t CheckDecorationsOfEntryPoints(ValidationState_t& vstate) { << storage_class << " for Entry Point id " << entry_point << "."; } + + const uint32_t ptr_id = var_instr->word(1); + Instruction* ptr_instr = vstate.FindDef(ptr_id); + // It is guaranteed (by validator ID checks) that ptr_instr is + // OpTypePointer. Word 3 of this instruction is the type being pointed + // to. + const uint32_t type_id = ptr_instr->word(3); + Instruction* type_instr = vstate.FindDef(type_id); if (type_instr && SpvOpTypeStruct == type_instr->opcode() && isBuiltInStruct(type_id, vstate)) { if (storage_class == SpvStorageClassInput) ++num_builtin_inputs; diff --git a/third_party/spirv-tools/source/val/validate_derivatives.cpp b/third_party/spirv-tools/source/val/validate_derivatives.cpp index 398e79ab12..0e0dbbe3d2 100644 --- a/third_party/spirv-tools/source/val/validate_derivatives.cpp +++ b/third_party/spirv-tools/source/val/validate_derivatives.cpp @@ -16,6 +16,8 @@ #include "source/val/validate.h" +#include + #include "source/diagnostic.h" #include "source/opcode.h" #include "source/val/instruction.h" @@ -52,10 +54,12 @@ spv_result_t DerivativesPass(ValidationState_t& _, const Instruction* inst) { << spvOpcodeString(opcode); } - _.current_function().RegisterExecutionModelLimitation( - SpvExecutionModelFragment, std::string( - "Derivative instructions require Fragment execution model: ") + - spvOpcodeString(opcode)); + _.function(inst->function()->id()) + ->RegisterExecutionModelLimitation( + SpvExecutionModelFragment, + std::string("Derivative instructions require Fragment execution " + "model: ") + + spvOpcodeString(opcode)); break; } diff --git a/third_party/spirv-tools/source/val/validate_execution_limitations.cpp b/third_party/spirv-tools/source/val/validate_execution_limitations.cpp new file mode 100644 index 0000000000..d449307701 --- /dev/null +++ b/third_party/spirv-tools/source/val/validate_execution_limitations.cpp @@ -0,0 +1,61 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "source/val/validate.h" + +#include "source/val/function.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { + +spv_result_t ValidateExecutionLimitations(ValidationState_t& _, + const Instruction* inst) { + if (inst->opcode() != SpvOpFunction) { + return SPV_SUCCESS; + } + + const auto func = _.function(inst->id()); + if (!func) { + return _.diag(SPV_ERROR_INTERNAL, inst) + << "Internal error: missing function id " << inst->id() << "."; + } + + for (uint32_t entry_id : _.FunctionEntryPoints(inst->id())) { + const auto* models = _.GetExecutionModels(entry_id); + if (models) { + if (models->empty()) { + return _.diag(SPV_ERROR_INTERNAL, inst) + << "Internal error: empty execution models for function id " + << entry_id << "."; + } + for (const auto model : *models) { + std::string reason; + if (!func->IsCompatibleWithExecutionModel(model, &reason)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpEntryPoint Entry Point '" << _.getIdName(entry_id) + << "'s callgraph contains function " + << _.getIdName(inst->id()) + << ", which cannot be used with the current execution " + "model:\n" + << reason; + } + } + } + } + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/third_party/spirv-tools/source/val/validate_ext_inst.cpp b/third_party/spirv-tools/source/val/validate_ext_inst.cpp index b72c3634c1..eb3427090e 100644 --- a/third_party/spirv-tools/source/val/validate_ext_inst.cpp +++ b/third_party/spirv-tools/source/val/validate_ext_inst.cpp @@ -17,6 +17,8 @@ #include "source/val/validate.h" #include +#include +#include #include "source/diagnostic.h" #include "source/latest_version_glsl_std_450_header.h" @@ -742,10 +744,11 @@ spv_result_t ExtInstPass(ValidationState_t& _, const Instruction* inst) { } } - _.current_function().RegisterExecutionModelLimitation( - SpvExecutionModelFragment, - ext_inst_name() + - std::string(" requires Fragment execution model")); + _.function(inst->function()->id()) + ->RegisterExecutionModelLimitation( + SpvExecutionModelFragment, + ext_inst_name() + + std::string(" requires Fragment execution model")); break; } diff --git a/third_party/spirv-tools/source/val/validate_function.cpp b/third_party/spirv-tools/source/val/validate_function.cpp new file mode 100644 index 0000000000..39f00fedc7 --- /dev/null +++ b/third_party/spirv-tools/source/val/validate_function.cpp @@ -0,0 +1,202 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "source/val/validate.h" + +#include + +#include "source/opcode.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { +namespace { + +spv_result_t ValidateFunction(ValidationState_t& _, const Instruction* inst) { + const auto function_type_id = inst->GetOperandAs(3); + const auto function_type = _.FindDef(function_type_id); + if (!function_type || SpvOpTypeFunction != function_type->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpFunction Function Type '" << _.getIdName(function_type_id) + << "' is not a function type."; + } + + const auto return_id = function_type->GetOperandAs(1); + if (return_id != inst->type_id()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpFunction Result Type '" << _.getIdName(inst->type_id()) + << "' does not match the Function Type's return type '" + << _.getIdName(return_id) << "'."; + } + + for (auto& pair : inst->uses()) { + const auto* use = pair.first; + const std::vector acceptable = { + SpvOpFunctionCall, + SpvOpEntryPoint, + SpvOpEnqueueKernel, + SpvOpGetKernelNDrangeSubGroupCount, + SpvOpGetKernelNDrangeMaxSubGroupSize, + SpvOpGetKernelWorkGroupSize, + SpvOpGetKernelPreferredWorkGroupSizeMultiple, + SpvOpGetKernelLocalSizeForSubgroupCount, + SpvOpGetKernelMaxNumSubgroups}; + if (std::find(acceptable.begin(), acceptable.end(), use->opcode()) == + acceptable.end()) { + return _.diag(SPV_ERROR_INVALID_ID, use) + << "Invalid use of function result id " << _.getIdName(inst->id()) + << "."; + } + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateFunctionParameter(ValidationState_t& _, + const Instruction* inst) { + // NOTE: Find OpFunction & ensure OpFunctionParameter is not out of place. + size_t param_index = 0; + size_t inst_num = inst->LineNum() - 1; + if (inst_num == 0) { + return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) + << "Function parameter cannot be the first instruction."; + } + + auto func_inst = &_.ordered_instructions()[inst_num]; + while (--inst_num) { + func_inst = &_.ordered_instructions()[inst_num]; + if (func_inst->opcode() == SpvOpFunction) { + break; + } else if (func_inst->opcode() == SpvOpFunctionParameter) { + ++param_index; + } + } + + if (func_inst->opcode() != SpvOpFunction) { + return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) + << "Function parameter must be preceded by a function."; + } + + const auto function_type_id = func_inst->GetOperandAs(3); + const auto function_type = _.FindDef(function_type_id); + if (!function_type) { + return _.diag(SPV_ERROR_INVALID_ID, func_inst) + << "Missing function type definition."; + } + if (param_index >= function_type->words().size() - 3) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Too many OpFunctionParameters for " << func_inst->id() + << ": expected " << function_type->words().size() - 3 + << " based on the function's type"; + } + + const auto param_type = + _.FindDef(function_type->GetOperandAs(param_index + 2)); + if (!param_type || inst->type_id() != param_type->id()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpFunctionParameter Result Type '" + << _.getIdName(inst->type_id()) + << "' does not match the OpTypeFunction parameter " + "type of the same index."; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateFunctionCall(ValidationState_t& _, + const Instruction* inst) { + const auto function_id = inst->GetOperandAs(2); + const auto function = _.FindDef(function_id); + if (!function || SpvOpFunction != function->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpFunctionCall Function '" << _.getIdName(function_id) + << "' is not a function."; + } + + auto return_type = _.FindDef(function->type_id()); + if (!return_type || return_type->id() != inst->type_id()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpFunctionCall Result Type '" + << _.getIdName(inst->type_id()) + << "'s type does not match Function '" + << _.getIdName(return_type->id()) << "'s return type."; + } + + const auto function_type_id = function->GetOperandAs(3); + const auto function_type = _.FindDef(function_type_id); + if (!function_type || function_type->opcode() != SpvOpTypeFunction) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Missing function type definition."; + } + + const auto function_call_arg_count = inst->words().size() - 4; + const auto function_param_count = function_type->words().size() - 3; + if (function_param_count != function_call_arg_count) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpFunctionCall Function 's parameter count does not match " + "the argument count."; + } + + for (size_t argument_index = 3, param_index = 2; + argument_index < inst->operands().size(); + argument_index++, param_index++) { + const auto argument_id = inst->GetOperandAs(argument_index); + const auto argument = _.FindDef(argument_id); + if (!argument) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Missing argument " << argument_index - 3 << " definition."; + } + + const auto argument_type = _.FindDef(argument->type_id()); + if (!argument_type) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Missing argument " << argument_index - 3 + << " type definition."; + } + + const auto parameter_type_id = + function_type->GetOperandAs(param_index); + const auto parameter_type = _.FindDef(parameter_type_id); + if (!parameter_type || argument_type->id() != parameter_type->id()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpFunctionCall Argument '" << _.getIdName(argument_id) + << "'s type does not match Function '" + << _.getIdName(parameter_type_id) << "'s parameter type."; + } + } + return SPV_SUCCESS; +} + +} // namespace + +spv_result_t FunctionPass(ValidationState_t& _, const Instruction* inst) { + switch (inst->opcode()) { + case SpvOpFunction: + if (auto error = ValidateFunction(_, inst)) return error; + break; + case SpvOpFunctionParameter: + if (auto error = ValidateFunctionParameter(_, inst)) return error; + break; + case SpvOpFunctionCall: + if (auto error = ValidateFunctionCall(_, inst)) return error; + break; + default: + break; + } + + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/third_party/spirv-tools/source/val/validate_id.cpp b/third_party/spirv-tools/source/val/validate_id.cpp index af69051810..688659fabf 100644 --- a/third_party/spirv-tools/source/val/validate_id.cpp +++ b/third_party/spirv-tools/source/val/validate_id.cpp @@ -20,13 +20,13 @@ #include #include #include +#include #include #include #include #include "source/diagnostic.h" #include "source/instruction.h" -#include "source/message.h" #include "source/opcode.h" #include "source/operand.h" #include "source/spirv_validator_options.h" @@ -90,467 +90,6 @@ class idUsage { SPV_ERROR_INVALID_DIAGNOSTIC); \ helper -template <> -bool idUsage::isValid(const spv_instruction_t* inst, - const spv_opcode_desc) { - auto typeIndex = 1; - auto type = module_.FindDef(inst->words[typeIndex]); - if (!type || SpvOpTypeStruct != type->opcode()) { - DIAG(type) << "OpMemberName Type '" - << module_.getIdName(inst->words[typeIndex]) - << "' is not a struct type."; - return false; - } - auto memberIndex = 2; - auto member = inst->words[memberIndex]; - auto memberCount = (uint32_t)(type->words().size() - 2); - if (memberCount <= member) { - DIAG(module_.FindDef(member)) - << "OpMemberName Member '" - << module_.getIdName(inst->words[memberIndex]) - << "' index is larger than Type '" << module_.getIdName(type->id()) - << "'s member count."; - return false; - } - return true; -} - -template <> -bool idUsage::isValid(const spv_instruction_t* inst, - const spv_opcode_desc) { - auto fileIndex = 1; - auto file = module_.FindDef(inst->words[fileIndex]); - if (!file || SpvOpString != file->opcode()) { - DIAG(file) << "OpLine Target '" - << module_.getIdName(inst->words[fileIndex]) - << "' is not an OpString."; - return false; - } - return true; -} - -template <> -bool idUsage::isValid(const spv_instruction_t* inst, - const spv_opcode_desc) { - auto decorationIndex = 2; - auto decoration = inst->words[decorationIndex]; - if (decoration == SpvDecorationSpecId) { - auto targetIndex = 1; - auto target = module_.FindDef(inst->words[targetIndex]); - if (!target || !spvOpcodeIsScalarSpecConstant(target->opcode())) { - DIAG(target) << "OpDecorate SpectId decoration target '" - << module_.getIdName(inst->words[decorationIndex]) - << "' is not a scalar specialization constant."; - return false; - } - } - // TODO: Add validations for all decorations. - return true; -} - -template <> -bool idUsage::isValid(const spv_instruction_t* inst, - const spv_opcode_desc) { - auto structTypeIndex = 1; - auto structType = module_.FindDef(inst->words[structTypeIndex]); - if (!structType || SpvOpTypeStruct != structType->opcode()) { - DIAG(structType) << "OpMemberDecorate Structure type '" - << module_.getIdName(inst->words[structTypeIndex]) - << "' is not a struct type."; - return false; - } - auto memberIndex = 2; - auto member = inst->words[memberIndex]; - auto memberCount = static_cast(structType->words().size() - 2); - if (memberCount < member) { - DIAG(structType) << "Index " << member - << " provided in OpMemberDecorate for struct " - << module_.getIdName(inst->words[structTypeIndex]) - << " is out of bounds. The structure has " << memberCount - << " members. Largest valid index is " << memberCount - 1 - << "."; - return false; - } - return true; -} - -template <> -bool idUsage::isValid(const spv_instruction_t* inst, - const spv_opcode_desc) { - auto decorationGroupIndex = 1; - auto decorationGroup = module_.FindDef(inst->words[decorationGroupIndex]); - - for (auto pair : decorationGroup->uses()) { - auto use = pair.first; - if (use->opcode() != SpvOpDecorate && use->opcode() != SpvOpGroupDecorate && - use->opcode() != SpvOpGroupMemberDecorate && - use->opcode() != SpvOpName) { - DIAG(decorationGroup) << "Result id of OpDecorationGroup can only " - << "be targeted by OpName, OpGroupDecorate, " - << "OpDecorate, and OpGroupMemberDecorate"; - return false; - } - } - return true; -} - -template <> -bool idUsage::isValid(const spv_instruction_t* inst, - const spv_opcode_desc) { - auto decorationGroupIndex = 1; - auto decorationGroup = module_.FindDef(inst->words[decorationGroupIndex]); - if (!decorationGroup || SpvOpDecorationGroup != decorationGroup->opcode()) { - DIAG(decorationGroup) << "OpGroupDecorate Decoration group '" - << module_.getIdName( - inst->words[decorationGroupIndex]) - << "' is not a decoration group."; - return false; - } - return true; -} - -template <> -bool idUsage::isValid(const spv_instruction_t* inst, - const spv_opcode_desc) { - auto decorationGroupIndex = 1; - auto decorationGroup = module_.FindDef(inst->words[decorationGroupIndex]); - if (!decorationGroup || SpvOpDecorationGroup != decorationGroup->opcode()) { - DIAG(decorationGroup) << "OpGroupMemberDecorate Decoration group '" - << module_.getIdName( - inst->words[decorationGroupIndex]) - << "' is not a decoration group."; - return false; - } - // Grammar checks ensures that the number of arguments to this instruction - // is an odd number: 1 decoration group + (id,literal) pairs. - for (size_t i = 2; i + 1 < inst->words.size(); i = i + 2) { - const uint32_t struct_id = inst->words[i]; - const uint32_t index = inst->words[i + 1]; - auto struct_instr = module_.FindDef(struct_id); - if (!struct_instr || SpvOpTypeStruct != struct_instr->opcode()) { - DIAG(struct_instr) << "OpGroupMemberDecorate Structure type '" - << module_.getIdName(struct_id) - << "' is not a struct type."; - return false; - } - const uint32_t num_struct_members = - static_cast(struct_instr->words().size() - 2); - if (index >= num_struct_members) { - DIAG(struct_instr) - << "Index " << index - << " provided in OpGroupMemberDecorate for struct " - << module_.getIdName(struct_id) - << " is out of bounds. The structure has " << num_struct_members - << " members. Largest valid index is " << num_struct_members - 1 - << "."; - return false; - } - } - return true; -} - -template <> -bool idUsage::isValid(const spv_instruction_t* inst, - const spv_opcode_desc) { - auto entryPointIndex = 2; - auto entryPoint = module_.FindDef(inst->words[entryPointIndex]); - if (!entryPoint || SpvOpFunction != entryPoint->opcode()) { - DIAG(entryPoint) << "OpEntryPoint Entry Point '" - << module_.getIdName(inst->words[entryPointIndex]) - << "' is not a function."; - return false; - } - // don't check kernel function signatures - const SpvExecutionModel executionModel = SpvExecutionModel(inst->words[1]); - if (executionModel != SpvExecutionModelKernel) { - // TODO: Check the entry point signature is void main(void), may be subject - // to change - auto entryPointType = module_.FindDef(entryPoint->words()[4]); - if (!entryPointType || 3 != entryPointType->words().size()) { - DIAG(entryPoint) << "OpEntryPoint Entry Point '" - << module_.getIdName(inst->words[entryPointIndex]) - << "'s function parameter count is not zero."; - return false; - } - } - - auto returnType = module_.FindDef(entryPoint->type_id()); - if (!returnType || SpvOpTypeVoid != returnType->opcode()) { - DIAG(entryPoint) << "OpEntryPoint Entry Point '" - << module_.getIdName(inst->words[entryPointIndex]) - << "'s function return type is not void."; - return false; - } - return true; -} - -template <> -bool idUsage::isValid(const spv_instruction_t* inst, - const spv_opcode_desc) { - auto entryPointIndex = 1; - auto entryPointID = inst->words[entryPointIndex]; - auto found = - std::find(entry_points_.cbegin(), entry_points_.cend(), entryPointID); - if (found == entry_points_.cend()) { - DIAG(module_.FindDef(entryPointID)) - << "OpExecutionMode Entry Point '" - << module_.getIdName(inst->words[entryPointIndex]) - << "' is not the Entry Point " - "operand of an OpEntryPoint."; - return false; - } - return true; -} - -template <> -bool idUsage::isValid(const spv_instruction_t* inst, - const spv_opcode_desc) { - auto componentIndex = 2; - auto componentType = module_.FindDef(inst->words[componentIndex]); - if (!componentType || !spvOpcodeIsScalarType(componentType->opcode())) { - DIAG(componentType) << "OpTypeVector Component Type '" - << module_.getIdName(inst->words[componentIndex]) - << "' is not a scalar type."; - return false; - } - return true; -} - -template <> -bool idUsage::isValid(const spv_instruction_t* inst, - const spv_opcode_desc) { - auto columnTypeIndex = 2; - auto columnType = module_.FindDef(inst->words[columnTypeIndex]); - if (!columnType || SpvOpTypeVector != columnType->opcode()) { - DIAG(columnType) << "OpTypeMatrix Column Type '" - << module_.getIdName(inst->words[columnTypeIndex]) - << "' is not a vector."; - return false; - } - return true; -} - -template <> -bool idUsage::isValid(const spv_instruction_t*, - const spv_opcode_desc) { - // OpTypeSampler takes no arguments in Rev31 and beyond. - return true; -} - -// True if the integer constant is > 0. constWords are words of the -// constant-defining instruction (either OpConstant or -// OpSpecConstant). typeWords are the words of the constant's-type-defining -// OpTypeInt. -bool aboveZero(const std::vector& constWords, - const std::vector& typeWords) { - const uint32_t width = typeWords[2]; - const bool is_signed = typeWords[3] > 0; - const uint32_t loWord = constWords[3]; - if (width > 32) { - // The spec currently doesn't allow integers wider than 64 bits. - const uint32_t hiWord = constWords[4]; // Must exist, per spec. - if (is_signed && (hiWord >> 31)) return false; - return (loWord | hiWord) > 0; - } else { - if (is_signed && (loWord >> 31)) return false; - return loWord > 0; - } -} - -template <> -bool idUsage::isValid(const spv_instruction_t* inst, - const spv_opcode_desc) { - auto elementTypeIndex = 2; - auto elementType = module_.FindDef(inst->words[elementTypeIndex]); - if (!elementType || !spvOpcodeGeneratesType(elementType->opcode())) { - DIAG(elementType) << "OpTypeArray Element Type '" - << module_.getIdName(inst->words[elementTypeIndex]) - << "' is not a type."; - return false; - } - auto lengthIndex = 3; - auto length = module_.FindDef(inst->words[lengthIndex]); - if (!length || !spvOpcodeIsConstant(length->opcode())) { - DIAG(length) << "OpTypeArray Length '" - << module_.getIdName(inst->words[lengthIndex]) - << "' is not a scalar constant type."; - return false; - } - - // NOTE: Check the initialiser value of the constant - auto constInst = length->words(); - auto constResultTypeIndex = 1; - auto constResultType = module_.FindDef(constInst[constResultTypeIndex]); - if (!constResultType || SpvOpTypeInt != constResultType->opcode()) { - DIAG(length) << "OpTypeArray Length '" - << module_.getIdName(inst->words[lengthIndex]) - << "' is not a constant integer type."; - return false; - } - - switch (length->opcode()) { - case SpvOpSpecConstant: - case SpvOpConstant: - if (aboveZero(length->words(), constResultType->words())) break; - // Else fall through! - case SpvOpConstantNull: { - DIAG(length) << "OpTypeArray Length '" - << module_.getIdName(inst->words[lengthIndex]) - << "' default value must be at least 1."; - return false; - } - case SpvOpSpecConstantOp: - // Assume it's OK, rather than try to evaluate the operation. - break; - default: - assert(0 && "bug in spvOpcodeIsConstant() or result type isn't int"); - } - return true; -} - -template <> -bool idUsage::isValid(const spv_instruction_t* inst, - const spv_opcode_desc) { - auto elementTypeIndex = 2; - auto elementType = module_.FindDef(inst->words[elementTypeIndex]); - if (!elementType || !spvOpcodeGeneratesType(elementType->opcode())) { - DIAG(elementType) << "OpTypeRuntimeArray Element Type '" - << module_.getIdName(inst->words[elementTypeIndex]) - << "' is not a type."; - return false; - } - return true; -} - -template <> -bool idUsage::isValid(const spv_instruction_t* inst, - const spv_opcode_desc) { - ValidationState_t& vstate = const_cast(module_); - const uint32_t struct_id = inst->words[1]; - auto structType = module_.FindDef(struct_id); - for (size_t memberTypeIndex = 2; memberTypeIndex < inst->words.size(); - ++memberTypeIndex) { - auto memberTypeId = inst->words[memberTypeIndex]; - auto memberType = module_.FindDef(memberTypeId); - if (!memberType || !spvOpcodeGeneratesType(memberType->opcode())) { - DIAG(memberType) << "OpTypeStruct Member Type '" - << module_.getIdName(inst->words[memberTypeIndex]) - << "' is not a type."; - return false; - } - if (SpvOpTypeStruct == memberType->opcode() && - module_.IsStructTypeWithBuiltInMember(memberTypeId)) { - DIAG(memberType) - << "Structure " << module_.getIdName(memberTypeId) - << " contains members with BuiltIn decoration. Therefore this " - "structure may not be contained as a member of another structure " - "type. Structure " - << module_.getIdName(struct_id) << " contains structure " - << module_.getIdName(memberTypeId) << "."; - return false; - } - if (module_.IsForwardPointer(memberTypeId)) { - if (memberType->opcode() != SpvOpTypePointer) { - DIAG(memberType) << "Found a forward reference to a non-pointer " - "type in OpTypeStruct instruction."; - return false; - } - // If we're dealing with a forward pointer: - // Find out the type that the pointer is pointing to (must be struct) - // word 3 is the of the type being pointed to. - auto typePointingTo = module_.FindDef(memberType->words()[3]); - if (typePointingTo && typePointingTo->opcode() != SpvOpTypeStruct) { - // Forward declared operands of a struct may only point to a struct. - DIAG(memberType) - << "A forward reference operand in an OpTypeStruct must be an " - "OpTypePointer that points to an OpTypeStruct. " - "Found OpTypePointer that points to Op" - << spvOpcodeString(static_cast(typePointingTo->opcode())) - << "."; - return false; - } - } - } - std::unordered_set built_in_members; - for (auto decoration : vstate.id_decorations(struct_id)) { - if (decoration.dec_type() == SpvDecorationBuiltIn && - decoration.struct_member_index() != Decoration::kInvalidMember) { - built_in_members.insert(decoration.struct_member_index()); - } - } - int num_struct_members = static_cast(inst->words.size() - 2); - int num_builtin_members = static_cast(built_in_members.size()); - if (num_builtin_members > 0 && num_builtin_members != num_struct_members) { - DIAG(structType) - << "When BuiltIn decoration is applied to a structure-type member, " - "all members of that structure type must also be decorated with " - "BuiltIn (No allowed mixing of built-in variables and " - "non-built-in variables within a single structure). Structure id " - << struct_id << " does not meet this requirement."; - return false; - } - if (num_builtin_members > 0) { - vstate.RegisterStructTypeWithBuiltInMember(struct_id); - } - return true; -} - -template <> -bool idUsage::isValid(const spv_instruction_t* inst, - const spv_opcode_desc) { - auto typeIndex = 3; - auto type = module_.FindDef(inst->words[typeIndex]); - if (!type || !spvOpcodeGeneratesType(type->opcode())) { - DIAG(type) << "OpTypePointer Type '" - << module_.getIdName(inst->words[typeIndex]) - << "' is not a type."; - return false; - } - return true; -} - -template <> -bool idUsage::isValid(const spv_instruction_t* inst, - const spv_opcode_desc) { - auto returnTypeIndex = 2; - auto returnType = module_.FindDef(inst->words[returnTypeIndex]); - if (!returnType || !spvOpcodeGeneratesType(returnType->opcode())) { - DIAG(returnType) << "OpTypeFunction Return Type '" - << module_.getIdName(inst->words[returnTypeIndex]) - << "' is not a type."; - return false; - } - size_t num_args = 0; - for (size_t paramTypeIndex = 3; paramTypeIndex < inst->words.size(); - ++paramTypeIndex, ++num_args) { - auto paramType = module_.FindDef(inst->words[paramTypeIndex]); - if (!paramType || !spvOpcodeGeneratesType(paramType->opcode())) { - DIAG(paramType) << "OpTypeFunction Parameter Type '" - << module_.getIdName(inst->words[paramTypeIndex]) - << "' is not a type."; - return false; - } - } - const uint32_t num_function_args_limit = - module_.options()->universal_limits_.max_function_args; - if (num_args > num_function_args_limit) { - DIAG(returnType) << "OpTypeFunction may not take more than " - << num_function_args_limit - << " arguments. OpTypeFunction '" - << module_.getIdName(inst->words[1]) << "' has " - << num_args << " arguments."; - return false; - } - return true; -} - -template <> -bool idUsage::isValid(const spv_instruction_t*, - const spv_opcode_desc) { - // OpTypePipe has no ID arguments. - return true; -} - template <> bool idUsage::isValid(const spv_instruction_t* inst, const spv_opcode_desc) { @@ -1102,326 +641,6 @@ bool idUsage::isValid(const spv_instruction_t* inst, return true; } -template <> -bool idUsage::isValid(const spv_instruction_t* inst, - const spv_opcode_desc) { - const auto* thisInst = module_.FindDef(inst->words[2u]); - if (!thisInst) return false; - - for (uint32_t entryId : module_.FunctionEntryPoints(thisInst->id())) { - const Function* thisFunc = module_.function(thisInst->id()); - assert(thisFunc); - const auto* models = module_.GetExecutionModels(entryId); - if (models) { - assert(models->size()); - for (auto model : *models) { - std::string reason; - if (!thisFunc->IsCompatibleWithExecutionModel(model, &reason)) { - DIAG(module_.FindDef(inst->words[2])) - << "OpEntryPoint Entry Point '" << module_.getIdName(entryId) - << "'s callgraph contains function " - << module_.getIdName(thisInst->id()) - << ", which cannot be used with the current execution model:\n" - << reason; - return false; - } - } - } - } - - auto resultTypeIndex = 1; - auto resultType = module_.FindDef(inst->words[resultTypeIndex]); - if (!resultType) return false; - auto functionTypeIndex = 4; - auto functionType = module_.FindDef(inst->words[functionTypeIndex]); - if (!functionType || SpvOpTypeFunction != functionType->opcode()) { - DIAG(functionType) << "OpFunction Function Type '" - << module_.getIdName(inst->words[functionTypeIndex]) - << "' is not a function type."; - return false; - } - auto returnType = module_.FindDef(functionType->words()[2]); - assert(returnType); - if (returnType->id() != resultType->id()) { - DIAG(resultType) << "OpFunction Result Type '" - << module_.getIdName(inst->words[resultTypeIndex]) - << "' does not match the Function Type '" - << module_.getIdName(resultType->id()) - << "'s return type."; - return false; - } - return true; -} - -template <> -bool idUsage::isValid(const spv_instruction_t* inst, - const spv_opcode_desc) { - auto resultTypeIndex = 1; - auto resultType = module_.FindDef(inst->words[resultTypeIndex]); - if (!resultType) return false; - // NOTE: Find OpFunction & ensure OpFunctionParameter is not out of place. - size_t paramIndex = 0; - assert(firstInst < inst && "Invalid instruction pointer"); - while (firstInst != --inst) { - if (SpvOpFunction == inst->opcode) { - break; - } else if (SpvOpFunctionParameter == inst->opcode) { - paramIndex++; - } - } - auto functionType = module_.FindDef(inst->words[4]); - assert(functionType); - if (paramIndex >= functionType->words().size() - 3) { - DIAG(module_.FindDef(inst->words[0])) - << "Too many OpFunctionParameters for " << inst->words[2] - << ": expected " << functionType->words().size() - 3 - << " based on the function's type"; - return false; - } - auto paramType = module_.FindDef(functionType->words()[paramIndex + 3]); - assert(paramType); - if (resultType->id() != paramType->id()) { - DIAG(resultType) << "OpFunctionParameter Result Type '" - << module_.getIdName(inst->words[resultTypeIndex]) - << "' does not match the OpTypeFunction parameter " - "type of the same index."; - return false; - } - return true; -} - -template <> -bool idUsage::isValid(const spv_instruction_t* inst, - const spv_opcode_desc) { - auto resultTypeIndex = 1; - auto resultType = module_.FindDef(inst->words[resultTypeIndex]); - if (!resultType) return false; - auto functionIndex = 3; - auto function = module_.FindDef(inst->words[functionIndex]); - if (!function || SpvOpFunction != function->opcode()) { - DIAG(function) << "OpFunctionCall Function '" - << module_.getIdName(inst->words[functionIndex]) - << "' is not a function."; - return false; - } - auto returnType = module_.FindDef(function->type_id()); - assert(returnType); - if (returnType->id() != resultType->id()) { - DIAG(resultType) << "OpFunctionCall Result Type '" - << module_.getIdName(inst->words[resultTypeIndex]) - << "'s type does not match Function '" - << module_.getIdName(returnType->id()) - << "'s return type."; - return false; - } - auto functionType = module_.FindDef(function->words()[4]); - assert(functionType); - auto functionCallArgCount = inst->words.size() - 4; - auto functionParamCount = functionType->words().size() - 3; - if (functionParamCount != functionCallArgCount) { - DIAG(module_.FindDef(inst->words.back())) - << "OpFunctionCall Function 's parameter count does not match " - "the argument count."; - return false; - } - for (size_t argumentIndex = 4, paramIndex = 3; - argumentIndex < inst->words.size(); argumentIndex++, paramIndex++) { - auto argument = module_.FindDef(inst->words[argumentIndex]); - if (!argument) return false; - auto argumentType = module_.FindDef(argument->type_id()); - assert(argumentType); - auto parameterType = module_.FindDef(functionType->words()[paramIndex]); - assert(parameterType); - if (argumentType->id() != parameterType->id()) { - DIAG(argument) << "OpFunctionCall Argument '" - << module_.getIdName(inst->words[argumentIndex]) - << "'s type does not match Function '" - << module_.getIdName(parameterType->id()) - << "'s parameter type."; - return false; - } - } - return true; -} - -template <> -bool idUsage::isValid(const spv_instruction_t* inst, - const spv_opcode_desc /*opcodeEntry*/) { - auto thisInst = module_.FindDef(inst->words[2]); - SpvOp typeOp = module_.GetIdOpcode(thisInst->type_id()); - if (!spvOpcodeGeneratesType(typeOp)) { - DIAG(thisInst) << "OpPhi's type " - << module_.getIdName(thisInst->type_id()) - << " is not a type instruction."; - return false; - } - - auto block = thisInst->block(); - size_t numInOps = inst->words.size() - 3; - if (numInOps % 2 != 0) { - DIAG(thisInst) - << "OpPhi does not have an equal number of incoming values and " - "basic blocks."; - return false; - } - - // Create a uniqued vector of predecessor ids for comparison against - // incoming values. OpBranchConditional %cond %label %label produces two - // predecessors in the CFG. - std::vector predIds; - std::transform(block->predecessors()->begin(), block->predecessors()->end(), - std::back_inserter(predIds), - [](const BasicBlock* b) { return b->id(); }); - std::sort(predIds.begin(), predIds.end()); - predIds.erase(std::unique(predIds.begin(), predIds.end()), predIds.end()); - - size_t numEdges = numInOps / 2; - if (numEdges != predIds.size()) { - DIAG(thisInst) << "OpPhi's number of incoming blocks (" << numEdges - << ") does not match block's predecessor count (" - << block->predecessors()->size() << ")."; - return false; - } - - for (size_t i = 3; i < inst->words.size(); ++i) { - auto incId = inst->words[i]; - if (i % 2 == 1) { - // Incoming value type must match the phi result type. - auto incTypeId = module_.GetTypeId(incId); - if (thisInst->type_id() != incTypeId) { - DIAG(thisInst) << "OpPhi's result type " - << module_.getIdName(thisInst->type_id()) - << " does not match incoming value " - << module_.getIdName(incId) << " type " - << module_.getIdName(incTypeId) << "."; - return false; - } - } else { - if (module_.GetIdOpcode(incId) != SpvOpLabel) { - DIAG(thisInst) << "OpPhi's incoming basic block " - << module_.getIdName(incId) << " is not an OpLabel."; - return false; - } - - // Incoming basic block must be an immediate predecessor of the phi's - // block. - if (!std::binary_search(predIds.begin(), predIds.end(), incId)) { - DIAG(thisInst) << "OpPhi's incoming basic block " - << module_.getIdName(incId) - << " is not a predecessor of " - << module_.getIdName(block->id()) << "."; - return false; - } - } - } - - return true; -} - -template <> -bool idUsage::isValid(const spv_instruction_t* inst, - const spv_opcode_desc) { - const size_t numOperands = inst->words.size() - 1; - const size_t condOperandIndex = 1; - const size_t targetTrueIndex = 2; - const size_t targetFalseIndex = 3; - - // num_operands is either 3 or 5 --- if 5, the last two need to be literal - // integers - if (numOperands != 3 && numOperands != 5) { - Instruction* fake_inst = nullptr; - DIAG(fake_inst) << "OpBranchConditional requires either 3 or 5 parameters"; - return false; - } - - bool ret = true; - - // grab the condition operand and check that it is a bool - const auto condOp = module_.FindDef(inst->words[condOperandIndex]); - if (!condOp || !module_.IsBoolScalarType(condOp->type_id())) { - DIAG(condOp) - << "Condition operand for OpBranchConditional must be of boolean type"; - ret = false; - } - - // target operands must be OpLabel - // note that we don't need to check that the target labels are in the same - // function, - // PerformCfgChecks already checks for that - const auto targetOpTrue = module_.FindDef(inst->words[targetTrueIndex]); - if (!targetOpTrue || SpvOpLabel != targetOpTrue->opcode()) { - DIAG(targetOpTrue) - << "The 'True Label' operand for OpBranchConditional must be the " - "ID of an OpLabel instruction"; - ret = false; - } - - const auto targetOpFalse = module_.FindDef(inst->words[targetFalseIndex]); - if (!targetOpFalse || SpvOpLabel != targetOpFalse->opcode()) { - DIAG(targetOpFalse) - << "The 'False Label' operand for OpBranchConditional must be the " - "ID of an OpLabel instruction"; - ret = false; - } - - return ret; -} - -template <> -bool idUsage::isValid(const spv_instruction_t* inst, - const spv_opcode_desc) { - auto valueIndex = 1; - auto value = module_.FindDef(inst->words[valueIndex]); - if (!value || !value->type_id()) { - DIAG(value) << "OpReturnValue Value '" - << module_.getIdName(inst->words[valueIndex]) - << "' does not represent a value."; - return false; - } - auto valueType = module_.FindDef(value->type_id()); - if (!valueType || SpvOpTypeVoid == valueType->opcode()) { - DIAG(value) << "OpReturnValue value's type '" - << module_.getIdName(value->type_id()) - << "' is missing or void."; - return false; - } - - const bool uses_variable_pointer = - module_.features().variable_pointers || - module_.features().variable_pointers_storage_buffer; - - if (addressingModel == SpvAddressingModelLogical && - SpvOpTypePointer == valueType->opcode() && !uses_variable_pointer && - !module_.options()->relax_logical_pointer) { - DIAG(value) - << "OpReturnValue value's type '" - << module_.getIdName(value->type_id()) - << "' is a pointer, which is invalid in the Logical addressing model."; - return false; - } - - // NOTE: Find OpFunction - const spv_instruction_t* function = inst - 1; - while (firstInst != function) { - if (SpvOpFunction == function->opcode) break; - function--; - } - if (SpvOpFunction != function->opcode) { - DIAG(value) << "OpReturnValue is not in a basic block."; - return false; - } - auto returnType = module_.FindDef(function->words[1]); - if (!returnType || returnType->id() != valueType->id()) { - DIAG(value) << "OpReturnValue Value '" - << module_.getIdName(inst->words[valueIndex]) - << "'s type does not match OpFunction's return type."; - return false; - } - return true; -} - -#undef DIAG - bool idUsage::isValid(const spv_instruction_t* inst) { spv_opcode_desc opcodeEntry = nullptr; if (spvOpcodeTableValueLookup(targetEnv, opcodeTable, inst->opcode, @@ -1431,24 +650,6 @@ bool idUsage::isValid(const spv_instruction_t* inst) { case Spv##OpCode: \ return isValid(inst, opcodeEntry); switch (inst->opcode) { - CASE(OpMemberName) - CASE(OpLine) - CASE(OpDecorate) - CASE(OpMemberDecorate) - CASE(OpDecorationGroup) - CASE(OpGroupDecorate) - CASE(OpGroupMemberDecorate) - CASE(OpEntryPoint) - CASE(OpExecutionMode) - CASE(OpTypeVector) - CASE(OpTypeMatrix) - CASE(OpTypeSampler) - CASE(OpTypeArray) - CASE(OpTypeRuntimeArray) - CASE(OpTypeStruct) - CASE(OpTypePointer) - CASE(OpTypeFunction) - CASE(OpTypePipe) CASE(OpConstantTrue) CASE(OpConstantFalse) CASE(OpConstantComposite) @@ -1458,19 +659,11 @@ bool idUsage::isValid(const spv_instruction_t* inst) { CASE(OpSpecConstantFalse) CASE(OpSpecConstantComposite) CASE(OpSampledImage) - CASE(OpFunction) - CASE(OpFunctionParameter) - CASE(OpFunctionCall) // Other composite opcodes are validated in validate_composites.cpp. // Arithmetic opcodes are validated in validate_arithmetics.cpp. // Bitwise opcodes are validated in validate_bitwise.cpp. // Logical opcodes are validated in validate_logicals.cpp. // Derivative opcodes are validated in validate_derivatives.cpp. - CASE(OpPhi) - // OpBranch is validated in validate_cfg.cpp. - // See tests in test/val/val_cfg_test.cpp. - CASE(OpBranchConditional) - CASE(OpReturnValue) default: return true; } @@ -1624,8 +817,6 @@ spv_result_t IdPass(ValidationState_t& _, Instruction* inst) { } if (result_id) _.RemoveIfForwardDeclared(result_id); - _.RegisterInstruction(inst); - return SPV_SUCCESS; } diff --git a/third_party/spirv-tools/source/val/validate_image.cpp b/third_party/spirv-tools/source/val/validate_image.cpp index 47c3e43e8c..0d2dd00c03 100644 --- a/third_party/spirv-tools/source/val/validate_image.cpp +++ b/third_party/spirv-tools/source/val/validate_image.cpp @@ -16,6 +16,8 @@ #include "source/val/validate.h" +#include + #include "source/diagnostic.h" #include "source/opcode.h" #include "source/spirv_target_env.h" @@ -116,7 +118,7 @@ bool IsImplicitLod(SpvOp opcode) { return true; default: break; - }; + } return false; } @@ -133,7 +135,7 @@ bool IsExplicitLod(SpvOp opcode) { return true; default: break; - }; + } return false; } @@ -152,7 +154,7 @@ bool IsProj(SpvOp opcode) { return true; default: break; - }; + } return false; } @@ -225,7 +227,7 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image Operands Offset, ConstOffset, ConstOffsets cannot be used " << "together"; - }; + } const bool is_implicit_lod = IsImplicitLod(opcode); const bool is_explicit_lod = IsExplicitLod(opcode); @@ -236,7 +238,7 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, if (!is_implicit_lod) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image Operand Bias can only be used with ImplicitLod opcodes"; - }; + } const uint32_t type_id = _.GetTypeId(inst->word(word_index++)); if (!_.IsFloatScalarType(type_id)) { @@ -263,7 +265,7 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image Operand Lod can only be used with ExplicitLod opcodes " << "and OpImageFetch"; - }; + } if (mask & SpvImageOperandsGradMask) { return _.diag(SPV_ERROR_INVALID_DATA, inst) @@ -303,7 +305,7 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, if (!is_explicit_lod) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image Operand Grad can only be used with ExplicitLod opcodes"; - }; + } const uint32_t dx_type_id = _.GetTypeId(inst->word(word_index++)); const uint32_t dy_type_id = _.GetTypeId(inst->word(word_index++)); @@ -463,7 +465,7 @@ spv_result_t ValidateImageOperands(ValidationState_t& _, return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image Operand MinLod can only be used with ImplicitLod " << "opcodes or together with Image Operand Grad"; - }; + } const uint32_t type_id = _.GetTypeId(inst->word(word_index++)); if (!_.IsFloatScalarType(type_id)) { @@ -1093,10 +1095,11 @@ spv_result_t ValidateImageRead(ValidationState_t& _, const Instruction* inst) { << "Image Dim SubpassData cannot be used with ImageSparseRead"; } - _.current_function().RegisterExecutionModelLimitation( - SpvExecutionModelFragment, - std::string("Dim SubpassData requires Fragment execution model: ") + - spvOpcodeString(opcode)); + _.function(inst->function()->id()) + ->RegisterExecutionModelLimitation( + SpvExecutionModelFragment, + std::string("Dim SubpassData requires Fragment execution model: ") + + spvOpcodeString(opcode)); } if (_.GetIdOpcode(info.sampled_type) != SpvOpTypeVoid) { @@ -1279,7 +1282,7 @@ spv_result_t ValidateImageQuerySizeLod(ValidationState_t& _, default: return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image 'Dim' must be 1D, 2D, 3D or Cube"; - }; + } if (info.multisampled != 0) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image 'MS' must be 0"; @@ -1350,7 +1353,7 @@ spv_result_t ValidateImageQuerySize(ValidationState_t& _, default: return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image 'Dim' must be Buffer, 2D, 3D or Rect"; - }; + } if (info.multisampled != 0) { @@ -1385,9 +1388,10 @@ spv_result_t ValidateImageQueryFormatOrOrder(ValidationState_t& _, spv_result_t ValidateImageQueryLod(ValidationState_t& _, const Instruction* inst) { - _.current_function().RegisterExecutionModelLimitation( - SpvExecutionModelFragment, - "OpImageQueryLod requires Fragment execution model"); + _.function(inst->function()->id()) + ->RegisterExecutionModelLimitation( + SpvExecutionModelFragment, + "OpImageQueryLod requires Fragment execution model"); const uint32_t result_type = inst->type_id(); if (!_.IsFloatVectorType(result_type)) { @@ -1510,9 +1514,10 @@ spv_result_t ValidateImageSparseTexelsResident(ValidationState_t& _, spv_result_t ImagePass(ValidationState_t& _, const Instruction* inst) { const SpvOp opcode = inst->opcode(); if (IsImplicitLod(opcode)) { - _.current_function().RegisterExecutionModelLimitation( - SpvExecutionModelFragment, - "ImplicitLod instructions require Fragment execution model"); + _.function(inst->function()->id()) + ->RegisterExecutionModelLimitation( + SpvExecutionModelFragment, + "ImplicitLod instructions require Fragment execution model"); } switch (opcode) { diff --git a/third_party/spirv-tools/source/val/validate_instruction.cpp b/third_party/spirv-tools/source/val/validate_instruction.cpp index 33e1bc771f..85995caa3e 100644 --- a/third_party/spirv-tools/source/val/validate_instruction.cpp +++ b/third_party/spirv-tools/source/val/validate_instruction.cpp @@ -18,9 +18,9 @@ #include #include - #include #include +#include #include "source/binary.h" #include "source/diagnostic.h" diff --git a/third_party/spirv-tools/source/val/validate_interfaces.cpp b/third_party/spirv-tools/source/val/validate_interfaces.cpp index 354e4be487..b5d680e501 100644 --- a/third_party/spirv-tools/source/val/validate_interfaces.cpp +++ b/third_party/spirv-tools/source/val/validate_interfaces.cpp @@ -15,6 +15,7 @@ #include "source/val/validate.h" #include +#include #include "source/diagnostic.h" #include "source/val/function.h" diff --git a/third_party/spirv-tools/source/val/validate_memory.cpp b/third_party/spirv-tools/source/val/validate_memory.cpp index 7f0f578824..18c3cca0f3 100644 --- a/third_party/spirv-tools/source/val/validate_memory.cpp +++ b/third_party/spirv-tools/source/val/validate_memory.cpp @@ -15,6 +15,8 @@ #include "source/val/validate.h" #include +#include +#include #include "source/opcode.h" #include "source/val/instruction.h" @@ -314,96 +316,87 @@ spv_result_t ValidateCopyMemory(ValidationState_t& _, const Instruction& inst) { } const auto target_pointer_type = _.FindDef(target->type_id()); - assert(target_pointer_type); - const auto target_type = _.FindDef(target_pointer_type->words()[3]); - assert(target_type); - const auto source_pointer_type = _.FindDef(source->type_id()); - assert(source_pointer_type); - const auto source_type = _.FindDef(source_pointer_type->words()[3]); - assert(source_type); - if (target_type->id() != source_type->id()) { - return _.diag(SPV_ERROR_INVALID_ID, &inst) - << "OpCopyMemory Target '" << _.getIdName(source_id) - << "'s type does not match Source '" - << _.getIdName(source_type->id()) << "'s type."; - } - return SPV_SUCCESS; -} - -spv_result_t ValidateCopyMemorySized(ValidationState_t& _, - const Instruction& inst) { - const auto target_index = 0; - const auto target_id = inst.GetOperandAs(target_index); - const auto target = _.FindDef(target_id); - if (!target) { + if (!target_pointer_type || + target_pointer_type->opcode() != SpvOpTypePointer) { return _.diag(SPV_ERROR_INVALID_ID, &inst) << "Target operand '" << _.getIdName(target_id) - << "' is not defined."; - } - - const auto source_index = 1; - const auto source_id = inst.GetOperandAs(source_index); - const auto source = _.FindDef(source_id); - if (!source) { - return _.diag(SPV_ERROR_INVALID_ID, &inst) - << "Source operand '" << _.getIdName(source_id) - << "' is not defined."; - } - - const auto size_index = 2; - const auto size_id = inst.GetOperandAs(size_index); - const auto size = _.FindDef(size_id); - if (!size) { - return _.diag(SPV_ERROR_INVALID_ID, &inst) - << "Size operand '" << _.getIdName(size_id) - << "' is not defined."; - } - - const auto target_pointer_type = _.FindDef(target->type_id()); - if (!target_pointer_type || - SpvOpTypePointer != target_pointer_type->opcode()) { - return _.diag(SPV_ERROR_INVALID_ID, &inst) - << "OpCopyMemorySized Target '" << _.getIdName(target_id) << "' is not a pointer."; } + const auto source_pointer_type = _.FindDef(source->type_id()); if (!source_pointer_type || - SpvOpTypePointer != source_pointer_type->opcode()) { + source_pointer_type->opcode() != SpvOpTypePointer) { return _.diag(SPV_ERROR_INVALID_ID, &inst) - << "OpCopyMemorySized Source '" << _.getIdName(source_id) + << "Source operand '" << _.getIdName(source_id) << "' is not a pointer."; } - switch (size->opcode()) { - // TODO: The following opcode's are assumed to be valid, refer to the - // following bug https://cvs.khronos.org/bugzilla/show_bug.cgi?id=13871 for - // clarification - case SpvOpConstant: - case SpvOpSpecConstant: { - auto size_type = _.FindDef(size->type_id()); - assert(size_type); - if (SpvOpTypeInt != size_type->opcode()) { - return _.diag(SPV_ERROR_INVALID_ID, &inst) - << "OpCopyMemorySized Size '" << _.getIdName(size_id) - << "'s type is not an integer type."; - } - } break; - case SpvOpVariable: { - auto pointer_type = _.FindDef(size->type_id()); - assert(pointer_type); - auto size_type = _.FindDef(pointer_type->type_id()); - if (!size_type || SpvOpTypeInt != size_type->opcode()) { - return _.diag(SPV_ERROR_INVALID_ID, &inst) - << "OpCopyMemorySized Size '" << _.getIdName(size_id) - << "'s variable type is not an integer type."; - } - } break; - default: + + if (inst.opcode() == SpvOpCopyMemory) { + const auto target_type = + _.FindDef(target_pointer_type->GetOperandAs(2)); + if (!target_type || target_type->opcode() == SpvOpTypeVoid) { return _.diag(SPV_ERROR_INVALID_ID, &inst) - << "OpCopyMemorySized Size '" << _.getIdName(size_id) - << "' is not a constant or variable."; + << "Target operand '" << _.getIdName(target_id) + << "' cannot be a void pointer."; + } + + const auto source_type = + _.FindDef(source_pointer_type->GetOperandAs(2)); + if (!source_type || source_type->opcode() == SpvOpTypeVoid) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "Source operand '" << _.getIdName(source_id) + << "' cannot be a void pointer."; + } + + if (target_type->id() != source_type->id()) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "Target '" << _.getIdName(source_id) + << "'s type does not match Source '" + << _.getIdName(source_type->id()) << "'s type."; + } + } else { + const auto size_id = inst.GetOperandAs(2); + const auto size = _.FindDef(size_id); + if (!size) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "Size operand '" << _.getIdName(size_id) + << "' is not defined."; + } + + const auto size_type = _.FindDef(size->type_id()); + if (!_.IsIntScalarType(size_type->id())) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "Size operand '" << _.getIdName(size_id) + << "' must be a scalar integer type."; + } + + bool is_zero = true; + switch (size->opcode()) { + case SpvOpConstantNull: + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "Size operand '" << _.getIdName(size_id) + << "' cannot be a constant zero."; + case SpvOpConstant: + if (size_type->word(3) == 1 && + size->word(size->words().size() - 1) & 0x80000000) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "Size operand '" << _.getIdName(size_id) + << "' cannot have the sign bit set to 1."; + } + for (size_t i = 3; is_zero && i < size->words().size(); ++i) { + is_zero &= (size->word(i) == 0); + } + if (is_zero) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "Size operand '" << _.getIdName(size_id) + << "' cannot be a constant zero."; + } + break; + default: + // Cannot infer any other opcodes. + break; + } } - // TODO: Check that consant is a least size 1, see the same bug as above for - // clarification? return SPV_SUCCESS; } @@ -574,10 +567,8 @@ spv_result_t ValidateMemoryInstructions(ValidationState_t& _, if (auto error = ValidateStore(_, *inst)) return error; break; case SpvOpCopyMemory: - if (auto error = ValidateCopyMemory(_, *inst)) return error; - break; case SpvOpCopyMemorySized: - if (auto error = ValidateCopyMemorySized(_, *inst)) return error; + if (auto error = ValidateCopyMemory(_, *inst)) return error; break; case SpvOpAccessChain: case SpvOpInBoundsAccessChain: diff --git a/third_party/spirv-tools/source/val/validate_mode_setting.cpp b/third_party/spirv-tools/source/val/validate_mode_setting.cpp new file mode 100644 index 0000000000..60e7c0a1d1 --- /dev/null +++ b/third_party/spirv-tools/source/val/validate_mode_setting.cpp @@ -0,0 +1,91 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +#include "source/val/validate.h" + +#include + +#include "source/opcode.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { +namespace { + +spv_result_t ValidateEntryPoint(ValidationState_t& _, const Instruction* inst) { + const auto entry_point_id = inst->GetOperandAs(1); + auto entry_point = _.FindDef(entry_point_id); + if (!entry_point || SpvOpFunction != entry_point->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpEntryPoint Entry Point '" << _.getIdName(entry_point_id) + << "' is not a function."; + } + // don't check kernel function signatures + const SpvExecutionModel execution_model = + inst->GetOperandAs(0); + if (execution_model != SpvExecutionModelKernel) { + // TODO: Check the entry point signature is void main(void), may be subject + // to change + const auto entry_point_type_id = entry_point->GetOperandAs(3); + const auto entry_point_type = _.FindDef(entry_point_type_id); + if (!entry_point_type || 3 != entry_point_type->words().size()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpEntryPoint Entry Point '" << _.getIdName(entry_point_id) + << "'s function parameter count is not zero."; + } + } + + auto return_type = _.FindDef(entry_point->type_id()); + if (!return_type || SpvOpTypeVoid != return_type->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpEntryPoint Entry Point '" << _.getIdName(entry_point_id) + << "'s function return type is not void."; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateExecutionMode(ValidationState_t& _, + const Instruction* inst) { + const auto entry_point_id = inst->GetOperandAs(0); + const auto found = std::find(_.entry_points().cbegin(), + _.entry_points().cend(), entry_point_id); + if (found == _.entry_points().cend()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpExecutionMode Entry Point '" + << _.getIdName(entry_point_id) + << "' is not the Entry Point " + "operand of an OpEntryPoint."; + } + return SPV_SUCCESS; +} + +} // namespace + +spv_result_t ModeSettingPass(ValidationState_t& _, const Instruction* inst) { + switch (inst->opcode()) { + case SpvOpEntryPoint: + if (auto error = ValidateEntryPoint(_, inst)) return error; + break; + case SpvOpExecutionMode: + if (auto error = ValidateExecutionMode(_, inst)) return error; + break; + default: + break; + } + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/third_party/spirv-tools/source/val/validate_primitives.cpp b/third_party/spirv-tools/source/val/validate_primitives.cpp index 3616cb994a..7d11f2e7a9 100644 --- a/third_party/spirv-tools/source/val/validate_primitives.cpp +++ b/third_party/spirv-tools/source/val/validate_primitives.cpp @@ -35,10 +35,11 @@ spv_result_t PrimitivesPass(ValidationState_t& _, const Instruction* inst) { case SpvOpEndPrimitive: case SpvOpEmitStreamVertex: case SpvOpEndStreamPrimitive: - _.current_function().RegisterExecutionModelLimitation( - SpvExecutionModelGeometry, - std::string(spvOpcodeString(opcode)) + - " instructions require Geometry execution model"); + _.function(inst->function()->id()) + ->RegisterExecutionModelLimitation( + SpvExecutionModelGeometry, + std::string(spvOpcodeString(opcode)) + + " instructions require Geometry execution model"); break; default: break; diff --git a/third_party/spirv-tools/source/val/validate_type.cpp b/third_party/spirv-tools/source/val/validate_type.cpp new file mode 100644 index 0000000000..b0cedcac96 --- /dev/null +++ b/third_party/spirv-tools/source/val/validate_type.cpp @@ -0,0 +1,305 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Ensures type declarations are unique unless allowed by the specification. + +#include "source/val/validate.h" + +#include "source/opcode.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { +namespace { + +// True if the integer constant is > 0. |const_words| are words of the +// constant-defining instruction (either OpConstant or +// OpSpecConstant). typeWords are the words of the constant's-type-defining +// OpTypeInt. +bool AboveZero(const std::vector& const_words, + const std::vector& type_words) { + const uint32_t width = type_words[2]; + const bool is_signed = type_words[3] > 0; + const uint32_t lo_word = const_words[3]; + if (width > 32) { + // The spec currently doesn't allow integers wider than 64 bits. + const uint32_t hi_word = const_words[4]; // Must exist, per spec. + if (is_signed && (hi_word >> 31)) return false; + return (lo_word | hi_word) > 0; + } else { + if (is_signed && (lo_word >> 31)) return false; + return lo_word > 0; + } +} + +// Validates that type declarations are unique, unless multiple declarations +// of the same data type are allowed by the specification. +// (see section 2.8 Types and Variables) +// Doesn't do anything if SPV_VAL_ignore_type_decl_unique was declared in the +// module. +spv_result_t ValidateUniqueness(ValidationState_t& _, const Instruction* inst) { + if (_.HasExtension(Extension::kSPV_VALIDATOR_ignore_type_decl_unique)) + return SPV_SUCCESS; + + const auto opcode = inst->opcode(); + if (opcode != SpvOpTypeArray && opcode != SpvOpTypeRuntimeArray && + opcode != SpvOpTypeStruct && opcode != SpvOpTypePointer && + !_.RegisterUniqueTypeDeclaration(inst)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Duplicate non-aggregate type declarations are not allowed. " + "Opcode: " + << spvOpcodeString(opcode) << " id: " << inst->id(); + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateTypeVector(ValidationState_t& _, const Instruction* inst) { + const auto component_index = 1; + const auto component_id = inst->GetOperandAs(component_index); + const auto component_type = _.FindDef(component_id); + if (!component_type || !spvOpcodeIsScalarType(component_type->opcode())) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpTypeVector Component Type '" << _.getIdName(component_id) + << "' is not a scalar type."; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateTypeMatrix(ValidationState_t& _, const Instruction* inst) { + const auto column_type_index = 1; + const auto column_type_id = inst->GetOperandAs(column_type_index); + const auto column_type = _.FindDef(column_type_id); + if (!column_type || SpvOpTypeVector != column_type->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpTypeMatrix Column Type '" << _.getIdName(column_type_id) + << "' is not a vector."; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateTypeArray(ValidationState_t& _, const Instruction* inst) { + const auto element_type_index = 1; + const auto element_type_id = inst->GetOperandAs(element_type_index); + const auto element_type = _.FindDef(element_type_id); + if (!element_type || !spvOpcodeGeneratesType(element_type->opcode())) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpTypeArray Element Type '" << _.getIdName(element_type_id) + << "' is not a type."; + } + const auto length_index = 2; + const auto length_id = inst->GetOperandAs(length_index); + const auto length = _.FindDef(length_id); + if (!length || !spvOpcodeIsConstant(length->opcode())) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpTypeArray Length '" << _.getIdName(length_id) + << "' is not a scalar constant type."; + } + + // NOTE: Check the initialiser value of the constant + const auto const_inst = length->words(); + const auto const_result_type_index = 1; + const auto const_result_type = _.FindDef(const_inst[const_result_type_index]); + if (!const_result_type || SpvOpTypeInt != const_result_type->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpTypeArray Length '" << _.getIdName(length_id) + << "' is not a constant integer type."; + } + + switch (length->opcode()) { + case SpvOpSpecConstant: + case SpvOpConstant: + if (AboveZero(length->words(), const_result_type->words())) break; + // Else fall through! + case SpvOpConstantNull: { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpTypeArray Length '" << _.getIdName(length_id) + << "' default value must be at least 1."; + } + case SpvOpSpecConstantOp: + // Assume it's OK, rather than try to evaluate the operation. + break; + default: + assert(0 && "bug in spvOpcodeIsConstant() or result type isn't int"); + } + return SPV_SUCCESS; +} + +spv_result_t ValidateTypeRuntimeArray(ValidationState_t& _, + const Instruction* inst) { + const auto element_type_index = 1; + const auto element_id = inst->GetOperandAs(element_type_index); + const auto element_type = _.FindDef(element_id); + if (!element_type || !spvOpcodeGeneratesType(element_type->opcode())) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpTypeRuntimeArray Element Type '" + << _.getIdName(element_id) << "' is not a type."; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateTypeStruct(ValidationState_t& _, const Instruction* inst) { + const uint32_t struct_id = inst->GetOperandAs(0); + for (size_t member_type_index = 1; + member_type_index < inst->operands().size(); ++member_type_index) { + auto member_type_id = inst->GetOperandAs(member_type_index); + auto member_type = _.FindDef(member_type_id); + if (!member_type || !spvOpcodeGeneratesType(member_type->opcode())) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpTypeStruct Member Type '" << _.getIdName(member_type_id) + << "' is not a type."; + } + if (member_type->opcode() == SpvOpTypeVoid) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Structures cannot contain a void type."; + } + if (SpvOpTypeStruct == member_type->opcode() && + _.IsStructTypeWithBuiltInMember(member_type_id)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Structure " << _.getIdName(member_type_id) + << " contains members with BuiltIn decoration. Therefore this " + "structure may not be contained as a member of another " + "structure " + "type. Structure " + << _.getIdName(struct_id) << " contains structure " + << _.getIdName(member_type_id) << "."; + } + if (_.IsForwardPointer(member_type_id)) { + if (member_type->opcode() != SpvOpTypePointer) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Found a forward reference to a non-pointer " + "type in OpTypeStruct instruction."; + } + // If we're dealing with a forward pointer: + // Find out the type that the pointer is pointing to (must be struct) + // word 3 is the of the type being pointed to. + auto type_pointing_to = _.FindDef(member_type->words()[3]); + if (type_pointing_to && type_pointing_to->opcode() != SpvOpTypeStruct) { + // Forward declared operands of a struct may only point to a struct. + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "A forward reference operand in an OpTypeStruct must be an " + "OpTypePointer that points to an OpTypeStruct. " + "Found OpTypePointer that points to Op" + << spvOpcodeString( + static_cast(type_pointing_to->opcode())) + << "."; + } + } + } + std::unordered_set built_in_members; + for (auto decoration : _.id_decorations(struct_id)) { + if (decoration.dec_type() == SpvDecorationBuiltIn && + decoration.struct_member_index() != Decoration::kInvalidMember) { + built_in_members.insert(decoration.struct_member_index()); + } + } + int num_struct_members = static_cast(inst->operands().size() - 1); + int num_builtin_members = static_cast(built_in_members.size()); + if (num_builtin_members > 0 && num_builtin_members != num_struct_members) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "When BuiltIn decoration is applied to a structure-type member, " + "all members of that structure type must also be decorated with " + "BuiltIn (No allowed mixing of built-in variables and " + "non-built-in variables within a single structure). Structure id " + << struct_id << " does not meet this requirement."; + } + if (num_builtin_members > 0) { + _.RegisterStructTypeWithBuiltInMember(struct_id); + } + return SPV_SUCCESS; +} + +spv_result_t ValidateTypePointer(ValidationState_t& _, + const Instruction* inst) { + const auto type_id = inst->GetOperandAs(2); + const auto type = _.FindDef(type_id); + if (!type || !spvOpcodeGeneratesType(type->opcode())) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpTypePointer Type '" << _.getIdName(type_id) + << "' is not a type."; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateTypeFunction(ValidationState_t& _, + const Instruction* inst) { + const auto return_type_id = inst->GetOperandAs(1); + const auto return_type = _.FindDef(return_type_id); + if (!return_type || !spvOpcodeGeneratesType(return_type->opcode())) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpTypeFunction Return Type '" << _.getIdName(return_type_id) + << "' is not a type."; + } + size_t num_args = 0; + for (size_t param_type_index = 2; param_type_index < inst->operands().size(); + ++param_type_index, ++num_args) { + const auto param_id = inst->GetOperandAs(param_type_index); + const auto param_type = _.FindDef(param_id); + if (!param_type || !spvOpcodeGeneratesType(param_type->opcode())) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpTypeFunction Parameter Type '" << _.getIdName(param_id) + << "' is not a type."; + } + } + const uint32_t num_function_args_limit = + _.options()->universal_limits_.max_function_args; + if (num_args > num_function_args_limit) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpTypeFunction may not take more than " + << num_function_args_limit << " arguments. OpTypeFunction '" + << _.getIdName(inst->GetOperandAs(0)) << "' has " + << num_args << " arguments."; + } + return SPV_SUCCESS; +} + +} // namespace + +spv_result_t TypePass(ValidationState_t& _, const Instruction* inst) { + if (!spvOpcodeGeneratesType(inst->opcode())) return SPV_SUCCESS; + + if (auto error = ValidateUniqueness(_, inst)) return error; + + switch (inst->opcode()) { + case SpvOpTypeVector: + if (auto error = ValidateTypeVector(_, inst)) return error; + break; + case SpvOpTypeMatrix: + if (auto error = ValidateTypeMatrix(_, inst)) return error; + break; + case SpvOpTypeArray: + if (auto error = ValidateTypeArray(_, inst)) return error; + break; + case SpvOpTypeRuntimeArray: + if (auto error = ValidateTypeRuntimeArray(_, inst)) return error; + break; + case SpvOpTypeStruct: + if (auto error = ValidateTypeStruct(_, inst)) return error; + break; + case SpvOpTypePointer: + if (auto error = ValidateTypePointer(_, inst)) return error; + break; + case SpvOpTypeFunction: + if (auto error = ValidateTypeFunction(_, inst)) return error; + break; + default: + break; + } + + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/third_party/spirv-tools/source/val/validate_type_unique.cpp b/third_party/spirv-tools/source/val/validate_type_unique.cpp deleted file mode 100644 index 1f4de10548..0000000000 --- a/third_party/spirv-tools/source/val/validate_type_unique.cpp +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Ensures type declarations are unique unless allowed by the specification. - -#include "source/val/validate.h" - -#include "source/diagnostic.h" -#include "source/opcode.h" -#include "source/val/instruction.h" -#include "source/val/validation_state.h" - -namespace spvtools { -namespace val { - -// Validates that type declarations are unique, unless multiple declarations -// of the same data type are allowed by the specification. -// (see section 2.8 Types and Variables) -// Doesn't do anything if SPV_VAL_ignore_type_decl_unique was declared in the -// module. -spv_result_t TypeUniquePass(ValidationState_t& _, const Instruction* inst) { - if (_.HasExtension(Extension::kSPV_VALIDATOR_ignore_type_decl_unique)) - return SPV_SUCCESS; - - const SpvOp opcode = inst->opcode(); - - if (spvOpcodeGeneratesType(opcode)) { - if (opcode == SpvOpTypeArray || opcode == SpvOpTypeRuntimeArray || - opcode == SpvOpTypeStruct || opcode == SpvOpTypePointer) { - // Duplicate declarations of aggregates are allowed. - return SPV_SUCCESS; - } - - if (!_.RegisterUniqueTypeDeclaration(inst)) { - return _.diag(SPV_ERROR_INVALID_DATA, inst) - << "Duplicate non-aggregate type declarations are not allowed." - << " Opcode: " << spvOpcodeString(SpvOp(inst->opcode())) - << " id: " << inst->id(); - } - } - - return SPV_SUCCESS; -} - -} // namespace val -} // namespace spvtools diff --git a/third_party/spirv-tools/source/val/validation_state.cpp b/third_party/spirv-tools/source/val/validation_state.cpp old mode 100755 new mode 100644 index 5c3c384e7c..c2b08e8afc --- a/third_party/spirv-tools/source/val/validation_state.cpp +++ b/third_party/spirv-tools/source/val/validation_state.cpp @@ -12,17 +12,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "val/validation_state.h" +#include "source/val/validation_state.h" #include #include +#include -#include "opcode.h" +#include "source/opcode.h" +#include "source/spirv_target_env.h" +#include "source/val/basic_block.h" +#include "source/val/construct.h" +#include "source/val/function.h" #include "spirv-tools/libspirv.h" -#include "spirv_target_env.h" -#include "val/basic_block.h" -#include "val/construct.h" -#include "val/function.h" namespace spvtools { namespace val { @@ -320,6 +321,12 @@ const Function* ValidationState_t::function(uint32_t id) const { return it->second; } +Function* ValidationState_t::function(uint32_t id) { + auto it = id_to_function_.find(id); + if (it == id_to_function_.end()) return nullptr; + return it->second; +} + bool ValidationState_t::in_function_body() const { return in_function_; } bool ValidationState_t::in_block() const { @@ -455,17 +462,7 @@ spv_result_t ValidationState_t::RegisterFunctionEnd() { Instruction* ValidationState_t::AddOrderedInstruction( const spv_parsed_instruction_t* inst) { - if (in_function_body()) { - ordered_instructions_.emplace_back(inst, ¤t_function(), - current_function().current_block()); - if (in_block() && - spvOpcodeIsBlockTerminator(static_cast(inst->opcode))) { - current_function().current_block()->set_terminator( - &ordered_instructions_.back()); - } - } else { - ordered_instructions_.emplace_back(inst, nullptr, nullptr); - } + ordered_instructions_.emplace_back(inst); ordered_instructions_.back().SetLineNum(ordered_instructions_.size()); return &ordered_instructions_.back(); } diff --git a/third_party/spirv-tools/source/val/validation_state.h b/third_party/spirv-tools/source/val/validation_state.h old mode 100755 new mode 100644 index 3f63047f9b..769985918a --- a/third_party/spirv-tools/source/val/validation_state.h +++ b/third_party/spirv-tools/source/val/validation_state.h @@ -12,9 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_VAL_VALIDATIONSTATE_H_ -#define LIBSPIRV_VAL_VALIDATIONSTATE_H_ +#ifndef SOURCE_VAL_VALIDATION_STATE_H_ +#define SOURCE_VAL_VALIDATION_STATE_H_ +#include #include #include #include @@ -22,17 +23,17 @@ #include #include -#include "assembly_grammar.h" -#include "decoration.h" -#include "diagnostic.h" -#include "disassemble.h" -#include "enum_set.h" -#include "latest_version_spirv_header.h" +#include "source/assembly_grammar.h" +#include "source/diagnostic.h" +#include "source/disassemble.h" +#include "source/enum_set.h" +#include "source/latest_version_spirv_header.h" +#include "source/spirv_definition.h" +#include "source/spirv_validator_options.h" +#include "source/val/decoration.h" +#include "source/val/function.h" +#include "source/val/instruction.h" #include "spirv-tools/libspirv.h" -#include "spirv_definition.h" -#include "spirv_validator_options.h" -#include "val/function.h" -#include "val/instruction.h" namespace spvtools { namespace val { @@ -183,6 +184,7 @@ class ValidationState_t { /// Returns function state with the given id, or nullptr if no such function. const Function* function(uint32_t id) const; + Function* function(uint32_t id); /// Returns true if the called after a function instruction but before the /// function end instruction @@ -647,4 +649,4 @@ class ValidationState_t { } // namespace val } // namespace spvtools -#endif /// LIBSPIRV_VAL_VALIDATIONSTATE_H_ +#endif // SOURCE_VAL_VALIDATION_STATE_H_ diff --git a/third_party/spirv-tools/syntax.md b/third_party/spirv-tools/syntax.md old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/test/CMakeLists.txt b/third_party/spirv-tools/test/CMakeLists.txt old mode 100755 new mode 100644 index 5317e1f1f2..2d2e8b2181 --- a/third_party/spirv-tools/test/CMakeLists.txt +++ b/third_party/spirv-tools/test/CMakeLists.txt @@ -198,16 +198,23 @@ add_spvtools_unittest( add_spvtools_unittest( TARGET bit_stream SRCS bit_stream.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../source/comp/bit_stream.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../source/comp/bit_stream.h LIBS ${SPIRV_TOOLS}) add_spvtools_unittest( TARGET huffman_codec SRCS huffman_codec.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../source/comp/bit_stream.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../source/comp/bit_stream.h + ${CMAKE_CURRENT_SOURCE_DIR}/../source/comp/huffman_codec.h LIBS ${SPIRV_TOOLS}) add_spvtools_unittest( TARGET move_to_front SRCS move_to_front_test.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../source/comp/move_to_front.h + ${CMAKE_CURRENT_SOURCE_DIR}/../source/comp/move_to_front.cpp LIBS ${SPIRV_TOOLS}) add_subdirectory(comp) diff --git a/third_party/spirv-tools/test/assembly_context_test.cpp b/third_party/spirv-tools/test/assembly_context_test.cpp old mode 100755 new mode 100644 index 40ba5bd02b..b6d60b95d9 --- a/third_party/spirv-tools/test/assembly_context_test.cpp +++ b/third_party/spirv-tools/test/assembly_context_test.cpp @@ -12,12 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "unit_spirv.h" - -#include +#include #include +#include "gmock/gmock.h" #include "source/instruction.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/assembly_format_test.cpp b/third_party/spirv-tools/test/assembly_format_test.cpp old mode 100755 new mode 100644 index d760e66b54..59e500b813 --- a/third_party/spirv-tools/test/assembly_format_test.cpp +++ b/third_party/spirv-tools/test/assembly_format_test.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "test_fixture.h" +#include "test/test_fixture.h" namespace svptools { namespace { diff --git a/third_party/spirv-tools/test/binary_destroy_test.cpp b/third_party/spirv-tools/test/binary_destroy_test.cpp old mode 100755 new mode 100644 index 26c559a509..e3870c9f0b --- a/third_party/spirv-tools/test/binary_destroy_test.cpp +++ b/third_party/spirv-tools/test/binary_destroy_test.cpp @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "unit_spirv.h" +#include "test/unit_spirv.h" -#include "test_fixture.h" +#include "test/test_fixture.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/binary_endianness_test.cpp b/third_party/spirv-tools/test/binary_endianness_test.cpp old mode 100755 new mode 100644 index 194d799ad5..3cd405d52d --- a/third_party/spirv-tools/test/binary_endianness_test.cpp +++ b/third_party/spirv-tools/test/binary_endianness_test.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "unit_spirv.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/binary_header_get_test.cpp b/third_party/spirv-tools/test/binary_header_get_test.cpp old mode 100755 new mode 100644 index 751433a144..e771f1a39c --- a/third_party/spirv-tools/test/binary_header_get_test.cpp +++ b/third_party/spirv-tools/test/binary_header_get_test.cpp @@ -13,7 +13,7 @@ // limitations under the License. #include "source/spirv_constant.h" -#include "unit_spirv.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/binary_parse_test.cpp b/third_party/spirv-tools/test/binary_parse_test.cpp old mode 100755 new mode 100644 index fab893773e..7d97001586 --- a/third_party/spirv-tools/test/binary_parse_test.cpp +++ b/third_party/spirv-tools/test/binary_parse_test.cpp @@ -12,16 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include +#include #include #include #include #include "gmock/gmock.h" -#include "latest_version_opencl_std_header.h" -#include "source/message.h" +#include "source/latest_version_opencl_std_header.h" #include "source/table.h" -#include "test_fixture.h" -#include "unit_spirv.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" // Returns true if two spv_parsed_operand_t values are equal. // To use this operator, this definition must appear in the same namespace diff --git a/third_party/spirv-tools/test/binary_strnlen_s_test.cpp b/third_party/spirv-tools/test/binary_strnlen_s_test.cpp old mode 100755 new mode 100644 index 0903465b1f..5f43bde678 --- a/third_party/spirv-tools/test/binary_strnlen_s_test.cpp +++ b/third_party/spirv-tools/test/binary_strnlen_s_test.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "unit_spirv.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/binary_to_text.literal_test.cpp b/third_party/spirv-tools/test/binary_to_text.literal_test.cpp old mode 100755 new mode 100644 index 65b98d2657..bcfb0f016d --- a/third_party/spirv-tools/test/binary_to_text.literal_test.cpp +++ b/third_party/spirv-tools/test/binary_to_text.literal_test.cpp @@ -12,10 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "unit_spirv.h" +#include +#include +#include #include "gmock/gmock.h" -#include "test_fixture.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/binary_to_text_test.cpp b/third_party/spirv-tools/test/binary_to_text_test.cpp old mode 100755 new mode 100644 index 291b0e1867..016041f492 --- a/third_party/spirv-tools/test/binary_to_text_test.cpp +++ b/third_party/spirv-tools/test/binary_to_text_test.cpp @@ -12,14 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "unit_spirv.h" - #include +#include +#include +#include #include "gmock/gmock.h" - #include "source/spirv_constant.h" -#include "test_fixture.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/bit_stream.cpp b/third_party/spirv-tools/test/bit_stream.cpp old mode 100755 new mode 100644 index eca5802ea6..f02faf3c6e --- a/third_party/spirv-tools/test/bit_stream.cpp +++ b/third_party/spirv-tools/test/bit_stream.cpp @@ -12,23 +12,88 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include +#include #include #include "gmock/gmock.h" -#include "util/bit_stream.h" +#include "source/comp/bit_stream.h" namespace spvtools { -namespace utils { +namespace comp { namespace { +// Converts |buffer| to a stream of '0' and '1'. +template +std::string BufferToStream(const std::vector& buffer) { + std::stringstream ss; + for (auto it = buffer.begin(); it != buffer.end(); ++it) { + std::string str = std::bitset(*it).to_string(); + // Strings generated by std::bitset::to_string are read right to left. + // Reversing to left to right. + std::reverse(str.begin(), str.end()); + ss << str; + } + return ss.str(); +} + +// Converts a left-to-right input string of '0' and '1' to a buffer of |T| +// words. +template +std::vector StreamToBuffer(std::string str) { + // The input string is left-to-right, the input argument of std::bitset needs + // to right-to-left. Instead of reversing tokens, reverse the entire string + // and iterate tokens from end to begin. + std::reverse(str.begin(), str.end()); + const int word_size = static_cast(sizeof(T) * 8); + const int str_length = static_cast(str.length()); + std::vector buffer; + buffer.reserve(NumBitsToNumWords(str.length())); + for (int index = str_length - word_size; index >= 0; index -= word_size) { + buffer.push_back(static_cast( + std::bitset(str, index, word_size).to_ullong())); + } + const size_t suffix_length = str.length() % word_size; + if (suffix_length != 0) { + buffer.push_back(static_cast( + std::bitset(str, 0, suffix_length).to_ullong())); + } + return buffer; +} + +// Adds '0' chars at the end of the string until the size is a multiple of N. +template +std::string PadToWord(std::string&& str) { + const size_t tail_length = str.size() % N; + if (tail_length != 0) str += std::string(N - tail_length, '0'); + return std::move(str); +} + +// Adds '0' chars at the end of the string until the size is a multiple of N. +template +std::string PadToWord(const std::string& str) { + return PadToWord(std::string(str)); +} + +// Converts a left-to-right stream of bits to std::bitset. +template +std::bitset StreamToBitset(std::string str) { + std::reverse(str.begin(), str.end()); + return std::bitset(str); +} + +// Converts a left-to-right stream of bits to uint64. +uint64_t StreamToBits(std::string str) { + std::reverse(str.begin(), str.end()); + return std::bitset<64>(str).to_ullong(); +} + // A simple and inefficient implementatition of BitWriterInterface, // using std::stringstream. Intended for tests only. class BitWriterStringStream : public BitWriterInterface { public: - void WriteStream(const std::string& bits) override { ss_ << bits; } - void WriteBits(uint64_t bits, size_t num_bits) override { assert(num_bits <= 64); ss_ << BitsToStream(bits, num_bits); @@ -71,52 +136,11 @@ class BitReaderFromString : public BitReaderInterface { bool ReachedEnd() const override { return pos_ >= str_.length(); } - const std::string& GetStreamPadded64() const { return str_; } - private: std::string str_; size_t pos_; }; -TEST(Log2U16, Test) { - EXPECT_EQ(0u, Log2U64(0)); - EXPECT_EQ(0u, Log2U64(1)); - EXPECT_EQ(1u, Log2U64(2)); - EXPECT_EQ(1u, Log2U64(3)); - EXPECT_EQ(2u, Log2U64(4)); - EXPECT_EQ(2u, Log2U64(5)); - EXPECT_EQ(2u, Log2U64(6)); - EXPECT_EQ(2u, Log2U64(7)); - EXPECT_EQ(3u, Log2U64(8)); - EXPECT_EQ(3u, Log2U64(9)); - EXPECT_EQ(3u, Log2U64(10)); - EXPECT_EQ(3u, Log2U64(11)); - EXPECT_EQ(3u, Log2U64(12)); - EXPECT_EQ(3u, Log2U64(13)); - EXPECT_EQ(3u, Log2U64(14)); - EXPECT_EQ(3u, Log2U64(15)); - EXPECT_EQ(4u, Log2U64(16)); - EXPECT_EQ(4u, Log2U64(17)); - EXPECT_EQ(5u, Log2U64(35)); - EXPECT_EQ(6u, Log2U64(72)); - EXPECT_EQ(7u, Log2U64(255)); - EXPECT_EQ(8u, Log2U64(256)); - EXPECT_EQ(15u, Log2U64(65535)); - EXPECT_EQ(16u, Log2U64(65536)); - EXPECT_EQ(19u, Log2U64(0xFFFFF)); - EXPECT_EQ(23u, Log2U64(0xFFFFFF)); - EXPECT_EQ(27u, Log2U64(0xFFFFFFF)); - EXPECT_EQ(31u, Log2U64(0xFFFFFFFF)); - EXPECT_EQ(35u, Log2U64(0xFFFFFFFFF)); - EXPECT_EQ(39u, Log2U64(0xFFFFFFFFFF)); - EXPECT_EQ(43u, Log2U64(0xFFFFFFFFFFF)); - EXPECT_EQ(47u, Log2U64(0xFFFFFFFFFFFF)); - EXPECT_EQ(51u, Log2U64(0xFFFFFFFFFFFFF)); - EXPECT_EQ(55u, Log2U64(0xFFFFFFFFFFFFFF)); - EXPECT_EQ(59u, Log2U64(0xFFFFFFFFFFFFFFF)); - EXPECT_EQ(63u, Log2U64(0xFFFFFFFFFFFFFFFF)); -} - TEST(NumBitsToNumWords, Word8) { EXPECT_EQ(0u, NumBitsToNumWords<8>(0)); EXPECT_EQ(1u, NumBitsToNumWords<8>(1)); @@ -139,34 +163,6 @@ TEST(NumBitsToNumWords, Word64) { EXPECT_EQ(3u, NumBitsToNumWords<64>(129)); } -TEST(ZigZagCoding, Encode) { - EXPECT_EQ(0u, EncodeZigZag(0)); - EXPECT_EQ(1u, EncodeZigZag(-1)); - EXPECT_EQ(2u, EncodeZigZag(1)); - EXPECT_EQ(3u, EncodeZigZag(-2)); - EXPECT_EQ(4u, EncodeZigZag(2)); - EXPECT_EQ(5u, EncodeZigZag(-3)); - EXPECT_EQ(6u, EncodeZigZag(3)); - EXPECT_EQ(std::numeric_limits::max() - 1, - EncodeZigZag(std::numeric_limits::max())); - EXPECT_EQ(std::numeric_limits::max(), - EncodeZigZag(std::numeric_limits::min())); -} - -TEST(ZigZagCoding, Decode) { - EXPECT_EQ(0, DecodeZigZag(0)); - EXPECT_EQ(-1, DecodeZigZag(1)); - EXPECT_EQ(1, DecodeZigZag(2)); - EXPECT_EQ(-2, DecodeZigZag(3)); - EXPECT_EQ(2, DecodeZigZag(4)); - EXPECT_EQ(-3, DecodeZigZag(5)); - EXPECT_EQ(3, DecodeZigZag(6)); - EXPECT_EQ(std::numeric_limits::min(), - DecodeZigZag(std::numeric_limits::max())); - EXPECT_EQ(std::numeric_limits::max(), - DecodeZigZag(std::numeric_limits::max() - 1)); -} - TEST(ZigZagCoding, Encode0) { EXPECT_EQ(0u, EncodeZigZag(0, 0)); EXPECT_EQ(1u, EncodeZigZag(-1, 0)); @@ -189,18 +185,6 @@ TEST(ZigZagCoding, Decode0) { DecodeZigZag(std::numeric_limits::max() - 1, 0)); } -TEST(ZigZagCoding, Decode0SameAsNormalZigZag) { - for (int32_t i = -10000; i < 10000; i += 123) { - ASSERT_EQ(DecodeZigZag(i), DecodeZigZag(i, 0)); - } -} - -TEST(ZigZagCoding, Encode0SameAsNormalZigZag) { - for (uint32_t i = 0; i < 10000; i += 123) { - ASSERT_EQ(EncodeZigZag(i), EncodeZigZag(i, 0)); - } -} - TEST(ZigZagCoding, Encode1) { EXPECT_EQ(0u, EncodeZigZag(0, 1)); EXPECT_EQ(1u, EncodeZigZag(1, 1)); @@ -426,30 +410,6 @@ TEST(BitWriterStringStream, Empty) { EXPECT_EQ("", writer.GetStreamRaw()); } -TEST(BitWriterStringStream, WriteStream) { - BitWriterStringStream writer; - const std::string bits1 = "1011111111111111111"; - writer.WriteStream(bits1); - EXPECT_EQ(19u, writer.GetNumBits()); - EXPECT_EQ(3u, writer.GetDataSizeBytes()); - EXPECT_EQ(bits1, writer.GetStreamRaw()); - - const std::string bits2 = "10100001010101010000111111111111111111111111111"; - writer.WriteStream(bits2); - EXPECT_EQ(66u, writer.GetNumBits()); - EXPECT_EQ(9u, writer.GetDataSizeBytes()); - EXPECT_EQ(bits1 + bits2, writer.GetStreamRaw()); -} - -TEST(BitWriterStringStream, WriteBitSet) { - BitWriterStringStream writer; - const std::string bits1 = "10101"; - writer.WriteBitset(StreamToBitset<16>(bits1)); - EXPECT_EQ(16u, writer.GetNumBits()); - EXPECT_EQ(2u, writer.GetDataSizeBytes()); - EXPECT_EQ(PadToWord<16>(bits1), writer.GetStreamRaw()); -} - TEST(BitWriterStringStream, WriteBits) { BitWriterStringStream writer; const uint64_t bits1 = 0x1 | 0x2 | 0x10; @@ -480,20 +440,19 @@ TEST(BitWriterStringStream, WriteMultiple) { BitWriterStringStream writer; std::string expected_result; - const std::string bits1 = "101001111111001100010000001110001111111100"; - writer.WriteStream(bits1); - const std::string bits2 = "10100011000010010101"; - writer.WriteBitset(StreamToBitset<20>(bits2)); + const uint64_t b2_val = 0x4 | 0x2 | 0x40; + const std::string bits2 = BitsToStream(b2_val, 8); + writer.WriteBits(b2_val, 8); const uint64_t val = 0x1 | 0x2 | 0x10; const std::string bits3 = BitsToStream(val, 8); writer.WriteBits(val, 8); - const std::string expected = bits1 + bits2 + bits3; + const std::string expected = bits2 + bits3; EXPECT_EQ(expected.length(), writer.GetNumBits()); - EXPECT_EQ(9u, writer.GetDataSizeBytes()); + EXPECT_EQ(2u, writer.GetDataSizeBytes()); EXPECT_EQ(expected, writer.GetStreamRaw()); EXPECT_EQ(PadToWord<8>(expected), BufferToStream(writer.GetDataCopy())); @@ -503,46 +462,6 @@ TEST(BitWriterWord64, Empty) { BitWriterWord64 writer; EXPECT_EQ(0u, writer.GetNumBits()); EXPECT_EQ(0u, writer.GetDataSizeBytes()); - EXPECT_EQ("", writer.GetStreamPadded64()); -} - -TEST(BitWriterWord64, WriteStream) { - BitWriterWord64 writer; - std::string expected; - - { - const std::string bits = "101"; - expected += bits; - writer.WriteStream(bits); - EXPECT_EQ(expected.length(), writer.GetNumBits()); - EXPECT_EQ(1u, writer.GetDataSizeBytes()); - EXPECT_EQ(PadToWord<64>(expected), writer.GetStreamPadded64()); - } - - { - const std::string bits = "10000111111111110000000"; - expected += bits; - writer.WriteStream(bits); - EXPECT_EQ(expected.length(), writer.GetNumBits()); - EXPECT_EQ(PadToWord<64>(expected), writer.GetStreamPadded64()); - } - - { - const std::string bits = "101001111111111100000111111111111100"; - expected += bits; - writer.WriteStream(bits); - EXPECT_EQ(expected.length(), writer.GetNumBits()); - EXPECT_EQ(PadToWord<64>(expected), writer.GetStreamPadded64()); - } -} - -TEST(BitWriterWord64, WriteBitset) { - BitWriterWord64 writer; - const std::string bits1 = "10101"; - writer.WriteBitset(StreamToBitset<16>(bits1), 12); - EXPECT_EQ(12u, writer.GetNumBits()); - EXPECT_EQ(2u, writer.GetDataSizeBytes()); - EXPECT_EQ(PadToWord<64>(bits1), writer.GetStreamPadded64()); } TEST(BitWriterWord64, WriteBits) { @@ -553,7 +472,6 @@ TEST(BitWriterWord64, WriteBits) { writer.WriteBits(bits1, 5); EXPECT_EQ(15u, writer.GetNumBits()); EXPECT_EQ(2u, writer.GetDataSizeBytes()); - EXPECT_EQ(PadToWord<64>("110011100111001"), writer.GetStreamPadded64()); } TEST(BitWriterWord64, WriteZeroBits) { @@ -563,18 +481,11 @@ TEST(BitWriterWord64, WriteZeroBits) { EXPECT_EQ(0u, writer.GetNumBits()); writer.WriteBits(1, 1); writer.WriteBits(0, 0); - EXPECT_EQ(PadToWord<64>("1"), writer.GetStreamPadded64()); writer.WriteBits(0, 63); EXPECT_EQ(64u, writer.GetNumBits()); writer.WriteBits(0, 0); writer.WriteBits(7, 3); writer.WriteBits(0, 0); - EXPECT_EQ( - PadToWord<64>( - "1" - "000000000000000000000000000000000000000000000000000000000000000" - "111"), - writer.GetStreamPadded64()); } TEST(BitWriterWord64, ComparisonTestWriteLotsOfBits) { @@ -586,42 +497,6 @@ TEST(BitWriterWord64, ComparisonTestWriteLotsOfBits) { writer2.WriteBits(i, 16); ASSERT_EQ(writer1.GetNumBits(), writer2.GetNumBits()); } - - EXPECT_EQ(PadToWord<64>(writer1.GetStreamRaw()), writer2.GetStreamPadded64()); -} - -TEST(BitWriterWord64, ComparisonTestWriteLotsOfStreams) { - BitWriterStringStream writer1; - BitWriterWord64 writer2(16384); - - for (int i = 0; i < 1000; ++i) { - std::string bits = "1111100000"; - if (i % 2) bits += "101010"; - if (i % 3) bits += "1110100"; - if (i % 5) bits += "1110100111111111111"; - writer1.WriteStream(bits); - writer2.WriteStream(bits); - ASSERT_EQ(writer1.GetNumBits(), writer2.GetNumBits()); - } - - EXPECT_EQ(PadToWord<64>(writer1.GetStreamRaw()), writer2.GetStreamPadded64()); -} - -TEST(BitWriterWord64, ComparisonTestWriteLotsOfBitsets) { - BitWriterStringStream writer1; - BitWriterWord64 writer2(16384); - - for (uint64_t i = 0; i < 65000; i += 25) { - std::bitset<16> bits1(i); - std::bitset<24> bits2(i); - writer1.WriteBitset(bits1); - writer1.WriteBitset(bits2); - writer2.WriteBitset(bits1); - writer2.WriteBitset(bits2); - ASSERT_EQ(writer1.GetNumBits(), writer2.GetNumBits()); - } - - EXPECT_EQ(PadToWord<64>(writer1.GetStreamRaw()), writer2.GetStreamPadded64()); } TEST(GetLowerBits, Test) { @@ -659,7 +534,6 @@ TEST(BitReaderFromString, FromU8) { "10111011"; BitReaderFromString reader(buffer); - EXPECT_EQ(PadToWord<64>(total_stream), reader.GetStreamPadded64()); uint64_t bits = 0; EXPECT_EQ(2u, reader.ReadBits(&bits, 2)); @@ -688,7 +562,6 @@ TEST(BitReaderFromString, FromU64) { "1011101110111011101110111011101110111011101110111011101110111011"; BitReaderFromString reader(buffer); - EXPECT_EQ(total_stream, reader.GetStreamPadded64()); uint64_t bits = 0; size_t pos = 0; @@ -726,40 +599,6 @@ TEST(BitReaderWord64, ReadBitsSingleByte) { EXPECT_TRUE(reader.ReachedEnd()); } -TEST(BitReaderWord64, ReadBitsetSingleByte) { - BitReaderWord64 reader(std::vector({uint8_t(0xCC)})); - std::bitset<4> bits; - EXPECT_EQ(2u, reader.ReadBitset(&bits, 2)); - EXPECT_EQ(0u, bits.to_ullong()); - EXPECT_EQ(2u, reader.ReadBitset(&bits, 2)); - EXPECT_EQ(3u, bits.to_ullong()); - EXPECT_FALSE(reader.OnlyZeroesLeft()); - EXPECT_EQ(4u, reader.ReadBitset(&bits, 4)); - EXPECT_EQ(12u, bits.to_ullong()); - EXPECT_TRUE(reader.OnlyZeroesLeft()); -} - -TEST(BitReaderWord64, ReadStreamSingleByte) { - BitReaderWord64 reader(std::vector({uint8_t(0xAA)})); - EXPECT_EQ("", reader.ReadStream(0)); - EXPECT_EQ("0", reader.ReadStream(1)); - EXPECT_EQ("101", reader.ReadStream(3)); - EXPECT_EQ("01010000", reader.ReadStream(8)); - EXPECT_TRUE(reader.OnlyZeroesLeft()); - EXPECT_EQ("0000000000000000000000000000000000000000000000000000", - reader.ReadStream(64)); - EXPECT_TRUE(reader.ReachedEnd()); -} - -TEST(BitReaderWord64, ReadStreamEmpty) { - std::vector buffer; - BitReaderWord64 reader(std::move(buffer)); - EXPECT_TRUE(reader.OnlyZeroesLeft()); - EXPECT_TRUE(reader.ReachedEnd()); - EXPECT_EQ("", reader.ReadStream(10)); - EXPECT_TRUE(reader.ReachedEnd()); -} - TEST(BitReaderWord64, ReadBitsTwoWords) { std::vector buffer = {0x0000000000000001, 0x0000000000FFFFFF}; @@ -932,37 +771,6 @@ TEST(VariableWidthWrite, Write0U) { "000" "000", writer.GetStreamRaw()); - writer.WriteVariableWidthU8(0, 2); - EXPECT_EQ( - "000" - "000" - "000" - "000", - writer.GetStreamRaw()); -} - -TEST(VariableWidthWrite, Write0S) { - BitWriterStringStream writer; - writer.WriteVariableWidthS64(0, 2, 0); - EXPECT_EQ("000", writer.GetStreamRaw()); - writer.WriteVariableWidthS32(0, 2, 0); - EXPECT_EQ( - "000" - "000", - writer.GetStreamRaw()); - writer.WriteVariableWidthS16(0, 2, 0); - EXPECT_EQ( - "000" - "000" - "000", - writer.GetStreamRaw()); - writer.WriteVariableWidthS8(0, 2, 0); - EXPECT_EQ( - "000" - "000" - "000" - "000", - writer.GetStreamRaw()); } TEST(VariableWidthWrite, WriteSmallUnsigned) { @@ -980,13 +788,6 @@ TEST(VariableWidthWrite, WriteSmallUnsigned) { "010" "110", writer.GetStreamRaw()); - writer.WriteVariableWidthU8(4, 2); - EXPECT_EQ( - "100" - "010" - "110" - "001100", - writer.GetStreamRaw()); } TEST(VariableWidthWrite, WriteSmallSigned) { @@ -998,19 +799,6 @@ TEST(VariableWidthWrite, WriteSmallSigned) { "010" "100", writer.GetStreamRaw()); - writer.WriteVariableWidthS16(3, 2, 0); - EXPECT_EQ( - "010" - "100" - "011100", - writer.GetStreamRaw()); - writer.WriteVariableWidthS8(-4, 2, 0); - EXPECT_EQ( - "010" - "100" - "011100" - "111100", - writer.GetStreamRaw()); } TEST(VariableWidthWrite, U64Val127ChunkLength7) { @@ -1042,16 +830,6 @@ TEST(VariableWidthWrite, U16Val2ChunkLength4) { writer.GetStreamRaw()); } -TEST(VariableWidthWrite, U8Val128ChunkLength7) { - BitWriterStringStream writer; - writer.WriteVariableWidthU8(128, 7); - EXPECT_EQ( - "0000000" - "1" - "1", - writer.GetStreamRaw()); -} - TEST(VariableWidthWrite, U64ValAAAAChunkLength2) { BitWriterStringStream writer; writer.WriteVariableWidthU64(0xAAAA, 2); @@ -1075,16 +853,6 @@ TEST(VariableWidthWrite, U64ValAAAAChunkLength2) { writer.GetStreamRaw()); } -TEST(VariableWidthWrite, S8ValM128ChunkLength7) { - BitWriterStringStream writer; - writer.WriteVariableWidthS8(-128, 7, 0); - EXPECT_EQ( - "1111111" - "1" - "1", - writer.GetStreamRaw()); -} - TEST(VariableWidthRead, U64Val127ChunkLength7) { BitReaderFromString reader( "1111111" @@ -1114,16 +882,6 @@ TEST(VariableWidthRead, U16Val2ChunkLength4) { EXPECT_EQ(2u, val); } -TEST(VariableWidthRead, U8Val128ChunkLength7) { - BitReaderFromString reader( - "0000000" - "1" - "1"); - uint8_t val = 0; - ASSERT_TRUE(reader.ReadVariableWidthU8(&val, 7)); - EXPECT_EQ(128u, val); -} - TEST(VariableWidthRead, U64ValAAAAChunkLength2) { BitReaderFromString reader( "01" @@ -1147,16 +905,6 @@ TEST(VariableWidthRead, U64ValAAAAChunkLength2) { EXPECT_EQ(0xAAAAu, val); } -TEST(VariableWidthRead, S8ValM128ChunkLength7) { - BitReaderFromString reader( - "1111111" - "1" - "1"); - int8_t val = 0; - ASSERT_TRUE(reader.ReadVariableWidthS8(&val, 7, 0)); - EXPECT_EQ(-128, val); -} - TEST(VariableWidthRead, FailTooShort) { BitReaderFromString reader("00000001100000"); uint64_t val = 0; @@ -1213,24 +961,6 @@ TEST(VariableWidthWriteRead, SingleWriteReadU32) { } } -TEST(VariableWidthWriteRead, SingleWriteReadS32) { - for (int32_t i = 0; i < 100000; i += 123) { - const int32_t val = i * (i % 2 ? -i : i); - const size_t chunk_length = i % 16 + 1; - const size_t zigzag_exponent = i % 11; - - BitWriterWord64 writer; - writer.WriteVariableWidthS32(val, chunk_length, zigzag_exponent); - - BitReaderWord64 reader(writer.GetDataCopy()); - int32_t read_val = 0; - ASSERT_TRUE( - reader.ReadVariableWidthS32(&read_val, chunk_length, zigzag_exponent)); - - ASSERT_EQ(val, read_val) << "Chunk length " << chunk_length; - } -} - TEST(VariableWidthWriteRead, SingleWriteReadU16) { for (int i = 0; i < 65536; i += 123) { const uint16_t val = static_cast(i); @@ -1247,58 +977,6 @@ TEST(VariableWidthWriteRead, SingleWriteReadU16) { } } -TEST(VariableWidthWriteRead, SingleWriteReadS16) { - for (int i = -32768; i < 32768; i += 123) { - const int16_t val = static_cast(i); - const size_t chunk_length = std::abs(i) % 10 + 1; - const size_t zigzag_exponent = std::abs(i) % 7; - - BitWriterWord64 writer; - writer.WriteVariableWidthS16(val, chunk_length, zigzag_exponent); - - BitReaderWord64 reader(writer.GetDataCopy()); - int16_t read_val = 0; - ASSERT_TRUE( - reader.ReadVariableWidthS16(&read_val, chunk_length, zigzag_exponent)); - - ASSERT_EQ(val, read_val) << "Chunk length " << chunk_length; - } -} - -TEST(VariableWidthWriteRead, SingleWriteReadU8) { - for (int i = 0; i < 256; ++i) { - const uint8_t val = static_cast(i); - const size_t chunk_length = val % 5 + 1; - - BitWriterWord64 writer; - writer.WriteVariableWidthU8(val, chunk_length); - - BitReaderWord64 reader(writer.GetDataCopy()); - uint8_t read_val = 0; - ASSERT_TRUE(reader.ReadVariableWidthU8(&read_val, chunk_length)); - - ASSERT_EQ(val, read_val) << "Chunk length " << chunk_length; - } -} - -TEST(VariableWidthWriteRead, SingleWriteReadS8) { - for (int i = -128; i < 128; ++i) { - const int8_t val = static_cast(i); - const size_t chunk_length = std::abs(i) % 5 + 1; - const size_t zigzag_exponent = std::abs(i) % 3; - - BitWriterWord64 writer; - writer.WriteVariableWidthS8(val, chunk_length, zigzag_exponent); - - BitReaderWord64 reader(writer.GetDataCopy()); - int8_t read_val = 0; - ASSERT_TRUE( - reader.ReadVariableWidthS8(&read_val, chunk_length, zigzag_exponent)); - - ASSERT_EQ(val, read_val) << "Chunk length " << chunk_length; - } -} - TEST(VariableWidthWriteRead, SmallNumbersChunkLength4) { const std::vector expected_values = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; @@ -1342,70 +1020,6 @@ TEST(VariableWidthWriteRead, VariedNumbersChunkLength8) { EXPECT_EQ(expected_values, actual_values); } -TEST(FixedWidthWrite, Val0Max3) { - BitWriterStringStream writer; - writer.WriteFixedWidth(0, 3); - EXPECT_EQ("00", writer.GetStreamRaw()); -} - -TEST(FixedWidthWrite, Val0Max5) { - BitWriterStringStream writer; - writer.WriteFixedWidth(0, 5); - EXPECT_EQ("000", writer.GetStreamRaw()); -} - -TEST(FixedWidthWrite, Val0Max255) { - BitWriterStringStream writer; - writer.WriteFixedWidth(0, 255); - EXPECT_EQ("00000000", writer.GetStreamRaw()); -} - -TEST(FixedWidthWrite, Val3Max8) { - BitWriterStringStream writer; - writer.WriteFixedWidth(3, 8); - EXPECT_EQ("1100", writer.GetStreamRaw()); -} - -TEST(FixedWidthWrite, Val15Max127) { - BitWriterStringStream writer; - writer.WriteFixedWidth(15, 127); - EXPECT_EQ("1111000", writer.GetStreamRaw()); -} - -TEST(FixedWidthRead, Val0Max3) { - BitReaderFromString reader("0011111"); - uint64_t val = 0; - ASSERT_TRUE(reader.ReadFixedWidth(&val, 3)); - EXPECT_EQ(0u, val); -} - -TEST(FixedWidthRead, Val0Max5) { - BitReaderFromString reader("0001010101"); - uint64_t val = 0; - ASSERT_TRUE(reader.ReadFixedWidth(&val, 5)); - EXPECT_EQ(0u, val); -} - -TEST(FixedWidthRead, Val3Max8) { - BitReaderFromString reader("11001010101"); - uint64_t val = 0; - ASSERT_TRUE(reader.ReadFixedWidth(&val, 8)); - EXPECT_EQ(3u, val); -} - -TEST(FixedWidthRead, Val15Max127) { - BitReaderFromString reader("111100010101"); - uint64_t val = 0; - ASSERT_TRUE(reader.ReadFixedWidth(&val, 127)); - EXPECT_EQ(15u, val); -} - -TEST(FixedWidthRead, Fail) { - BitReaderFromString reader("111100"); - uint64_t val = 0; - ASSERT_FALSE(reader.ReadFixedWidth(&val, 127)); -} - } // namespace -} // namespace utils +} // namespace comp } // namespace spvtools diff --git a/third_party/spirv-tools/test/c_interface_test.cpp b/third_party/spirv-tools/test/c_interface_test.cpp old mode 100755 new mode 100644 index 62dad24e55..1b735be5d7 --- a/third_party/spirv-tools/test/c_interface_test.cpp +++ b/third_party/spirv-tools/test/c_interface_test.cpp @@ -12,11 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - -#include "message.h" +#include "gtest/gtest.h" +#include "source/table.h" #include "spirv-tools/libspirv.h" -#include "table.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/comment_test.cpp b/third_party/spirv-tools/test/comment_test.cpp old mode 100755 new mode 100644 index e95c48460a..f46b72ac58 --- a/third_party/spirv-tools/test/comment_test.cpp +++ b/third_party/spirv-tools/test/comment_test.cpp @@ -12,9 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include + #include "gmock/gmock.h" -#include "test_fixture.h" -#include "unit_spirv.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/comp/CMakeLists.txt b/third_party/spirv-tools/test/comp/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/test/comp/markv_codec_test.cpp b/third_party/spirv-tools/test/comp/markv_codec_test.cpp old mode 100755 new mode 100644 index 2502e329f2..76918f7479 --- a/third_party/spirv-tools/test/comp/markv_codec_test.cpp +++ b/third_party/spirv-tools/test/comp/markv_codec_test.cpp @@ -17,12 +17,13 @@ #include #include #include +#include #include "gmock/gmock.h" #include "source/comp/markv.h" -#include "test_fixture.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" #include "tools/comp/markv_model_factory.h" -#include "unit_spirv.h" namespace spvtools { namespace comp { diff --git a/third_party/spirv-tools/test/cpp_interface_test.cpp b/third_party/spirv-tools/test/cpp_interface_test.cpp old mode 100755 new mode 100644 index b8cbf2d191..bcc2cd6c75 --- a/third_party/spirv-tools/test/cpp_interface_test.cpp +++ b/third_party/spirv-tools/test/cpp_interface_test.cpp @@ -12,9 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include +#include +#include +#include +#include "gmock/gmock.h" +#include "gtest/gtest.h" #include "spirv-tools/optimizer.hpp" #include "spirv/1.1/spirv.h" @@ -24,6 +27,15 @@ namespace { using ::testing::ContainerEq; using ::testing::HasSubstr; +// Return a string that contains the minimum instructions needed to form +// a valid module. Other instructions can be appended to this string. +std::string Header() { + return R"(OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +)"; +} + TEST(CppInterface, SuccessfulRoundTrip) { const std::string input_text = "%2 = OpSizeOf %1 %3\n"; SpirvTools t(SPV_ENV_UNIVERSAL_1_1); @@ -127,10 +139,6 @@ TEST(CppInterface, DisassembleOverloads) { } TEST(CppInterface, SuccessfulValidation) { - const std::string input_text = R"( - OpCapability Shader - OpCapability Linkage - OpMemoryModel Logical GLSL450)"; SpirvTools t(SPV_ENV_UNIVERSAL_1_1); int invocation_count = 0; t.SetMessageConsumer([&invocation_count](spv_message_level_t, const char*, @@ -139,19 +147,15 @@ TEST(CppInterface, SuccessfulValidation) { }); std::vector binary; - EXPECT_TRUE(t.Assemble(input_text, &binary)); + EXPECT_TRUE(t.Assemble(Header(), &binary)); EXPECT_TRUE(t.Validate(binary)); EXPECT_EQ(0, invocation_count); } TEST(CppInterface, ValidateOverloads) { - const std::string input_text = R"( - OpCapability Shader - OpCapability Linkage - OpMemoryModel Logical GLSL450)"; SpirvTools t(SPV_ENV_UNIVERSAL_1_1); std::vector binary; - EXPECT_TRUE(t.Assemble(input_text, &binary)); + EXPECT_TRUE(t.Assemble(Header(), &binary)); { EXPECT_TRUE(t.Validate(binary)); } { EXPECT_TRUE(t.Validate(binary.data(), binary.size())); } @@ -179,11 +183,9 @@ TEST(CppInterface, ValidateEmptyModule) { // with the given number of members. std::string MakeModuleHavingStruct(int num_members) { std::stringstream os; - os << R"(OpCapability Shader - OpCapability Linkage - OpMemoryModel Logical GLSL450 - %1 = OpTypeInt 32 0 - %2 = OpTypeStruct)"; + os << Header(); + os << R"(%1 = OpTypeInt 32 0 + %2 = OpTypeStruct)"; for (int i = 0; i < num_members; i++) os << " %1"; return os.str(); } @@ -217,8 +219,8 @@ TEST(CppInterface, ValidateWithOptionsFail) { // Checks that after running the given optimizer |opt| on the given |original| // source code, we can get the given |optimized| source code. -void CheckOptimization(const char* original, const char* optimized, - const Optimizer& opt) { +void CheckOptimization(const std::string& original, + const std::string& optimized, const Optimizer& opt) { SpirvTools t(SPV_ENV_UNIVERSAL_1_1); std::vector original_binary; ASSERT_TRUE(t.Assemble(original, &original_binary)); @@ -239,29 +241,31 @@ TEST(CppInterface, OptimizeEmptyModule) { Optimizer o(SPV_ENV_UNIVERSAL_1_1); o.RegisterPass(CreateStripDebugInfoPass()); - EXPECT_TRUE(o.Run(binary.data(), binary.size(), &binary)); + + // Fails to validate. + EXPECT_FALSE(o.Run(binary.data(), binary.size(), &binary)); } TEST(CppInterface, OptimizeModifiedModule) { Optimizer o(SPV_ENV_UNIVERSAL_1_1); o.RegisterPass(CreateStripDebugInfoPass()); - CheckOptimization("OpSource GLSL 450", "", o); + CheckOptimization(Header() + "OpSource GLSL 450", Header(), o); } TEST(CppInterface, OptimizeMulitplePasses) { - const char* original_text = - "OpSource GLSL 450 " - "OpDecorate %true SpecId 1 " - "%bool = OpTypeBool " - "%true = OpSpecConstantTrue %bool"; + std::string original_text = Header() + + "OpSource GLSL 450 " + "OpDecorate %true SpecId 1 " + "%bool = OpTypeBool " + "%true = OpSpecConstantTrue %bool"; Optimizer o(SPV_ENV_UNIVERSAL_1_1); o.RegisterPass(CreateStripDebugInfoPass()) .RegisterPass(CreateFreezeSpecConstantValuePass()); - const char* expected_text = - "%bool = OpTypeBool\n" - "%true = OpConstantTrue %bool\n"; + std::string expected_text = Header() + + "%bool = OpTypeBool\n" + "%true = OpConstantTrue %bool\n"; CheckOptimization(original_text, expected_text, o); } @@ -276,7 +280,7 @@ TEST(CppInterface, OptimizeReassignPassToken) { token = CreateStripDebugInfoPass(); CheckOptimization( - "OpSource GLSL 450", "", + Header() + "OpSource GLSL 450", Header(), Optimizer(SPV_ENV_UNIVERSAL_1_1).RegisterPass(std::move(token))); } @@ -285,7 +289,7 @@ TEST(CppInterface, OptimizeMoveConstructPassToken) { Optimizer::PassToken token2(std::move(token1)); CheckOptimization( - "OpSource GLSL 450", "", + Header() + "OpSource GLSL 450", Header(), Optimizer(SPV_ENV_UNIVERSAL_1_1).RegisterPass(std::move(token2))); } @@ -295,14 +299,14 @@ TEST(CppInterface, OptimizeMoveAssignPassToken) { token2 = std::move(token1); CheckOptimization( - "OpSource GLSL 450", "", + Header() + "OpSource GLSL 450", Header(), Optimizer(SPV_ENV_UNIVERSAL_1_1).RegisterPass(std::move(token2))); } TEST(CppInterface, OptimizeSameAddressForOriginalOptimizedBinary) { SpirvTools t(SPV_ENV_UNIVERSAL_1_1); std::vector binary; - ASSERT_TRUE(t.Assemble("OpSource GLSL 450", &binary)); + ASSERT_TRUE(t.Assemble(Header() + "OpSource GLSL 450", &binary)); EXPECT_TRUE(Optimizer(SPV_ENV_UNIVERSAL_1_1) .RegisterPass(CreateStripDebugInfoPass()) @@ -310,7 +314,7 @@ TEST(CppInterface, OptimizeSameAddressForOriginalOptimizedBinary) { std::string optimized_text; EXPECT_TRUE(t.Disassemble(binary, &optimized_text)); - EXPECT_EQ("", optimized_text); + EXPECT_EQ(Header(), optimized_text); } // TODO(antiagainst): tests for SetMessageConsumer(). diff --git a/third_party/spirv-tools/test/diagnostic_test.cpp b/third_party/spirv-tools/test/diagnostic_test.cpp old mode 100755 new mode 100644 index 60f5cbefe6..f86bae1130 --- a/third_party/spirv-tools/test/diagnostic_test.cpp +++ b/third_party/spirv-tools/test/diagnostic_test.cpp @@ -14,9 +14,10 @@ #include #include +#include #include "gmock/gmock.h" -#include "unit_spirv.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/enum_set_test.cpp b/third_party/spirv-tools/test/enum_set_test.cpp old mode 100755 new mode 100644 index f4b2467e9c..ddacd42147 --- a/third_party/spirv-tools/test/enum_set_test.cpp +++ b/third_party/spirv-tools/test/enum_set_test.cpp @@ -12,11 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include +#include #include -#include "gmock/gmock.h" -#include "enum_set.h" -#include "unit_spirv.h" +#include "gmock/gmock.h" +#include "source/enum_set.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/enum_string_mapping_test.cpp b/third_party/spirv-tools/test/enum_string_mapping_test.cpp old mode 100755 new mode 100644 index 94080bd7d0..b525d6014a --- a/third_party/spirv-tools/test/enum_string_mapping_test.cpp +++ b/third_party/spirv-tools/test/enum_string_mapping_test.cpp @@ -15,10 +15,12 @@ // Tests for OpExtension validator rules. #include +#include +#include -#include "enum_string_mapping.h" -#include "extensions.h" #include "gtest/gtest.h" +#include "source/enum_string_mapping.h" +#include "source/extensions.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/ext_inst.debuginfo_test.cpp b/third_party/spirv-tools/test/ext_inst.debuginfo_test.cpp old mode 100755 new mode 100644 index 1810590967..15fa8f7656 --- a/third_party/spirv-tools/test/ext_inst.debuginfo_test.cpp +++ b/third_party/spirv-tools/test/ext_inst.debuginfo_test.cpp @@ -12,11 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "unit_spirv.h" +#include +#include -#include #include "DebugInfo.h" -#include "test_fixture.h" +#include "gmock/gmock.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" // This file tests the correctness of encoding and decoding of instructions // involving the DebugInfo extended instruction set. diff --git a/third_party/spirv-tools/test/ext_inst.glsl_test.cpp b/third_party/spirv-tools/test/ext_inst.glsl_test.cpp old mode 100755 new mode 100644 index e42bc84760..991c487f1a --- a/third_party/spirv-tools/test/ext_inst.glsl_test.cpp +++ b/third_party/spirv-tools/test/ext_inst.glsl_test.cpp @@ -13,10 +13,11 @@ // limitations under the License. #include +#include #include -#include "latest_version_glsl_std_450_header.h" -#include "unit_spirv.h" +#include "source/latest_version_glsl_std_450_header.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/ext_inst.opencl_test.cpp b/third_party/spirv-tools/test/ext_inst.opencl_test.cpp old mode 100755 new mode 100644 index a6950bf697..06bc5e848a --- a/third_party/spirv-tools/test/ext_inst.opencl_test.cpp +++ b/third_party/spirv-tools/test/ext_inst.opencl_test.cpp @@ -12,11 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "unit_spirv.h" +#include +#include -#include -#include "latest_version_opencl_std_header.h" -#include "test_fixture.h" +#include "gmock/gmock.h" +#include "source/latest_version_opencl_std_header.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/fix_word_test.cpp b/third_party/spirv-tools/test/fix_word_test.cpp old mode 100755 new mode 100644 index d7ddffd7da..b8c3a33d53 --- a/third_party/spirv-tools/test/fix_word_test.cpp +++ b/third_party/spirv-tools/test/fix_word_test.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "unit_spirv.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/testing/fuzzers/BUILD.gn b/third_party/spirv-tools/test/fuzzers/BUILD.gn similarity index 67% rename from third_party/spirv-tools/testing/fuzzers/BUILD.gn rename to third_party/spirv-tools/test/fuzzers/BUILD.gn index 718e8f6c9a..df8291a563 100644 --- a/third_party/spirv-tools/testing/fuzzers/BUILD.gn +++ b/third_party/spirv-tools/test/fuzzers/BUILD.gn @@ -33,8 +33,10 @@ if (!build_with_chromium || use_fuzzing_engine) { testonly = true deps = [ - ":spvtools_opt_fuzzer", ":spvtools_val_fuzzer", + ":spvtools_opt_legalization_fuzzer", + ":spvtools_opt_performance_fuzzer", + ":spvtools_opt_size_fuzzer", ] } } @@ -60,9 +62,21 @@ template("spvtools_fuzzer") { } } -spvtools_fuzzer("spvtools_opt_fuzzer_src") { +spvtools_fuzzer("spvtools_opt_performance_fuzzer_src") { sources = [ - "spvtools_opt_fuzzer.cpp", + "spvtools_opt_performance_fuzzer.cpp", + ] +} + +spvtools_fuzzer("spvtools_opt_legalization_fuzzer_src") { + sources = [ + "spvtools_opt_legalization_fuzzer.cpp", + ] +} + +spvtools_fuzzer("spvtools_opt_size_fuzzer_src") { + sources = [ + "spvtools_opt_size_fuzzer.cpp", ] } @@ -73,10 +87,26 @@ spvtools_fuzzer("spvtools_val_fuzzer_src") { } if (!build_with_chromium || use_fuzzing_engine) { - fuzzer_test("spvtools_opt_fuzzer") { + fuzzer_test("spvtools_opt_performance_fuzzer") { sources = [] deps = [ - ":spvtools_opt_fuzzer_src", + ":spvtools_opt_performance_fuzzer_src", + ] + seed_corpus = "corpora/spv" + } + + fuzzer_test("spvtools_opt_legalization_fuzzer") { + sources = [] + deps = [ + ":spvtools_opt_legalization_fuzzer_src", + ] + seed_corpus = "corpora/spv" + } + + fuzzer_test("spvtools_opt_size_fuzzer") { + sources = [] + deps = [ + ":spvtools_opt_size_fuzzer_src", ] seed_corpus = "corpora/spv" } diff --git a/third_party/spirv-tools/testing/fuzzers/corpora/spv/simple.spv b/third_party/spirv-tools/test/fuzzers/corpora/spv/simple.spv similarity index 100% rename from third_party/spirv-tools/testing/fuzzers/corpora/spv/simple.spv rename to third_party/spirv-tools/test/fuzzers/corpora/spv/simple.spv diff --git a/third_party/spirv-tools/test/fuzzers/spvtools_opt_legalization_fuzzer.cpp b/third_party/spirv-tools/test/fuzzers/spvtools_opt_legalization_fuzzer.cpp new file mode 100644 index 0000000000..b45a98c370 --- /dev/null +++ b/third_party/spirv-tools/test/fuzzers/spvtools_opt_legalization_fuzzer.cpp @@ -0,0 +1,38 @@ +// Copyright (c) 2018 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include + +#include "spirv-tools/optimizer.hpp" + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + spvtools::Optimizer optimizer(SPV_ENV_UNIVERSAL_1_3); + optimizer.SetMessageConsumer([](spv_message_level_t, const char*, + const spv_position_t&, const char*) {}); + + std::vector input; + input.resize(size >> 2); + + size_t count = 0; + for (size_t i = 0; (i + 3) < size; i += 4) { + input[count++] = data[i] | (data[i + 1] << 8) | (data[i + 2] << 16) | + (data[i + 3]) << 24; + } + + optimizer.RegisterLegalizationPasses(); + optimizer.Run(input.data(), input.size(), &input); + + return 0; +} diff --git a/third_party/spirv-tools/testing/fuzzers/spvtools_opt_fuzzer.cpp b/third_party/spirv-tools/test/fuzzers/spvtools_opt_performance_fuzzer.cpp similarity index 98% rename from third_party/spirv-tools/testing/fuzzers/spvtools_opt_fuzzer.cpp rename to third_party/spirv-tools/test/fuzzers/spvtools_opt_performance_fuzzer.cpp index 7f94febcc6..6c3bd6aba8 100644 --- a/third_party/spirv-tools/testing/fuzzers/spvtools_opt_fuzzer.cpp +++ b/third_party/spirv-tools/test/fuzzers/spvtools_opt_performance_fuzzer.cpp @@ -13,6 +13,7 @@ // limitations under the License. #include +#include #include "spirv-tools/optimizer.hpp" diff --git a/third_party/spirv-tools/test/fuzzers/spvtools_opt_size_fuzzer.cpp b/third_party/spirv-tools/test/fuzzers/spvtools_opt_size_fuzzer.cpp new file mode 100644 index 0000000000..68c7974774 --- /dev/null +++ b/third_party/spirv-tools/test/fuzzers/spvtools_opt_size_fuzzer.cpp @@ -0,0 +1,38 @@ +// Copyright (c) 2018 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include + +#include "spirv-tools/optimizer.hpp" + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + spvtools::Optimizer optimizer(SPV_ENV_UNIVERSAL_1_3); + optimizer.SetMessageConsumer([](spv_message_level_t, const char*, + const spv_position_t&, const char*) {}); + + std::vector input; + input.resize(size >> 2); + + size_t count = 0; + for (size_t i = 0; (i + 3) < size; i += 4) { + input[count++] = data[i] | (data[i + 1] << 8) | (data[i + 2] << 16) | + (data[i + 3]) << 24; + } + + optimizer.RegisterSizePasses(); + optimizer.Run(input.data(), input.size(), &input); + + return 0; +} diff --git a/third_party/spirv-tools/testing/fuzzers/spvtools_val_fuzzer.cpp b/third_party/spirv-tools/test/fuzzers/spvtools_val_fuzzer.cpp similarity index 98% rename from third_party/spirv-tools/testing/fuzzers/spvtools_val_fuzzer.cpp rename to third_party/spirv-tools/test/fuzzers/spvtools_val_fuzzer.cpp index 9b06a1f65f..5dc4303b45 100644 --- a/third_party/spirv-tools/testing/fuzzers/spvtools_val_fuzzer.cpp +++ b/third_party/spirv-tools/test/fuzzers/spvtools_val_fuzzer.cpp @@ -13,6 +13,7 @@ // limitations under the License. #include +#include #include "spirv-tools/libspirv.hpp" diff --git a/third_party/spirv-tools/test/generator_magic_number_test.cpp b/third_party/spirv-tools/test/generator_magic_number_test.cpp old mode 100755 new mode 100644 index 9e49dae7b6..bc5fdf57a5 --- a/third_party/spirv-tools/test/generator_magic_number_test.cpp +++ b/third_party/spirv-tools/test/generator_magic_number_test.cpp @@ -12,11 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "unit_spirv.h" - -#include +#include +#include +#include +#include +#include "gmock/gmock.h" #include "source/opcode.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/hex_float_test.cpp b/third_party/spirv-tools/test/hex_float_test.cpp old mode 100755 new mode 100644 index dc21d16d91..6b805f34ca --- a/third_party/spirv-tools/test/hex_float_test.cpp +++ b/third_party/spirv-tools/test/hex_float_test.cpp @@ -15,14 +15,16 @@ #include #include #include +#include #include #include #include +#include +#include -#include - +#include "gmock/gmock.h" #include "source/util/hex_float.h" -#include "unit_spirv.h" +#include "test/unit_spirv.h" namespace spvtools { namespace utils { diff --git a/third_party/spirv-tools/test/huffman_codec.cpp b/third_party/spirv-tools/test/huffman_codec.cpp old mode 100755 new mode 100644 index defb773368..58a7810613 --- a/third_party/spirv-tools/test/huffman_codec.cpp +++ b/third_party/spirv-tools/test/huffman_codec.cpp @@ -12,19 +12,20 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Contains utils for reading, writing and debug printing bit streams. - +#include #include #include #include #include +#include +#include #include "gmock/gmock.h" -#include "util/bit_stream.h" -#include "util/huffman_codec.h" +#include "source/comp/bit_stream.h" +#include "source/comp/huffman_codec.h" namespace spvtools { -namespace utils { +namespace comp { namespace { const std::map& GetTestSet() { @@ -312,5 +313,5 @@ TEST(Huffman, CreateFromTextU64) { } } // namespace -} // namespace utils +} // namespace comp } // namespace spvtools diff --git a/third_party/spirv-tools/test/immediate_int_test.cpp b/third_party/spirv-tools/test/immediate_int_test.cpp old mode 100755 new mode 100644 index b26a7af76f..393075a4e7 --- a/third_party/spirv-tools/test/immediate_int_test.cpp +++ b/third_party/spirv-tools/test/immediate_int_test.cpp @@ -16,10 +16,9 @@ #include #include -#include - +#include "gmock/gmock.h" #include "source/util/bitutils.h" -#include "test_fixture.h" +#include "test/test_fixture.h" namespace spvtools { namespace utils { diff --git a/third_party/spirv-tools/test/libspirv_macros_test.cpp b/third_party/spirv-tools/test/libspirv_macros_test.cpp old mode 100755 new mode 100644 index edb46c3614..bf5add671a --- a/third_party/spirv-tools/test/libspirv_macros_test.cpp +++ b/third_party/spirv-tools/test/libspirv_macros_test.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "unit_spirv.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/link/CMakeLists.txt b/third_party/spirv-tools/test/link/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/test/link/binary_version_test.cpp b/third_party/spirv-tools/test/link/binary_version_test.cpp old mode 100755 new mode 100644 index 89f39476f9..0ceeebae25 --- a/third_party/spirv-tools/test/link/binary_version_test.cpp +++ b/third_party/spirv-tools/test/link/binary_version_test.cpp @@ -12,8 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include + #include "gmock/gmock.h" -#include "linker_fixture.h" +#include "test/link/linker_fixture.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/link/entry_points_test.cpp b/third_party/spirv-tools/test/link/entry_points_test.cpp old mode 100755 new mode 100644 index 632cde3eff..bac8e02ef6 --- a/third_party/spirv-tools/test/link/entry_points_test.cpp +++ b/third_party/spirv-tools/test/link/entry_points_test.cpp @@ -12,8 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include + #include "gmock/gmock.h" -#include "linker_fixture.h" +#include "test/link/linker_fixture.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/link/global_values_amount_test.cpp b/third_party/spirv-tools/test/link/global_values_amount_test.cpp old mode 100755 new mode 100644 index d0d953d37f..2c4ee1f03d --- a/third_party/spirv-tools/test/link/global_values_amount_test.cpp +++ b/third_party/spirv-tools/test/link/global_values_amount_test.cpp @@ -12,8 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include + #include "gmock/gmock.h" -#include "linker_fixture.h" +#include "test/link/linker_fixture.h" namespace spvtools { namespace { @@ -24,7 +26,7 @@ class EntryPointsAmountTest : public spvtest::LinkerTest { public: EntryPointsAmountTest() { binaries.reserve(0xFFFF); } - virtual void SetUp() override { + void SetUp() override { binaries.push_back({SpvMagicNumber, SpvVersion, SPV_GENERATOR_CODEPLAY, @@ -101,7 +103,7 @@ class EntryPointsAmountTest : public spvtest::LinkerTest { binaries.push_back(binary); } } - virtual void TearDown() override { binaries.clear(); } + void TearDown() override { binaries.clear(); } spvtest::Binaries binaries; }; diff --git a/third_party/spirv-tools/test/link/ids_limit_test.cpp b/third_party/spirv-tools/test/link/ids_limit_test.cpp old mode 100755 new mode 100644 index a89ffe414b..6d7815a24d --- a/third_party/spirv-tools/test/link/ids_limit_test.cpp +++ b/third_party/spirv-tools/test/link/ids_limit_test.cpp @@ -12,8 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include + #include "gmock/gmock.h" -#include "linker_fixture.h" +#include "test/link/linker_fixture.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/link/linker_fixture.h b/third_party/spirv-tools/test/link/linker_fixture.h old mode 100755 new mode 100644 index a1e3ec8662..303f1bfd57 --- a/third_party/spirv-tools/test/link/linker_fixture.h +++ b/third_party/spirv-tools/test/link/linker_fixture.h @@ -12,15 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_TEST_LINK_LINK_TEST -#define LIBSPIRV_TEST_LINK_LINK_TEST +#ifndef TEST_LINK_LINKER_FIXTURE_H_ +#define TEST_LINK_LINKER_FIXTURE_H_ #include +#include +#include #include "source/spirv_constant.h" -#include "unit_spirv.h" - #include "spirv-tools/linker.hpp" +#include "test/unit_spirv.h" namespace spvtest { @@ -60,7 +61,7 @@ class LinkerTest : public ::testing::Test { tools_.SetMessageConsumer(consumer); } - virtual void TearDown() override { error_message_.clear(); } + void TearDown() override { error_message_.clear(); } // Assembles each of the given strings into SPIR-V binaries before linking // them together. SPV_ERROR_INVALID_TEXT is returned if the assembling failed @@ -121,4 +122,4 @@ class LinkerTest : public ::testing::Test { } // namespace spvtest -#endif // LIBSPIRV_TEST_LINK_LINK_TEST +#endif // TEST_LINK_LINKER_FIXTURE_H_ diff --git a/third_party/spirv-tools/test/link/matching_imports_to_exports_test.cpp b/third_party/spirv-tools/test/link/matching_imports_to_exports_test.cpp old mode 100755 new mode 100644 index b1ee7ed451..59e62d51b8 --- a/third_party/spirv-tools/test/link/matching_imports_to_exports_test.cpp +++ b/third_party/spirv-tools/test/link/matching_imports_to_exports_test.cpp @@ -12,8 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include + #include "gmock/gmock.h" -#include "linker_fixture.h" +#include "test/link/linker_fixture.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/link/memory_model_test.cpp b/third_party/spirv-tools/test/link/memory_model_test.cpp old mode 100755 new mode 100644 index 4e2cfaf2af..2add5046c7 --- a/third_party/spirv-tools/test/link/memory_model_test.cpp +++ b/third_party/spirv-tools/test/link/memory_model_test.cpp @@ -12,8 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include + #include "gmock/gmock.h" -#include "linker_fixture.h" +#include "test/link/linker_fixture.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/link/partial_linkage_test.cpp b/third_party/spirv-tools/test/link/partial_linkage_test.cpp old mode 100755 new mode 100644 index c2cb5fd539..c43b06e55a --- a/third_party/spirv-tools/test/link/partial_linkage_test.cpp +++ b/third_party/spirv-tools/test/link/partial_linkage_test.cpp @@ -12,8 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include + #include "gmock/gmock.h" -#include "linker_fixture.h" +#include "test/link/linker_fixture.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/link/unique_ids_test.cpp b/third_party/spirv-tools/test/link/unique_ids_test.cpp old mode 100755 new mode 100644 index f95f801fad..55c70ea670 --- a/third_party/spirv-tools/test/link/unique_ids_test.cpp +++ b/third_party/spirv-tools/test/link/unique_ids_test.cpp @@ -12,8 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include +#include + #include "gmock/gmock.h" -#include "linker_fixture.h" +#include "test/link/linker_fixture.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/log_test.cpp b/third_party/spirv-tools/test/log_test.cpp old mode 100755 new mode 100644 index eeaf7de0ed..ec66aa1ece --- a/third_party/spirv-tools/test/log_test.cpp +++ b/third_party/spirv-tools/test/log_test.cpp @@ -12,11 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include - -#include "message.h" -#include "opt/log.h" +#include "source/opt/log.h" +#include "gmock/gmock.h" +#include "gtest/gtest.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/move_to_front_test.cpp b/third_party/spirv-tools/test/move_to_front_test.cpp old mode 100755 new mode 100644 index dfe9b0e15d..c95d38656c --- a/third_party/spirv-tools/test/move_to_front_test.cpp +++ b/third_party/spirv-tools/test/move_to_front_test.cpp @@ -15,16 +15,18 @@ #include #include #include +#include +#include #include "gmock/gmock.h" -#include "util/move_to_front.h" +#include "source/comp/move_to_front.h" namespace spvtools { -namespace utils { +namespace comp { namespace { // Class used to test the inner workings of MoveToFront. -class MoveToFrontTester : public MoveToFront { +class MoveToFrontTester : public MoveToFront { public: // Inserts the value in the internal tree data structure. For testing only. void TestInsert(uint32_t val) { InsertNode(CreateNode(val, val)); } @@ -821,122 +823,6 @@ TEST(MoveToFront, LargerScale) { ASSERT_EQ(1000u, value); } -TEST(MoveToFront, String) { - MoveToFront mtf; - - EXPECT_TRUE(mtf.Insert("AAA")); - EXPECT_TRUE(mtf.Insert("BBB")); - EXPECT_TRUE(mtf.Insert("CCC")); - EXPECT_FALSE(mtf.Insert("AAA")); - - EXPECT_TRUE(mtf.HasValue("AAA")); - EXPECT_FALSE(mtf.HasValue("DDD")); - - std::string value; - EXPECT_TRUE(mtf.ValueFromRank(2, &value)); - EXPECT_EQ("BBB", value); - - EXPECT_TRUE(mtf.ValueFromRank(2, &value)); - EXPECT_EQ("CCC", value); - - uint32_t rank = 0; - EXPECT_TRUE(mtf.RankFromValue("AAA", &rank)); - EXPECT_EQ(3u, rank); - - EXPECT_FALSE(mtf.ValueFromRank(0, &value)); - EXPECT_FALSE(mtf.RankFromValue("ABC", &rank)); - EXPECT_FALSE(mtf.Remove("ABC")); - - EXPECT_TRUE(mtf.Remove("AAA")); - EXPECT_FALSE(mtf.Remove("AAA")); - EXPECT_FALSE(mtf.RankFromValue("AAA", &rank)); - - EXPECT_TRUE(mtf.Insert("AAA")); - EXPECT_TRUE(mtf.RankFromValue("AAA", &rank)); - EXPECT_EQ(1u, rank); - - EXPECT_TRUE(mtf.Promote("BBB")); - EXPECT_TRUE(mtf.RankFromValue("BBB", &rank)); - EXPECT_EQ(1u, rank); -} - -TEST(MultiMoveToFront, Empty) { - MultiMoveToFront multi_mtf; - - uint32_t rank = 0; - std::string value; - - EXPECT_EQ(0u, multi_mtf.GetSize(1001)); - EXPECT_FALSE(multi_mtf.RankFromValue(1001, "AAA", &rank)); - EXPECT_FALSE(multi_mtf.ValueFromRank(1001, 1, &value)); - EXPECT_FALSE(multi_mtf.HasValue(1001, "AAA")); - EXPECT_FALSE(multi_mtf.Remove(1001, "AAA")); -} - -TEST(MultiMoveToFront, TwoSequences) { - MultiMoveToFront multi_mtf; - - uint32_t rank = 0; - std::string value; - - EXPECT_TRUE(multi_mtf.Insert(1001, "AAA")); - - EXPECT_EQ(1u, multi_mtf.GetSize(1001)); - EXPECT_EQ(0u, multi_mtf.GetSize(1002)); - EXPECT_TRUE(multi_mtf.HasValue(1001, "AAA")); - EXPECT_FALSE(multi_mtf.HasValue(1002, "AAA")); - - EXPECT_TRUE(multi_mtf.RankFromValue(1001, "AAA", &rank)); - EXPECT_EQ(1u, rank); - EXPECT_FALSE(multi_mtf.RankFromValue(1002, "AAA", &rank)); - - EXPECT_TRUE(multi_mtf.ValueFromRank(1001, rank, &value)); - EXPECT_EQ("AAA", value); - EXPECT_FALSE(multi_mtf.ValueFromRank(1002, rank, &value)); - - EXPECT_TRUE(multi_mtf.Insert(1001, "BBB")); - - EXPECT_EQ(2u, multi_mtf.GetSize(1001)); - EXPECT_EQ(0u, multi_mtf.GetSize(1002)); - EXPECT_TRUE(multi_mtf.HasValue(1001, "BBB")); - EXPECT_FALSE(multi_mtf.HasValue(1002, "BBB")); - - EXPECT_TRUE(multi_mtf.RankFromValue(1001, "BBB", &rank)); - EXPECT_EQ(1u, rank); - EXPECT_FALSE(multi_mtf.RankFromValue(1002, "BBB", &rank)); - - EXPECT_TRUE(multi_mtf.ValueFromRank(1001, rank, &value)); - EXPECT_EQ("BBB", value); - EXPECT_FALSE(multi_mtf.ValueFromRank(1002, rank, &value)); - - EXPECT_TRUE(multi_mtf.Insert(1002, "AAA")); - - EXPECT_EQ(2u, multi_mtf.GetSize(1001)); - EXPECT_EQ(1u, multi_mtf.GetSize(1002)); - EXPECT_TRUE(multi_mtf.HasValue(1002, "AAA")); - - EXPECT_TRUE(multi_mtf.RankFromValue(1002, "AAA", &rank)); - EXPECT_EQ(1u, rank); - - EXPECT_TRUE(multi_mtf.RankFromValue(1001, "AAA", &rank)); - EXPECT_EQ(2u, rank); - - multi_mtf.Promote("BBB"); - - EXPECT_TRUE(multi_mtf.RankFromValue(1001, "BBB", &rank)); - EXPECT_EQ(1u, rank); - - EXPECT_TRUE(multi_mtf.Insert(1002, "CCC")); - EXPECT_TRUE(multi_mtf.RankFromValue(1002, "CCC", &rank)); - EXPECT_EQ(1u, rank); - - multi_mtf.Promote("AAA"); - EXPECT_TRUE(multi_mtf.RankFromValue(1001, "AAA", &rank)); - EXPECT_EQ(1u, rank); - EXPECT_TRUE(multi_mtf.RankFromValue(1002, "AAA", &rank)); - EXPECT_EQ(1u, rank); -} - } // namespace -} // namespace utils +} // namespace comp } // namespace spvtools diff --git a/third_party/spirv-tools/test/name_mapper_test.cpp b/third_party/spirv-tools/test/name_mapper_test.cpp old mode 100755 new mode 100644 index 41970d5a97..9a9ee8aa01 --- a/third_party/spirv-tools/test/name_mapper_test.cpp +++ b/third_party/spirv-tools/test/name_mapper_test.cpp @@ -12,12 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include +#include + #include "gmock/gmock.h" - -#include "test_fixture.h" -#include "unit_spirv.h" - #include "source/name_mapper.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/named_id_test.cpp b/third_party/spirv-tools/test/named_id_test.cpp old mode 100755 new mode 100644 index f70c98f885..4ba54adc3a --- a/third_party/spirv-tools/test/named_id_test.cpp +++ b/third_party/spirv-tools/test/named_id_test.cpp @@ -12,10 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include -#include "test_fixture.h" -#include "unit_spirv.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/opcode_make_test.cpp b/third_party/spirv-tools/test/opcode_make_test.cpp old mode 100755 new mode 100644 index 16eda24d89..6481ef326d --- a/third_party/spirv-tools/test/opcode_make_test.cpp +++ b/third_party/spirv-tools/test/opcode_make_test.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "unit_spirv.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/opcode_require_capabilities_test.cpp b/third_party/spirv-tools/test/opcode_require_capabilities_test.cpp old mode 100755 new mode 100644 index 6a537823b0..32bf1dc085 --- a/third_party/spirv-tools/test/opcode_require_capabilities_test.cpp +++ b/third_party/spirv-tools/test/opcode_require_capabilities_test.cpp @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "unit_spirv.h" +#include "test/unit_spirv.h" -#include "enum_set.h" +#include "source/enum_set.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/opcode_split_test.cpp b/third_party/spirv-tools/test/opcode_split_test.cpp old mode 100755 new mode 100644 index 1ab98eb809..43fedb3855 --- a/third_party/spirv-tools/test/opcode_split_test.cpp +++ b/third_party/spirv-tools/test/opcode_split_test.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "unit_spirv.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/opcode_table_get_test.cpp b/third_party/spirv-tools/test/opcode_table_get_test.cpp old mode 100755 new mode 100644 index e63d4011df..6f80ad7d8c --- a/third_party/spirv-tools/test/opcode_table_get_test.cpp +++ b/third_party/spirv-tools/test/opcode_table_get_test.cpp @@ -12,9 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - -#include "unit_spirv.h" +#include "gmock/gmock.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/operand-class-test-coverage.csv b/third_party/spirv-tools/test/operand-class-test-coverage.csv old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/test/operand_capabilities_test.cpp b/third_party/spirv-tools/test/operand_capabilities_test.cpp old mode 100755 new mode 100644 index baf4f9522e..0aeb505f0c --- a/third_party/spirv-tools/test/operand_capabilities_test.cpp +++ b/third_party/spirv-tools/test/operand_capabilities_test.cpp @@ -15,11 +15,11 @@ // Test capability dependencies for enums. #include +#include #include "gmock/gmock.h" - -#include "enum_set.h" -#include "unit_spirv.h" +#include "source/enum_set.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/operand_pattern_test.cpp b/third_party/spirv-tools/test/operand_pattern_test.cpp old mode 100755 new mode 100644 index e3c20e4596..b3e3024908 --- a/third_party/spirv-tools/test/operand_pattern_test.cpp +++ b/third_party/spirv-tools/test/operand_pattern_test.cpp @@ -12,10 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "unit_spirv.h" +#include #include "gmock/gmock.h" #include "source/operand.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/operand_test.cpp b/third_party/spirv-tools/test/operand_test.cpp old mode 100755 new mode 100644 index be927d6633..08522c323e --- a/third_party/spirv-tools/test/operand_test.cpp +++ b/third_party/spirv-tools/test/operand_test.cpp @@ -12,7 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "unit_spirv.h" +#include + +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/opt/CMakeLists.txt b/third_party/spirv-tools/test/opt/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/test/opt/aggressive_dead_code_elim_test.cpp b/third_party/spirv-tools/test/opt/aggressive_dead_code_elim_test.cpp old mode 100755 new mode 100644 index 3164412b75..873fc34e97 --- a/third_party/spirv-tools/test/opt/aggressive_dead_code_elim_test.cpp +++ b/third_party/spirv-tools/test/opt/aggressive_dead_code_elim_test.cpp @@ -13,9 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "assembly_builder.h" -#include "pass_fixture.h" -#include "pass_utils.h" +#include +#include + +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/assembly_builder.h b/third_party/spirv-tools/test/opt/assembly_builder.h old mode 100755 new mode 100644 index e09b1d7a81..1673c092be --- a/third_party/spirv-tools/test/opt/assembly_builder.h +++ b/third_party/spirv-tools/test/opt/assembly_builder.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_TEST_OPT_ASSEMBLY_BUILDER -#define LIBSPIRV_TEST_OPT_ASSEMBLY_BUILDER +#ifndef TEST_OPT_ASSEMBLY_BUILDER_H_ +#define TEST_OPT_ASSEMBLY_BUILDER_H_ #include #include @@ -263,4 +263,4 @@ class AssemblyBuilder { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_TEST_OPT_ASSEMBLY_BUILDER +#endif // TEST_OPT_ASSEMBLY_BUILDER_H_ diff --git a/third_party/spirv-tools/test/opt/assembly_builder_test.cpp b/third_party/spirv-tools/test/opt/assembly_builder_test.cpp old mode 100755 new mode 100644 index 33c3583ec6..55fbbe9046 --- a/third_party/spirv-tools/test/opt/assembly_builder_test.cpp +++ b/third_party/spirv-tools/test/opt/assembly_builder_test.cpp @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "assembly_builder.h" +#include "test/opt/assembly_builder.h" -#include "pass_fixture.h" -#include "pass_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/block_merge_test.cpp b/third_party/spirv-tools/test/opt/block_merge_test.cpp old mode 100755 new mode 100644 index 3c180b72ca..aaa70cd4a7 --- a/third_party/spirv-tools/test/opt/block_merge_test.cpp +++ b/third_party/spirv-tools/test/opt/block_merge_test.cpp @@ -13,8 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "pass_fixture.h" -#include "pass_utils.h" +#include + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/ccp_test.cpp b/third_party/spirv-tools/test/opt/ccp_test.cpp old mode 100755 new mode 100644 index 7987d8c186..5ccea71fba --- a/third_party/spirv-tools/test/opt/ccp_test.cpp +++ b/third_party/spirv-tools/test/opt/ccp_test.cpp @@ -12,12 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include + #include "gmock/gmock.h" #include "gtest/gtest.h" -#include "pass_fixture.h" -#include "pass_utils.h" - -#include "opt/ccp_pass.h" +#include "source/opt/ccp_pass.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/cfg_cleanup_test.cpp b/third_party/spirv-tools/test/opt/cfg_cleanup_test.cpp old mode 100755 new mode 100644 index 67a2797826..369c766706 --- a/third_party/spirv-tools/test/opt/cfg_cleanup_test.cpp +++ b/third_party/spirv-tools/test/opt/cfg_cleanup_test.cpp @@ -12,8 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "pass_fixture.h" -#include "pass_utils.h" +#include + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/combine_access_chains_test.cpp b/third_party/spirv-tools/test/opt/combine_access_chains_test.cpp index a9ed91046c..ab9e185b68 100644 --- a/third_party/spirv-tools/test/opt/combine_access_chains_test.cpp +++ b/third_party/spirv-tools/test/opt/combine_access_chains_test.cpp @@ -12,10 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "assembly_builder.h" +#include + #include "gmock/gmock.h" -#include "pass_fixture.h" -#include "pass_utils.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/common_uniform_elim_test.cpp b/third_party/spirv-tools/test/opt/common_uniform_elim_test.cpp old mode 100755 new mode 100644 index dcba88a91d..f5199ed875 --- a/third_party/spirv-tools/test/opt/common_uniform_elim_test.cpp +++ b/third_party/spirv-tools/test/opt/common_uniform_elim_test.cpp @@ -13,7 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "pass_fixture.h" +#include + +#include "test/opt/pass_fixture.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/compact_ids_test.cpp b/third_party/spirv-tools/test/opt/compact_ids_test.cpp old mode 100755 new mode 100644 index e993711002..b1e4b2cbb1 --- a/third_party/spirv-tools/test/opt/compact_ids_test.cpp +++ b/third_party/spirv-tools/test/opt/compact_ids_test.cpp @@ -12,13 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include +#include +#include +#include +#include "gmock/gmock.h" #include "spirv-tools/libspirv.hpp" #include "spirv-tools/optimizer.hpp" - -#include "pass_fixture.h" -#include "pass_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { @@ -105,7 +107,7 @@ OpMemoryModel Logical Simple OpEntryPoint GLCompute %100 "main" %200 = OpTypeVoid %300 = OpTypeFunction %200 -%100 = OpFunction %300 None %200 +%100 = OpFunction %200 None %300 %400 = OpLabel OpReturn OpFunctionEnd @@ -134,7 +136,7 @@ OpMemoryModel Logical Simple OpEntryPoint GLCompute %1 "main" %2 = OpTypeVoid %3 = OpTypeFunction %2 -%1 = OpFunction %3 None %2 +%1 = OpFunction %2 None %3 %4 = OpLabel OpReturn OpFunctionEnd @@ -149,7 +151,7 @@ OpMemoryModel Logical Simple OpEntryPoint GLCompute %100 "main" %200 = OpTypeVoid %300 = OpTypeFunction %200 -%100 = OpFunction %300 None %200 +%100 = OpFunction %200 None %300 %400 = OpLabel OpReturn OpFunctionEnd @@ -183,7 +185,7 @@ OpMemoryModel Logical Simple OpEntryPoint GLCompute %1 "main" %2 = OpTypeVoid %3 = OpTypeFunction %2 -%1 = OpFunction %3 None %2 +%1 = OpFunction %2 None %3 %4 = OpLabel OpReturn OpFunctionEnd diff --git a/third_party/spirv-tools/test/opt/constant_manager_test.cpp b/third_party/spirv-tools/test/opt/constant_manager_test.cpp index 7ca92ad7a0..57dea65120 100644 --- a/third_party/spirv-tools/test/opt/constant_manager_test.cpp +++ b/third_party/spirv-tools/test/opt/constant_manager_test.cpp @@ -12,12 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include +#include +#include -#include "opt/build_module.h" -#include "opt/constants.h" -#include "opt/ir_context.h" +#include "gmock/gmock.h" +#include "gtest/gtest.h" +#include "source/opt/build_module.h" +#include "source/opt/constants.h" +#include "source/opt/ir_context.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/copy_prop_array_test.cpp b/third_party/spirv-tools/test/opt/copy_prop_array_test.cpp old mode 100755 new mode 100644 index bd51c0b482..dcce77d224 --- a/third_party/spirv-tools/test/opt/copy_prop_array_test.cpp +++ b/third_party/spirv-tools/test/opt/copy_prop_array_test.cpp @@ -13,11 +13,11 @@ // limitations under the License. #include +#include -#include - -#include "assembly_builder.h" -#include "pass_fixture.h" +#include "gmock/gmock.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/dead_branch_elim_test.cpp b/third_party/spirv-tools/test/opt/dead_branch_elim_test.cpp old mode 100755 new mode 100644 index 379f02e318..939b12deb9 --- a/third_party/spirv-tools/test/opt/dead_branch_elim_test.cpp +++ b/third_party/spirv-tools/test/opt/dead_branch_elim_test.cpp @@ -13,8 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "pass_fixture.h" -#include "pass_utils.h" +#include + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/dead_insert_elim_test.cpp b/third_party/spirv-tools/test/opt/dead_insert_elim_test.cpp old mode 100755 new mode 100644 index e4128245e9..8ae6894d8c --- a/third_party/spirv-tools/test/opt/dead_insert_elim_test.cpp +++ b/third_party/spirv-tools/test/opt/dead_insert_elim_test.cpp @@ -13,8 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "pass_fixture.h" -#include "pass_utils.h" +#include + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/dead_variable_elim_test.cpp b/third_party/spirv-tools/test/opt/dead_variable_elim_test.cpp old mode 100755 new mode 100644 index 672b2055a6..fca13a8e2f --- a/third_party/spirv-tools/test/opt/dead_variable_elim_test.cpp +++ b/third_party/spirv-tools/test/opt/dead_variable_elim_test.cpp @@ -12,8 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "pass_fixture.h" -#include "pass_utils.h" +#include + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/decoration_manager_test.cpp b/third_party/spirv-tools/test/opt/decoration_manager_test.cpp old mode 100755 new mode 100644 index 85349671dc..973cb403dd --- a/third_party/spirv-tools/test/opt/decoration_manager_test.cpp +++ b/third_party/spirv-tools/test/opt/decoration_manager_test.cpp @@ -13,14 +13,16 @@ // limitations under the License. #include +#include +#include +#include -#include - +#include "gmock/gmock.h" #include "source/opt/build_module.h" #include "source/opt/decoration_manager.h" #include "source/opt/ir_context.h" #include "source/spirv_constant.h" -#include "unit_spirv.h" +#include "test/unit_spirv.h" namespace spvtools { namespace opt { @@ -61,7 +63,7 @@ class DecorationManagerTest : public ::testing::Test { tools_.SetMessageConsumer(consumer_); } - virtual void TearDown() override { error_message_.clear(); } + void TearDown() override { error_message_.clear(); } DecorationManager* GetDecorationManager(const std::string& text) { context_ = BuildModule(SPV_ENV_UNIVERSAL_1_2, consumer_, text); diff --git a/third_party/spirv-tools/test/opt/def_use_test.cpp b/third_party/spirv-tools/test/opt/def_use_test.cpp old mode 100755 new mode 100644 index 10a6382e24..3b856ce7fb --- a/third_party/spirv-tools/test/opt/def_use_test.cpp +++ b/third_party/spirv-tools/test/opt/def_use_test.cpp @@ -13,18 +13,21 @@ // limitations under the License. #include +#include +#include #include +#include +#include -#include -#include - -#include "opt/build_module.h" -#include "opt/def_use_manager.h" -#include "opt/ir_context.h" -#include "opt/module.h" -#include "pass_fixture.h" -#include "pass_utils.h" +#include "gmock/gmock.h" +#include "gtest/gtest.h" +#include "source/opt/build_module.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" #include "spirv-tools/libspirv.hpp" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/dominator_tree/CMakeLists.txt b/third_party/spirv-tools/test/opt/dominator_tree/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/test/opt/dominator_tree/common_dominators.cpp b/third_party/spirv-tools/test/opt/dominator_tree/common_dominators.cpp old mode 100755 new mode 100644 index 597c393145..dfa03e986a --- a/third_party/spirv-tools/test/opt/dominator_tree/common_dominators.cpp +++ b/third_party/spirv-tools/test/opt/dominator_tree/common_dominators.cpp @@ -12,11 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include +#include +#include -#include "opt/build_module.h" -#include "opt/ir_context.h" +#include "gmock/gmock.h" +#include "gtest/gtest.h" +#include "source/opt/build_module.h" +#include "source/opt/ir_context.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/dominator_tree/generated.cpp b/third_party/spirv-tools/test/opt/dominator_tree/generated.cpp old mode 100755 new mode 100644 index f2340516dc..43b723e93c --- a/third_party/spirv-tools/test/opt/dominator_tree/generated.cpp +++ b/third_party/spirv-tools/test/opt/dominator_tree/generated.cpp @@ -12,21 +12,20 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include #include #include #include #include -#include "../assembly_builder.h" -#include "../function_utils.h" -#include "../pass_fixture.h" -#include "../pass_utils.h" -#include "opt/dominator_analysis.h" -#include "opt/iterator.h" -#include "opt/pass.h" +#include "gmock/gmock.h" +#include "source/opt/dominator_analysis.h" +#include "source/opt/iterator.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/dominator_tree/nested_ifs.cpp b/third_party/spirv-tools/test/opt/dominator_tree/nested_ifs.cpp old mode 100755 new mode 100644 index 1c51084857..0552b75801 --- a/third_party/spirv-tools/test/opt/dominator_tree/nested_ifs.cpp +++ b/third_party/spirv-tools/test/opt/dominator_tree/nested_ifs.cpp @@ -12,18 +12,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include #include #include -#include "../assembly_builder.h" -#include "../function_utils.h" -#include "../pass_fixture.h" -#include "../pass_utils.h" -#include "opt/dominator_analysis.h" -#include "opt/pass.h" +#include "gmock/gmock.h" +#include "source/opt/dominator_analysis.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/dominator_tree/nested_ifs_post.cpp b/third_party/spirv-tools/test/opt/dominator_tree/nested_ifs_post.cpp old mode 100755 new mode 100644 index c1e4e3db3d..ad759df868 --- a/third_party/spirv-tools/test/opt/dominator_tree/nested_ifs_post.cpp +++ b/third_party/spirv-tools/test/opt/dominator_tree/nested_ifs_post.cpp @@ -12,18 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include #include #include -#include "../assembly_builder.h" -#include "../function_utils.h" -#include "../pass_fixture.h" -#include "../pass_utils.h" -#include "opt/dominator_analysis.h" -#include "opt/pass.h" +#include "gmock/gmock.h" +#include "source/opt/dominator_analysis.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/dominator_tree/nested_loops.cpp b/third_party/spirv-tools/test/opt/dominator_tree/nested_loops.cpp old mode 100755 new mode 100644 index fdaacb02ef..7d03937b1a --- a/third_party/spirv-tools/test/opt/dominator_tree/nested_loops.cpp +++ b/third_party/spirv-tools/test/opt/dominator_tree/nested_loops.cpp @@ -12,18 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include #include #include -#include "../assembly_builder.h" -#include "../function_utils.h" -#include "../pass_fixture.h" -#include "../pass_utils.h" -#include "opt/dominator_analysis.h" -#include "opt/pass.h" +#include "gmock/gmock.h" +#include "source/opt/dominator_analysis.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/dominator_tree/nested_loops_with_unreachables.cpp b/third_party/spirv-tools/test/opt/dominator_tree/nested_loops_with_unreachables.cpp old mode 100755 new mode 100644 index de09be0208..e87e8ddab3 --- a/third_party/spirv-tools/test/opt/dominator_tree/nested_loops_with_unreachables.cpp +++ b/third_party/spirv-tools/test/opt/dominator_tree/nested_loops_with_unreachables.cpp @@ -12,17 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include -#include - -#include "../assembly_builder.h" -#include "../function_utils.h" -#include "../pass_fixture.h" -#include "../pass_utils.h" -#include "opt/dominator_analysis.h" -#include "opt/pass.h" +#include "gmock/gmock.h" +#include "source/opt/dominator_analysis.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/dominator_tree/post.cpp b/third_party/spirv-tools/test/opt/dominator_tree/post.cpp old mode 100755 new mode 100644 index 47d1b5b0c4..bb10fdef1d --- a/third_party/spirv-tools/test/opt/dominator_tree/post.cpp +++ b/third_party/spirv-tools/test/opt/dominator_tree/post.cpp @@ -12,17 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include -#include - -#include "../assembly_builder.h" -#include "../function_utils.h" -#include "../pass_fixture.h" -#include "../pass_utils.h" -#include "opt/dominator_analysis.h" -#include "opt/pass.h" +#include "gmock/gmock.h" +#include "source/opt/dominator_analysis.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/dominator_tree/simple.cpp b/third_party/spirv-tools/test/opt/dominator_tree/simple.cpp old mode 100755 new mode 100644 index 36b2932ff5..d11854d550 --- a/third_party/spirv-tools/test/opt/dominator_tree/simple.cpp +++ b/third_party/spirv-tools/test/opt/dominator_tree/simple.cpp @@ -12,17 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include -#include - -#include "../assembly_builder.h" -#include "../function_utils.h" -#include "../pass_fixture.h" -#include "../pass_utils.h" -#include "opt/dominator_analysis.h" -#include "opt/pass.h" +#include "gmock/gmock.h" +#include "source/opt/dominator_analysis.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/dominator_tree/switch_case_fallthrough.cpp b/third_party/spirv-tools/test/opt/dominator_tree/switch_case_fallthrough.cpp old mode 100755 new mode 100644 index 0ba768a44d..d9dd7d1619 --- a/third_party/spirv-tools/test/opt/dominator_tree/switch_case_fallthrough.cpp +++ b/third_party/spirv-tools/test/opt/dominator_tree/switch_case_fallthrough.cpp @@ -12,17 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include -#include - -#include "../assembly_builder.h" -#include "../function_utils.h" -#include "../pass_fixture.h" -#include "../pass_utils.h" -#include "opt/dominator_analysis.h" -#include "opt/pass.h" +#include "gmock/gmock.h" +#include "source/opt/dominator_analysis.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/dominator_tree/unreachable_for.cpp b/third_party/spirv-tools/test/opt/dominator_tree/unreachable_for.cpp old mode 100755 new mode 100644 index d346d16de1..469e5c142d --- a/third_party/spirv-tools/test/opt/dominator_tree/unreachable_for.cpp +++ b/third_party/spirv-tools/test/opt/dominator_tree/unreachable_for.cpp @@ -12,17 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include -#include - -#include "../assembly_builder.h" -#include "../function_utils.h" -#include "../pass_fixture.h" -#include "../pass_utils.h" -#include "opt/dominator_analysis.h" -#include "opt/pass.h" +#include "gmock/gmock.h" +#include "source/opt/dominator_analysis.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/dominator_tree/unreachable_for_post.cpp b/third_party/spirv-tools/test/opt/dominator_tree/unreachable_for_post.cpp old mode 100755 new mode 100644 index ec6ebd246e..8d3e37b4a4 --- a/third_party/spirv-tools/test/opt/dominator_tree/unreachable_for_post.cpp +++ b/third_party/spirv-tools/test/opt/dominator_tree/unreachable_for_post.cpp @@ -12,17 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include -#include - -#include "../assembly_builder.h" -#include "../function_utils.h" -#include "../pass_fixture.h" -#include "../pass_utils.h" -#include "opt/dominator_analysis.h" -#include "opt/pass.h" +#include "gmock/gmock.h" +#include "source/opt/dominator_analysis.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/eliminate_dead_const_test.cpp b/third_party/spirv-tools/test/opt/eliminate_dead_const_test.cpp old mode 100755 new mode 100644 index 2d1b3695d1..7fac866cec --- a/third_party/spirv-tools/test/opt/eliminate_dead_const_test.cpp +++ b/third_party/spirv-tools/test/opt/eliminate_dead_const_test.cpp @@ -12,15 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "assembly_builder.h" -#include "pass_fixture.h" -#include "pass_utils.h" - #include #include #include #include +#include #include +#include + +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/eliminate_dead_functions_test.cpp b/third_party/spirv-tools/test/opt/eliminate_dead_functions_test.cpp old mode 100755 new mode 100644 index b49b41b08e..0a3d490a8f --- a/third_party/spirv-tools/test/opt/eliminate_dead_functions_test.cpp +++ b/third_party/spirv-tools/test/opt/eliminate_dead_functions_test.cpp @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include -#include - -#include "assembly_builder.h" -#include "pass_fixture.h" -#include "pass_utils.h" +#include "gmock/gmock.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/feature_manager_test.cpp b/third_party/spirv-tools/test/opt/feature_manager_test.cpp old mode 100755 new mode 100644 index 983e2afb22..767376cf5e --- a/third_party/spirv-tools/test/opt/feature_manager_test.cpp +++ b/third_party/spirv-tools/test/opt/feature_manager_test.cpp @@ -12,12 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include #include +#include +#include -#include "opt/build_module.h" -#include "opt/ir_context.h" +#include "gmock/gmock.h" +#include "gtest/gtest.h" +#include "source/opt/build_module.h" +#include "source/opt/ir_context.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/flatten_decoration_test.cpp b/third_party/spirv-tools/test/opt/flatten_decoration_test.cpp old mode 100755 new mode 100644 index 3f0075b243..483ee6e53c --- a/third_party/spirv-tools/test/opt/flatten_decoration_test.cpp +++ b/third_party/spirv-tools/test/opt/flatten_decoration_test.cpp @@ -13,10 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include +#include +#include -#include "pass_fixture.h" -#include "pass_utils.h" +#include "gmock/gmock.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/fold_spec_const_op_composite_test.cpp b/third_party/spirv-tools/test/opt/fold_spec_const_op_composite_test.cpp old mode 100755 new mode 100644 index 15e29be366..8ecfd5c788 --- a/third_party/spirv-tools/test/opt/fold_spec_const_op_composite_test.cpp +++ b/third_party/spirv-tools/test/opt/fold_spec_const_op_composite_test.cpp @@ -12,12 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "assembly_builder.h" - #include +#include +#include -#include "pass_fixture.h" -#include "pass_utils.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/fold_test.cpp b/third_party/spirv-tools/test/opt/fold_test.cpp old mode 100755 new mode 100644 index e4a52c71cd..b1e5758866 --- a/third_party/spirv-tools/test/opt/fold_test.cpp +++ b/third_party/spirv-tools/test/opt/fold_test.cpp @@ -11,24 +11,26 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include +#include #include +#include -#include -#include -#include +#include "gmock/gmock.h" +#include "gtest/gtest.h" +#include "source/opt/build_module.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/fold.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "spirv-tools/libspirv.hpp" +#include "test/opt/pass_utils.h" #ifdef SPIRV_EFFCEE #include "effcee/effcee.h" #endif -#include "opt/build_module.h" -#include "opt/def_use_manager.h" -#include "opt/ir_context.h" -#include "opt/module.h" -#include "pass_utils.h" -#include "spirv-tools/libspirv.hpp" - namespace spvtools { namespace opt { namespace { @@ -5767,7 +5769,7 @@ TEST_P(MatchingInstructionWithNoResultFoldingTest, Case) { // Fold the instruction to test. Instruction* inst = nullptr; Function* func = &*context->module()->begin(); - for(auto& bb : *func) { + for (auto& bb : *func) { Instruction* terminator = bb.terminator(); if (terminator->IsReturnOrAbort()) { inst = terminator->PreviousNode(); diff --git a/third_party/spirv-tools/test/opt/freeze_spec_const_test.cpp b/third_party/spirv-tools/test/opt/freeze_spec_const_test.cpp old mode 100755 new mode 100644 index 306f8c570f..5cc7843b11 --- a/third_party/spirv-tools/test/opt/freeze_spec_const_test.cpp +++ b/third_party/spirv-tools/test/opt/freeze_spec_const_test.cpp @@ -12,13 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "pass_fixture.h" -#include "pass_utils.h" - #include +#include #include +#include #include +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + namespace spvtools { namespace opt { namespace { diff --git a/third_party/spirv-tools/test/opt/function_utils.h b/third_party/spirv-tools/test/opt/function_utils.h old mode 100755 new mode 100644 index fdc223aa4e..803cacdd53 --- a/third_party/spirv-tools/test/opt/function_utils.h +++ b/third_party/spirv-tools/test/opt/function_utils.h @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_TEST_OPT_FUNCTION_UTILS_H_ -#define LIBSPIRV_TEST_OPT_FUNCTION_UTILS_H_ +#ifndef TEST_OPT_FUNCTION_UTILS_H_ +#define TEST_OPT_FUNCTION_UTILS_H_ -#include "opt/function.h" -#include "opt/module.h" +#include "source/opt/function.h" +#include "source/opt/module.h" namespace spvtest { @@ -52,4 +52,4 @@ inline const spvtools::opt::BasicBlock* GetBasicBlock( } // namespace spvtest -#endif // LIBSPIRV_TEST_OPT_FUNCTION_UTILS_H_ +#endif // TEST_OPT_FUNCTION_UTILS_H_ diff --git a/third_party/spirv-tools/test/opt/if_conversion_test.cpp b/third_party/spirv-tools/test/opt/if_conversion_test.cpp old mode 100755 new mode 100644 index 6ad052fa8e..a62a15e88f --- a/third_party/spirv-tools/test/opt/if_conversion_test.cpp +++ b/third_party/spirv-tools/test/opt/if_conversion_test.cpp @@ -12,10 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "assembly_builder.h" +#include + #include "gmock/gmock.h" -#include "pass_fixture.h" -#include "pass_utils.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/inline_opaque_test.cpp b/third_party/spirv-tools/test/opt/inline_opaque_test.cpp old mode 100755 new mode 100644 index d756a62ecf..d10913aec0 --- a/third_party/spirv-tools/test/opt/inline_opaque_test.cpp +++ b/third_party/spirv-tools/test/opt/inline_opaque_test.cpp @@ -13,8 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "pass_fixture.h" -#include "pass_utils.h" +#include + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/inline_test.cpp b/third_party/spirv-tools/test/opt/inline_test.cpp old mode 100755 new mode 100644 index aaba88c0aa..4eab77da4f --- a/third_party/spirv-tools/test/opt/inline_test.cpp +++ b/third_party/spirv-tools/test/opt/inline_test.cpp @@ -13,8 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "pass_fixture.h" -#include "pass_utils.h" +#include +#include +#include + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/insert_extract_elim_test.cpp b/third_party/spirv-tools/test/opt/insert_extract_elim_test.cpp old mode 100755 new mode 100644 index 3eae006408..c5169750bd --- a/third_party/spirv-tools/test/opt/insert_extract_elim_test.cpp +++ b/third_party/spirv-tools/test/opt/insert_extract_elim_test.cpp @@ -13,9 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include "pass_fixture.h" -#include "pass_utils.h" +#include + +#include "source/opt/simplification_pass.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/instruction_list_test.cpp b/third_party/spirv-tools/test/opt/instruction_list_test.cpp old mode 100755 new mode 100644 index 0f8496f4fc..e745790a3b --- a/third_party/spirv-tools/test/opt/instruction_list_test.cpp +++ b/third_party/spirv-tools/test/opt/instruction_list_test.cpp @@ -14,13 +14,13 @@ #include #include +#include #include #include "gmock/gmock.h" #include "gtest/gtest.h" - -#include "opt/instruction.h" -#include "opt/instruction_list.h" +#include "source/opt/instruction.h" +#include "source/opt/instruction_list.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/instruction_test.cpp b/third_party/spirv-tools/test/opt/instruction_test.cpp old mode 100755 new mode 100644 index 407b666d37..2ace6b8acb --- a/third_party/spirv-tools/test/opt/instruction_test.cpp +++ b/third_party/spirv-tools/test/opt/instruction_test.cpp @@ -12,15 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "opt/instruction.h" -#include "opt/ir_context.h" +#include +#include +#include #include "gmock/gmock.h" - -#include "pass_fixture.h" -#include "pass_utils.h" +#include "source/opt/instruction.h" +#include "source/opt/ir_context.h" #include "spirv-tools/libspirv.h" -#include "unit_spirv.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" +#include "test/unit_spirv.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/ir_builder.cpp b/third_party/spirv-tools/test/opt/ir_builder.cpp old mode 100755 new mode 100644 index 5484116eb6..7eeb86dd33 --- a/third_party/spirv-tools/test/opt/ir_builder.cpp +++ b/third_party/spirv-tools/test/opt/ir_builder.cpp @@ -12,23 +12,24 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include #include +#include +#include #include +#include "gmock/gmock.h" +#include "gtest/gtest.h" +#include "source/opt/basic_block.h" +#include "source/opt/build_module.h" +#include "source/opt/instruction.h" +#include "source/opt/ir_builder.h" +#include "source/opt/type_manager.h" +#include "spirv-tools/libspirv.hpp" + #ifdef SPIRV_EFFCEE #include "effcee/effcee.h" #endif -#include "opt/basic_block.h" -#include "opt/ir_builder.h" - -#include "opt/build_module.h" -#include "opt/instruction.h" -#include "opt/type_manager.h" -#include "spirv-tools/libspirv.hpp" - namespace spvtools { namespace opt { namespace { diff --git a/third_party/spirv-tools/test/opt/ir_context_test.cpp b/third_party/spirv-tools/test/opt/ir_context_test.cpp old mode 100755 new mode 100644 index 5fe68c8009..c64e5b04ff --- a/third_party/spirv-tools/test/opt/ir_context_test.cpp +++ b/third_party/spirv-tools/test/opt/ir_context_test.cpp @@ -12,14 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include #include +#include +#include +#include -#include "opt/ir_context.h" -#include "opt/pass.h" -#include "pass_fixture.h" -#include "pass_utils.h" +#include "gmock/gmock.h" +#include "gtest/gtest.h" +#include "source/opt/ir_context.h" +#include "source/opt/pass.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/ir_loader_test.cpp b/third_party/spirv-tools/test/opt/ir_loader_test.cpp old mode 100755 new mode 100644 index 8e8dd2e830..ac5c52075c --- a/third_party/spirv-tools/test/opt/ir_loader_test.cpp +++ b/third_party/spirv-tools/test/opt/ir_loader_test.cpp @@ -12,13 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include +#include +#include #include +#include +#include -#include "message.h" -#include "opt/build_module.h" -#include "opt/ir_context.h" +#include "gtest/gtest.h" +#include "source/opt/build_module.h" +#include "source/opt/ir_context.h" #include "spirv-tools/libspirv.hpp" namespace spvtools { @@ -317,11 +320,12 @@ TEST(IrBuilder, KeepModuleProcessedInRightPlace) { // Checks the given |error_message| is reported when trying to build a module // from the given |assembly|. void DoErrorMessageCheck(const std::string& assembly, - const std::string& error_message) { - auto consumer = [error_message](spv_message_level_t level, const char* source, - const spv_position_t& position, - const char* m) { - EXPECT_EQ(error_message, StringifyMessage(level, source, position, m)); + const std::string& error_message, uint32_t line_num) { + auto consumer = [error_message, line_num](spv_message_level_t, const char*, + const spv_position_t& position, + const char* m) { + EXPECT_EQ(error_message, m); + EXPECT_EQ(line_num, position.line); }; SpirvTools t(SPV_ENV_UNIVERSAL_1_1); @@ -332,13 +336,12 @@ void DoErrorMessageCheck(const std::string& assembly, TEST(IrBuilder, FunctionInsideFunction) { DoErrorMessageCheck("%2 = OpFunction %1 None %3\n%5 = OpFunction %4 None %6", - "error: :2:0:0: function inside function"); + "function inside function", 2); } TEST(IrBuilder, MismatchOpFunctionEnd) { DoErrorMessageCheck("OpFunctionEnd", - "error: :1:0:0: OpFunctionEnd without " - "corresponding OpFunction"); + "OpFunctionEnd without corresponding OpFunction", 1); } TEST(IrBuilder, OpFunctionEndInsideBasicBlock) { @@ -346,12 +349,12 @@ TEST(IrBuilder, OpFunctionEndInsideBasicBlock) { "%2 = OpFunction %1 None %3\n" "%4 = OpLabel\n" "OpFunctionEnd", - "error: :3:0:0: OpFunctionEnd inside basic block"); + "OpFunctionEnd inside basic block", 3); } TEST(IrBuilder, BasicBlockOutsideFunction) { DoErrorMessageCheck("OpCapability Shader\n%1 = OpLabel", - "error: :2:0:0: OpLabel outside function"); + "OpLabel outside function", 2); } TEST(IrBuilder, OpLabelInsideBasicBlock) { @@ -359,26 +362,23 @@ TEST(IrBuilder, OpLabelInsideBasicBlock) { "%2 = OpFunction %1 None %3\n" "%4 = OpLabel\n" "%5 = OpLabel", - "error: :3:0:0: OpLabel inside basic block"); + "OpLabel inside basic block", 3); } TEST(IrBuilder, TerminatorOutsideFunction) { - DoErrorMessageCheck( - "OpReturn", - "error: :1:0:0: terminator instruction outside function"); + DoErrorMessageCheck("OpReturn", "terminator instruction outside function", 1); } TEST(IrBuilder, TerminatorOutsideBasicBlock) { DoErrorMessageCheck("%2 = OpFunction %1 None %3\nOpReturn", - "error: :2:0:0: terminator instruction " - "outside basic block"); + "terminator instruction outside basic block", 2); } TEST(IrBuilder, NotAllowedInstAppearingInFunction) { DoErrorMessageCheck("%2 = OpFunction %1 None %3\n%5 = OpVariable %4 Function", - "error: :2:0:0: Non-OpFunctionParameter " - "(opcode: 59) found inside function but outside basic " - "block"); + "Non-OpFunctionParameter (opcode: 59) found inside " + "function but outside basic block", + 2); } TEST(IrBuilder, UniqueIds) { diff --git a/third_party/spirv-tools/test/opt/iterator_test.cpp b/third_party/spirv-tools/test/opt/iterator_test.cpp old mode 100755 new mode 100644 index 81e8d23788..d61bc1ab8e --- a/third_party/spirv-tools/test/opt/iterator_test.cpp +++ b/third_party/spirv-tools/test/opt/iterator_test.cpp @@ -17,8 +17,8 @@ #include "gmock/gmock.h" -#include "opt/iterator.h" -#include "opt/make_unique.h" +#include "source/opt/iterator.h" +#include "source/util/make_unique.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/line_debug_info_test.cpp b/third_party/spirv-tools/test/opt/line_debug_info_test.cpp old mode 100755 new mode 100644 index 729b144363..6a20a0136d --- a/third_party/spirv-tools/test/opt/line_debug_info_test.cpp +++ b/third_party/spirv-tools/test/opt/line_debug_info_test.cpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "pass_fixture.h" -#include "pass_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/local_access_chain_convert_test.cpp b/third_party/spirv-tools/test/opt/local_access_chain_convert_test.cpp old mode 100755 new mode 100644 index b535717af9..f15a950718 --- a/third_party/spirv-tools/test/opt/local_access_chain_convert_test.cpp +++ b/third_party/spirv-tools/test/opt/local_access_chain_convert_test.cpp @@ -13,8 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "pass_fixture.h" -#include "pass_utils.h" +#include + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { @@ -22,6 +24,8 @@ namespace { using LocalAccessChainConvertTest = PassTest<::testing::Test>; +#ifdef SPIRV_EFFCEE + TEST_F(LocalAccessChainConvertTest, StructOfVecsOfFloatConverted) { // #version 140 // @@ -66,38 +70,18 @@ OpName %gl_FragColor "gl_FragColor" %_ptr_Function_v4float = OpTypePointer Function %v4float %_ptr_Output_v4float = OpTypePointer Output %v4float %gl_FragColor = OpVariable %_ptr_Output_v4float Output -)"; - - const std::string predefs_after = - R"(OpCapability Shader -%1 = OpExtInstImport "GLSL.std.450" -OpMemoryModel Logical GLSL450 -OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor -OpExecutionMode %main OriginUpperLeft -OpSource GLSL 140 -OpName %main "main" -OpName %S_t "S_t" -OpMemberName %S_t 0 "v0" -OpMemberName %S_t 1 "v1" -OpName %s0 "s0" -OpName %BaseColor "BaseColor" -OpName %gl_FragColor "gl_FragColor" -%void = OpTypeVoid -%8 = OpTypeFunction %void -%float = OpTypeFloat 32 -%v4float = OpTypeVector %float 4 -%S_t = OpTypeStruct %v4float %v4float -%_ptr_Function_S_t = OpTypePointer Function %S_t -%int = OpTypeInt 32 1 -%_ptr_Input_v4float = OpTypePointer Input %v4float -%BaseColor = OpVariable %_ptr_Input_v4float Input -%_ptr_Function_v4float = OpTypePointer Function %v4float -%_ptr_Output_v4float = OpTypePointer Output %v4float -%gl_FragColor = OpVariable %_ptr_Output_v4float Output )"; const std::string before = - R"(%main = OpFunction %void None %8 + R"( +; CHECK: [[st_id:%\w+]] = OpLoad %v4float %BaseColor +; CHECK: [[ld1:%\w+]] = OpLoad %S_t %s0 +; CHECK: [[ex1:%\w+]] = OpCompositeInsert %S_t [[st_id]] [[ld1]] 1 +; CHECK: OpStore %s0 [[ex1]] +; CHECK: [[ld2:%\w+]] = OpLoad %S_t %s0 +; CHECK: [[ex2:%\w+]] = OpCompositeExtract %v4float [[ld2]] 1 +; CHECK: OpStore %gl_FragColor [[ex2]] +%main = OpFunction %void None %8 %17 = OpLabel %s0 = OpVariable %_ptr_Function_S_t Function %18 = OpLoad %v4float %BaseColor @@ -110,23 +94,8 @@ OpReturn OpFunctionEnd )"; - const std::string after = - R"(%main = OpFunction %void None %8 -%17 = OpLabel -%s0 = OpVariable %_ptr_Function_S_t Function -%18 = OpLoad %v4float %BaseColor -%22 = OpLoad %S_t %s0 -%23 = OpCompositeInsert %S_t %18 %22 1 -OpStore %s0 %23 -%24 = OpLoad %S_t %s0 -%25 = OpCompositeExtract %v4float %24 1 -OpStore %gl_FragColor %25 -OpReturn -OpFunctionEnd -)"; - - SinglePassRunAndCheck( - predefs_before + before, predefs_after + after, true, true); + SinglePassRunAndMatch(predefs_before + before, + true); } TEST_F(LocalAccessChainConvertTest, InBoundsAccessChainsConverted) { @@ -173,38 +142,18 @@ OpName %gl_FragColor "gl_FragColor" %_ptr_Function_v4float = OpTypePointer Function %v4float %_ptr_Output_v4float = OpTypePointer Output %v4float %gl_FragColor = OpVariable %_ptr_Output_v4float Output -)"; - - const std::string predefs_after = - R"(OpCapability Shader -%1 = OpExtInstImport "GLSL.std.450" -OpMemoryModel Logical GLSL450 -OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor -OpExecutionMode %main OriginUpperLeft -OpSource GLSL 140 -OpName %main "main" -OpName %S_t "S_t" -OpMemberName %S_t 0 "v0" -OpMemberName %S_t 1 "v1" -OpName %s0 "s0" -OpName %BaseColor "BaseColor" -OpName %gl_FragColor "gl_FragColor" -%void = OpTypeVoid -%8 = OpTypeFunction %void -%float = OpTypeFloat 32 -%v4float = OpTypeVector %float 4 -%S_t = OpTypeStruct %v4float %v4float -%_ptr_Function_S_t = OpTypePointer Function %S_t -%int = OpTypeInt 32 1 -%_ptr_Input_v4float = OpTypePointer Input %v4float -%BaseColor = OpVariable %_ptr_Input_v4float Input -%_ptr_Function_v4float = OpTypePointer Function %v4float -%_ptr_Output_v4float = OpTypePointer Output %v4float -%gl_FragColor = OpVariable %_ptr_Output_v4float Output )"; const std::string before = - R"(%main = OpFunction %void None %8 + R"( +; CHECK: [[st_id:%\w+]] = OpLoad %v4float %BaseColor +; CHECK: [[ld1:%\w+]] = OpLoad %S_t %s0 +; CHECK: [[ex1:%\w+]] = OpCompositeInsert %S_t [[st_id]] [[ld1]] 1 +; CHECK: OpStore %s0 [[ex1]] +; CHECK: [[ld2:%\w+]] = OpLoad %S_t %s0 +; CHECK: [[ex2:%\w+]] = OpCompositeExtract %v4float [[ld2]] 1 +; CHECK: OpStore %gl_FragColor [[ex2]] +%main = OpFunction %void None %8 %17 = OpLabel %s0 = OpVariable %_ptr_Function_S_t Function %18 = OpLoad %v4float %BaseColor @@ -217,23 +166,8 @@ OpReturn OpFunctionEnd )"; - const std::string after = - R"(%main = OpFunction %void None %8 -%17 = OpLabel -%s0 = OpVariable %_ptr_Function_S_t Function -%18 = OpLoad %v4float %BaseColor -%22 = OpLoad %S_t %s0 -%23 = OpCompositeInsert %S_t %18 %22 1 -OpStore %s0 %23 -%24 = OpLoad %S_t %s0 -%25 = OpCompositeExtract %v4float %24 1 -OpStore %gl_FragColor %25 -OpReturn -OpFunctionEnd -)"; - - SinglePassRunAndCheck( - predefs_before + before, predefs_after + after, true, true); + SinglePassRunAndMatch(predefs_before + before, + true); } TEST_F(LocalAccessChainConvertTest, TwoUsesofSingleChainConverted) { @@ -280,38 +214,18 @@ OpName %gl_FragColor "gl_FragColor" %_ptr_Function_v4float = OpTypePointer Function %v4float %_ptr_Output_v4float = OpTypePointer Output %v4float %gl_FragColor = OpVariable %_ptr_Output_v4float Output -)"; - - const std::string predefs_after = - R"(OpCapability Shader -%1 = OpExtInstImport "GLSL.std.450" -OpMemoryModel Logical GLSL450 -OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor -OpExecutionMode %main OriginUpperLeft -OpSource GLSL 140 -OpName %main "main" -OpName %S_t "S_t" -OpMemberName %S_t 0 "v0" -OpMemberName %S_t 1 "v1" -OpName %s0 "s0" -OpName %BaseColor "BaseColor" -OpName %gl_FragColor "gl_FragColor" -%void = OpTypeVoid -%8 = OpTypeFunction %void -%float = OpTypeFloat 32 -%v4float = OpTypeVector %float 4 -%S_t = OpTypeStruct %v4float %v4float -%_ptr_Function_S_t = OpTypePointer Function %S_t -%int = OpTypeInt 32 1 -%_ptr_Input_v4float = OpTypePointer Input %v4float -%BaseColor = OpVariable %_ptr_Input_v4float Input -%_ptr_Function_v4float = OpTypePointer Function %v4float -%_ptr_Output_v4float = OpTypePointer Output %v4float -%gl_FragColor = OpVariable %_ptr_Output_v4float Output )"; const std::string before = - R"(%main = OpFunction %void None %8 + R"( +; CHECK: [[st_id:%\w+]] = OpLoad %v4float %BaseColor +; CHECK: [[ld1:%\w+]] = OpLoad %S_t %s0 +; CHECK: [[ex1:%\w+]] = OpCompositeInsert %S_t [[st_id]] [[ld1]] 1 +; CHECK: OpStore %s0 [[ex1]] +; CHECK: [[ld2:%\w+]] = OpLoad %S_t %s0 +; CHECK: [[ex2:%\w+]] = OpCompositeExtract %v4float [[ld2]] 1 +; CHECK: OpStore %gl_FragColor [[ex2]] +%main = OpFunction %void None %8 %17 = OpLabel %s0 = OpVariable %_ptr_Function_S_t Function %18 = OpLoad %v4float %BaseColor @@ -323,23 +237,8 @@ OpReturn OpFunctionEnd )"; - const std::string after = - R"(%main = OpFunction %void None %8 -%17 = OpLabel -%s0 = OpVariable %_ptr_Function_S_t Function -%18 = OpLoad %v4float %BaseColor -%21 = OpLoad %S_t %s0 -%22 = OpCompositeInsert %S_t %18 %21 1 -OpStore %s0 %22 -%23 = OpLoad %S_t %s0 -%24 = OpCompositeExtract %v4float %23 1 -OpStore %gl_FragColor %24 -OpReturn -OpFunctionEnd -)"; - - SinglePassRunAndCheck( - predefs_before + before, predefs_after + after, true, true); + SinglePassRunAndMatch(predefs_before + before, + true); } TEST_F(LocalAccessChainConvertTest, OpaqueConverted) { @@ -347,7 +246,8 @@ TEST_F(LocalAccessChainConvertTest, OpaqueConverted) { // at the moment const std::string predefs = - R"(OpCapability Shader + R"( +OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Fragment %main "main" %outColor %texCoords @@ -390,7 +290,13 @@ OpDecorate %sampler15 DescriptorSet 0 )"; const std::string before = - R"(%main = OpFunction %void None %12 + R"( +; CHECK: [[l1:%\w+]] = OpLoad %S_t %param +; CHECK: [[e1:%\w+]] = OpCompositeExtract {{%\w+}} [[l1]] 2 +; CHECK: [[l2:%\w+]] = OpLoad %S_t %param +; CHECK: [[e2:%\w+]] = OpCompositeExtract {{%\w+}} [[l2]] 0 +; CHECK: OpImageSampleImplicitLod {{%\w+}} [[e1]] [[e2]] +%main = OpFunction %void None %12 %28 = OpLabel %s0 = OpVariable %_ptr_Function_S_t Function %param = OpVariable %_ptr_Function_S_t Function @@ -410,31 +316,6 @@ OpStore %param %33 OpStore %outColor %38 OpReturn OpFunctionEnd -)"; - - const std::string after = - R"(%main = OpFunction %void None %12 -%28 = OpLabel -%s0 = OpVariable %_ptr_Function_S_t Function -%param = OpVariable %_ptr_Function_S_t Function -%29 = OpLoad %v2float %texCoords -%45 = OpLoad %S_t %s0 -%46 = OpCompositeInsert %S_t %29 %45 0 -OpStore %s0 %46 -%31 = OpLoad %18 %sampler15 -%47 = OpLoad %S_t %s0 -%48 = OpCompositeInsert %S_t %31 %47 2 -OpStore %s0 %48 -%33 = OpLoad %S_t %s0 -OpStore %param %33 -%49 = OpLoad %S_t %param -%50 = OpCompositeExtract %18 %49 2 -%51 = OpLoad %S_t %param -%52 = OpCompositeExtract %v2float %51 0 -%38 = OpImageSampleImplicitLod %v4float %50 %52 -OpStore %outColor %38 -OpReturn -OpFunctionEnd )"; const std::string remain = @@ -451,8 +332,8 @@ OpReturn OpFunctionEnd )"; - SinglePassRunAndCheck( - predefs + before + remain, predefs + after + remain, true, true); + SinglePassRunAndMatch(predefs + before + remain, + true); } TEST_F(LocalAccessChainConvertTest, NestedStructsConverted) { @@ -507,41 +388,18 @@ OpName %gl_FragColor "gl_FragColor" %_ptr_Function_v4float = OpTypePointer Function %v4float %_ptr_Output_v4float = OpTypePointer Output %v4float %gl_FragColor = OpVariable %_ptr_Output_v4float Output -)"; - - const std::string predefs_after = - R"(OpCapability Shader -%1 = OpExtInstImport "GLSL.std.450" -OpMemoryModel Logical GLSL450 -OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor -OpExecutionMode %main OriginUpperLeft -OpSource GLSL 140 -OpName %main "main" -OpName %S1_t "S1_t" -OpMemberName %S1_t 0 "v1" -OpName %S2_t "S2_t" -OpMemberName %S2_t 0 "v2" -OpMemberName %S2_t 1 "s1" -OpName %s2 "s2" -OpName %BaseColor "BaseColor" -OpName %gl_FragColor "gl_FragColor" -%void = OpTypeVoid -%9 = OpTypeFunction %void -%float = OpTypeFloat 32 -%v4float = OpTypeVector %float 4 -%S1_t = OpTypeStruct %v4float -%S2_t = OpTypeStruct %v4float %S1_t -%_ptr_Function_S2_t = OpTypePointer Function %S2_t -%int = OpTypeInt 32 1 -%_ptr_Input_v4float = OpTypePointer Input %v4float -%BaseColor = OpVariable %_ptr_Input_v4float Input -%_ptr_Function_v4float = OpTypePointer Function %v4float -%_ptr_Output_v4float = OpTypePointer Output %v4float -%gl_FragColor = OpVariable %_ptr_Output_v4float Output )"; const std::string before = - R"(%main = OpFunction %void None %9 + R"( +; CHECK: [[st_id:%\w+]] = OpLoad %v4float %BaseColor +; CHECK: [[ld1:%\w+]] = OpLoad %S2_t %s2 +; CHECK: [[ex1:%\w+]] = OpCompositeInsert %S2_t [[st_id]] [[ld1]] 1 0 +; CHECK: OpStore %s2 [[ex1]] +; CHECK: [[ld2:%\w+]] = OpLoad %S2_t %s2 +; CHECK: [[ex2:%\w+]] = OpCompositeExtract %v4float [[ld2]] 1 0 +; CHECK: OpStore %gl_FragColor [[ex2]] +%main = OpFunction %void None %9 %19 = OpLabel %s2 = OpVariable %_ptr_Function_S2_t Function %20 = OpLoad %v4float %BaseColor @@ -554,25 +412,67 @@ OpReturn OpFunctionEnd )"; - const std::string after = - R"(%main = OpFunction %void None %9 -%19 = OpLabel -%s2 = OpVariable %_ptr_Function_S2_t Function -%20 = OpLoad %v4float %BaseColor -%24 = OpLoad %S2_t %s2 -%25 = OpCompositeInsert %S2_t %20 %24 1 0 -OpStore %s2 %25 -%26 = OpLoad %S2_t %s2 -%27 = OpCompositeExtract %v4float %26 1 0 -OpStore %gl_FragColor %27 + SinglePassRunAndMatch(predefs_before + before, + true); +} + +TEST_F(LocalAccessChainConvertTest, SomeAccessChainsHaveNoUse) { + // Based on HLSL source code: + // struct S { + // float f; + // }; + + // float main(float input : A) : B { + // S local = { input }; + // return local.f; + // } + + const std::string predefs = R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" %in_var_A %out_var_B +OpName %main "main" +OpName %in_var_A "in.var.A" +OpName %out_var_B "out.var.B" +OpName %S "S" +OpName %local "local" +%int = OpTypeInt 32 1 +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Input_float = OpTypePointer Input %float +%_ptr_Output_float = OpTypePointer Output %float +%S = OpTypeStruct %float +%_ptr_Function_S = OpTypePointer Function %S +%int_0 = OpConstant %int 0 +%in_var_A = OpVariable %_ptr_Input_float Input +%out_var_B = OpVariable %_ptr_Output_float Output +%main = OpFunction %void None %8 +%15 = OpLabel +%local = OpVariable %_ptr_Function_S Function +%16 = OpLoad %float %in_var_A +%17 = OpCompositeConstruct %S %16 +OpStore %local %17 +)"; + + const std::string before = + R"( +; CHECK: [[ld:%\w+]] = OpLoad %S %local +; CHECK: [[ex:%\w+]] = OpCompositeExtract %float [[ld]] 0 +; CHECK: OpStore %out_var_B [[ex]] +%18 = OpAccessChain %_ptr_Function_float %local %int_0 +%19 = OpAccessChain %_ptr_Function_float %local %int_0 +%20 = OpLoad %float %18 +OpStore %out_var_B %20 OpReturn OpFunctionEnd )"; - SinglePassRunAndCheck( - predefs_before + before, predefs_after + after, true, true); + SinglePassRunAndMatch(predefs + before, true); } +#endif // SPIRV_EFFCEE + TEST_F(LocalAccessChainConvertTest, DynamicallyIndexedVarNotConverted) { // #version 140 // @@ -649,67 +549,6 @@ OpFunctionEnd true); } -TEST_F(LocalAccessChainConvertTest, SomeAccessChainsHaveNoUse) { - // Based on HLSL source code: - // struct S { - // float f; - // }; - - // float main(float input : A) : B { - // S local = { input }; - // return local.f; - // } - - const std::string predefs = R"(OpCapability Shader -OpMemoryModel Logical GLSL450 -OpEntryPoint Vertex %main "main" %in_var_A %out_var_B -OpName %main "main" -OpName %in_var_A "in.var.A" -OpName %out_var_B "out.var.B" -OpName %S "S" -OpName %local "local" -%int = OpTypeInt 32 1 -%void = OpTypeVoid -%8 = OpTypeFunction %void -%float = OpTypeFloat 32 -%_ptr_Function_float = OpTypePointer Function %float -%_ptr_Input_float = OpTypePointer Input %float -%_ptr_Output_float = OpTypePointer Output %float -%S = OpTypeStruct %float -%_ptr_Function_S = OpTypePointer Function %S -%int_0 = OpConstant %int 0 -%in_var_A = OpVariable %_ptr_Input_float Input -%out_var_B = OpVariable %_ptr_Output_float Output -%main = OpFunction %void None %8 -%15 = OpLabel -%local = OpVariable %_ptr_Function_S Function -%16 = OpLoad %float %in_var_A -%17 = OpCompositeConstruct %S %16 -OpStore %local %17 -)"; - - const std::string before = - R"(%18 = OpAccessChain %_ptr_Function_float %local %int_0 -%19 = OpAccessChain %_ptr_Function_float %local %int_0 -%20 = OpLoad %float %18 -OpStore %out_var_B %20 -OpReturn -OpFunctionEnd -)"; - - const std::string after = - R"(%19 = OpAccessChain %_ptr_Function_float %local %int_0 -%21 = OpLoad %S %local -%22 = OpCompositeExtract %float %21 0 -OpStore %out_var_B %22 -OpReturn -OpFunctionEnd -)"; - - SinglePassRunAndCheck( - predefs + before, predefs + after, true, true); -} - // TODO(greg-lunarg): Add tests to verify handling of these cases: // // Assorted vector and matrix types diff --git a/third_party/spirv-tools/test/opt/local_redundancy_elimination_test.cpp b/third_party/spirv-tools/test/opt/local_redundancy_elimination_test.cpp old mode 100755 new mode 100644 index 3d26b7e235..bdaafb85f0 --- a/third_party/spirv-tools/test/opt/local_redundancy_elimination_test.cpp +++ b/third_party/spirv-tools/test/opt/local_redundancy_elimination_test.cpp @@ -12,13 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "opt/value_number_table.h" +#include -#include "assembly_builder.h" #include "gmock/gmock.h" -#include "opt/build_module.h" -#include "pass_fixture.h" -#include "pass_utils.h" +#include "source/opt/build_module.h" +#include "source/opt/value_number_table.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/local_single_block_elim.cpp b/third_party/spirv-tools/test/opt/local_single_block_elim.cpp old mode 100755 new mode 100644 index 21e2d29f04..da7540e6bf --- a/third_party/spirv-tools/test/opt/local_single_block_elim.cpp +++ b/third_party/spirv-tools/test/opt/local_single_block_elim.cpp @@ -13,8 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "pass_fixture.h" -#include "pass_utils.h" +#include + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { @@ -981,6 +983,83 @@ OpFunctionEnd SinglePassRunAndCheck( predefs_before + before, predefs_before + after, true, true); } + +// Test that that an unused OpAccessChain between two store does does not +// hinders the removal of the first store. We need to check this because +// local-access-chain-convert does always remove the OpAccessChain instructions +// that become dead. + +TEST_F(LocalSingleBlockLoadStoreElimTest, + StoreElimIfInterveningUnusedAccessChain) { + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor0 %Idx %BaseColor1 %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %v "v" +OpName %BaseColor0 "BaseColor0" +OpName %Idx "Idx" +OpName %BaseColor1 "BaseColor1" +OpName %OutColor "OutColor" +OpDecorate %BaseColor0 Location 0 +OpDecorate %Idx Flat +OpDecorate %Idx Location 2 +OpDecorate %BaseColor1 Location 1 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor0 = OpVariable %_ptr_Input_v4float Input +%_ptr_Function_float = OpTypePointer Function %float +%int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%Idx = OpVariable %_ptr_Input_int Input +%BaseColor1 = OpVariable %_ptr_Input_v4float Input +%float_0_100000001 = OpConstant %float 0.100000001 +%19 = OpConstantComposite %v4float %float_0_100000001 %float_0_100000001 %float_0_100000001 %float_0_100000001 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %10 +%21 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%22 = OpLoad %v4float %BaseColor0 +OpStore %v %22 +%23 = OpLoad %int %Idx +%24 = OpAccessChain %_ptr_Function_float %v %23 +%26 = OpLoad %v4float %BaseColor1 +%27 = OpFAdd %v4float %26 %19 +OpStore %v %27 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %10 +%21 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%22 = OpLoad %v4float %BaseColor0 +%23 = OpLoad %int %Idx +%24 = OpAccessChain %_ptr_Function_float %v %23 +%26 = OpLoad %v4float %BaseColor1 +%27 = OpFAdd %v4float %26 %19 +OpStore %v %27 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck( + predefs + before, predefs + after, true, true); +} // TODO(greg-lunarg): Add tests to verify handling of these cases: // // Other target variable types diff --git a/third_party/spirv-tools/test/opt/local_single_store_elim_test.cpp b/third_party/spirv-tools/test/opt/local_single_store_elim_test.cpp old mode 100755 new mode 100644 index e42c6fafae..23e82ba86d --- a/third_party/spirv-tools/test/opt/local_single_store_elim_test.cpp +++ b/third_party/spirv-tools/test/opt/local_single_store_elim_test.cpp @@ -13,8 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "pass_fixture.h" -#include "pass_utils.h" +#include + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { @@ -769,6 +771,80 @@ OpFunctionEnd SinglePassRunAndCheck(before, after, true, true); } +// Test that that an unused OpAccessChain between a store and a use does does +// not hinders the replacement of the use. We need to check this because +// local-access-chain-convert does always remove the OpAccessChain instructions +// that become dead. + +TEST_F(LocalSingleStoreElimTest, + StoreElimWithUnusedInterveningAccessChainLoad) { + // Last load of v is eliminated, but access chain load and store of v isn't + // + // #version 140 + // + // in vec4 BaseColor; + // + // void main() + // { + // vec4 v = BaseColor; + // float f = v[3]; + // gl_FragColor = v * f; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Function_float = OpTypePointer Function %float +%uint = OpTypeInt 32 0 +%uint_3 = OpConstant %uint 3 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %8 +%17 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%18 = OpLoad %v4float %BaseColor +OpStore %v %18 +%19 = OpAccessChain %_ptr_Function_float %v %uint_3 +%21 = OpLoad %v4float %v +OpStore %gl_FragColor %21 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %8 +%17 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%18 = OpLoad %v4float %BaseColor +OpStore %v %18 +%19 = OpAccessChain %_ptr_Function_float %v %uint_3 +OpStore %gl_FragColor %18 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(predefs + before, + predefs + after, true, true); +} // TODO(greg-lunarg): Add tests to verify handling of these cases: // // Other types diff --git a/third_party/spirv-tools/test/opt/local_ssa_elim_test.cpp b/third_party/spirv-tools/test/opt/local_ssa_elim_test.cpp old mode 100755 new mode 100644 index 2f5d7b52d0..01a354adb7 --- a/third_party/spirv-tools/test/opt/local_ssa_elim_test.cpp +++ b/third_party/spirv-tools/test/opt/local_ssa_elim_test.cpp @@ -13,8 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "pass_fixture.h" -#include "pass_utils.h" +#include +#include + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/loop_optimizations/CMakeLists.txt b/third_party/spirv-tools/test/opt/loop_optimizations/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/test/opt/loop_optimizations/dependence_analysis.cpp b/third_party/spirv-tools/test/opt/loop_optimizations/dependence_analysis.cpp index 7c9e88d2ac..8aeb20afc8 100644 --- a/third_party/spirv-tools/test/opt/loop_optimizations/dependence_analysis.cpp +++ b/third_party/spirv-tools/test/opt/loop_optimizations/dependence_analysis.cpp @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include #include #include @@ -21,16 +19,16 @@ #include #include -#include "../assembly_builder.h" -#include "../function_utils.h" -#include "../pass_fixture.h" -#include "../pass_utils.h" - -#include "opt/iterator.h" -#include "opt/loop_dependence.h" -#include "opt/loop_descriptor.h" -#include "opt/pass.h" -#include "opt/tree_iterator.h" +#include "gmock/gmock.h" +#include "source/opt/iterator.h" +#include "source/opt/loop_dependence.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/pass.h" +#include "source/opt/tree_iterator.h" +#include "test/opt//assembly_builder.h" +#include "test/opt//function_utils.h" +#include "test/opt//pass_fixture.h" +#include "test/opt//pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/loop_optimizations/dependence_analysis_helpers.cpp b/third_party/spirv-tools/test/opt/loop_optimizations/dependence_analysis_helpers.cpp index 10a41320c4..715cf541dd 100644 --- a/third_party/spirv-tools/test/opt/loop_optimizations/dependence_analysis_helpers.cpp +++ b/third_party/spirv-tools/test/opt/loop_optimizations/dependence_analysis_helpers.cpp @@ -12,24 +12,22 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include #include #include #include -#include "../assembly_builder.h" -#include "../function_utils.h" -#include "../pass_fixture.h" -#include "../pass_utils.h" - -#include "opt/iterator.h" -#include "opt/loop_dependence.h" -#include "opt/loop_descriptor.h" -#include "opt/pass.h" -#include "opt/scalar_analysis.h" -#include "opt/tree_iterator.h" +#include "gmock/gmock.h" +#include "source/opt/iterator.h" +#include "source/opt/loop_dependence.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/pass.h" +#include "source/opt/scalar_analysis.h" +#include "source/opt/tree_iterator.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/loop_optimizations/fusion_compatibility.cpp b/third_party/spirv-tools/test/opt/loop_optimizations/fusion_compatibility.cpp index eb284dba93..cda8576c5d 100644 --- a/third_party/spirv-tools/test/opt/loop_optimizations/fusion_compatibility.cpp +++ b/third_party/spirv-tools/test/opt/loop_optimizations/fusion_compatibility.cpp @@ -12,17 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include #include #include #include #include -#include "../pass_fixture.h" -#include "opt/loop_descriptor.h" -#include "opt/loop_fusion.h" +#include "gmock/gmock.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/loop_fusion.h" +#include "test/opt/pass_fixture.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/loop_optimizations/fusion_illegal.cpp b/third_party/spirv-tools/test/opt/loop_optimizations/fusion_illegal.cpp index 79121a6bd3..26d54457d2 100644 --- a/third_party/spirv-tools/test/opt/loop_optimizations/fusion_illegal.cpp +++ b/third_party/spirv-tools/test/opt/loop_optimizations/fusion_illegal.cpp @@ -12,17 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include #include #include #include #include -#include "../pass_fixture.h" -#include "opt/loop_descriptor.h" -#include "opt/loop_fusion.h" +#include "gmock/gmock.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/loop_fusion.h" +#include "test/opt/pass_fixture.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/loop_optimizations/fusion_legal.cpp b/third_party/spirv-tools/test/opt/loop_optimizations/fusion_legal.cpp index 9cc651d9b4..509516f80d 100644 --- a/third_party/spirv-tools/test/opt/loop_optimizations/fusion_legal.cpp +++ b/third_party/spirv-tools/test/opt/loop_optimizations/fusion_legal.cpp @@ -12,22 +12,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include #include #include #include #include +#include "gmock/gmock.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/loop_fusion.h" +#include "test/opt/pass_fixture.h" + #ifdef SPIRV_EFFCEE #include "effcee/effcee.h" #endif -#include "../pass_fixture.h" -#include "opt/loop_descriptor.h" -#include "opt/loop_fusion.h" - namespace spvtools { namespace opt { namespace { diff --git a/third_party/spirv-tools/test/opt/loop_optimizations/fusion_pass.cpp b/third_party/spirv-tools/test/opt/loop_optimizations/fusion_pass.cpp index 0cd719023e..857ada9393 100644 --- a/third_party/spirv-tools/test/opt/loop_optimizations/fusion_pass.cpp +++ b/third_party/spirv-tools/test/opt/loop_optimizations/fusion_pass.cpp @@ -12,14 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include +#include + +#include "gmock/gmock.h" +#include "test/opt/pass_fixture.h" #ifdef SPIRV_EFFCEE #include "effcee/effcee.h" #endif -#include "../pass_fixture.h" - namespace spvtools { namespace opt { namespace { diff --git a/third_party/spirv-tools/test/opt/loop_optimizations/hoist_all_loop_types.cpp b/third_party/spirv-tools/test/opt/loop_optimizations/hoist_all_loop_types.cpp old mode 100755 new mode 100644 index 1bf7c5cb76..27e0a0d917 --- a/third_party/spirv-tools/test/opt/loop_optimizations/hoist_all_loop_types.cpp +++ b/third_party/spirv-tools/test/opt/loop_optimizations/hoist_all_loop_types.cpp @@ -14,10 +14,9 @@ #include -#include - -#include "../pass_fixture.h" -#include "opt/licm_pass.h" +#include "gmock/gmock.h" +#include "source/opt/licm_pass.h" +#include "test/opt/pass_fixture.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/loop_optimizations/hoist_double_nested_loops.cpp b/third_party/spirv-tools/test/opt/loop_optimizations/hoist_double_nested_loops.cpp old mode 100755 new mode 100644 index c65a216d6f..ea1949658d --- a/third_party/spirv-tools/test/opt/loop_optimizations/hoist_double_nested_loops.cpp +++ b/third_party/spirv-tools/test/opt/loop_optimizations/hoist_double_nested_loops.cpp @@ -14,10 +14,9 @@ #include -#include - -#include "../pass_fixture.h" -#include "opt/licm_pass.h" +#include "gmock/gmock.h" +#include "source/opt/licm_pass.h" +#include "test/opt/pass_fixture.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/loop_optimizations/hoist_from_independent_loops.cpp b/third_party/spirv-tools/test/opt/loop_optimizations/hoist_from_independent_loops.cpp old mode 100755 new mode 100644 index 8e7a80b329..abc79e37c5 --- a/third_party/spirv-tools/test/opt/loop_optimizations/hoist_from_independent_loops.cpp +++ b/third_party/spirv-tools/test/opt/loop_optimizations/hoist_from_independent_loops.cpp @@ -14,10 +14,9 @@ #include -#include - -#include "../pass_fixture.h" -#include "opt/licm_pass.h" +#include "gmock/gmock.h" +#include "source/opt/licm_pass.h" +#include "test/opt/pass_fixture.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/loop_optimizations/hoist_simple_case.cpp b/third_party/spirv-tools/test/opt/loop_optimizations/hoist_simple_case.cpp old mode 100755 new mode 100644 index db9813237f..e973d9d298 --- a/third_party/spirv-tools/test/opt/loop_optimizations/hoist_simple_case.cpp +++ b/third_party/spirv-tools/test/opt/loop_optimizations/hoist_simple_case.cpp @@ -14,10 +14,9 @@ #include -#include - -#include "../pass_fixture.h" -#include "opt/licm_pass.h" +#include "gmock/gmock.h" +#include "source/opt/licm_pass.h" +#include "test/opt/pass_fixture.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/loop_optimizations/hoist_single_nested_loops.cpp b/third_party/spirv-tools/test/opt/loop_optimizations/hoist_single_nested_loops.cpp old mode 100755 new mode 100644 index 32ef7cff08..7fa1fb0a0d --- a/third_party/spirv-tools/test/opt/loop_optimizations/hoist_single_nested_loops.cpp +++ b/third_party/spirv-tools/test/opt/loop_optimizations/hoist_single_nested_loops.cpp @@ -14,16 +14,14 @@ #include -#include - -#include "../pass_fixture.h" -#include "opt/licm_pass.h" +#include "gmock/gmock.h" +#include "source/opt/licm_pass.h" +#include "test/opt/pass_fixture.h" namespace spvtools { namespace opt { namespace { -using namespace spvtools; using ::testing::UnorderedElementsAre; using PassClassTest = PassTest<::testing::Test>; diff --git a/third_party/spirv-tools/test/opt/loop_optimizations/hoist_without_preheader.cpp b/third_party/spirv-tools/test/opt/loop_optimizations/hoist_without_preheader.cpp old mode 100755 new mode 100644 index e69afd2c22..9e8d02fac5 --- a/third_party/spirv-tools/test/opt/loop_optimizations/hoist_without_preheader.cpp +++ b/third_party/spirv-tools/test/opt/loop_optimizations/hoist_without_preheader.cpp @@ -14,10 +14,9 @@ #include -#include - -#include "../pass_fixture.h" -#include "opt/licm_pass.h" +#include "gmock/gmock.h" +#include "source/opt/licm_pass.h" +#include "test/opt/pass_fixture.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/loop_optimizations/lcssa.cpp b/third_party/spirv-tools/test/opt/loop_optimizations/lcssa.cpp old mode 100755 new mode 100644 index 0f0bd0bbb5..220772652b --- a/third_party/spirv-tools/test/opt/loop_optimizations/lcssa.cpp +++ b/third_party/spirv-tools/test/opt/loop_optimizations/lcssa.cpp @@ -12,24 +12,22 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include #include #include +#include "gmock/gmock.h" +#include "source/opt/build_module.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/loop_utils.h" +#include "source/opt/pass.h" +#include "test/opt//assembly_builder.h" +#include "test/opt/function_utils.h" + #ifdef SPIRV_EFFCEE #include "effcee/effcee.h" #endif -#include "../assembly_builder.h" -#include "../function_utils.h" - -#include "opt/build_module.h" -#include "opt/loop_descriptor.h" -#include "opt/loop_utils.h" -#include "opt/pass.h" - namespace spvtools { namespace opt { namespace { diff --git a/third_party/spirv-tools/test/opt/loop_optimizations/loop_descriptions.cpp b/third_party/spirv-tools/test/opt/loop_optimizations/loop_descriptions.cpp old mode 100755 new mode 100644 index c55f12638c..91dbdc6b54 --- a/third_party/spirv-tools/test/opt/loop_optimizations/loop_descriptions.cpp +++ b/third_party/spirv-tools/test/opt/loop_optimizations/loop_descriptions.cpp @@ -12,18 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include #include #include -#include "../assembly_builder.h" -#include "../function_utils.h" -#include "../pass_fixture.h" -#include "../pass_utils.h" -#include "opt/loop_descriptor.h" -#include "opt/pass.h" +#include "gmock/gmock.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/loop_optimizations/loop_fission.cpp b/third_party/spirv-tools/test/opt/loop_optimizations/loop_fission.cpp index 6fc95a5679..e513f4253a 100644 --- a/third_party/spirv-tools/test/opt/loop_optimizations/loop_fission.cpp +++ b/third_party/spirv-tools/test/opt/loop_optimizations/loop_fission.cpp @@ -12,19 +12,19 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include -#include - -#include "../assembly_builder.h" -#include "../function_utils.h" -#include "../pass_fixture.h" -#include "../pass_utils.h" -#include "opt/loop_fission.h" -#include "opt/loop_unroller.h" -#include "opt/loop_utils.h" -#include "opt/pass.h" +#include "gmock/gmock.h" +#include "source/opt/loop_fission.h" +#include "source/opt/loop_unroller.h" +#include "source/opt/loop_utils.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/loop_optimizations/nested_loops.cpp b/third_party/spirv-tools/test/opt/loop_optimizations/nested_loops.cpp old mode 100755 new mode 100644 index 062044af32..651cdef44b --- a/third_party/spirv-tools/test/opt/loop_optimizations/nested_loops.cpp +++ b/third_party/spirv-tools/test/opt/loop_optimizations/nested_loops.cpp @@ -12,22 +12,20 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include #include #include #include -#include "../assembly_builder.h" -#include "../function_utils.h" -#include "../pass_fixture.h" -#include "../pass_utils.h" - -#include "opt/iterator.h" -#include "opt/loop_descriptor.h" -#include "opt/pass.h" -#include "opt/tree_iterator.h" +#include "gmock/gmock.h" +#include "source/opt/iterator.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/pass.h" +#include "source/opt/tree_iterator.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/loop_optimizations/peeling.cpp b/third_party/spirv-tools/test/opt/loop_optimizations/peeling.cpp old mode 100755 new mode 100644 index cd1e49ce41..e5db20b408 --- a/third_party/spirv-tools/test/opt/loop_optimizations/peeling.cpp +++ b/third_party/spirv-tools/test/opt/loop_optimizations/peeling.cpp @@ -12,17 +12,20 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/opt/ir_builder.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/loop_peeling.h" +#include "test/opt/pass_fixture.h" #ifdef SPIRV_EFFCEE #include "effcee/effcee.h" #endif -#include "../pass_fixture.h" -#include "opt/ir_builder.h" -#include "opt/loop_descriptor.h" -#include "opt/loop_peeling.h" - namespace spvtools { namespace opt { namespace { diff --git a/third_party/spirv-tools/test/opt/loop_optimizations/peeling_pass.cpp b/third_party/spirv-tools/test/opt/loop_optimizations/peeling_pass.cpp index 47e7914cef..284ad838d4 100644 --- a/third_party/spirv-tools/test/opt/loop_optimizations/peeling_pass.cpp +++ b/third_party/spirv-tools/test/opt/loop_optimizations/peeling_pass.cpp @@ -12,12 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include +#include +#include +#include -#include "../pass_fixture.h" -#include "opt/ir_builder.h" -#include "opt/loop_descriptor.h" -#include "opt/loop_peeling.h" +#include "gmock/gmock.h" +#include "source/opt/ir_builder.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/loop_peeling.h" +#include "test/opt/pass_fixture.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/loop_optimizations/unroll_assumptions.cpp b/third_party/spirv-tools/test/opt/loop_optimizations/unroll_assumptions.cpp old mode 100755 new mode 100644 index be55c773f6..62f77d7822 --- a/third_party/spirv-tools/test/opt/loop_optimizations/unroll_assumptions.cpp +++ b/third_party/spirv-tools/test/opt/loop_optimizations/unroll_assumptions.cpp @@ -12,18 +12,18 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include -#include - -#include "../assembly_builder.h" -#include "../function_utils.h" -#include "../pass_fixture.h" -#include "../pass_utils.h" -#include "opt/loop_unroller.h" -#include "opt/loop_utils.h" -#include "opt/pass.h" +#include "gmock/gmock.h" +#include "source/opt/loop_unroller.h" +#include "source/opt/loop_utils.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/loop_optimizations/unroll_simple.cpp b/third_party/spirv-tools/test/opt/loop_optimizations/unroll_simple.cpp old mode 100755 new mode 100644 index 26cb07ff3f..3b01fdc317 --- a/third_party/spirv-tools/test/opt/loop_optimizations/unroll_simple.cpp +++ b/third_party/spirv-tools/test/opt/loop_optimizations/unroll_simple.cpp @@ -12,18 +12,18 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include -#include - -#include "../assembly_builder.h" -#include "../function_utils.h" -#include "../pass_fixture.h" -#include "../pass_utils.h" -#include "opt/loop_unroller.h" -#include "opt/loop_utils.h" -#include "opt/pass.h" +#include "gmock/gmock.h" +#include "source/opt/loop_unroller.h" +#include "source/opt/loop_utils.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/loop_optimizations/unswitch.cpp b/third_party/spirv-tools/test/opt/loop_optimizations/unswitch.cpp old mode 100755 new mode 100644 index 5082d23461..96a7fc010b --- a/third_party/spirv-tools/test/opt/loop_optimizations/unswitch.cpp +++ b/third_party/spirv-tools/test/opt/loop_optimizations/unswitch.cpp @@ -12,14 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include +#include + +#include "gmock/gmock.h" +#include "test/opt/pass_fixture.h" #ifdef SPIRV_EFFCEE #include "effcee/effcee.h" #endif -#include "../pass_fixture.h" - namespace spvtools { namespace opt { namespace { diff --git a/third_party/spirv-tools/test/opt/module_test.cpp b/third_party/spirv-tools/test/opt/module_test.cpp old mode 100755 new mode 100644 index 3270e40bc0..c4f450ea95 --- a/third_party/spirv-tools/test/opt/module_test.cpp +++ b/third_party/spirv-tools/test/opt/module_test.cpp @@ -12,18 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include +#include #include #include "gmock/gmock.h" #include "gtest/gtest.h" - -#include "message.h" -#include "opt/build_module.h" -#include "opt/module.h" +#include "source/opt/build_module.h" +#include "source/opt/module.h" #include "spirv-tools/libspirv.hpp" - -#include "module_utils.h" +#include "test/opt/module_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/module_utils.h b/third_party/spirv-tools/test/opt/module_utils.h old mode 100755 new mode 100644 index 5a3a1dabf3..007f132c25 --- a/third_party/spirv-tools/test/opt/module_utils.h +++ b/third_party/spirv-tools/test/opt/module_utils.h @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_TEST_OPT_MODULE_UTILS_H_ -#define LIBSPIRV_TEST_OPT_MODULE_UTILS_H_ +#ifndef TEST_OPT_MODULE_UTILS_H_ +#define TEST_OPT_MODULE_UTILS_H_ #include -#include "opt/module.h" +#include "source/opt/module.h" namespace spvtest { @@ -31,4 +31,4 @@ inline uint32_t GetIdBound(const spvtools::opt::Module& m) { } // namespace spvtest -#endif // LIBSPIRV_TEST_OPT_MODULE_UTILS_H_ +#endif // TEST_OPT_MODULE_UTILS_H_ diff --git a/third_party/spirv-tools/test/opt/optimizer_test.cpp b/third_party/spirv-tools/test/opt/optimizer_test.cpp old mode 100755 new mode 100644 index 0c2a374159..90abc00d0d --- a/third_party/spirv-tools/test/opt/optimizer_test.cpp +++ b/third_party/spirv-tools/test/opt/optimizer_test.cpp @@ -12,12 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include +#include +#include +#include "gmock/gmock.h" #include "spirv-tools/libspirv.hpp" #include "spirv-tools/optimizer.hpp" - -#include "pass_fixture.h" +#include "test/opt/pass_fixture.h" namespace spvtools { namespace opt { @@ -25,10 +26,20 @@ namespace { using ::testing::Eq; +// Return a string that contains the minimum instructions needed to form +// a valid module. Other instructions can be appended to this string. +std::string Header() { + return R"(OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +)"; +} + TEST(Optimizer, CanRunNullPassWithDistinctInputOutputVectors) { SpirvTools tools(SPV_ENV_UNIVERSAL_1_0); std::vector binary_in; - tools.Assemble("OpName %foo \"foo\"\n%foo = OpTypeVoid", &binary_in); + tools.Assemble(Header() + "OpName %foo \"foo\"\n%foo = OpTypeVoid", + &binary_in); Optimizer opt(SPV_ENV_UNIVERSAL_1_0); opt.RegisterPass(CreateNullPass()); @@ -37,13 +48,15 @@ TEST(Optimizer, CanRunNullPassWithDistinctInputOutputVectors) { std::string disassembly; tools.Disassemble(binary_out.data(), binary_out.size(), &disassembly); - EXPECT_THAT(disassembly, Eq("OpName %foo \"foo\"\n%foo = OpTypeVoid\n")); + EXPECT_THAT(disassembly, + Eq(Header() + "OpName %foo \"foo\"\n%foo = OpTypeVoid\n")); } TEST(Optimizer, CanRunTransformingPassWithDistinctInputOutputVectors) { SpirvTools tools(SPV_ENV_UNIVERSAL_1_0); std::vector binary_in; - tools.Assemble("OpName %foo \"foo\"\n%foo = OpTypeVoid", &binary_in); + tools.Assemble(Header() + "OpName %foo \"foo\"\n%foo = OpTypeVoid", + &binary_in); Optimizer opt(SPV_ENV_UNIVERSAL_1_0); opt.RegisterPass(CreateStripDebugInfoPass()); @@ -52,7 +65,7 @@ TEST(Optimizer, CanRunTransformingPassWithDistinctInputOutputVectors) { std::string disassembly; tools.Disassemble(binary_out.data(), binary_out.size(), &disassembly); - EXPECT_THAT(disassembly, Eq("%void = OpTypeVoid\n")); + EXPECT_THAT(disassembly, Eq(Header() + "%void = OpTypeVoid\n")); } TEST(Optimizer, CanRunNullPassWithAliasedVectors) { @@ -72,7 +85,7 @@ TEST(Optimizer, CanRunNullPassWithAliasedVectors) { TEST(Optimizer, CanRunNullPassWithAliasedVectorDataButDifferentSize) { SpirvTools tools(SPV_ENV_UNIVERSAL_1_0); std::vector binary; - tools.Assemble("OpName %foo \"foo\"\n%foo = OpTypeVoid", &binary); + tools.Assemble(Header() + "OpName %foo \"foo\"\n%foo = OpTypeVoid", &binary); Optimizer opt(SPV_ENV_UNIVERSAL_1_0); opt.RegisterPass(CreateNullPass()); @@ -87,13 +100,14 @@ TEST(Optimizer, CanRunNullPassWithAliasedVectorDataButDifferentSize) { std::string disassembly; tools.Disassemble(binary.data(), binary.size(), &disassembly); - EXPECT_THAT(disassembly, Eq("OpName %foo \"foo\"\n%foo = OpTypeVoid\n")); + EXPECT_THAT(disassembly, + Eq(Header() + "OpName %foo \"foo\"\n%foo = OpTypeVoid\n")); } TEST(Optimizer, CanRunTransformingPassWithAliasedVectors) { SpirvTools tools(SPV_ENV_UNIVERSAL_1_0); std::vector binary; - tools.Assemble("OpName %foo \"foo\"\n%foo = OpTypeVoid", &binary); + tools.Assemble(Header() + "OpName %foo \"foo\"\n%foo = OpTypeVoid", &binary); Optimizer opt(SPV_ENV_UNIVERSAL_1_0); opt.RegisterPass(CreateStripDebugInfoPass()); @@ -101,7 +115,7 @@ TEST(Optimizer, CanRunTransformingPassWithAliasedVectors) { std::string disassembly; tools.Disassemble(binary.data(), binary.size(), &disassembly); - EXPECT_THAT(disassembly, Eq("%void = OpTypeVoid\n")); + EXPECT_THAT(disassembly, Eq(Header() + "%void = OpTypeVoid\n")); } TEST(Optimizer, CanValidateFlags) { diff --git a/third_party/spirv-tools/test/opt/pass_fixture.h b/third_party/spirv-tools/test/opt/pass_fixture.h old mode 100755 new mode 100644 index a77e3b6857..9d9eb3661c --- a/third_party/spirv-tools/test/opt/pass_fixture.h +++ b/third_party/spirv-tools/test/opt/pass_fixture.h @@ -12,26 +12,27 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_TEST_OPT_PASS_FIXTURE_H_ -#define LIBSPIRV_TEST_OPT_PASS_FIXTURE_H_ +#ifndef TEST_OPT_PASS_FIXTURE_H_ +#define TEST_OPT_PASS_FIXTURE_H_ #include +#include #include #include +#include #include -#include +#include "gtest/gtest.h" +#include "source/opt/build_module.h" +#include "source/opt/pass_manager.h" +#include "source/opt/passes.h" +#include "source/util/make_unique.h" +#include "spirv-tools/libspirv.hpp" #ifdef SPIRV_EFFCEE #include "effcee/effcee.h" #endif -#include "opt/build_module.h" -#include "opt/make_unique.h" -#include "opt/pass_manager.h" -#include "opt/passes.h" -#include "spirv-tools/libspirv.hpp" - namespace spvtools { namespace opt { @@ -190,7 +191,7 @@ class PassTest : public TestT { // Renews the pass manager, including clearing all previously added passes. void RenewPassManger() { - manager_.reset(new PassManager()); + manager_ = MakeUnique(); manager_->SetMessageConsumer(consumer_); } @@ -242,4 +243,4 @@ class PassTest : public TestT { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_TEST_OPT_PASS_FIXTURE_H_ +#endif // TEST_OPT_PASS_FIXTURE_H_ diff --git a/third_party/spirv-tools/test/opt/pass_manager_test.cpp b/third_party/spirv-tools/test/opt/pass_manager_test.cpp old mode 100755 new mode 100644 index 3bb24b8c57..c7273e9c18 --- a/third_party/spirv-tools/test/opt/pass_manager_test.cpp +++ b/third_party/spirv-tools/test/opt/pass_manager_test.cpp @@ -12,13 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "gmock/gmock.h" - #include +#include +#include +#include +#include -#include "module_utils.h" -#include "opt/make_unique.h" -#include "pass_fixture.h" +#include "gmock/gmock.h" +#include "source/util/make_unique.h" +#include "test/opt/module_utils.h" +#include "test/opt/pass_fixture.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/pass_merge_return_test.cpp b/third_party/spirv-tools/test/opt/pass_merge_return_test.cpp old mode 100755 new mode 100644 index 52411eb277..5b2f6c6514 --- a/third_party/spirv-tools/test/opt/pass_merge_return_test.cpp +++ b/third_party/spirv-tools/test/opt/pass_merge_return_test.cpp @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include +#include +#include "gmock/gmock.h" #include "spirv-tools/libspirv.hpp" #include "spirv-tools/optimizer.hpp" - -#include "pass_fixture.h" -#include "pass_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/pass_remove_duplicates_test.cpp b/third_party/spirv-tools/test/opt/pass_remove_duplicates_test.cpp old mode 100755 new mode 100644 index 53e5f5e5d0..887fdfdb4e --- a/third_party/spirv-tools/test/opt/pass_remove_duplicates_test.cpp +++ b/third_party/spirv-tools/test/opt/pass_remove_duplicates_test.cpp @@ -13,15 +13,17 @@ // limitations under the License. #include +#include +#include +#include -#include - +#include "gmock/gmock.h" #include "source/opt/build_module.h" #include "source/opt/ir_context.h" #include "source/opt/pass_manager.h" #include "source/opt/remove_duplicates_pass.h" #include "source/spirv_constant.h" -#include "unit_spirv.h" +#include "test/unit_spirv.h" namespace spvtools { namespace opt { @@ -59,7 +61,7 @@ class RemoveDuplicatesTest : public ::testing::Test { tools_.SetMessageConsumer(consumer_); } - virtual void TearDown() override { error_message_.clear(); } + void TearDown() override { error_message_.clear(); } std::string RunPass(const std::string& text) { context_ = spvtools::BuildModule(SPV_ENV_UNIVERSAL_1_2, consumer_, text); diff --git a/third_party/spirv-tools/test/opt/pass_test.cpp b/third_party/spirv-tools/test/opt/pass_test.cpp old mode 100755 new mode 100644 index bfbe00eaa7..bce05b6790 --- a/third_party/spirv-tools/test/opt/pass_test.cpp +++ b/third_party/spirv-tools/test/opt/pass_test.cpp @@ -12,15 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include -#include - -#include "assembly_builder.h" -#include "opt/pass.h" -#include "pass_fixture.h" -#include "pass_utils.h" +#include "gmock/gmock.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/pass_utils.cpp b/third_party/spirv-tools/test/opt/pass_utils.cpp old mode 100755 new mode 100644 index 2f9ce1d396..ceb9996102 --- a/third_party/spirv-tools/test/opt/pass_utils.cpp +++ b/third_party/spirv-tools/test/opt/pass_utils.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "pass_utils.h" +#include "test/opt/pass_utils.h" #include #include diff --git a/third_party/spirv-tools/test/opt/pass_utils.h b/third_party/spirv-tools/test/opt/pass_utils.h old mode 100755 new mode 100644 index 9bb1e9018f..37406842a9 --- a/third_party/spirv-tools/test/opt/pass_utils.h +++ b/third_party/spirv-tools/test/opt/pass_utils.h @@ -12,9 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_TEST_OPT_PASS_UTILS_H_ -#define LIBSPIRV_TEST_OPT_PASS_UTILS_H_ +#ifndef TEST_OPT_PASS_UTILS_H_ +#define TEST_OPT_PASS_UTILS_H_ +#include #include #include #include @@ -64,4 +65,4 @@ std::vector Concat(const std::vector& a, const std::vector& b) { } // namespace opt } // namespace spvtools -#endif // LIBSPIRV_TEST_OPT_PASS_UTILS_H_ +#endif // TEST_OPT_PASS_UTILS_H_ diff --git a/third_party/spirv-tools/test/opt/private_to_local_test.cpp b/third_party/spirv-tools/test/opt/private_to_local_test.cpp old mode 100755 new mode 100644 index b0f73d84e7..d7eb37e511 --- a/third_party/spirv-tools/test/opt/private_to_local_test.cpp +++ b/third_party/spirv-tools/test/opt/private_to_local_test.cpp @@ -12,13 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "opt/value_number_table.h" +#include -#include "assembly_builder.h" #include "gmock/gmock.h" -#include "opt/build_module.h" -#include "pass_fixture.h" -#include "pass_utils.h" +#include "source/opt/build_module.h" +#include "source/opt/value_number_table.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/propagator_test.cpp b/third_party/spirv-tools/test/opt/propagator_test.cpp old mode 100755 new mode 100644 index d90b970fe2..fb8e487cc7 --- a/third_party/spirv-tools/test/opt/propagator_test.cpp +++ b/third_party/spirv-tools/test/opt/propagator_test.cpp @@ -12,14 +12,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include +#include +#include +#include +#include -#include "opt/build_module.h" -#include "opt/cfg.h" -#include "opt/ir_context.h" -#include "opt/pass.h" -#include "opt/propagator.h" +#include "gmock/gmock.h" +#include "gtest/gtest.h" +#include "source/opt/build_module.h" +#include "source/opt/cfg.h" +#include "source/opt/ir_context.h" +#include "source/opt/pass.h" +#include "source/opt/propagator.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/reduce_load_size_test.cpp b/third_party/spirv-tools/test/opt/reduce_load_size_test.cpp index d694ff909c..1d367e101b 100644 --- a/third_party/spirv-tools/test/opt/reduce_load_size_test.cpp +++ b/third_party/spirv-tools/test/opt/reduce_load_size_test.cpp @@ -12,8 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "pass_fixture.h" -#include "pass_utils.h" +#include + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/redundancy_elimination_test.cpp b/third_party/spirv-tools/test/opt/redundancy_elimination_test.cpp old mode 100755 new mode 100644 index 39c6f56884..a6e8c4f28a --- a/third_party/spirv-tools/test/opt/redundancy_elimination_test.cpp +++ b/third_party/spirv-tools/test/opt/redundancy_elimination_test.cpp @@ -12,13 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "opt/value_number_table.h" +#include -#include "assembly_builder.h" #include "gmock/gmock.h" -#include "opt/build_module.h" -#include "pass_fixture.h" -#include "pass_utils.h" +#include "source/opt/build_module.h" +#include "source/opt/value_number_table.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/register_liveness.cpp b/third_party/spirv-tools/test/opt/register_liveness.cpp index ec0a8ee9e9..cb973d2e6b 100644 --- a/third_party/spirv-tools/test/opt/register_liveness.cpp +++ b/third_party/spirv-tools/test/opt/register_liveness.cpp @@ -12,17 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include #include +#include #include -#include "assembly_builder.h" -#include "function_utils.h" -#include "opt/register_pressure.h" -#include "pass_fixture.h" -#include "pass_utils.h" +#include "gmock/gmock.h" +#include "source/opt/register_pressure.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/replace_invalid_opc_test.cpp b/third_party/spirv-tools/test/opt/replace_invalid_opc_test.cpp old mode 100755 new mode 100644 index 8da830c051..adfe2ee1e9 --- a/third_party/spirv-tools/test/opt/replace_invalid_opc_test.cpp +++ b/third_party/spirv-tools/test/opt/replace_invalid_opc_test.cpp @@ -12,11 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "assembly_builder.h" -#include "gmock/gmock.h" -#include "pass_fixture.h" - #include +#include +#include + +#include "gmock/gmock.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/scalar_analysis.cpp b/third_party/spirv-tools/test/opt/scalar_analysis.cpp old mode 100755 new mode 100644 index 0d76b3da4e..598d8c7b73 --- a/third_party/spirv-tools/test/opt/scalar_analysis.cpp +++ b/third_party/spirv-tools/test/opt/scalar_analysis.cpp @@ -12,23 +12,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include #include #include #include -#include "assembly_builder.h" -#include "function_utils.h" -#include "pass_fixture.h" -#include "pass_utils.h" - -#include "opt/iterator.h" -#include "opt/loop_descriptor.h" -#include "opt/pass.h" -#include "opt/scalar_analysis.h" -#include "opt/tree_iterator.h" +#include "gmock/gmock.h" +#include "source/opt/iterator.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/pass.h" +#include "source/opt/scalar_analysis.h" +#include "source/opt/tree_iterator.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/scalar_replacement_test.cpp b/third_party/spirv-tools/test/opt/scalar_replacement_test.cpp old mode 100755 new mode 100644 index bd3ce60947..652978bb06 --- a/third_party/spirv-tools/test/opt/scalar_replacement_test.cpp +++ b/third_party/spirv-tools/test/opt/scalar_replacement_test.cpp @@ -12,10 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "assembly_builder.h" +#include + #include "gmock/gmock.h" -#include "pass_fixture.h" -#include "pass_utils.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/set_spec_const_default_value_test.cpp b/third_party/spirv-tools/test/opt/set_spec_const_default_value_test.cpp old mode 100755 new mode 100644 index b415a6542c..161674fe02 --- a/third_party/spirv-tools/test/opt/set_spec_const_default_value_test.cpp +++ b/third_party/spirv-tools/test/opt/set_spec_const_default_value_test.cpp @@ -12,9 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "pass_fixture.h" +#include -#include +#include "gmock/gmock.h" +#include "test/opt/pass_fixture.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/simplification_test.cpp b/third_party/spirv-tools/test/opt/simplification_test.cpp old mode 100755 new mode 100644 index 40248ea06c..b5ad26790a --- a/third_party/spirv-tools/test/opt/simplification_test.cpp +++ b/third_party/spirv-tools/test/opt/simplification_test.cpp @@ -12,11 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "opt/simplification_pass.h" +#include -#include "assembly_builder.h" #include "gmock/gmock.h" -#include "pass_fixture.h" +#include "source/opt/simplification_pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/strength_reduction_test.cpp b/third_party/spirv-tools/test/opt/strength_reduction_test.cpp old mode 100755 new mode 100644 index 69313aa634..654c90df95 --- a/third_party/spirv-tools/test/opt/strength_reduction_test.cpp +++ b/third_party/spirv-tools/test/opt/strength_reduction_test.cpp @@ -12,16 +12,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "assembly_builder.h" -#include "gmock/gmock.h" -#include "pass_fixture.h" -#include "pass_utils.h" - #include #include #include #include +#include #include +#include + +#include "gmock/gmock.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/strip_debug_info_test.cpp b/third_party/spirv-tools/test/opt/strip_debug_info_test.cpp old mode 100755 new mode 100644 index ff1d41676c..f40ed382a6 --- a/third_party/spirv-tools/test/opt/strip_debug_info_test.cpp +++ b/third_party/spirv-tools/test/opt/strip_debug_info_test.cpp @@ -12,8 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "pass_fixture.h" -#include "pass_utils.h" +#include + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/strip_reflect_info_test.cpp b/third_party/spirv-tools/test/opt/strip_reflect_info_test.cpp old mode 100755 new mode 100644 index 08c6668a62..088cac7aa5 --- a/third_party/spirv-tools/test/opt/strip_reflect_info_test.cpp +++ b/third_party/spirv-tools/test/opt/strip_reflect_info_test.cpp @@ -12,8 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "pass_fixture.h" -#include "pass_utils.h" +#include + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/type_manager_test.cpp b/third_party/spirv-tools/test/opt/type_manager_test.cpp old mode 100755 new mode 100644 index f77536cb0e..cf1fcb583e --- a/third_party/spirv-tools/test/opt/type_manager_test.cpp +++ b/third_party/spirv-tools/test/opt/type_manager_test.cpp @@ -12,18 +12,22 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "gtest/gtest.h" +#include "source/opt/build_module.h" +#include "source/opt/instruction.h" +#include "source/opt/type_manager.h" +#include "spirv-tools/libspirv.hpp" #ifdef SPIRV_EFFCEE #include "effcee/effcee.h" #endif -#include "opt/build_module.h" -#include "opt/instruction.h" -#include "opt/type_manager.h" -#include "spirv-tools/libspirv.hpp" - namespace spvtools { namespace opt { namespace analysis { diff --git a/third_party/spirv-tools/test/opt/types_test.cpp b/third_party/spirv-tools/test/opt/types_test.cpp old mode 100755 new mode 100644 index 192cb16475..c11187e834 --- a/third_party/spirv-tools/test/opt/types_test.cpp +++ b/third_party/spirv-tools/test/opt/types_test.cpp @@ -13,12 +13,12 @@ // limitations under the License. #include +#include #include -#include - -#include "opt/make_unique.h" -#include "opt/types.h" +#include "gtest/gtest.h" +#include "source/opt/types.h" +#include "source/util/make_unique.h" namespace spvtools { namespace opt { @@ -28,13 +28,14 @@ namespace { // Fixture class providing some element types. class SameTypeTest : public ::testing::Test { protected: - virtual void SetUp() override { - void_t_.reset(new Void()); - u32_t_.reset(new Integer(32, false)); - f64_t_.reset(new Float(64)); - v3u32_t_.reset(new Vector(u32_t_.get(), 3)); - image_t_.reset(new Image(f64_t_.get(), SpvDim2D, 1, 1, 0, 0, - SpvImageFormatR16, SpvAccessQualifierReadWrite)); + void SetUp() override { + void_t_ = MakeUnique(); + u32_t_ = MakeUnique(32, false); + f64_t_ = MakeUnique(64); + v3u32_t_ = MakeUnique(u32_t_.get(), 3); + image_t_ = + MakeUnique(f64_t_.get(), SpvDim2D, 1, 1, 0, 0, SpvImageFormatR16, + SpvAccessQualifierReadWrite); } // Element types to be used for constructing other types for testing. diff --git a/third_party/spirv-tools/test/opt/unify_const_test.cpp b/third_party/spirv-tools/test/opt/unify_const_test.cpp old mode 100755 new mode 100644 index d277ce4ea7..37728cc232 --- a/third_party/spirv-tools/test/opt/unify_const_test.cpp +++ b/third_party/spirv-tools/test/opt/unify_const_test.cpp @@ -12,11 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include +#include #include +#include +#include -#include "assembly_builder.h" -#include "pass_fixture.h" -#include "pass_utils.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/utils_test.cpp b/third_party/spirv-tools/test/opt/utils_test.cpp old mode 100755 new mode 100644 index 893deb8823..9bb82a367d --- a/third_party/spirv-tools/test/opt/utils_test.cpp +++ b/third_party/spirv-tools/test/opt/utils_test.cpp @@ -12,9 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include +#include +#include -#include "pass_utils.h" +#include "gtest/gtest.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/value_table_test.cpp b/third_party/spirv-tools/test/opt/value_table_test.cpp old mode 100755 new mode 100644 index 6ea8e14b1f..ef338ae7ec --- a/third_party/spirv-tools/test/opt/value_table_test.cpp +++ b/third_party/spirv-tools/test/opt/value_table_test.cpp @@ -12,12 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "opt/value_number_table.h" +#include -#include "assembly_builder.h" #include "gmock/gmock.h" -#include "opt/build_module.h" -#include "pass_fixture.h" +#include "source/opt/build_module.h" +#include "source/opt/value_number_table.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/vector_dce_test.cpp b/third_party/spirv-tools/test/opt/vector_dce_test.cpp index a69bfd1d70..d1af0de19c 100644 --- a/third_party/spirv-tools/test/opt/vector_dce_test.cpp +++ b/third_party/spirv-tools/test/opt/vector_dce_test.cpp @@ -12,8 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "pass_fixture.h" -#include "pass_utils.h" +#include + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" namespace spvtools { namespace opt { diff --git a/third_party/spirv-tools/test/opt/workaround1209_test.cpp b/third_party/spirv-tools/test/opt/workaround1209_test.cpp old mode 100755 new mode 100644 index 23a8b2ea72..853a01cb22 --- a/third_party/spirv-tools/test/opt/workaround1209_test.cpp +++ b/third_party/spirv-tools/test/opt/workaround1209_test.cpp @@ -12,17 +12,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "assembly_builder.h" -#include "gmock/gmock.h" -#include "pass_fixture.h" -#include "pass_utils.h" - #include #include #include #include +#include #include +#include "gmock/gmock.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + namespace spvtools { namespace opt { namespace { diff --git a/third_party/spirv-tools/test/parse_number_test.cpp b/third_party/spirv-tools/test/parse_number_test.cpp old mode 100755 new mode 100644 index 284002da4c..c99205cf57 --- a/third_party/spirv-tools/test/parse_number_test.cpp +++ b/third_party/spirv-tools/test/parse_number_test.cpp @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include diff --git a/third_party/spirv-tools/test/preserve_numeric_ids_test.cpp b/third_party/spirv-tools/test/preserve_numeric_ids_test.cpp old mode 100755 new mode 100644 index aa7387253a..1c3354d55e --- a/third_party/spirv-tools/test/preserve_numeric_ids_test.cpp +++ b/third_party/spirv-tools/test/preserve_numeric_ids_test.cpp @@ -18,7 +18,7 @@ #include "source/text.h" #include "source/text_handler.h" -#include "test_fixture.h" +#include "test/test_fixture.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/scripts/test_compact_ids.py b/third_party/spirv-tools/test/scripts/test_compact_ids.py old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/test/software_version_test.cpp b/third_party/spirv-tools/test/software_version_test.cpp old mode 100755 new mode 100644 index 634c254a5e..80b944a300 --- a/third_party/spirv-tools/test/software_version_test.cpp +++ b/third_party/spirv-tools/test/software_version_test.cpp @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "unit_spirv.h" - #include +#include #include "gmock/gmock.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/stats/CMakeLists.txt b/third_party/spirv-tools/test/stats/CMakeLists.txt old mode 100755 new mode 100644 index 20f05fd0fb..3e4a0742f8 --- a/third_party/spirv-tools/test/stats/CMakeLists.txt +++ b/third_party/spirv-tools/test/stats/CMakeLists.txt @@ -19,6 +19,7 @@ set(VAL_TEST_COMMON_SRCS add_spvtools_unittest(TARGET stats_aggregate SRCS stats_aggregate_test.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../../tools/stats/spirv_stats.cpp ${VAL_TEST_COMMON_SRCS} LIBS ${SPIRV_TOOLS} ) diff --git a/third_party/spirv-tools/test/stats/stats_aggregate_test.cpp b/third_party/spirv-tools/test/stats/stats_aggregate_test.cpp old mode 100755 new mode 100644 index 7071f5a395..505fe2d6d2 --- a/third_party/spirv-tools/test/stats/stats_aggregate_test.cpp +++ b/third_party/spirv-tools/test/stats/stats_aggregate_test.cpp @@ -15,12 +15,14 @@ // Tests for unique type declaration rules validator. #include +#include -#include "source/spirv_stats.h" -#include "test_fixture.h" -#include "unit_spirv.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" +#include "tools/stats/spirv_stats.h" namespace spvtools { +namespace stats { namespace { using spvtest::ScopedContext; @@ -431,54 +433,6 @@ OpMemoryModel Logical GLSL450 EXPECT_EQ(1u, stats.s64_constant_hist.at(-64)); } -TEST(AggregateStats, IdDescriptor) { - const std::string code1 = R"( -OpCapability Addresses -OpCapability Kernel -OpCapability GenericPointer -OpCapability Linkage -OpMemoryModel Physical32 OpenCL -%u32 = OpTypeInt 32 0 -%f32 = OpTypeFloat 32 -%1 = OpConstant %f32 1 -%2 = OpConstant %f32 1 -%3 = OpConstant %u32 32 -)"; - - const std::string code2 = R"( -OpCapability Shader -OpCapability Linkage -OpMemoryModel Logical GLSL450 -%f32 = OpTypeFloat 32 -%u32 = OpTypeInt 32 0 -%1 = OpConstant %f32 1 -%2 = OpConstant %f32 3 -%3 = OpConstant %u32 32 -)"; - - const uint32_t kF32 = 1951208733; - const uint32_t kU32 = 2430404313; - const uint32_t kF32_1 = 296981500; - const uint32_t kF32_3 = 1450415100; - const uint32_t kU32_32 = 827246872; - - SpirvStats stats; - - CompileAndAggregateStats(code1, &stats); - - { - const std::unordered_map expected = { - {kF32, 3}, {kU32, 2}, {kF32_1, 2}, {kU32_32, 1}}; - EXPECT_EQ(expected, stats.id_descriptor_hist); - } - - CompileAndAggregateStats(code2, &stats); - { - const std::unordered_map expected = { - {kF32, 6}, {kU32, 4}, {kF32_1, 3}, {kF32_3, 1}, {kU32_32, 2}}; - EXPECT_EQ(expected, stats.id_descriptor_hist); - } -} - } // namespace +} // namespace stats } // namespace spvtools diff --git a/third_party/spirv-tools/test/stats/stats_analyzer_test.cpp b/third_party/spirv-tools/test/stats/stats_analyzer_test.cpp old mode 100755 new mode 100644 index 7d5f2f9ca6..3764c5bdd2 --- a/third_party/spirv-tools/test/stats/stats_analyzer_test.cpp +++ b/third_party/spirv-tools/test/stats/stats_analyzer_test.cpp @@ -17,11 +17,12 @@ #include #include -#include "latest_version_spirv_header.h" -#include "test_fixture.h" +#include "source/latest_version_spirv_header.h" +#include "test/test_fixture.h" #include "tools/stats/stats_analyzer.h" namespace spvtools { +namespace stats { namespace { // Fills |stats| with some synthetic header stats, as if aggregated from 100 @@ -169,4 +170,5 @@ TEST(StatsAnalyzer, OpcodeMarkov) { } } // namespace +} // namespace stats } // namespace spvtools diff --git a/third_party/spirv-tools/test/string_utils_test.cpp b/third_party/spirv-tools/test/string_utils_test.cpp old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/test/target_env_test.cpp b/third_party/spirv-tools/test/target_env_test.cpp old mode 100755 new mode 100644 index 4740a2d792..f9624646dc --- a/third_party/spirv-tools/test/target_env_test.cpp +++ b/third_party/spirv-tools/test/target_env_test.cpp @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - -#include "unit_spirv.h" +#include +#include "gmock/gmock.h" #include "source/spirv_target_env.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/test_fixture.h b/third_party/spirv-tools/test/test_fixture.h old mode 100755 new mode 100644 index e2948a899e..e85015c947 --- a/third_party/spirv-tools/test/test_fixture.h +++ b/third_party/spirv-tools/test/test_fixture.h @@ -12,10 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_TEST_TEST_FIXTURE_H_ -#define LIBSPIRV_TEST_TEST_FIXTURE_H_ +#ifndef TEST_TEST_FIXTURE_H_ +#define TEST_TEST_FIXTURE_H_ -#include "unit_spirv.h" +#include +#include + +#include "test/unit_spirv.h" namespace spvtest { @@ -179,4 +182,4 @@ using TextToBinaryTest = TextToBinaryTestBase<::testing::Test>; using RoundTripTest = spvtest::TextToBinaryTestBase<::testing::TestWithParam>; -#endif // LIBSPIRV_TEST_TEST_FIXTURE_H_ +#endif // TEST_TEST_FIXTURE_H_ diff --git a/third_party/spirv-tools/test/text_advance_test.cpp b/third_party/spirv-tools/test/text_advance_test.cpp old mode 100755 new mode 100644 index ebbe215785..9de77a8362 --- a/third_party/spirv-tools/test/text_advance_test.cpp +++ b/third_party/spirv-tools/test/text_advance_test.cpp @@ -12,7 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "unit_spirv.h" +#include + +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/text_destroy_test.cpp b/third_party/spirv-tools/test/text_destroy_test.cpp old mode 100755 new mode 100644 index 1c5b739767..4c2837ba6c --- a/third_party/spirv-tools/test/text_destroy_test.cpp +++ b/third_party/spirv-tools/test/text_destroy_test.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "unit_spirv.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/text_literal_test.cpp b/third_party/spirv-tools/test/text_literal_test.cpp old mode 100755 new mode 100644 index 74f4373548..7028089317 --- a/third_party/spirv-tools/test/text_literal_test.cpp +++ b/third_party/spirv-tools/test/text_literal_test.cpp @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "unit_spirv.h" +#include +#include +#include #include "gmock/gmock.h" -#include "message.h" -#include "test_fixture.h" - -#include +#include "test/test_fixture.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/text_start_new_inst_test.cpp b/third_party/spirv-tools/test/text_start_new_inst_test.cpp old mode 100755 new mode 100644 index 756156779c..ff35ac84c7 --- a/third_party/spirv-tools/test/text_start_new_inst_test.cpp +++ b/third_party/spirv-tools/test/text_start_new_inst_test.cpp @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "unit_spirv.h" - #include +#include "test/unit_spirv.h" + namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/text_to_binary.annotation_test.cpp b/third_party/spirv-tools/test/text_to_binary.annotation_test.cpp old mode 100755 new mode 100644 index 27df121f58..7aec905555 --- a/third_party/spirv-tools/test/text_to_binary.annotation_test.cpp +++ b/third_party/spirv-tools/test/text_to_binary.annotation_test.cpp @@ -15,13 +15,14 @@ // Assembler tests for instructions in the "Annotation" section of the // SPIR-V spec. -#include "unit_spirv.h" - #include +#include #include +#include #include "gmock/gmock.h" -#include "test_fixture.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/text_to_binary.barrier_test.cpp b/third_party/spirv-tools/test/text_to_binary.barrier_test.cpp old mode 100755 new mode 100644 index f3723aa809..545d26ff29 --- a/third_party/spirv-tools/test/text_to_binary.barrier_test.cpp +++ b/third_party/spirv-tools/test/text_to_binary.barrier_test.cpp @@ -15,10 +15,11 @@ // Assembler tests for instructions in the "Barrier Instructions" section // of the SPIR-V spec. -#include "unit_spirv.h" +#include #include "gmock/gmock.h" -#include "test_fixture.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/text_to_binary.constant_test.cpp b/third_party/spirv-tools/test/text_to_binary.constant_test.cpp old mode 100755 new mode 100644 index d110e79f39..1a24b528f2 --- a/third_party/spirv-tools/test/text_to_binary.constant_test.cpp +++ b/third_party/spirv-tools/test/text_to_binary.constant_test.cpp @@ -15,13 +15,14 @@ // Assembler tests for instructions in the "Group Instrucions" section of the // SPIR-V spec. -#include "unit_spirv.h" - #include #include +#include +#include #include "gmock/gmock.h" -#include "test_fixture.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/text_to_binary.control_flow_test.cpp b/third_party/spirv-tools/test/text_to_binary.control_flow_test.cpp old mode 100755 new mode 100644 index df83867509..07f1108840 --- a/third_party/spirv-tools/test/text_to_binary.control_flow_test.cpp +++ b/third_party/spirv-tools/test/text_to_binary.control_flow_test.cpp @@ -16,13 +16,13 @@ // SPIR-V spec. #include +#include #include #include -#include "unit_spirv.h" - #include "gmock/gmock.h" -#include "test_fixture.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/text_to_binary.debug_test.cpp b/third_party/spirv-tools/test/text_to_binary.debug_test.cpp old mode 100755 new mode 100644 index 9f5f0682c3..b85650e5ec --- a/third_party/spirv-tools/test/text_to_binary.debug_test.cpp +++ b/third_party/spirv-tools/test/text_to_binary.debug_test.cpp @@ -15,12 +15,12 @@ // Assembler tests for instructions in the "Debug" section of the // SPIR-V spec. -#include "unit_spirv.h" - #include +#include #include "gmock/gmock.h" -#include "test_fixture.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/text_to_binary.device_side_enqueue_test.cpp b/third_party/spirv-tools/test/text_to_binary.device_side_enqueue_test.cpp old mode 100755 new mode 100644 index 06f5aafb7d..25c100b8ef --- a/third_party/spirv-tools/test/text_to_binary.device_side_enqueue_test.cpp +++ b/third_party/spirv-tools/test/text_to_binary.device_side_enqueue_test.cpp @@ -15,10 +15,12 @@ // Assembler tests for instructions in the "Device-Side Enqueue Instructions" // section of the SPIR-V spec. -#include "unit_spirv.h" +#include +#include #include "gmock/gmock.h" -#include "test_fixture.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/text_to_binary.extension_test.cpp b/third_party/spirv-tools/test/text_to_binary.extension_test.cpp old mode 100755 new mode 100644 index cb595cb5cc..0d8d324b89 --- a/third_party/spirv-tools/test/text_to_binary.extension_test.cpp +++ b/third_party/spirv-tools/test/text_to_binary.extension_test.cpp @@ -15,12 +15,15 @@ // Assembler tests for instructions in the "Extension Instruction" section // of the SPIR-V spec. -#include "unit_spirv.h" +#include +#include +#include #include "gmock/gmock.h" -#include "latest_version_glsl_std_450_header.h" -#include "latest_version_opencl_std_header.h" -#include "test_fixture.h" +#include "source/latest_version_glsl_std_450_header.h" +#include "source/latest_version_opencl_std_header.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/text_to_binary.function_test.cpp b/third_party/spirv-tools/test/text_to_binary.function_test.cpp old mode 100755 new mode 100644 index ddd5461c8b..748461fb19 --- a/third_party/spirv-tools/test/text_to_binary.function_test.cpp +++ b/third_party/spirv-tools/test/text_to_binary.function_test.cpp @@ -15,10 +15,12 @@ // Assembler tests for instructions in the "Function" section of the // SPIR-V spec. -#include "unit_spirv.h" +#include +#include #include "gmock/gmock.h" -#include "test_fixture.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/text_to_binary.group_test.cpp b/third_party/spirv-tools/test/text_to_binary.group_test.cpp old mode 100755 new mode 100644 index 07887621ac..2f4b76d2f2 --- a/third_party/spirv-tools/test/text_to_binary.group_test.cpp +++ b/third_party/spirv-tools/test/text_to_binary.group_test.cpp @@ -15,10 +15,12 @@ // Assembler tests for instructions in the "Group Instrucions" section of the // SPIR-V spec. -#include "unit_spirv.h" +#include +#include #include "gmock/gmock.h" -#include "test_fixture.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/text_to_binary.image_test.cpp b/third_party/spirv-tools/test/text_to_binary.image_test.cpp old mode 100755 new mode 100644 index 3463e4bcaf..c1adedf448 --- a/third_party/spirv-tools/test/text_to_binary.image_test.cpp +++ b/third_party/spirv-tools/test/text_to_binary.image_test.cpp @@ -15,10 +15,12 @@ // Assembler tests for instructions in the "Image Instructions" section of // the SPIR-V spec. -#include "unit_spirv.h" +#include +#include #include "gmock/gmock.h" -#include "test_fixture.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/text_to_binary.literal_test.cpp b/third_party/spirv-tools/test/text_to_binary.literal_test.cpp old mode 100755 new mode 100644 index ce1f4ee00e..bcbb63e0db --- a/third_party/spirv-tools/test/text_to_binary.literal_test.cpp +++ b/third_party/spirv-tools/test/text_to_binary.literal_test.cpp @@ -14,7 +14,9 @@ // Assembler tests for literal numbers and literal strings. -#include "test_fixture.h" +#include + +#include "test/test_fixture.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/text_to_binary.memory_test.cpp b/third_party/spirv-tools/test/text_to_binary.memory_test.cpp old mode 100755 new mode 100644 index 38da78c8e7..ead08e6fda --- a/third_party/spirv-tools/test/text_to_binary.memory_test.cpp +++ b/third_party/spirv-tools/test/text_to_binary.memory_test.cpp @@ -15,12 +15,13 @@ // Assembler tests for instructions in the "Memory Instructions" section of // the SPIR-V spec. -#include "unit_spirv.h" - #include +#include +#include #include "gmock/gmock.h" -#include "test_fixture.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/text_to_binary.misc_test.cpp b/third_party/spirv-tools/test/text_to_binary.misc_test.cpp old mode 100755 new mode 100644 index bf524571c8..03b1e0914d --- a/third_party/spirv-tools/test/text_to_binary.misc_test.cpp +++ b/third_party/spirv-tools/test/text_to_binary.misc_test.cpp @@ -15,10 +15,10 @@ // Assembler tests for instructions in the "Miscellaneous" section of the // SPIR-V spec. -#include "unit_spirv.h" +#include "test/unit_spirv.h" #include "gmock/gmock.h" -#include "test_fixture.h" +#include "test/test_fixture.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/text_to_binary.mode_setting_test.cpp b/third_party/spirv-tools/test/text_to_binary.mode_setting_test.cpp old mode 100755 new mode 100644 index ad4629b99c..ed4fa2fb41 --- a/third_party/spirv-tools/test/text_to_binary.mode_setting_test.cpp +++ b/third_party/spirv-tools/test/text_to_binary.mode_setting_test.cpp @@ -15,10 +15,13 @@ // Assembler tests for instructions in the "Mode-Setting" section of the // SPIR-V spec. -#include "unit_spirv.h" +#include +#include +#include #include "gmock/gmock.h" -#include "test_fixture.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/text_to_binary.pipe_storage_test.cpp b/third_party/spirv-tools/test/text_to_binary.pipe_storage_test.cpp old mode 100755 new mode 100644 index ca3daf7fdb..f74dbcfdfe --- a/third_party/spirv-tools/test/text_to_binary.pipe_storage_test.cpp +++ b/third_party/spirv-tools/test/text_to_binary.pipe_storage_test.cpp @@ -13,7 +13,7 @@ // limitations under the License. #include "gmock/gmock.h" -#include "test_fixture.h" +#include "test/test_fixture.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/text_to_binary.reserved_sampling_test.cpp b/third_party/spirv-tools/test/text_to_binary.reserved_sampling_test.cpp old mode 100755 new mode 100644 index 54baf246ea..42e4e2aeb1 --- a/third_party/spirv-tools/test/text_to_binary.reserved_sampling_test.cpp +++ b/third_party/spirv-tools/test/text_to_binary.reserved_sampling_test.cpp @@ -14,10 +14,11 @@ // Validation tests for illegal instructions -#include "unit_spirv.h" +#include #include "gmock/gmock.h" -#include "test_fixture.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/text_to_binary.subgroup_dispatch_test.cpp b/third_party/spirv-tools/test/text_to_binary.subgroup_dispatch_test.cpp old mode 100755 new mode 100644 index 10aa77cf95..967e3c38b1 --- a/third_party/spirv-tools/test/text_to_binary.subgroup_dispatch_test.cpp +++ b/third_party/spirv-tools/test/text_to_binary.subgroup_dispatch_test.cpp @@ -15,10 +15,10 @@ // Assembler tests for instructions in the "Barrier Instructions" section // of the SPIR-V spec. -#include "unit_spirv.h" +#include "test/unit_spirv.h" #include "gmock/gmock.h" -#include "test_fixture.h" +#include "test/test_fixture.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/text_to_binary.type_declaration_test.cpp b/third_party/spirv-tools/test/text_to_binary.type_declaration_test.cpp old mode 100755 new mode 100644 index c4e7f7e0b3..c6f158f299 --- a/third_party/spirv-tools/test/text_to_binary.type_declaration_test.cpp +++ b/third_party/spirv-tools/test/text_to_binary.type_declaration_test.cpp @@ -15,10 +15,12 @@ // Assembler tests for instructions in the "Type-Declaration" section of the // SPIR-V spec. -#include "unit_spirv.h" +#include +#include #include "gmock/gmock.h" -#include "test_fixture.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/text_to_binary_test.cpp b/third_party/spirv-tools/test/text_to_binary_test.cpp old mode 100755 new mode 100644 index 4c2ad586aa..4ba37ad4de --- a/third_party/spirv-tools/test/text_to_binary_test.cpp +++ b/third_party/spirv-tools/test/text_to_binary_test.cpp @@ -14,16 +14,16 @@ #include #include +#include #include #include #include "gmock/gmock.h" - #include "source/spirv_constant.h" #include "source/util/bitutils.h" #include "source/util/hex_float.h" -#include "test_fixture.h" -#include "unit_spirv.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/text_word_get_test.cpp b/third_party/spirv-tools/test/text_word_get_test.cpp old mode 100755 new mode 100644 index 54e8493216..b74a680fa7 --- a/third_party/spirv-tools/test/text_word_get_test.cpp +++ b/third_party/spirv-tools/test/text_word_get_test.cpp @@ -12,7 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "unit_spirv.h" +#include + +#include "test/unit_spirv.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/timer_test.cpp b/third_party/spirv-tools/test/timer_test.cpp old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/test/unit_spirv.cpp b/third_party/spirv-tools/test/unit_spirv.cpp old mode 100755 new mode 100644 index 807f89c7df..84ed87a510 --- a/third_party/spirv-tools/test/unit_spirv.cpp +++ b/third_party/spirv-tools/test/unit_spirv.cpp @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "unit_spirv.h" +#include "test/unit_spirv.h" #include "gmock/gmock.h" -#include "test_fixture.h" +#include "test/test_fixture.h" namespace spvtools { namespace { diff --git a/third_party/spirv-tools/test/unit_spirv.h b/third_party/spirv-tools/test/unit_spirv.h old mode 100755 new mode 100644 index 5e27871591..2244288844 --- a/third_party/spirv-tools/test/unit_spirv.h +++ b/third_party/spirv-tools/test/unit_spirv.h @@ -12,14 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_TEST_UNITSPIRV_H_ -#define LIBSPIRV_TEST_UNITSPIRV_H_ +#ifndef TEST_UNIT_SPIRV_H_ +#define TEST_UNIT_SPIRV_H_ #include #include +#include #include +#include "gtest/gtest.h" #include "source/assembly_grammar.h" #include "source/binary.h" #include "source/diagnostic.h" @@ -31,8 +33,6 @@ #include "source/val/validate.h" #include "spirv-tools/libspirv.h" -#include - #ifdef __ANDROID__ #include namespace std { @@ -231,4 +231,4 @@ inline std::vector ElementsIn( } } // namespace spvtest -#endif // LIBSPIRV_TEST_UNITSPIRV_H_ +#endif // TEST_UNIT_SPIRV_H_ diff --git a/third_party/spirv-tools/test/util/CMakeLists.txt b/third_party/spirv-tools/test/util/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/test/util/bit_vector_test.cpp b/third_party/spirv-tools/test/util/bit_vector_test.cpp index 76ec560d80..8d967f8f93 100644 --- a/third_party/spirv-tools/test/util/bit_vector_test.cpp +++ b/third_party/spirv-tools/test/util/bit_vector_test.cpp @@ -16,7 +16,7 @@ #include "gmock/gmock.h" -#include "util/bit_vector.h" +#include "source/util/bit_vector.h" namespace spvtools { namespace utils { diff --git a/third_party/spirv-tools/test/util/ilist_test.cpp b/third_party/spirv-tools/test/util/ilist_test.cpp old mode 100755 new mode 100644 index 987d74662c..4a546f993c --- a/third_party/spirv-tools/test/util/ilist_test.cpp +++ b/third_party/spirv-tools/test/util/ilist_test.cpp @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include "gmock/gmock.h" - -#include "util/ilist.h" +#include "source/util/ilist.h" namespace spvtools { namespace utils { diff --git a/third_party/spirv-tools/test/util/small_vector_test.cpp b/third_party/spirv-tools/test/util/small_vector_test.cpp index 3460fdcc89..01d7df1857 100644 --- a/third_party/spirv-tools/test/util/small_vector_test.cpp +++ b/third_party/spirv-tools/test/util/small_vector_test.cpp @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include "gmock/gmock.h" - -#include "util/small_vector.h" +#include "source/util/small_vector.h" namespace spvtools { namespace utils { diff --git a/third_party/spirv-tools/test/val/CMakeLists.txt b/third_party/spirv-tools/test/val/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/test/val/val_adjacency_test.cpp b/third_party/spirv-tools/test/val/val_adjacency_test.cpp old mode 100755 new mode 100644 index 431f9b7d78..d62830514a --- a/third_party/spirv-tools/test/val/val_adjacency_test.cpp +++ b/third_party/spirv-tools/test/val/val_adjacency_test.cpp @@ -16,8 +16,8 @@ #include #include "gmock/gmock.h" -#include "unit_spirv.h" -#include "val_fixtures.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { diff --git a/third_party/spirv-tools/test/val/val_arithmetics_test.cpp b/third_party/spirv-tools/test/val/val_arithmetics_test.cpp old mode 100755 new mode 100644 index 73174e29d9..1c8d88be5a --- a/third_party/spirv-tools/test/val/val_arithmetics_test.cpp +++ b/third_party/spirv-tools/test/val/val_arithmetics_test.cpp @@ -17,8 +17,8 @@ #include #include "gmock/gmock.h" -#include "unit_spirv.h" -#include "val_fixtures.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { diff --git a/third_party/spirv-tools/test/val/val_atomics_test.cpp b/third_party/spirv-tools/test/val/val_atomics_test.cpp old mode 100755 new mode 100644 index a2b4236183..9aece39aa1 --- a/third_party/spirv-tools/test/val/val_atomics_test.cpp +++ b/third_party/spirv-tools/test/val/val_atomics_test.cpp @@ -16,8 +16,8 @@ #include #include "gmock/gmock.h" -#include "unit_spirv.h" -#include "val_fixtures.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { diff --git a/third_party/spirv-tools/test/val/val_barriers_test.cpp b/third_party/spirv-tools/test/val/val_barriers_test.cpp old mode 100755 new mode 100644 index cf88ac2244..710504eca4 --- a/third_party/spirv-tools/test/val/val_barriers_test.cpp +++ b/third_party/spirv-tools/test/val/val_barriers_test.cpp @@ -16,8 +16,8 @@ #include #include "gmock/gmock.h" -#include "unit_spirv.h" -#include "val_fixtures.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { diff --git a/third_party/spirv-tools/test/val/val_bitwise_test.cpp b/third_party/spirv-tools/test/val/val_bitwise_test.cpp old mode 100755 new mode 100644 index e14ebfa01b..18ccd4f8e1 --- a/third_party/spirv-tools/test/val/val_bitwise_test.cpp +++ b/third_party/spirv-tools/test/val/val_bitwise_test.cpp @@ -17,8 +17,8 @@ #include #include "gmock/gmock.h" -#include "unit_spirv.h" -#include "val_fixtures.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { diff --git a/third_party/spirv-tools/test/val/val_builtins_test.cpp b/third_party/spirv-tools/test/val/val_builtins_test.cpp old mode 100755 new mode 100644 index acfcdcd824..0c8909cec1 --- a/third_party/spirv-tools/test/val/val_builtins_test.cpp +++ b/third_party/spirv-tools/test/val/val_builtins_test.cpp @@ -20,10 +20,12 @@ #include #include #include +#include +#include #include "gmock/gmock.h" -#include "unit_spirv.h" -#include "val_fixtures.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { diff --git a/third_party/spirv-tools/test/val/val_capability_test.cpp b/third_party/spirv-tools/test/val/val_capability_test.cpp old mode 100755 new mode 100644 index b1d6dc3124..2ee7133cd6 --- a/third_party/spirv-tools/test/val/val_capability_test.cpp +++ b/third_party/spirv-tools/test/val/val_capability_test.cpp @@ -18,14 +18,14 @@ #include #include #include +#include -#include - +#include "gmock/gmock.h" #include "source/assembly_grammar.h" -#include "spirv_target_env.h" -#include "test_fixture.h" -#include "unit_spirv.h" -#include "val_fixtures.h" +#include "source/spirv_target_env.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { diff --git a/third_party/spirv-tools/test/val/val_cfg_test.cpp b/third_party/spirv-tools/test/val/val_cfg_test.cpp old mode 100755 new mode 100644 index 9f48a0c1bc..045166925c --- a/third_party/spirv-tools/test/val/val_cfg_test.cpp +++ b/third_party/spirv-tools/test/val/val_cfg_test.cpp @@ -26,9 +26,9 @@ #include "source/diagnostic.h" #include "source/val/validate.h" -#include "test_fixture.h" -#include "unit_spirv.h" -#include "val_fixtures.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { @@ -477,9 +477,10 @@ TEST_P(ValidateCFG, BranchTargetFirstBlockBadSinceEntryBlock) { TEST_P(ValidateCFG, BranchTargetFirstBlockBadSinceValue) { Block entry("entry"); + entry.SetBody("%undef = OpUndef %voidt\n"); Block bad("bad"); Block end("end", SpvOpReturn); - Block badvalue("func"); // This referenes the function name. + Block badvalue("undef"); // This referenes the OpUndef. std::string str = header(GetParam()) + nameOps("entry", "bad", std::make_pair("func", "Main")) + types_consts() + @@ -493,11 +494,10 @@ TEST_P(ValidateCFG, BranchTargetFirstBlockBadSinceValue) { CompileSuccessfully(str); ASSERT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); - EXPECT_THAT( - getDiagnosticString(), - MatchesRegex("Block\\(s\\) \\{.\\[Main\\]\\} are referenced but not " - "defined in function .\\[Main\\]\n" - " %Main = OpFunction %void None %10\n")) + EXPECT_THAT(getDiagnosticString(), + MatchesRegex("Block\\(s\\) \\{..\\} are referenced but not " + "defined in function .\\[Main\\]\n" + " %Main = OpFunction %void None %10\n")) << str; } diff --git a/third_party/spirv-tools/test/val/val_composites_test.cpp b/third_party/spirv-tools/test/val/val_composites_test.cpp old mode 100755 new mode 100644 index 4b21db5393..429007b00b --- a/third_party/spirv-tools/test/val/val_composites_test.cpp +++ b/third_party/spirv-tools/test/val/val_composites_test.cpp @@ -16,8 +16,8 @@ #include #include "gmock/gmock.h" -#include "unit_spirv.h" -#include "val_fixtures.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { diff --git a/third_party/spirv-tools/test/val/val_conversion_test.cpp b/third_party/spirv-tools/test/val/val_conversion_test.cpp old mode 100755 new mode 100644 index 3fb6d29451..e0b8a00180 --- a/third_party/spirv-tools/test/val/val_conversion_test.cpp +++ b/third_party/spirv-tools/test/val/val_conversion_test.cpp @@ -17,8 +17,8 @@ #include #include "gmock/gmock.h" -#include "unit_spirv.h" -#include "val_fixtures.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { diff --git a/third_party/spirv-tools/test/val/val_data_test.cpp b/third_party/spirv-tools/test/val/val_data_test.cpp old mode 100755 new mode 100644 index 916f98276f..d022d8b8a3 --- a/third_party/spirv-tools/test/val/val_data_test.cpp +++ b/third_party/spirv-tools/test/val/val_data_test.cpp @@ -19,8 +19,8 @@ #include #include "gmock/gmock.h" -#include "unit_spirv.h" -#include "val_fixtures.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { @@ -529,6 +529,17 @@ TEST_F(ValidateData, missing_forward_pointer_decl) { HasSubstr("must first be declared using OpTypeForwardPointer")); } +TEST_F(ValidateData, missing_forward_pointer_decl_self_reference) { + std::string str = header_with_addresses + R"( +%uintt = OpTypeInt 32 0 +%3 = OpTypeStruct %3 %uintt +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("must first be declared using OpTypeForwardPointer")); +} + TEST_F(ValidateData, forward_pointer_missing_definition) { std::string str = header_with_addresses + R"( OpTypeForwardPointer %_ptr_Generic_struct_A Generic diff --git a/third_party/spirv-tools/test/val/val_decoration_test.cpp b/third_party/spirv-tools/test/val/val_decoration_test.cpp old mode 100755 new mode 100644 index d2905ae977..4638af8688 --- a/third_party/spirv-tools/test/val/val_decoration_test.cpp +++ b/third_party/spirv-tools/test/val/val_decoration_test.cpp @@ -14,10 +14,13 @@ // Validation tests for decorations +#include +#include + #include "gmock/gmock.h" #include "source/val/decoration.h" -#include "unit_spirv.h" -#include "val_fixtures.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { @@ -3017,6 +3020,30 @@ TEST_F(ValidateDecorations, LayoutNotCheckedWhenSkipBlockLayout) { ValidateAndRetrieveValidationState(SPV_ENV_VULKAN_1_0)); EXPECT_THAT(getDiagnosticString(), Eq("")); } + +TEST_F(ValidateDecorations, EntryPointVariableWrongStorageClass) { + const std::string spirv = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "func" %var +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%ptr_int_Workgroup = OpTypePointer Workgroup %int +%var = OpVariable %ptr_int_Workgroup Workgroup +%func_ty = OpTypeFunction %void +%1 = OpFunction %void None %func_ty +%2 = OpLabel +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpEntryPoint interfaces must be OpVariables with " + "Storage Class of Input(1) or Output(3). Found Storage " + "Class 4 for Entry Point id 1.")); +} } // namespace } // namespace val } // namespace spvtools diff --git a/third_party/spirv-tools/test/val/val_derivatives_test.cpp b/third_party/spirv-tools/test/val/val_derivatives_test.cpp old mode 100755 new mode 100644 index 1d8519f65c..93a70e87cf --- a/third_party/spirv-tools/test/val/val_derivatives_test.cpp +++ b/third_party/spirv-tools/test/val/val_derivatives_test.cpp @@ -16,8 +16,8 @@ #include #include "gmock/gmock.h" -#include "unit_spirv.h" -#include "val_fixtures.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { diff --git a/third_party/spirv-tools/test/val/val_explicit_reserved_test.cpp b/third_party/spirv-tools/test/val/val_explicit_reserved_test.cpp index 67356c93b4..f01e933fae 100644 --- a/third_party/spirv-tools/test/val/val_explicit_reserved_test.cpp +++ b/third_party/spirv-tools/test/val/val_explicit_reserved_test.cpp @@ -14,10 +14,11 @@ // Validation tests for illegal instructions -#include "unit_spirv.h" +#include #include "gmock/gmock.h" -#include "val_fixtures.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { diff --git a/third_party/spirv-tools/test/val/val_ext_inst_test.cpp b/third_party/spirv-tools/test/val/val_ext_inst_test.cpp old mode 100755 new mode 100644 index e3c3311cfd..40126fd9d6 --- a/third_party/spirv-tools/test/val/val_ext_inst_test.cpp +++ b/third_party/spirv-tools/test/val/val_ext_inst_test.cpp @@ -18,10 +18,11 @@ #include #include +#include #include "gmock/gmock.h" -#include "unit_spirv.h" -#include "val_fixtures.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { diff --git a/third_party/spirv-tools/test/val/val_extensions_test.cpp b/third_party/spirv-tools/test/val/val_extensions_test.cpp old mode 100755 new mode 100644 index 328e22ac46..b185c3ca7e --- a/third_party/spirv-tools/test/val/val_extensions_test.cpp +++ b/third_party/spirv-tools/test/val/val_extensions_test.cpp @@ -15,14 +15,15 @@ // Tests for OpExtension validator rules. #include +#include -#include "enum_string_mapping.h" -#include "extensions.h" #include "gmock/gmock.h" -#include "spirv_target_env.h" -#include "test_fixture.h" -#include "unit_spirv.h" -#include "val_fixtures.h" +#include "source/enum_string_mapping.h" +#include "source/extensions.h" +#include "source/spirv_target_env.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { diff --git a/third_party/spirv-tools/test/val/val_fixtures.h b/third_party/spirv-tools/test/val/val_fixtures.h old mode 100755 new mode 100644 index 21762e8936..73a0cc6246 --- a/third_party/spirv-tools/test/val/val_fixtures.h +++ b/third_party/spirv-tools/test/val/val_fixtures.h @@ -14,12 +14,15 @@ // Common validation fixtures for unit tests -#ifndef LIBSPIRV_TEST_VALIDATE_FIXTURES_H_ -#define LIBSPIRV_TEST_VALIDATE_FIXTURES_H_ +#ifndef TEST_VAL_VAL_FIXTURES_H_ +#define TEST_VAL_VAL_FIXTURES_H_ + +#include +#include #include "source/val/validation_state.h" -#include "test_fixture.h" -#include "unit_spirv.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" namespace spvtest { @@ -136,4 +139,5 @@ spv_position_t ValidateBase::getErrorPosition() { } } // namespace spvtest -#endif + +#endif // TEST_VAL_VAL_FIXTURES_H_ diff --git a/third_party/spirv-tools/test/val/val_id_test.cpp b/third_party/spirv-tools/test/val/val_id_test.cpp old mode 100755 new mode 100644 index 09f1239e40..eee503d625 --- a/third_party/spirv-tools/test/val/val_id_test.cpp +++ b/third_party/spirv-tools/test/val/val_id_test.cpp @@ -14,11 +14,12 @@ #include #include +#include #include "gmock/gmock.h" -#include "test_fixture.h" -#include "unit_spirv.h" -#include "val_fixtures.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" // NOTE: The tests in this file are ONLY testing ID usage, there for the input // SPIR-V does not follow the logical layout rules from the spec in all cases in @@ -40,20 +41,31 @@ std::string kOpCapabilitySetup = R"( OpCapability Shader OpCapability Linkage OpCapability Addresses - OpCapability Pipes - OpCapability LiteralSampler - OpCapability DeviceEnqueue - OpCapability Vector16 OpCapability Int8 OpCapability Int16 OpCapability Int64 OpCapability Float64 + OpCapability LiteralSampler + OpCapability Pipes + OpCapability DeviceEnqueue + OpCapability Vector16 )"; std::string kGLSL450MemoryModel = kOpCapabilitySetup + R"( OpMemoryModel Logical GLSL450 )"; +std::string kNoKernelGLSL450MemoryModel = R"( + OpCapability Shader + OpCapability Linkage + OpCapability Addresses + OpCapability Int8 + OpCapability Int16 + OpCapability Int64 + OpCapability Float64 + OpMemoryModel Logical GLSL450 +)"; + std::string kOpenCLMemoryModel32 = R"( OpCapability Addresses OpCapability Linkage @@ -113,6 +125,7 @@ std::string BranchConditionalSetup = R"( %v4float = OpTypeVector %float 4 ; constants + %true = OpConstantTrue %bool %i0 = OpConstant %int 0 %i1 = OpConstant %int 1 %f0 = OpConstant %float 0 @@ -1025,23 +1038,6 @@ TEST_F(ValidateIdWithMessage, "component count does not match Result Type '4's " "vector component count.")); } -TEST_F(ValidateIdWithMessage, OpConstantCompositeMatrixColumnTypeBad) { - std::string spirv = kGLSL450MemoryModel + R"( - %1 = OpTypeInt 32 0 - %2 = OpTypeFloat 32 - %3 = OpTypeVector %1 2 - %4 = OpTypeVector %3 2 - %5 = OpTypeMatrix %2 2 - %6 = OpConstant %1 42 - %7 = OpConstant %2 3.14 - %8 = OpConstantComposite %3 %6 %6 - %9 = OpConstantComposite %4 %7 %7 -%10 = OpConstantComposite %5 %8 %9)"; - CompileSuccessfully(spirv.c_str()); - EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("Columns in a matrix must be of type vector.")); -} TEST_F(ValidateIdWithMessage, OpConstantCompositeArrayGood) { std::string spirv = kGLSL450MemoryModel + R"( %1 = OpTypeInt 32 0 @@ -2196,13 +2192,14 @@ TEST_F(ValidateIdWithMessage, OpStoreObjectGood) { %6 = OpVariable %3 UniformConstant %7 = OpFunction %1 None %4 %8 = OpLabel - OpStore %6 %7 +%9 = OpUndef %1 + OpStore %6 %9 OpReturn OpFunctionEnd)"; CompileSuccessfully(spirv.c_str()); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), - HasSubstr("OpStore Object '7's type is void.")); + HasSubstr("OpStore Object '9's type is void.")); } TEST_F(ValidateIdWithMessage, OpStoreTypeBad) { std::string spirv = kGLSL450MemoryModel + R"( @@ -2583,6 +2580,49 @@ TEST_F(ValidateIdWithMessage, OpCopyMemoryGood) { CompileSuccessfully(spirv.c_str()); EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); } + +TEST_F(ValidateIdWithMessage, OpCopyMemoryNonPointerTarget) { + const std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypePointer Uniform %2 +%4 = OpTypeFunction %1 %2 %3 +%5 = OpFunction %1 None %4 +%6 = OpFunctionParameter %2 +%7 = OpFunctionParameter %3 +%8 = OpLabel +OpCopyMemory %6 %7 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Target operand '6' is not a pointer.")); +} + +TEST_F(ValidateIdWithMessage, OpCopyMemoryNonPointerSource) { + const std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypePointer Uniform %2 +%4 = OpTypeFunction %1 %2 %3 +%5 = OpFunction %1 None %4 +%6 = OpFunctionParameter %2 +%7 = OpFunctionParameter %3 +%8 = OpLabel +OpCopyMemory %7 %6 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Source operand '6' is not a pointer.")); +} + TEST_F(ValidateIdWithMessage, OpCopyMemoryBad) { std::string spirv = kGLSL450MemoryModel + R"( %1 = OpTypeVoid @@ -2603,11 +2643,54 @@ TEST_F(ValidateIdWithMessage, OpCopyMemoryBad) { CompileSuccessfully(spirv.c_str()); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), - HasSubstr("OpCopyMemory Target '5's type does not match " + HasSubstr("Target '5's type does not match " "Source '2's type.")); } -// TODO: OpCopyMemorySized +TEST_F(ValidateIdWithMessage, OpCopyMemoryVoidTarget) { + const std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypePointer Uniform %1 +%4 = OpTypePointer Uniform %2 +%5 = OpTypeFunction %1 %3 %4 +%6 = OpFunction %1 None %5 +%7 = OpFunctionParameter %3 +%8 = OpFunctionParameter %4 +%9 = OpLabel +OpCopyMemory %7 %8 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Target operand '7' cannot be a void pointer.")); +} + +TEST_F(ValidateIdWithMessage, OpCopyMemoryVoidSource) { + const std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypePointer Uniform %1 +%4 = OpTypePointer Uniform %2 +%5 = OpTypeFunction %1 %3 %4 +%6 = OpFunction %1 None %5 +%7 = OpFunctionParameter %3 +%8 = OpFunctionParameter %4 +%9 = OpLabel +OpCopyMemory %8 %7 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Source operand '7' cannot be a void pointer.")); +} + TEST_F(ValidateIdWithMessage, OpCopyMemorySizedGood) { std::string spirv = kGLSL450MemoryModel + R"( %1 = OpTypeVoid @@ -2643,7 +2726,7 @@ TEST_F(ValidateIdWithMessage, OpCopyMemorySizedTargetBad) { CompileSuccessfully(spirv.c_str()); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), - HasSubstr("OpCopyMemorySized Target '9' is not a pointer.")); + HasSubstr("Target operand '9' is not a pointer.")); } TEST_F(ValidateIdWithMessage, OpCopyMemorySizedSourceBad) { std::string spirv = kGLSL450MemoryModel + R"( @@ -2662,7 +2745,7 @@ TEST_F(ValidateIdWithMessage, OpCopyMemorySizedSourceBad) { CompileSuccessfully(spirv.c_str()); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), - HasSubstr("OpCopyMemorySized Source '6' is not a pointer.")); + HasSubstr("Source operand '6' is not a pointer.")); } TEST_F(ValidateIdWithMessage, OpCopyMemorySizedSizeBad) { std::string spirv = kGLSL450MemoryModel + R"( @@ -2681,9 +2764,9 @@ TEST_F(ValidateIdWithMessage, OpCopyMemorySizedSizeBad) { OpFunctionEnd)"; CompileSuccessfully(spirv.c_str()); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); - EXPECT_THAT(getDiagnosticString(), - HasSubstr("OpCopyMemorySized Size '6's variable type is not " - "an integer type.")); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Size operand '6' must be a scalar integer type.")); } TEST_F(ValidateIdWithMessage, OpCopyMemorySizedSizeTypeBad) { std::string spirv = kGLSL450MemoryModel + R"( @@ -2706,8 +2789,173 @@ TEST_F(ValidateIdWithMessage, OpCopyMemorySizedSizeTypeBad) { EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT( getDiagnosticString(), - HasSubstr( - "OpCopyMemorySized Size '9's type is not an integer type.")); + HasSubstr("Size operand '9' must be a scalar integer type.")); +} + +TEST_F(ValidateIdWithMessage, OpCopyMemorySizedSizeConstantNull) { + const std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpConstantNull %2 +%4 = OpTypePointer Uniform %2 +%5 = OpTypeFloat 32 +%6 = OpTypePointer UniformConstant %5 +%7 = OpTypeFunction %1 %4 %6 +%8 = OpFunction %1 None %7 +%9 = OpFunctionParameter %4 +%10 = OpFunctionParameter %6 +%11 = OpLabel +OpCopyMemorySized %9 %10 %3 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Size operand '3' cannot be a constant zero.")); +} + +TEST_F(ValidateIdWithMessage, OpCopyMemorySizedSizeConstantZero) { + const std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpConstant %2 0 +%4 = OpTypePointer Uniform %2 +%5 = OpTypeFloat 32 +%6 = OpTypePointer UniformConstant %5 +%7 = OpTypeFunction %1 %4 %6 +%8 = OpFunction %1 None %7 +%9 = OpFunctionParameter %4 +%10 = OpFunctionParameter %6 +%11 = OpLabel +OpCopyMemorySized %9 %10 %3 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Size operand '3' cannot be a constant zero.")); +} + +TEST_F(ValidateIdWithMessage, OpCopyMemorySizedSizeConstantZero64) { + const std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 64 0 +%3 = OpConstant %2 0 +%4 = OpTypePointer Uniform %2 +%5 = OpTypeFloat 32 +%6 = OpTypePointer UniformConstant %5 +%7 = OpTypeFunction %1 %4 %6 +%8 = OpFunction %1 None %7 +%9 = OpFunctionParameter %4 +%10 = OpFunctionParameter %6 +%11 = OpLabel +OpCopyMemorySized %9 %10 %3 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Size operand '3' cannot be a constant zero.")); +} + +TEST_F(ValidateIdWithMessage, OpCopyMemorySizedSizeConstantNegative) { + const std::string spirv = kNoKernelGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 1 +%3 = OpConstant %2 -1 +%4 = OpTypePointer Uniform %2 +%5 = OpTypeFloat 32 +%6 = OpTypePointer UniformConstant %5 +%7 = OpTypeFunction %1 %4 %6 +%8 = OpFunction %1 None %7 +%9 = OpFunctionParameter %4 +%10 = OpFunctionParameter %6 +%11 = OpLabel +OpCopyMemorySized %9 %10 %3 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Size operand '3' cannot have the sign bit set to 1.")); +} + +TEST_F(ValidateIdWithMessage, OpCopyMemorySizedSizeConstantNegative64) { + const std::string spirv = kNoKernelGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 64 1 +%3 = OpConstant %2 -1 +%4 = OpTypePointer Uniform %2 +%5 = OpTypeFloat 32 +%6 = OpTypePointer UniformConstant %5 +%7 = OpTypeFunction %1 %4 %6 +%8 = OpFunction %1 None %7 +%9 = OpFunctionParameter %4 +%10 = OpFunctionParameter %6 +%11 = OpLabel +OpCopyMemorySized %9 %10 %3 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Size operand '3' cannot have the sign bit set to 1.")); +} + +TEST_F(ValidateIdWithMessage, OpCopyMemorySizedSizeUnsignedNegative) { + const std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpConstant %2 2147483648 +%4 = OpTypePointer Uniform %2 +%5 = OpTypeFloat 32 +%6 = OpTypePointer UniformConstant %5 +%7 = OpTypeFunction %1 %4 %6 +%8 = OpFunction %1 None %7 +%9 = OpFunctionParameter %4 +%10 = OpFunctionParameter %6 +%11 = OpLabel +OpCopyMemorySized %9 %10 %3 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpCopyMemorySizedSizeUnsignedNegative64) { + const std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 64 0 +%3 = OpConstant %2 9223372036854775808 +%4 = OpTypePointer Uniform %2 +%5 = OpTypeFloat 32 +%6 = OpTypePointer UniformConstant %5 +%7 = OpTypeFunction %1 %4 %6 +%8 = OpFunction %1 None %7 +%9 = OpFunctionParameter %4 +%10 = OpFunctionParameter %6 +%11 = OpLabel +OpCopyMemorySized %9 %10 %3 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); } const char kDeeplyNestedStructureSetup[] = R"( @@ -2795,7 +3043,8 @@ TEST_P(AccessChainInstructionTest, AccessChainResultTypeBad) { const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( %float_entry = )" + - instr + R"( %float %my_matrix )" + elem + + instr + + R"( %float %my_matrix )" + elem + R"(%int_0 %int_1 OpReturn OpFunctionEnd @@ -2834,8 +3083,8 @@ TEST_P(AccessChainInstructionTest, AccessChainBaseTypeNonPtrVariableBad) { const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( %entry = )" + - instr + - R"( %_ptr_Private_float %_ptr_Private_float )" + elem + + instr + R"( %_ptr_Private_float %_ptr_Private_float )" + + elem + R"(%int_0 %int_1 OpReturn OpFunctionEnd @@ -2855,8 +3104,7 @@ TEST_P(AccessChainInstructionTest, const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( %entry = )" + - instr + - R"( %_ptr_Function_float %my_matrix )" + elem + + instr + R"( %_ptr_Function_float %my_matrix )" + elem + R"(%int_0 %int_1 OpReturn OpFunctionEnd @@ -2875,10 +3123,10 @@ TEST_P(AccessChainInstructionTest, AccessChainBasePtrNotPointingToCompositeBad) { const std::string instr = GetParam(); const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; - std::string spirv = - kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( -%entry = )" + instr + - R"( %_ptr_Private_float %my_float_var )" + elem + R"(%int_0 + std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( +%entry = )" + + instr + R"( %_ptr_Private_float %my_float_var )" + elem + + R"(%int_0 OpReturn OpFunctionEnd )"; @@ -2897,8 +3145,8 @@ TEST_P(AccessChainInstructionTest, AccessChainNoIndexesGood) { const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( %entry = )" + - instr + - R"( %_ptr_Private_float %my_float_var )" + elem + R"( + instr + R"( %_ptr_Private_float %my_float_var )" + elem + + R"( OpReturn OpFunctionEnd )"; @@ -2913,8 +3161,8 @@ TEST_P(AccessChainInstructionTest, AccessChainNoIndexesBad) { const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( %entry = )" + - instr + - R"( %_ptr_Private_mat4x3 %my_float_var )" + elem + R"( + instr + R"( %_ptr_Private_mat4x3 %my_float_var )" + elem + + R"( OpReturn OpFunctionEnd )"; @@ -3062,10 +3310,10 @@ TEST_P(AccessChainInstructionTest, CustomizedAccessChainTooManyIndexesBad) { TEST_P(AccessChainInstructionTest, AccessChainUndefinedIndexBad) { const std::string instr = GetParam(); const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; - std::string spirv = - kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( -%entry = )" + instr + - R"( %_ptr_Private_float %my_matrix )" + elem + R"(%float %int_1 + std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( +%entry = )" + + instr + R"( %_ptr_Private_float %my_matrix )" + elem + + R"(%float %int_1 OpReturn OpFunctionEnd )"; @@ -3103,8 +3351,7 @@ TEST_P(AccessChainInstructionTest, const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( %entry = )" + - instr + - R"( %_ptr_Uniform_float %blockName_var )" + elem + + instr + R"( %_ptr_Uniform_float %blockName_var )" + elem + R"(%int_0 %int_1 %int_2 OpReturn OpFunctionEnd @@ -3124,8 +3371,7 @@ TEST_P(AccessChainInstructionTest, AccessChainStructTooManyIndexesBad) { const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( %entry = )" + - instr + - R"( %_ptr_Uniform_float %blockName_var )" + elem + + instr + R"( %_ptr_Uniform_float %blockName_var )" + elem + R"(%int_0 %int_2 %int_2 OpReturn OpFunctionEnd @@ -3144,8 +3390,7 @@ TEST_P(AccessChainInstructionTest, AccessChainStructIndexOutOfBoundBad) { const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( %entry = )" + - instr + - R"( %_ptr_Uniform_float %blockName_var )" + elem + + instr + R"( %_ptr_Uniform_float %blockName_var )" + elem + R"(%int_3 %int_2 %int_2 OpReturn OpFunctionEnd @@ -3195,8 +3440,7 @@ TEST_P(AccessChainInstructionTest, AccessChainIndexIntoRuntimeArrayGood) { const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( %runtime_arr_entry = )" + - instr + - R"( %_ptr_Uniform_float %blockName_var )" + elem + + instr + R"( %_ptr_Uniform_float %blockName_var )" + elem + R"(%int_2 %int_0 OpReturn OpFunctionEnd @@ -3211,8 +3455,7 @@ TEST_P(AccessChainInstructionTest, AccessChainIndexIntoRuntimeArrayBad) { const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( %runtime_arr_entry = )" + - instr + - R"( %_ptr_Uniform_float %blockName_var )" + elem + + instr + R"( %_ptr_Uniform_float %blockName_var )" + elem + R"(%int_2 %int_0 %int_1 OpReturn OpFunctionEnd @@ -3232,8 +3475,7 @@ TEST_P(AccessChainInstructionTest, AccessChainMatrixMoreArgsThanNeededBad) { const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( %entry = )" + - instr + - R"( %_ptr_Private_float %my_matrix )" + elem + + instr + R"( %_ptr_Private_float %my_matrix )" + elem + R"(%int_0 %int_1 %int_0 OpReturn OpFunctionEnd @@ -3253,8 +3495,7 @@ TEST_P(AccessChainInstructionTest, const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( %entry = )" + - instr + - R"( %_ptr_Private_mat4x3 %my_matrix )" + elem + + instr + R"( %_ptr_Private_mat4x3 %my_matrix )" + elem + R"(%int_0 %int_1 OpReturn OpFunctionEnd @@ -3304,7 +3545,7 @@ TEST_F(ValidateIdWithMessage, OpFunctionResultTypeBad) { EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), HasSubstr("OpFunction Result Type '2' does not match the " - "Function Type '2's return type.")); + "Function Type's return type '1'.")); } TEST_F(ValidateIdWithMessage, OpReturnValueTypeBad) { std::string spirv = kGLSL450MemoryModel + R"( @@ -3337,6 +3578,22 @@ OpFunctionEnd)"; HasSubstr("OpFunction Function Type '2' is not a function type.")); } +TEST_F(ValidateIdWithMessage, OpFunctionUseBad) { + const std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeFloat 32 +%2 = OpTypeFunction %1 +%3 = OpFunction %1 None %2 +%4 = OpLabel +OpReturnValue %3 +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Invalid use of function result id 3.")); +} + TEST_F(ValidateIdWithMessage, OpFunctionParameterGood) { std::string spirv = kGLSL450MemoryModel + R"( %1 = OpTypeVoid @@ -4163,39 +4420,27 @@ TEST_F(ValidateIdWithMessage, OpBranchConditional_CondIsScalarInt) { TEST_F(ValidateIdWithMessage, OpBranchConditional_TrueTargetIsNotLabel) { std::string spirv = BranchConditionalSetup + R"( OpSelectionMerge %end None - OpBranchConditional %i0 %i0 %target_f + OpBranchConditional %true %i0 %target_f )" + BranchConditionalTail; CompileSuccessfully(spirv.c_str()); - // EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); - // EXPECT_THAT( - // getDiagnosticString(), - // HasSubstr("The 'True Label' operand for OpBranchConditional must be the - // ID of an OpLabel instruction")); - - // xxxnsubtil: this is actually caught by the ID validation instead - EXPECT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), - HasSubstr("are referenced but not defined in function")); + HasSubstr("The 'True Label' operand for OpBranchConditional must " + "be the ID of an OpLabel instruction")); } TEST_F(ValidateIdWithMessage, OpBranchConditional_FalseTargetIsNotLabel) { std::string spirv = BranchConditionalSetup + R"( OpSelectionMerge %end None - OpBranchConditional %i0 %target_t %i0 + OpBranchConditional %true %target_t %i0 )" + BranchConditionalTail; CompileSuccessfully(spirv.c_str()); - // EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); - // EXPECT_THAT( - // getDiagnosticString(), - // HasSubstr("The 'False Label' operand for OpBranchConditional must be - // the ID of an OpLabel instruction")); - - // xxxnsubtil: this is actually caught by the ID validation - EXPECT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); EXPECT_THAT(getDiagnosticString(), - HasSubstr("are referenced but not defined in function")); + HasSubstr("The 'False Label' operand for OpBranchConditional " + "must be the ID of an OpLabel instruction")); } TEST_F(ValidateIdWithMessage, OpBranchConditional_NotEnoughWeights) { @@ -4638,10 +4883,9 @@ OpFunctionEnd )"; CompileSuccessfully(spirv.c_str()); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); - EXPECT_THAT( - getDiagnosticString(), - HasSubstr("OpDecorate SpectId decoration target '1' is not a " - "scalar specialization constant.")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpDecorate SpecId decoration target '1' is not a " + "scalar specialization constant.")); } TEST_F(ValidateIdWithMessage, SpecIdTargetOpSpecConstantOpBad) { @@ -4660,10 +4904,9 @@ OpFunctionEnd )"; CompileSuccessfully(spirv.c_str()); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); - EXPECT_THAT( - getDiagnosticString(), - HasSubstr("OpDecorate SpectId decoration target '1' is not a " - "scalar specialization constant.")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpDecorate SpecId decoration target '1' is not a " + "scalar specialization constant.")); } TEST_F(ValidateIdWithMessage, SpecIdTargetOpSpecConstantCompositeBad) { @@ -4681,10 +4924,9 @@ OpFunctionEnd )"; CompileSuccessfully(spirv.c_str()); EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); - EXPECT_THAT( - getDiagnosticString(), - HasSubstr("OpDecorate SpectId decoration target '1' is not a " - "scalar specialization constant.")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpDecorate SpecId decoration target '1' is not a " + "scalar specialization constant.")); } TEST_F(ValidateIdWithMessage, SpecIdTargetGood) { @@ -4735,6 +4977,18 @@ TEST_F(ValidateIdWithMessage, CorrectErrorForShuffle) { EXPECT_EQ(23, getErrorPosition().index); } +TEST_F(ValidateIdWithMessage, VoidStructMember) { + const std::string spirv = kGLSL450MemoryModel + R"( +%void = OpTypeVoid +%struct = OpTypeStruct %void +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Structures cannot contain a void type.")); +} + // TODO: OpLifetimeStart // TODO: OpLifetimeStop // TODO: OpAtomicInit diff --git a/third_party/spirv-tools/test/val/val_image_test.cpp b/third_party/spirv-tools/test/val/val_image_test.cpp old mode 100755 new mode 100644 index 522d4c9070..03f3eeb995 --- a/third_party/spirv-tools/test/val/val_image_test.cpp +++ b/third_party/spirv-tools/test/val/val_image_test.cpp @@ -18,8 +18,8 @@ #include #include "gmock/gmock.h" -#include "unit_spirv.h" -#include "val_fixtures.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { @@ -339,8 +339,8 @@ OpFunctionEnd)"; return ss.str(); } -std::string GetShaderHeader( - const std::string& capabilities_and_extensions = "") { +std::string GetShaderHeader(const std::string& capabilities_and_extensions = "", + bool include_entry_point = true) { std::ostringstream ss; ss << R"( OpCapability Shader @@ -348,10 +348,18 @@ OpCapability Int64 )"; ss << capabilities_and_extensions; + if (!include_entry_point) { + ss << "OpCapability Linkage"; + } ss << R"( OpMemoryModel Logical GLSL450 -OpEntryPoint Fragment %main "main" +)"; + + if (include_entry_point) { + ss << "OpEntryPoint Fragment %main \"main\""; + } + ss << R"( %void = OpTypeVoid %func = OpTypeFunction %void %bool = OpTypeBool @@ -365,7 +373,7 @@ OpEntryPoint Fragment %main "main" } TEST_F(ValidateImage, TypeImageWrongSampledType) { - const std::string code = GetShaderHeader() + R"( + const std::string code = GetShaderHeader("", false) + R"( %img_type = OpTypeImage %bool 2D 0 0 0 1 Unknown )"; @@ -380,6 +388,11 @@ TEST_F(ValidateImage, TypeImageWrongSampledType) { TEST_F(ValidateImage, TypeImageVoidSampledTypeVulkan) { const std::string code = GetShaderHeader() + R"( %img_type = OpTypeImage %void 2D 0 0 0 1 Unknown +%void_func = OpTypeFunction %void +%main = OpFunction %void None %void_func +%main_lab = OpLabel +OpReturn +OpFunctionEnd )"; const spv_target_env env = SPV_ENV_VULKAN_1_0; @@ -393,6 +406,11 @@ TEST_F(ValidateImage, TypeImageVoidSampledTypeVulkan) { TEST_F(ValidateImage, TypeImageU64SampledTypeVulkan) { const std::string code = GetShaderHeader() + R"( %img_type = OpTypeImage %u64 2D 0 0 0 1 Unknown +%void_func = OpTypeFunction %void +%main = OpFunction %void None %void_func +%main_lab = OpLabel +OpReturn +OpFunctionEnd )"; const spv_target_env env = SPV_ENV_VULKAN_1_0; @@ -404,7 +422,7 @@ TEST_F(ValidateImage, TypeImageU64SampledTypeVulkan) { } TEST_F(ValidateImage, TypeImageWrongDepth) { - const std::string code = GetShaderHeader() + R"( + const std::string code = GetShaderHeader("", false) + R"( %img_type = OpTypeImage %f32 2D 3 0 0 1 Unknown )"; @@ -415,7 +433,7 @@ TEST_F(ValidateImage, TypeImageWrongDepth) { } TEST_F(ValidateImage, TypeImageWrongArrayed) { - const std::string code = GetShaderHeader() + R"( + const std::string code = GetShaderHeader("", false) + R"( %img_type = OpTypeImage %f32 2D 0 2 0 1 Unknown )"; @@ -426,7 +444,7 @@ TEST_F(ValidateImage, TypeImageWrongArrayed) { } TEST_F(ValidateImage, TypeImageWrongMS) { - const std::string code = GetShaderHeader() + R"( + const std::string code = GetShaderHeader("", false) + R"( %img_type = OpTypeImage %f32 2D 0 0 2 1 Unknown )"; @@ -437,7 +455,7 @@ TEST_F(ValidateImage, TypeImageWrongMS) { } TEST_F(ValidateImage, TypeImageWrongSampled) { - const std::string code = GetShaderHeader() + R"( + const std::string code = GetShaderHeader("", false) + R"( %img_type = OpTypeImage %f32 2D 0 0 0 3 Unknown )"; @@ -448,8 +466,9 @@ TEST_F(ValidateImage, TypeImageWrongSampled) { } TEST_F(ValidateImage, TypeImageWrongSampledForSubpassData) { - const std::string code = GetShaderHeader("OpCapability InputAttachment\n") + - R"( + const std::string code = + GetShaderHeader("OpCapability InputAttachment\n", false) + + R"( %img_type = OpTypeImage %f32 SubpassData 0 0 0 1 Unknown )"; @@ -460,8 +479,9 @@ TEST_F(ValidateImage, TypeImageWrongSampledForSubpassData) { } TEST_F(ValidateImage, TypeImageWrongFormatForSubpassData) { - const std::string code = GetShaderHeader("OpCapability InputAttachment\n") + - R"( + const std::string code = + GetShaderHeader("OpCapability InputAttachment\n", false) + + R"( %img_type = OpTypeImage %f32 SubpassData 0 0 0 2 Rgba32f )"; @@ -472,7 +492,7 @@ TEST_F(ValidateImage, TypeImageWrongFormatForSubpassData) { } TEST_F(ValidateImage, TypeSampledImageNotImage) { - const std::string code = GetShaderHeader() + R"( + const std::string code = GetShaderHeader("", false) + R"( %simg_type = OpTypeSampledImage %f32 )"; diff --git a/third_party/spirv-tools/test/val/val_interfaces_test.cpp b/third_party/spirv-tools/test/val/val_interfaces_test.cpp index 220a6c5db0..b673a040f4 100644 --- a/third_party/spirv-tools/test/val/val_interfaces_test.cpp +++ b/third_party/spirv-tools/test/val/val_interfaces_test.cpp @@ -12,9 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include + #include "gmock/gmock.h" -#include "unit_spirv.h" -#include "val_fixtures.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { diff --git a/third_party/spirv-tools/test/val/val_layout_test.cpp b/third_party/spirv-tools/test/val/val_layout_test.cpp old mode 100755 new mode 100644 index 95876b8d3e..145c5439b3 --- a/third_party/spirv-tools/test/val/val_layout_test.cpp +++ b/third_party/spirv-tools/test/val/val_layout_test.cpp @@ -14,15 +14,18 @@ // Validation tests for Logical Layout +#include #include #include #include +#include #include +#include #include "gmock/gmock.h" #include "source/diagnostic.h" -#include "unit_spirv.h" -#include "val_fixtures.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { @@ -494,6 +497,21 @@ TEST_F(ValidateEntryPoint, FunctionIsTargetOfEntryPointAndFunctionCallBad) { "instruction and an OpFunctionCall instruction.")); } +// Invalid. Must be within a function to make a function call. +TEST_F(ValidateEntryPoint, FunctionCallOutsideFunctionBody) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpName %variableName "variableName" + %34 = OpFunctionCall %variableName %1 + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_LAYOUT, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("FunctionCall must happen within a function body.")); +} + // Valid. Module with a function but no entry point is valid when Linkage // Capability is used. TEST_F(ValidateEntryPoint, NoEntryPointWithLinkageCapGood) { diff --git a/third_party/spirv-tools/test/val/val_limits_test.cpp b/third_party/spirv-tools/test/val/val_limits_test.cpp old mode 100755 new mode 100644 index 40fb1dcea6..55bf1e5f16 --- a/third_party/spirv-tools/test/val/val_limits_test.cpp +++ b/third_party/spirv-tools/test/val/val_limits_test.cpp @@ -19,8 +19,8 @@ #include #include "gmock/gmock.h" -#include "unit_spirv.h" -#include "val_fixtures.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { diff --git a/third_party/spirv-tools/test/val/val_literals_test.cpp b/third_party/spirv-tools/test/val/val_literals_test.cpp old mode 100755 new mode 100644 index 39a082bcc3..cbdbdd10e7 --- a/third_party/spirv-tools/test/val/val_literals_test.cpp +++ b/third_party/spirv-tools/test/val/val_literals_test.cpp @@ -18,7 +18,7 @@ #include #include "gmock/gmock.h" -#include "val_fixtures.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { diff --git a/third_party/spirv-tools/test/val/val_logicals_test.cpp b/third_party/spirv-tools/test/val/val_logicals_test.cpp old mode 100755 new mode 100644 index 4c41558084..449cdd54fc --- a/third_party/spirv-tools/test/val/val_logicals_test.cpp +++ b/third_party/spirv-tools/test/val/val_logicals_test.cpp @@ -17,8 +17,8 @@ #include #include "gmock/gmock.h" -#include "unit_spirv.h" -#include "val_fixtures.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { diff --git a/third_party/spirv-tools/test/val/val_non_uniform_test.cpp b/third_party/spirv-tools/test/val/val_non_uniform_test.cpp index 47e20bda61..6ff5c127b3 100644 --- a/third_party/spirv-tools/test/val/val_non_uniform_test.cpp +++ b/third_party/spirv-tools/test/val/val_non_uniform_test.cpp @@ -14,10 +14,11 @@ #include #include +#include #include "gmock/gmock.h" -#include "unit_spirv.h" -#include "val_fixtures.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { diff --git a/third_party/spirv-tools/test/val/val_primitives_test.cpp b/third_party/spirv-tools/test/val/val_primitives_test.cpp old mode 100755 new mode 100644 index 993846bddf..f02ba80570 --- a/third_party/spirv-tools/test/val/val_primitives_test.cpp +++ b/third_party/spirv-tools/test/val/val_primitives_test.cpp @@ -16,8 +16,8 @@ #include #include "gmock/gmock.h" -#include "unit_spirv.h" -#include "val_fixtures.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { diff --git a/third_party/spirv-tools/test/val/val_ssa_test.cpp b/third_party/spirv-tools/test/val/val_ssa_test.cpp old mode 100755 new mode 100644 index b82bd22089..25944f5189 --- a/third_party/spirv-tools/test/val/val_ssa_test.cpp +++ b/third_party/spirv-tools/test/val/val_ssa_test.cpp @@ -19,8 +19,8 @@ #include #include "gmock/gmock.h" -#include "unit_spirv.h" -#include "val_fixtures.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { diff --git a/third_party/spirv-tools/test/val/val_state_test.cpp b/third_party/spirv-tools/test/val/val_state_test.cpp old mode 100755 new mode 100644 index a344f4daa6..699b224ad0 --- a/third_party/spirv-tools/test/val/val_state_test.cpp +++ b/third_party/spirv-tools/test/val/val_state_test.cpp @@ -18,15 +18,15 @@ #include #include "gtest/gtest.h" -#include "latest_version_spirv_header.h" +#include "source/latest_version_spirv_header.h" -#include "enum_set.h" -#include "extensions.h" -#include "spirv_validator_options.h" -#include "val/construct.h" -#include "val/function.h" -#include "val/validation_state.h" -#include "val/validate.h" +#include "source/enum_set.h" +#include "source/extensions.h" +#include "source/spirv_validator_options.h" +#include "source/val/construct.h" +#include "source/val/function.h" +#include "source/val/validate.h" +#include "source/val/validation_state.h" namespace spvtools { namespace val { diff --git a/third_party/spirv-tools/test/val/val_storage_test.cpp b/third_party/spirv-tools/test/val/val_storage_test.cpp old mode 100755 new mode 100644 index 0f05dccc8c..46b3ddcbb5 --- a/third_party/spirv-tools/test/val/val_storage_test.cpp +++ b/third_party/spirv-tools/test/val/val_storage_test.cpp @@ -19,7 +19,7 @@ #include #include "gmock/gmock.h" -#include "val_fixtures.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { diff --git a/third_party/spirv-tools/test/val/val_type_unique_test.cpp b/third_party/spirv-tools/test/val/val_type_unique_test.cpp old mode 100755 new mode 100644 index 7215c1d6bd..67ceaddb86 --- a/third_party/spirv-tools/test/val/val_type_unique_test.cpp +++ b/third_party/spirv-tools/test/val/val_type_unique_test.cpp @@ -17,8 +17,8 @@ #include #include "gmock/gmock.h" -#include "unit_spirv.h" -#include "val_fixtures.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { diff --git a/third_party/spirv-tools/test/val/val_validation_state_test.cpp b/third_party/spirv-tools/test/val/val_validation_state_test.cpp old mode 100755 new mode 100644 index 79cc06e172..68504c5288 --- a/third_party/spirv-tools/test/val/val_validation_state_test.cpp +++ b/third_party/spirv-tools/test/val/val_validation_state_test.cpp @@ -17,9 +17,9 @@ #include #include "gmock/gmock.h" -#include "spirv_validator_options.h" -#include "unit_spirv.h" -#include "val_fixtures.h" +#include "source/spirv_validator_options.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { diff --git a/third_party/spirv-tools/test/val/val_version_test.cpp b/third_party/spirv-tools/test/val/val_version_test.cpp index 58f47897ed..fa252ac869 100644 --- a/third_party/spirv-tools/test/val/val_version_test.cpp +++ b/third_party/spirv-tools/test/val/val_version_test.cpp @@ -12,8 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include +#include + #include "gmock/gmock.h" -#include "val_fixtures.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { diff --git a/third_party/spirv-tools/test/val/val_webgpu_test.cpp b/third_party/spirv-tools/test/val/val_webgpu_test.cpp index a45c940154..b65d08fe69 100644 --- a/third_party/spirv-tools/test/val/val_webgpu_test.cpp +++ b/third_party/spirv-tools/test/val/val_webgpu_test.cpp @@ -14,9 +14,10 @@ // Validation tests for WebGPU env specific checks -#include +#include -#include "val_fixtures.h" +#include "gmock/gmock.h" +#include "test/val/val_fixtures.h" namespace spvtools { namespace val { diff --git a/third_party/spirv-tools/testing/test.gni b/third_party/spirv-tools/testing/test.gni deleted file mode 100644 index d42fe52c67..0000000000 --- a/third_party/spirv-tools/testing/test.gni +++ /dev/null @@ -1,413 +0,0 @@ -# Copyright 2018 The Chromium Authors. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# ============================================================================== -# TEST SETUP -# ============================================================================== - -if (is_android) { - import("//build/config/android/config.gni") - import("//build/config/android/rules.gni") - import("//build/config/sanitizers/sanitizers.gni") - import("//build/config/android/extract_unwind_tables.gni") -} - -if (is_fuchsia) { - import("//build/config/chromecast_build.gni") - import("//build/config/fuchsia/rules.gni") - import("//build/config/fuchsia/package.gni") -} - -if (is_chromeos) { - import("//build/config/chromeos/rules.gni") -} - -# Define a test as an executable (or apk on Android) with the "testonly" flag -# set. -# Variable: -# use_raw_android_executable: Use executable() rather than android_apk(). -# use_native_activity: Test implements ANativeActivity_onCreate(). -template("test") { - if (is_android) { - _use_raw_android_executable = defined(invoker.use_raw_android_executable) && - invoker.use_raw_android_executable - - # output_name is used to allow targets with the same name but in different - # packages to still produce unique runner scripts. - _output_name = invoker.target_name - if (defined(invoker.output_name)) { - _output_name = invoker.output_name - } - - _test_runner_target = "${_output_name}__test_runner_script" - _wrapper_script_vars = [ - "ignore_all_data_deps", - "shard_timeout", - ] - - assert(_use_raw_android_executable || enable_java_templates) - - _incremental_apk_only = - incremental_apk_by_default && !_use_raw_android_executable - - if (_use_raw_android_executable) { - _exec_target = "${target_name}__exec" - _dist_target = "${target_name}__dist" - _exec_output = - "$target_out_dir/${invoker.target_name}/${invoker.target_name}" - - executable(_exec_target) { - # Configs will always be defined since we set_defaults in BUILDCONFIG.gn. - configs = [] - data_deps = [] - forward_variables_from(invoker, - "*", - _wrapper_script_vars + [ "extra_dist_files" ]) - testonly = true - - # Thanks to the set_defaults() for test(), configs are initialized with - # the default shared_library configs rather than executable configs. - configs -= [ - "//build/config:shared_library_config", - "//build/config/android:hide_all_but_jni", - ] - configs += [ "//build/config:executable_config" ] - - # Don't output to the root or else conflict with the group() below. - output_name = rebase_path(_exec_output, root_out_dir) - if (is_component_build || is_asan) { - data_deps += [ "//build/android:cpplib_stripped" ] - } - } - - create_native_executable_dist(_dist_target) { - testonly = true - dist_dir = "$root_out_dir/$target_name" - binary = _exec_output - deps = [ - ":$_exec_target", - ] - if (defined(invoker.extra_dist_files)) { - extra_files = invoker.extra_dist_files - } - } - } else { - _library_target = "_${target_name}__library" - _apk_target = "${target_name}_apk" - _apk_specific_vars = [ - "android_manifest", - "android_manifest_dep", - "enable_multidex", - "proguard_configs", - "proguard_enabled", - "use_default_launcher", - "write_asset_list", - "use_native_activity", - ] - - # Adds the unwind tables from unstripped binary as an asset file in the - # apk, if |add_unwind_tables_in_apk| is specified by the test. - if (defined(invoker.add_unwind_tables_in_apk) && - invoker.add_unwind_tables_in_apk) { - _unwind_table_asset_name = "${target_name}_unwind_assets" - unwind_table_asset(_unwind_table_asset_name) { - testonly = true - library_target = _library_target - deps = [ - ":$_library_target", - ] - } - } - - shared_library(_library_target) { - # Configs will always be defined since we set_defaults in BUILDCONFIG.gn. - configs = [] # Prevent list overwriting warning. - configs = invoker.configs - testonly = true - - deps = [] - forward_variables_from( - invoker, - "*", - _apk_specific_vars + _wrapper_script_vars + [ "visibility" ]) - - if (!defined(invoker.use_default_launcher) || - invoker.use_default_launcher) { - deps += [ "//testing/android/native_test:native_test_native_code" ] - } - } - unittest_apk(_apk_target) { - forward_variables_from(invoker, _apk_specific_vars + [ "deps" ]) - shared_library = ":$_library_target" - apk_name = invoker.target_name - if (defined(invoker.output_name)) { - apk_name = invoker.output_name - install_script_name = "install_${invoker.output_name}" - } - - # Add the Java classes so that each target does not have to do it. - deps += [ "//base/test:test_support_java" ] - - if (defined(_unwind_table_asset_name)) { - deps += [ ":${_unwind_table_asset_name}" ] - } - - # TODO(agrieve): Remove this data_dep once bots don't build the _apk - # target (post-GYP). - # It's a bit backwards for the apk to depend on the runner script, since - # the apk is conceptually a runtime_dep of the script. However, it is - # currently necessary because the bots build this _apk target directly - # rather than the group() below. - data_deps = [ - ":$_test_runner_target", - ] - } - - _test_runner_target = "${_output_name}__test_runner_script" - _incremental_test_name = "${_output_name}_incremental" - _incremental_test_runner_target = - "${_output_name}_incremental__test_runner_script" - if (_incremental_apk_only) { - _incremental_test_name = _output_name - _incremental_test_runner_target = _test_runner_target - } - - # Incremental test targets work only for .apks. - test_runner_script(_incremental_test_runner_target) { - forward_variables_from(invoker, - _wrapper_script_vars + [ - "data", - "data_deps", - "deps", - "public_deps", - ]) - apk_target = ":$_apk_target" - test_name = _incremental_test_name - test_type = "gtest" - test_suite = _output_name - incremental_install = true - } - group("${target_name}_incremental") { - testonly = true - data_deps = [ - ":$_incremental_test_runner_target", - ] - deps = [ - ":${_apk_target}_incremental", - ] - } - } - - if (!_incremental_apk_only) { - test_runner_script(_test_runner_target) { - forward_variables_from(invoker, - _wrapper_script_vars + [ - "data", - "data_deps", - "deps", - "public_deps", - ]) - - if (_use_raw_android_executable) { - executable_dist_dir = "$root_out_dir/$_dist_target" - } else { - apk_target = ":$_apk_target" - } - test_name = _output_name - test_type = "gtest" - test_suite = _output_name - } - } - - test_runner_script(target_name) { - forward_variables_from(invoker, - _wrapper_script_vars + [ - "data", - "data_deps", - "deps", - "public_deps", - ]) - - if (_use_raw_android_executable) { - executable_dist_dir = "$root_out_dir/$_dist_target" - deps += [ - ":$_dist_target", - ":$_test_runner_target", - ] - } else { - apk_target = ":$_apk_target" - deps += [ ":$_apk_target" ] - if (_incremental_apk_only) { - deps += [ ":${target_name}_incremental" ] - } else { - deps += [ ":$_test_runner_target" ] - } - } - generated_script = "$root_build_dir/$_output_name" - incremental_install = _incremental_apk_only - test_name = _output_name - test_suite = _output_name - test_type = "gtest" - } - } else if (is_fuchsia) { - _output_name = invoker.target_name - _pkg_target = "${_output_name}_pkg" - _gen_runner_target = "${_output_name}_runner" - _exec_target = "${_output_name}__exec" - - group(target_name) { - testonly = true - deps = [ - ":$_gen_runner_target", - ":$_pkg_target", - ] - } - - # Makes the script which invokes the executable. - test_runner_script(_gen_runner_target) { - forward_variables_from(invoker, [ "use_test_server" ]) - test_name = _output_name - package_name = _output_name - } - - executable(_exec_target) { - testonly = true - forward_variables_from(invoker, "*") - output_name = _exec_target - } - - package(_pkg_target) { - testonly = true - package_name = _output_name - sandbox_policy = "//build/config/fuchsia/testing_sandbox_policy" - binary = get_label_info(_exec_target, "name") - deps = [ - ":$_exec_target", - ] - } - } else if (is_ios) { - import("//build/config/ios/ios_sdk.gni") - import("//build/config/ios/rules.gni") - - _test_target = target_name - _resources_bundle_data = target_name + "_resources_bundle_data" - - bundle_data(_resources_bundle_data) { - visibility = [ ":$_test_target" ] - sources = [ - "//testing/gtest_ios/Default.png", - ] - outputs = [ - "{{bundle_resources_dir}}/{{source_file_part}}", - ] - } - - ios_app_bundle(_test_target) { - testonly = true - - # See above call. - set_sources_assignment_filter([]) - forward_variables_from(invoker, "*", [ "testonly" ]) - - # Provide sensible defaults in case invoker did not define any of those - # required variables. - if (!defined(info_plist) && !defined(info_plist_target)) { - info_plist = "//testing/gtest_ios/unittest-Info.plist" - } - - _bundle_id_suffix = ios_generic_test_bundle_id_suffix - if (!ios_automatically_manage_certs) { - _bundle_id_suffix = "${target_name}" - } - if (!defined(extra_substitutions)) { - extra_substitutions = [] - } - extra_substitutions += [ "GTEST_BUNDLE_ID_SUFFIX=$_bundle_id_suffix" ] - - if (!defined(bundle_deps)) { - bundle_deps = [] - } - bundle_deps += [ ":$_resources_bundle_data" ] - } - } else if (is_chromeos && cros_board != "") { - # When the arg cros_board is set, assume we're in the cros chrome-sdk - # building simplechrome. - - _gen_runner_target = "${target_name}__runner" - _runtime_deps_file = - "$root_out_dir/gen.runtime/" + get_label_info(target_name, "dir") + - "/" + get_label_info(target_name, "name") + ".runtime_deps" - - generate_vm_runner_script(_gen_runner_target) { - testonly = true - generated_script = "$root_build_dir/bin/run_" + invoker.target_name - test_exe = "$root_out_dir/" + get_label_info(invoker.target_name, "name") - runtime_deps_file = _runtime_deps_file - } - - executable(target_name) { - forward_variables_from(invoker, "*") - if (!defined(deps)) { - deps = [] - } - if (!defined(data)) { - data = [] - } - - testonly = true - output_name = target_name - write_runtime_deps = _runtime_deps_file - data += [ _runtime_deps_file ] - deps += [ ":$_gen_runner_target" ] - } - } else { - executable(target_name) { - forward_variables_from(invoker, "*") - if (!defined(deps)) { - deps = [] - } - - testonly = true - deps += [ - # Give tests the default manifest on Windows (a no-op elsewhere). - "//build/win:default_exe_manifest", - ] - } - } -} - -# Test defaults. -set_defaults("test") { - if (is_android) { - configs = default_shared_library_configs - configs -= [ "//build/config/android:hide_all_but_jni_onload" ] - configs += [ "//build/config/android:hide_all_but_jni" ] - } else { - configs = default_executable_configs - } -} diff --git a/third_party/spirv-tools/tools/CMakeLists.txt b/third_party/spirv-tools/tools/CMakeLists.txt old mode 100755 new mode 100644 index 5dacca38ae..67143d879e --- a/third_party/spirv-tools/tools/CMakeLists.txt +++ b/third_party/spirv-tools/tools/CMakeLists.txt @@ -40,12 +40,15 @@ endfunction() if (NOT ${SPIRV_SKIP_EXECUTABLES}) add_spvtools_tool(TARGET spirv-as SRCS as/as.cpp LIBS ${SPIRV_TOOLS}) add_spvtools_tool(TARGET spirv-dis SRCS dis/dis.cpp LIBS ${SPIRV_TOOLS}) - add_spvtools_tool(TARGET spirv-val SRCS val/val.cpp LIBS ${SPIRV_TOOLS}) - add_spvtools_tool(TARGET spirv-opt SRCS opt/opt.cpp LIBS SPIRV-Tools-opt ${SPIRV_TOOLS}) + add_spvtools_tool(TARGET spirv-val SRCS val/val.cpp util/cli_consumer.cpp LIBS ${SPIRV_TOOLS}) + add_spvtools_tool(TARGET spirv-opt SRCS opt/opt.cpp util/cli_consumer.cpp LIBS SPIRV-Tools-opt ${SPIRV_TOOLS}) add_spvtools_tool(TARGET spirv-link SRCS link/linker.cpp LIBS SPIRV-Tools-link ${SPIRV_TOOLS}) add_spvtools_tool(TARGET spirv-stats SRCS stats/stats.cpp - stats/stats_analyzer.cpp + stats/stats_analyzer.cpp + stats/stats_analyzer.h + stats/spirv_stats.cpp + stats/spirv_stats.h LIBS ${SPIRV_TOOLS}) add_spvtools_tool(TARGET spirv-cfg SRCS cfg/cfg.cpp diff --git a/third_party/spirv-tools/tools/as/as.cpp b/third_party/spirv-tools/tools/as/as.cpp old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/tools/cfg/bin_to_dot.cpp b/third_party/spirv-tools/tools/cfg/bin_to_dot.cpp old mode 100755 new mode 100644 index 05facb9dd4..2561eea401 --- a/third_party/spirv-tools/tools/cfg/bin_to_dot.cpp +++ b/third_party/spirv-tools/tools/cfg/bin_to_dot.cpp @@ -12,15 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "bin_to_dot.h" +#include "tools/cfg/bin_to_dot.h" #include #include #include #include -#include "assembly_grammar.h" -#include "name_mapper.h" +#include "source/assembly_grammar.h" +#include "source/name_mapper.h" namespace { diff --git a/third_party/spirv-tools/tools/cfg/bin_to_dot.h b/third_party/spirv-tools/tools/cfg/bin_to_dot.h old mode 100755 new mode 100644 index 1181b25210..4de2e07faf --- a/third_party/spirv-tools/tools/cfg/bin_to_dot.h +++ b/third_party/spirv-tools/tools/cfg/bin_to_dot.h @@ -12,10 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef BIN_TO_DOT_H_ -#define BIN_TO_DOT_H_ +#ifndef TOOLS_CFG_BIN_TO_DOT_H_ +#define TOOLS_CFG_BIN_TO_DOT_H_ #include + #include "spirv-tools/libspirv.h" // Dumps the control flow graph for the given module to the output stream. @@ -24,4 +25,4 @@ spv_result_t BinaryToDot(const spv_const_context context, const uint32_t* words, size_t num_words, std::iostream* out, spv_diagnostic* diagnostic); -#endif // BIN_TO_DOT_H_ +#endif // TOOLS_CFG_BIN_TO_DOT_H_ diff --git a/third_party/spirv-tools/tools/cfg/cfg.cpp b/third_party/spirv-tools/tools/cfg/cfg.cpp old mode 100755 new mode 100644 index 2d0bcfae39..9e2c448ba2 --- a/third_party/spirv-tools/tools/cfg/cfg.cpp +++ b/third_party/spirv-tools/tools/cfg/cfg.cpp @@ -19,10 +19,9 @@ #include #include "spirv-tools/libspirv.h" +#include "tools/cfg/bin_to_dot.h" #include "tools/io.h" -#include "bin_to_dot.h" - // Prints a program usage message to stdout. static void print_usage(const char* argv0) { printf( diff --git a/third_party/spirv-tools/tools/comp/markv.cpp b/third_party/spirv-tools/tools/comp/markv.cpp old mode 100755 new mode 100644 index 960e9638de..9a0a51808d --- a/third_party/spirv-tools/tools/comp/markv.cpp +++ b/third_party/spirv-tools/tools/comp/markv.cpp @@ -19,13 +19,15 @@ #include #include #include +#include +#include #include -#include "markv_model_factory.h" #include "source/comp/markv.h" #include "source/spirv_target_env.h" #include "source/table.h" #include "spirv-tools/optimizer.hpp" +#include "tools/comp/markv_model_factory.h" #include "tools/io.h" namespace { diff --git a/third_party/spirv-tools/tools/comp/markv_model_factory.cpp b/third_party/spirv-tools/tools/comp/markv_model_factory.cpp old mode 100755 new mode 100644 index 35b7ba9934..863fcf5587 --- a/third_party/spirv-tools/tools/comp/markv_model_factory.cpp +++ b/third_party/spirv-tools/tools/comp/markv_model_factory.cpp @@ -12,9 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "markv_model_factory.h" +#include "tools/comp/markv_model_factory.h" -#include "markv_model_shader.h" +#include "source/util/make_unique.h" +#include "tools/comp/markv_model_shader.h" namespace spvtools { namespace comp { @@ -23,15 +24,15 @@ std::unique_ptr CreateMarkvModel(MarkvModelType type) { std::unique_ptr model; switch (type) { case kMarkvModelShaderLite: { - model.reset(new MarkvModelShaderLite()); + model = MakeUnique(); break; } case kMarkvModelShaderMid: { - model.reset(new MarkvModelShaderMid()); + model = MakeUnique(); break; } case kMarkvModelShaderMax: { - model.reset(new MarkvModelShaderMax()); + model = MakeUnique(); break; } case kMarkvModelUnknown: { diff --git a/third_party/spirv-tools/tools/comp/markv_model_factory.h b/third_party/spirv-tools/tools/comp/markv_model_factory.h old mode 100755 new mode 100644 index 084fc66d5f..c13898b986 --- a/third_party/spirv-tools/tools/comp/markv_model_factory.h +++ b/third_party/spirv-tools/tools/comp/markv_model_factory.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef SPIRV_TOOLS_COMP_MARKV_MODEL_FACTORY_H_ -#define SPIRV_TOOLS_COMP_MARKV_MODEL_FACTORY_H_ +#ifndef TOOLS_COMP_MARKV_MODEL_FACTORY_H_ +#define TOOLS_COMP_MARKV_MODEL_FACTORY_H_ #include @@ -34,4 +34,4 @@ std::unique_ptr CreateMarkvModel(MarkvModelType type); } // namespace comp } // namespace spvtools -#endif // SPIRV_TOOLS_COMP_MARKV_MODEL_FACTORY_H_ +#endif // TOOLS_COMP_MARKV_MODEL_FACTORY_H_ diff --git a/third_party/spirv-tools/tools/comp/markv_model_shader.cpp b/third_party/spirv-tools/tools/comp/markv_model_shader.cpp old mode 100755 new mode 100644 index 366275221e..8e296cd8ce --- a/third_party/spirv-tools/tools/comp/markv_model_shader.cpp +++ b/third_party/spirv-tools/tools/comp/markv_model_shader.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "markv_model_shader.h" +#include "tools/comp/markv_model_shader.h" #include #include @@ -21,7 +21,7 @@ #include #include -using spvtools::utils::HuffmanCodec; +#include "source/util/make_unique.h" namespace spvtools { namespace comp { @@ -36,24 +36,7 @@ inline uint32_t CombineOpcodeAndNumOperands(uint32_t opcode, return opcode | (num_operands << 16); } -// The following file contains autogenerated statistical coding rules. -// Can be generated by running spirv-stats on representative corpus of shaders -// with flags: -// --codegen_opcode_and_num_operands_hist -// --codegen_opcode_and_num_operands_markov_huffman_codecs -// --codegen_literal_string_huffman_codecs -// --codegen_non_id_word_huffman_codecs -// --codegen_id_descriptor_huffman_codecs -// -// Example: -// find -type f -print0 | xargs -0 -s 2000000 -// ~/SPIRV-Tools/build/tools/spirv-stats -v -// --codegen_opcode_and_num_operands_hist -// --codegen_opcode_and_num_operands_markov_huffman_codecs -// --codegen_literal_string_huffman_codecs --codegen_non_id_word_huffman_codecs -// --codegen_id_descriptor_huffman_codecs -o -// ~/SPIRV-Tools/source/comp/markv_autogen.inc -#include "markv_model_shader_default_autogen.inc" +#include "tools/comp/markv_model_shader_default_autogen.inc" } // namespace @@ -61,8 +44,8 @@ MarkvModelShaderLite::MarkvModelShaderLite() { const uint16_t kVersionNumber = 1; SetModelVersion(kVersionNumber); - opcode_and_num_operands_huffman_codec_.reset( - new HuffmanCodec(GetOpcodeAndNumOperandsHist())); + opcode_and_num_operands_huffman_codec_ = + MakeUnique>(GetOpcodeAndNumOperandsHist()); id_fallback_strategy_ = IdFallbackStrategy::kShortDescriptor; } @@ -71,8 +54,8 @@ MarkvModelShaderMid::MarkvModelShaderMid() { const uint16_t kVersionNumber = 1; SetModelVersion(kVersionNumber); - opcode_and_num_operands_huffman_codec_.reset( - new HuffmanCodec(GetOpcodeAndNumOperandsHist())); + opcode_and_num_operands_huffman_codec_ = + MakeUnique>(GetOpcodeAndNumOperandsHist()); non_id_word_huffman_codecs_ = GetNonIdWordHuffmanCodecs(); id_descriptor_huffman_codecs_ = GetIdDescriptorHuffmanCodecs(); descriptors_with_coding_scheme_ = GetDescriptorsWithCodingScheme(); @@ -85,8 +68,8 @@ MarkvModelShaderMax::MarkvModelShaderMax() { const uint16_t kVersionNumber = 1; SetModelVersion(kVersionNumber); - opcode_and_num_operands_huffman_codec_.reset( - new HuffmanCodec(GetOpcodeAndNumOperandsHist())); + opcode_and_num_operands_huffman_codec_ = + MakeUnique>(GetOpcodeAndNumOperandsHist()); opcode_and_num_operands_markov_huffman_codecs_ = GetOpcodeAndNumOperandsMarkovHuffmanCodecs(); non_id_word_huffman_codecs_ = GetNonIdWordHuffmanCodecs(); diff --git a/third_party/spirv-tools/tools/comp/markv_model_shader.h b/third_party/spirv-tools/tools/comp/markv_model_shader.h old mode 100755 new mode 100644 index 6c00978768..3a704571fd --- a/third_party/spirv-tools/tools/comp/markv_model_shader.h +++ b/third_party/spirv-tools/tools/comp/markv_model_shader.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef SPIRV_TOOLS_MARKV_MODEL_SHADER_H_ -#define SPIRV_TOOLS_MARKV_MODEL_SHADER_H_ +#ifndef TOOLS_COMP_MARKV_MODEL_SHADER_H_ +#define TOOLS_COMP_MARKV_MODEL_SHADER_H_ #include "source/comp/markv_model.h" @@ -44,4 +44,4 @@ class MarkvModelShaderMax : public MarkvModel { } // namespace comp } // namespace spvtools -#endif // SPIRV_TOOLS_MARKV_MODEL_SHADER_H_ +#endif // TOOLS_COMP_MARKV_MODEL_SHADER_H_ diff --git a/third_party/spirv-tools/tools/comp/markv_model_shader_default_autogen.inc b/third_party/spirv-tools/tools/comp/markv_model_shader_default_autogen.inc old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/tools/dis/dis.cpp b/third_party/spirv-tools/tools/dis/dis.cpp old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/tools/emacs/50spirv-tools.el b/third_party/spirv-tools/tools/emacs/50spirv-tools.el old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/tools/emacs/CMakeLists.txt b/third_party/spirv-tools/tools/emacs/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/tools/io.h b/third_party/spirv-tools/tools/io.h old mode 100755 new mode 100644 index 05d592d66f..aaf8fcdd29 --- a/third_party/spirv-tools/tools/io.h +++ b/third_party/spirv-tools/tools/io.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_TOOLS_IO_H_ -#define LIBSPIRV_TOOLS_IO_H_ +#ifndef TOOLS_IO_H_ +#define TOOLS_IO_H_ #include #include @@ -79,4 +79,4 @@ bool WriteFile(const char* filename, const char* mode, const T* data, return true; } -#endif // LIBSPIRV_TOOLS_IO_H_ +#endif // TOOLS_IO_H_ diff --git a/third_party/spirv-tools/tools/lesspipe/CMakeLists.txt b/third_party/spirv-tools/tools/lesspipe/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/tools/lesspipe/spirv-lesspipe.sh b/third_party/spirv-tools/tools/lesspipe/spirv-lesspipe.sh old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/tools/link/linker.cpp b/third_party/spirv-tools/tools/link/linker.cpp old mode 100755 new mode 100644 diff --git a/third_party/spirv-tools/tools/opt/opt.cpp b/third_party/spirv-tools/tools/opt/opt.cpp old mode 100755 new mode 100644 index 2fde5e8c74..144087124e --- a/third_party/spirv-tools/tools/opt/opt.cpp +++ b/third_party/spirv-tools/tools/opt/opt.cpp @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include #include #include @@ -20,17 +19,16 @@ #include #include #include +#include #include -#include "opt/log.h" -#include "opt/loop_peeling.h" -#include "opt/set_spec_constant_default_value_pass.h" +#include "source/opt/log.h" +#include "source/opt/loop_peeling.h" +#include "source/opt/set_spec_constant_default_value_pass.h" +#include "source/spirv_validator_options.h" #include "spirv-tools/optimizer.hpp" - -#include "message.h" #include "tools/io.h" - -using namespace spvtools; +#include "tools/util/cli_consumer.h" namespace { @@ -182,12 +180,12 @@ Options (in lexicographical order): early return in a loop. --legalize-hlsl Runs a series of optimizations that attempts to take SPIR-V - generated by and HLSL front-end and generate legal Vulkan SPIR-V. + generated by an HLSL front-end and generates legal Vulkan SPIR-V. The optimizations are: %s - Note this does not guarantee legal code. This option implies - --skip-validation. + Note this does not guarantee legal code. This option passes the + option --relax-logical-pointer to the validator. --local-redundancy-elimination Looks for instructions in the same basic block that compute the same value, and deletes the redundant ones. @@ -371,8 +369,8 @@ bool ReadFlagsFromFile(const char* oconfig_flag, std::vector* file_flags) { const char* fname = strchr(oconfig_flag, '='); if (fname == nullptr || fname[0] != '=') { - Errorf(opt_diagnostic, nullptr, {}, "Invalid -Oconfig flag %s", - oconfig_flag); + spvtools::Errorf(opt_diagnostic, nullptr, {}, "Invalid -Oconfig flag %s", + oconfig_flag); return false; } fname++; @@ -380,7 +378,8 @@ bool ReadFlagsFromFile(const char* oconfig_flag, std::ifstream input_file; input_file.open(fname); if (input_file.fail()) { - Errorf(opt_diagnostic, nullptr, {}, "Could not open file '%s'", fname); + spvtools::Errorf(opt_diagnostic, nullptr, {}, "Could not open file '%s'", + fname); return false; } @@ -395,9 +394,10 @@ bool ReadFlagsFromFile(const char* oconfig_flag, return true; } -OptStatus ParseFlags(int argc, const char** argv, Optimizer* optimizer, - const char** in_file, const char** out_file, - spv_validator_options options, bool* skip_validator); +OptStatus ParseFlags(int argc, const char** argv, + spvtools::Optimizer* optimizer, const char** in_file, + const char** out_file, spvtools::ValidatorOptions* options, + bool* skip_validator); // Parses and handles the -Oconfig flag. |prog_name| contains the name of // the spirv-opt binary (used to build a new argv vector for the recursive @@ -406,15 +406,15 @@ OptStatus ParseFlags(int argc, const char** argv, Optimizer* optimizer, // // This returns the same OptStatus instance returned by ParseFlags. OptStatus ParseOconfigFlag(const char* prog_name, const char* opt_flag, - Optimizer* optimizer, const char** in_file, + spvtools::Optimizer* optimizer, const char** in_file, const char** out_file) { std::vector flags; flags.push_back(prog_name); std::vector file_flags; if (!ReadFlagsFromFile(opt_flag, &file_flags)) { - Error(opt_diagnostic, nullptr, {}, - "Could not read optimizer flags from configuration file"); + spvtools::Error(opt_diagnostic, nullptr, {}, + "Could not read optimizer flags from configuration file"); return {OPT_STOP, 1}; } flags.insert(flags.end(), file_flags.begin(), file_flags.end()); @@ -422,8 +422,9 @@ OptStatus ParseOconfigFlag(const char* prog_name, const char* opt_flag, const char** new_argv = new const char*[flags.size()]; for (size_t i = 0; i < flags.size(); i++) { if (flags[i].find("-Oconfig=") != std::string::npos) { - Error(opt_diagnostic, nullptr, {}, - "Flag -Oconfig= may not be used inside the configuration file"); + spvtools::Error( + opt_diagnostic, nullptr, {}, + "Flag -Oconfig= may not be used inside the configuration file"); return {OPT_STOP, 1}; } new_argv[i] = flags[i].c_str(); @@ -482,16 +483,17 @@ std::string CanonicalizeFlag(const char** argv, int argc, int* argi) { // The name of the output file in |out_file|. The return value indicates whether // optimization should continue and a status code indicating an error or // success. -OptStatus ParseFlags(int argc, const char** argv, Optimizer* optimizer, - const char** in_file, const char** out_file, - spv_validator_options options, bool* skip_validator) { +OptStatus ParseFlags(int argc, const char** argv, + spvtools::Optimizer* optimizer, const char** in_file, + const char** out_file, spvtools::ValidatorOptions* options, + bool* skip_validator) { std::vector pass_flags; for (int argi = 1; argi < argc; ++argi) { const char* cur_arg = argv[argi]; if ('-' == cur_arg[0]) { if (0 == strcmp(cur_arg, "--version")) { - Logf(opt_diagnostic, SPV_MSG_INFO, nullptr, {}, "%s\n", - spvSoftwareVersionDetailsString()); + spvtools::Logf(opt_diagnostic, SPV_MSG_INFO, nullptr, {}, "%s\n", + spvSoftwareVersionDetailsString()); return {OPT_STOP, 0}; } else if (0 == strcmp(cur_arg, "--help") || 0 == strcmp(cur_arg, "-h")) { PrintUsage(argv[0]); @@ -508,8 +510,8 @@ OptStatus ParseFlags(int argc, const char** argv, Optimizer* optimizer, if (!*in_file) { *in_file = cur_arg; } else { - Error(opt_diagnostic, nullptr, {}, - "More than one input file specified"); + spvtools::Error(opt_diagnostic, nullptr, {}, + "More than one input file specified"); return {OPT_STOP, 1}; } } else if (0 == strncmp(cur_arg, "-Oconfig=", sizeof("-Oconfig=") - 1)) { @@ -525,7 +527,7 @@ OptStatus ParseFlags(int argc, const char** argv, Optimizer* optimizer, } else if (0 == strcmp(cur_arg, "--time-report")) { optimizer->SetTimeReport(&std::cerr); } else if (0 == strcmp(cur_arg, "--relax-struct-store")) { - options->relax_struct_store = true; + options->SetRelaxStructStore(true); } else { // Some passes used to accept the form '--pass arg', canonicalize them // to '--pass=arg'. @@ -533,14 +535,16 @@ OptStatus ParseFlags(int argc, const char** argv, Optimizer* optimizer, // If we were requested to legalize SPIR-V generated from the HLSL // front-end, skip validation. - if (0 == strcmp(cur_arg, "--legalize-hlsl")) *skip_validator = true; + if (0 == strcmp(cur_arg, "--legalize-hlsl")) { + options->SetRelaxLogicalPointer(true); + } } } else { if (!*in_file) { *in_file = cur_arg; } else { - Error(opt_diagnostic, nullptr, {}, - "More than one input file specified"); + spvtools::Error(opt_diagnostic, nullptr, {}, + "More than one input file specified"); return {OPT_STOP, 1}; } } @@ -561,25 +565,20 @@ int main(int argc, const char** argv) { bool skip_validator = false; spv_target_env target_env = kDefaultEnvironment; - spv_validator_options options = spvValidatorOptionsCreate(); + spvtools::ValidatorOptions options; spvtools::Optimizer optimizer(target_env); - optimizer.SetMessageConsumer([](spv_message_level_t level, const char* source, - const spv_position_t& position, - const char* message) { - std::cerr << StringifyMessage(level, source, position, message) - << std::endl; - }); + optimizer.SetMessageConsumer(spvtools::utils::CLIMessageConsumer); OptStatus status = ParseFlags(argc, argv, &optimizer, &in_file, &out_file, - options, &skip_validator); + &options, &skip_validator); if (status.action == OPT_STOP) { return status.code; } if (out_file == nullptr) { - Error(opt_diagnostic, nullptr, {}, "-o required"); + spvtools::Error(opt_diagnostic, nullptr, {}, "-o required"); return 1; } @@ -588,28 +587,10 @@ int main(int argc, const char** argv) { return 1; } - if (!skip_validator) { - // Let's do validation first. - spv_context context = spvContextCreate(target_env); - spv_diagnostic diagnostic = nullptr; - spv_const_binary_t binary_struct = {binary.data(), binary.size()}; - spv_result_t error = - spvValidateWithOptions(context, options, &binary_struct, &diagnostic); - if (error) { - spvDiagnosticPrint(diagnostic); - spvDiagnosticDestroy(diagnostic); - spvValidatorOptionsDestroy(options); - spvContextDestroy(context); - return error; - } - spvDiagnosticDestroy(diagnostic); - spvValidatorOptionsDestroy(options); - spvContextDestroy(context); - } - // By using the same vector as input and output, we save time in the case // that there was no change. - bool ok = optimizer.Run(binary.data(), binary.size(), &binary); + bool ok = optimizer.Run(binary.data(), binary.size(), &binary, options, + skip_validator); if (!WriteFile(out_file, "wb", binary.data(), binary.size())) { return 1; diff --git a/third_party/spirv-tools/source/spirv_stats.cpp b/third_party/spirv-tools/tools/stats/spirv_stats.cpp old mode 100755 new mode 100644 similarity index 55% rename from third_party/spirv-tools/source/spirv_stats.cpp rename to third_party/spirv-tools/tools/stats/spirv_stats.cpp index 9720d5502b..7751c64024 --- a/third_party/spirv-tools/source/spirv_stats.cpp +++ b/third_party/spirv-tools/tools/stats/spirv_stats.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "spirv_stats.h" +#include "tools/stats/spirv_stats.h" #include @@ -20,19 +20,20 @@ #include #include -#include "diagnostic.h" -#include "enum_string_mapping.h" -#include "extensions.h" -#include "id_descriptor.h" -#include "instruction.h" -#include "opcode.h" -#include "operand.h" +#include "source/diagnostic.h" +#include "source/enum_string_mapping.h" +#include "source/extensions.h" +#include "source/id_descriptor.h" +#include "source/instruction.h" +#include "source/opcode.h" +#include "source/operand.h" +#include "source/val/instruction.h" +#include "source/val/validate.h" +#include "source/val/validation_state.h" #include "spirv-tools/libspirv.h" -#include "val/instruction.h" -#include "val/validate.h" -#include "val/validation_state.h" namespace spvtools { +namespace stats { namespace { // Helper class for stats aggregation. Receives as in/out parameter. @@ -57,98 +58,6 @@ class StatsAggregator { ProcessCapability(&inst); ProcessExtension(&inst); ProcessConstant(&inst); - ProcessEnums(&inst); - ProcessLiteralStrings(&inst); - ProcessNonIdWords(&inst); - ProcessIdDescriptors(&inst); - } - } - - // Collects statistics of descriptors generated by IdDescriptorCollection. - void ProcessIdDescriptors(const val::Instruction* inst) { - const uint32_t new_descriptor = - id_descriptors_.ProcessInstruction(inst->c_inst()); - - if (new_descriptor) { - std::stringstream ss; - ss << spvOpcodeString(inst->opcode()); - for (size_t i = 1; i < inst->words().size(); ++i) { - ss << " " << inst->word(i); - } - stats_->id_descriptor_labels.emplace(new_descriptor, ss.str()); - } - - uint32_t index = 0; - for (const auto& operand : inst->operands()) { - if (spvIsIdType(operand.type)) { - const uint32_t descriptor = - id_descriptors_.GetDescriptor(inst->word(operand.offset)); - if (descriptor) { - ++stats_->id_descriptor_hist[descriptor]; - ++stats_ - ->operand_slot_id_descriptor_hist[std::pair( - inst->opcode(), index)][descriptor]; - } - } - ++index; - } - } - - // Collects statistics of enum words for operands of specific types. - void ProcessEnums(const val::Instruction* inst) { - for (const auto& operand : inst->operands()) { - switch (operand.type) { - case SPV_OPERAND_TYPE_SOURCE_LANGUAGE: - case SPV_OPERAND_TYPE_EXECUTION_MODEL: - case SPV_OPERAND_TYPE_ADDRESSING_MODEL: - case SPV_OPERAND_TYPE_MEMORY_MODEL: - case SPV_OPERAND_TYPE_EXECUTION_MODE: - case SPV_OPERAND_TYPE_STORAGE_CLASS: - case SPV_OPERAND_TYPE_DIMENSIONALITY: - case SPV_OPERAND_TYPE_SAMPLER_ADDRESSING_MODE: - case SPV_OPERAND_TYPE_SAMPLER_FILTER_MODE: - case SPV_OPERAND_TYPE_SAMPLER_IMAGE_FORMAT: - case SPV_OPERAND_TYPE_IMAGE_CHANNEL_ORDER: - case SPV_OPERAND_TYPE_IMAGE_CHANNEL_DATA_TYPE: - case SPV_OPERAND_TYPE_FP_ROUNDING_MODE: - case SPV_OPERAND_TYPE_LINKAGE_TYPE: - case SPV_OPERAND_TYPE_ACCESS_QUALIFIER: - case SPV_OPERAND_TYPE_FUNCTION_PARAMETER_ATTRIBUTE: - case SPV_OPERAND_TYPE_DECORATION: - case SPV_OPERAND_TYPE_BUILT_IN: - case SPV_OPERAND_TYPE_GROUP_OPERATION: - case SPV_OPERAND_TYPE_KERNEL_ENQ_FLAGS: - case SPV_OPERAND_TYPE_KERNEL_PROFILING_INFO: - case SPV_OPERAND_TYPE_CAPABILITY: { - ++stats_->enum_hist[operand.type][inst->word(operand.offset)]; - break; - } - default: - break; - } - } - } - - // Collects statistics of literal strings used by opcodes. - void ProcessLiteralStrings(const val::Instruction* inst) { - for (const auto& operand : inst->operands()) { - if (operand.type == SPV_OPERAND_TYPE_LITERAL_STRING) { - const std::string str = - reinterpret_cast(&inst->words()[operand.offset]); - ++stats_->literal_strings_hist[inst->opcode()][str]; - } - } - } - - // Collects statistics of all single word non-id operand slots. - void ProcessNonIdWords(const val::Instruction* inst) { - uint32_t index = 0; - for (const auto& operand : inst->operands()) { - if (operand.num_words == 1 && !spvIsIdType(operand.type)) { - ++stats_->operand_slot_non_id_words_hist[std::pair( - inst->opcode(), index)][inst->word(operand.offset)]; - } - ++index; } } @@ -171,18 +80,11 @@ class StatsAggregator { const SpvOp opcode = inst->opcode(); ++stats_->opcode_hist[opcode]; - const uint32_t opcode_and_num_operands = - (uint32_t(inst->operands().size()) << 16) | uint32_t(opcode); - ++stats_->opcode_and_num_operands_hist[opcode_and_num_operands]; - if (idx == 0) return; --idx; const auto& instructions = vstate_->ordered_instructions(); - const SpvOp prev_opcode = instructions[idx].opcode(); - ++stats_->opcode_and_num_operands_markov_hist[prev_opcode] - [opcode_and_num_operands]; auto step_it = stats_->opcode_markov_hist.begin(); for (; step_it != stats_->opcode_markov_hist.end(); --idx, ++step_it) { @@ -259,4 +161,5 @@ spv_result_t AggregateStats(const spv_context_t& context, const uint32_t* words, return SPV_SUCCESS; } +} // namespace stats } // namespace spvtools diff --git a/third_party/spirv-tools/source/spirv_stats.h b/third_party/spirv-tools/tools/stats/spirv_stats.h old mode 100755 new mode 100644 similarity index 63% rename from third_party/spirv-tools/source/spirv_stats.h rename to third_party/spirv-tools/tools/stats/spirv_stats.h index daa9b6b827..16e720fe31 --- a/third_party/spirv-tools/source/spirv_stats.h +++ b/third_party/spirv-tools/tools/stats/spirv_stats.h @@ -12,17 +12,19 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_SPIRV_STATS_H_ -#define LIBSPIRV_SPIRV_STATS_H_ +#ifndef TOOLS_STATS_SPIRV_STATS_H_ +#define TOOLS_STATS_SPIRV_STATS_H_ #include #include #include +#include #include #include "spirv-tools/libspirv.hpp" namespace spvtools { +namespace stats { struct SpirvStats { // Version histogram, version_word -> count. @@ -40,10 +42,6 @@ struct SpirvStats { // Opcode histogram, SpvOpXXX -> count. std::unordered_map opcode_hist; - // Histogram of words combining opcode and number of operands, - // opcode | (num_operands << 16) -> count. - std::unordered_map opcode_and_num_operands_hist; - // OpConstant u16 histogram, value -> count. std::unordered_map u16_constant_hist; @@ -68,42 +66,6 @@ struct SpirvStats { // OpConstant f64 histogram, value -> count. std::unordered_map f64_constant_hist; - // Enum histogram, operand type -> operand value -> count. - std::unordered_map> - enum_hist; - - // Histogram of all non-id single words. - // pair -> value -> count. - // This is a generalization of enum_hist, also includes literal integers and - // masks. - std::map, std::map> - operand_slot_non_id_words_hist; - - // Historgam of descriptors generated by IdDescriptorCollection. - // Descriptor -> count. - std::unordered_map id_descriptor_hist; - - // Debut labels for id descriptors, descriptor -> label. - std::unordered_map id_descriptor_labels; - - // Historgam of descriptors generated by IdDescriptorCollection for every - // operand slot. pair -> descriptor -> count. - std::map, std::map> - operand_slot_id_descriptor_hist; - - // Histogram of literal strings, sharded by opcodes, opcode -> string -> - // count. - // This is suboptimal if an opcode has multiple literal string operands, - // as it wouldn't differentiate between operands. - std::unordered_map> - literal_strings_hist; - - // Markov chain histograms: - // opcode -> next(opcode | (num_operands << 16)) -> count. - // See also opcode_and_num_operands_hist, which collects global statistics. - std::unordered_map> - opcode_and_num_operands_markov_hist; - // Used to collect statistics on opcodes triggering other opcodes. // Container scheme: gap between instructions -> cue opcode -> later opcode // -> count. @@ -125,6 +87,7 @@ spv_result_t AggregateStats(const spv_context_t& context, const uint32_t* words, const size_t num_words, spv_diagnostic* pDiagnostic, SpirvStats* stats); +} // namespace stats } // namespace spvtools -#endif // LIBSPIRV_SPIRV_STATS_H_ +#endif // TOOLS_STATS_SPIRV_STATS_H_ diff --git a/third_party/spirv-tools/tools/stats/stats.cpp b/third_party/spirv-tools/tools/stats/stats.cpp old mode 100755 new mode 100644 index 2b8624371f..256ec1e1b9 --- a/third_party/spirv-tools/tools/stats/stats.cpp +++ b/third_party/spirv-tools/tools/stats/stats.cpp @@ -17,14 +17,13 @@ #include #include #include +#include -#include "source/spirv_stats.h" #include "source/table.h" #include "spirv-tools/libspirv.h" -#include "stats_analyzer.h" #include "tools/io.h" - -using spvtools::SpirvStats; +#include "tools/stats/spirv_stats.h" +#include "tools/stats/stats_analyzer.h" namespace { @@ -49,35 +48,6 @@ Options: -v, --verbose Print additional info to stderr. - - --codegen_opcode_hist - Output generated C++ code for opcode histogram. - This flag disables non-C++ output. - - --codegen_opcode_and_num_operands_hist - Output generated C++ code for opcode_and_num_operands - histogram. - This flag disables non-C++ output. - - --codegen_opcode_and_num_operands_markov_huffman_codecs - Output generated C++ code for Huffman codecs of - opcode_and_num_operands Markov chain. - This flag disables non-C++ output. - - --codegen_literal_string_huffman_codecs - Output generated C++ code for Huffman codecs for - literal strings. - This flag disables non-C++ output. - - --codegen_non_id_word_huffman_codecs - Output generated C++ code for Huffman codecs for - single-word non-id slots. - This flag disables non-C++ output. - - --codegen_id_descriptor_huffman_codecs - Output generated C++ code for Huffman codecs for - common id descriptors. - This flag disables non-C++ output. )", argv0, argv0, argv0); } @@ -111,13 +81,6 @@ int main(int argc, char** argv) { bool expect_output_path = false; bool verbose = false; - bool export_text = true; - bool codegen_opcode_hist = false; - bool codegen_opcode_and_num_operands_hist = false; - bool codegen_opcode_and_num_operands_markov_huffman_codecs = false; - bool codegen_literal_string_huffman_codecs = false; - bool codegen_non_id_word_huffman_codecs = false; - bool codegen_id_descriptor_huffman_codecs = false; std::vector paths; const char* output_path = nullptr; @@ -129,29 +92,6 @@ int main(int argc, char** argv) { PrintUsage(argv[0]); continue_processing = false; return_code = 0; - } else if (0 == strcmp(cur_arg, "--codegen_opcode_hist")) { - codegen_opcode_hist = true; - export_text = false; - } else if (0 == - strcmp(cur_arg, "--codegen_opcode_and_num_operands_hist")) { - codegen_opcode_and_num_operands_hist = true; - export_text = false; - } else if (strcmp( - "--codegen_opcode_and_num_operands_markov_huffman_codecs", - cur_arg) == 0) { - codegen_opcode_and_num_operands_markov_huffman_codecs = true; - export_text = false; - } else if (0 == - strcmp(cur_arg, "--codegen_literal_string_huffman_codecs")) { - codegen_literal_string_huffman_codecs = true; - export_text = false; - } else if (0 == strcmp(cur_arg, "--codegen_non_id_word_huffman_codecs")) { - codegen_non_id_word_huffman_codecs = true; - export_text = false; - } else if (0 == - strcmp(cur_arg, "--codegen_id_descriptor_huffman_codecs")) { - codegen_id_descriptor_huffman_codecs = true; - export_text = false; } else if (0 == strcmp(cur_arg, "--verbose") || 0 == strcmp(cur_arg, "-v")) { verbose = true; @@ -183,7 +123,7 @@ int main(int argc, char** argv) { ScopedContext ctx(SPV_ENV_UNIVERSAL_1_1); spvtools::SetContextMessageConsumer(ctx.context, DiagnosticsMessageHandler); - spvtools::SpirvStats stats; + spvtools::stats::SpirvStats stats; stats.opcode_markov_hist.resize(1); for (size_t index = 0; index < paths.size(); ++index) { @@ -197,15 +137,15 @@ int main(int argc, char** argv) { std::vector contents; if (!ReadFile(path, "rb", &contents)) return 1; - if (SPV_SUCCESS != spvtools::AggregateStats(*ctx.context, contents.data(), - contents.size(), nullptr, - &stats)) { + if (SPV_SUCCESS != + spvtools::stats::AggregateStats(*ctx.context, contents.data(), + contents.size(), nullptr, &stats)) { std::cerr << "error: Failed to aggregate stats for " << path << std::endl; return 1; } } - StatsAnalyzer analyzer(stats); + spvtools::stats::StatsAnalyzer analyzer(stats); std::ofstream fout; if (output_path) { @@ -217,57 +157,24 @@ int main(int argc, char** argv) { } std::ostream& out = fout.is_open() ? fout : std::cout; + out << std::endl; + analyzer.WriteVersion(out); + analyzer.WriteGenerator(out); - if (export_text) { - out << std::endl; - analyzer.WriteVersion(out); - analyzer.WriteGenerator(out); + out << std::endl; + analyzer.WriteCapability(out); - out << std::endl; - analyzer.WriteCapability(out); + out << std::endl; + analyzer.WriteExtension(out); - out << std::endl; - analyzer.WriteExtension(out); + out << std::endl; + analyzer.WriteOpcode(out); - out << std::endl; - analyzer.WriteOpcode(out); + out << std::endl; + analyzer.WriteOpcodeMarkov(out); - out << std::endl; - analyzer.WriteOpcodeMarkov(out); - - out << std::endl; - analyzer.WriteConstantLiterals(out); - } - - if (codegen_opcode_hist) { - out << std::endl; - analyzer.WriteCodegenOpcodeHist(out); - } - - if (codegen_opcode_and_num_operands_hist) { - out << std::endl; - analyzer.WriteCodegenOpcodeAndNumOperandsHist(out); - } - - if (codegen_opcode_and_num_operands_markov_huffman_codecs) { - out << std::endl; - analyzer.WriteCodegenOpcodeAndNumOperandsMarkovHuffmanCodecs(out); - } - - if (codegen_literal_string_huffman_codecs) { - out << std::endl; - analyzer.WriteCodegenLiteralStringHuffmanCodecs(out); - } - - if (codegen_non_id_word_huffman_codecs) { - out << std::endl; - analyzer.WriteCodegenNonIdWordHuffmanCodecs(out); - } - - if (codegen_id_descriptor_huffman_codecs) { - out << std::endl; - analyzer.WriteCodegenIdDescriptorHuffmanCodecs(out); - } + out << std::endl; + analyzer.WriteConstantLiterals(out); return 0; } diff --git a/third_party/spirv-tools/tools/stats/stats_analyzer.cpp b/third_party/spirv-tools/tools/stats/stats_analyzer.cpp old mode 100755 new mode 100644 index 613b97d409..6d4cabbf6d --- a/third_party/spirv-tools/tools/stats/stats_analyzer.cpp +++ b/third_party/spirv-tools/tools/stats/stats_analyzer.cpp @@ -12,357 +12,35 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "stats_analyzer.h" +#include "tools/stats/stats_analyzer.h" #include #include #include #include +#include #include +#include #include #include +#include #include -#include "latest_version_spirv_header.h" #include "source/comp/markv_model.h" #include "source/enum_string_mapping.h" +#include "source/latest_version_spirv_header.h" #include "source/opcode.h" #include "source/operand.h" #include "source/spirv_constant.h" -#include "source/util/huffman_codec.h" +namespace spvtools { +namespace stats { namespace { -using spvtools::SpirvStats; -using spvtools::utils::HuffmanCodec; - // Signals that the value is not in the coding scheme and a fallback method // needs to be used. const uint64_t kMarkvNoneOfTheAbove = - spvtools::comp::MarkvModel::GetMarkvNoneOfTheAbove(); - -inline uint32_t CombineOpcodeAndNumOperands(uint32_t opcode, - uint32_t num_operands) { - return opcode | (num_operands << 16); -} - -// Returns all SPIR-V v1.2 opcodes. -std::vector GetAllOpcodes() { - return std::vector({ - SpvOpNop, - SpvOpUndef, - SpvOpSourceContinued, - SpvOpSource, - SpvOpSourceExtension, - SpvOpName, - SpvOpMemberName, - SpvOpString, - SpvOpLine, - SpvOpExtension, - SpvOpExtInstImport, - SpvOpExtInst, - SpvOpMemoryModel, - SpvOpEntryPoint, - SpvOpExecutionMode, - SpvOpCapability, - SpvOpTypeVoid, - SpvOpTypeBool, - SpvOpTypeInt, - SpvOpTypeFloat, - SpvOpTypeVector, - SpvOpTypeMatrix, - SpvOpTypeImage, - SpvOpTypeSampler, - SpvOpTypeSampledImage, - SpvOpTypeArray, - SpvOpTypeRuntimeArray, - SpvOpTypeStruct, - SpvOpTypeOpaque, - SpvOpTypePointer, - SpvOpTypeFunction, - SpvOpTypeEvent, - SpvOpTypeDeviceEvent, - SpvOpTypeReserveId, - SpvOpTypeQueue, - SpvOpTypePipe, - SpvOpTypeForwardPointer, - SpvOpConstantTrue, - SpvOpConstantFalse, - SpvOpConstant, - SpvOpConstantComposite, - SpvOpConstantSampler, - SpvOpConstantNull, - SpvOpSpecConstantTrue, - SpvOpSpecConstantFalse, - SpvOpSpecConstant, - SpvOpSpecConstantComposite, - SpvOpSpecConstantOp, - SpvOpFunction, - SpvOpFunctionParameter, - SpvOpFunctionEnd, - SpvOpFunctionCall, - SpvOpVariable, - SpvOpImageTexelPointer, - SpvOpLoad, - SpvOpStore, - SpvOpCopyMemory, - SpvOpCopyMemorySized, - SpvOpAccessChain, - SpvOpInBoundsAccessChain, - SpvOpPtrAccessChain, - SpvOpArrayLength, - SpvOpGenericPtrMemSemantics, - SpvOpInBoundsPtrAccessChain, - SpvOpDecorate, - SpvOpMemberDecorate, - SpvOpDecorationGroup, - SpvOpGroupDecorate, - SpvOpGroupMemberDecorate, - SpvOpVectorExtractDynamic, - SpvOpVectorInsertDynamic, - SpvOpVectorShuffle, - SpvOpCompositeConstruct, - SpvOpCompositeExtract, - SpvOpCompositeInsert, - SpvOpCopyObject, - SpvOpTranspose, - SpvOpSampledImage, - SpvOpImageSampleImplicitLod, - SpvOpImageSampleExplicitLod, - SpvOpImageSampleDrefImplicitLod, - SpvOpImageSampleDrefExplicitLod, - SpvOpImageSampleProjImplicitLod, - SpvOpImageSampleProjExplicitLod, - SpvOpImageSampleProjDrefImplicitLod, - SpvOpImageSampleProjDrefExplicitLod, - SpvOpImageFetch, - SpvOpImageGather, - SpvOpImageDrefGather, - SpvOpImageRead, - SpvOpImageWrite, - SpvOpImage, - SpvOpImageQueryFormat, - SpvOpImageQueryOrder, - SpvOpImageQuerySizeLod, - SpvOpImageQuerySize, - SpvOpImageQueryLod, - SpvOpImageQueryLevels, - SpvOpImageQuerySamples, - SpvOpConvertFToU, - SpvOpConvertFToS, - SpvOpConvertSToF, - SpvOpConvertUToF, - SpvOpUConvert, - SpvOpSConvert, - SpvOpFConvert, - SpvOpQuantizeToF16, - SpvOpConvertPtrToU, - SpvOpSatConvertSToU, - SpvOpSatConvertUToS, - SpvOpConvertUToPtr, - SpvOpPtrCastToGeneric, - SpvOpGenericCastToPtr, - SpvOpGenericCastToPtrExplicit, - SpvOpBitcast, - SpvOpSNegate, - SpvOpFNegate, - SpvOpIAdd, - SpvOpFAdd, - SpvOpISub, - SpvOpFSub, - SpvOpIMul, - SpvOpFMul, - SpvOpUDiv, - SpvOpSDiv, - SpvOpFDiv, - SpvOpUMod, - SpvOpSRem, - SpvOpSMod, - SpvOpFRem, - SpvOpFMod, - SpvOpVectorTimesScalar, - SpvOpMatrixTimesScalar, - SpvOpVectorTimesMatrix, - SpvOpMatrixTimesVector, - SpvOpMatrixTimesMatrix, - SpvOpOuterProduct, - SpvOpDot, - SpvOpIAddCarry, - SpvOpISubBorrow, - SpvOpUMulExtended, - SpvOpSMulExtended, - SpvOpAny, - SpvOpAll, - SpvOpIsNan, - SpvOpIsInf, - SpvOpIsFinite, - SpvOpIsNormal, - SpvOpSignBitSet, - SpvOpLessOrGreater, - SpvOpOrdered, - SpvOpUnordered, - SpvOpLogicalEqual, - SpvOpLogicalNotEqual, - SpvOpLogicalOr, - SpvOpLogicalAnd, - SpvOpLogicalNot, - SpvOpSelect, - SpvOpIEqual, - SpvOpINotEqual, - SpvOpUGreaterThan, - SpvOpSGreaterThan, - SpvOpUGreaterThanEqual, - SpvOpSGreaterThanEqual, - SpvOpULessThan, - SpvOpSLessThan, - SpvOpULessThanEqual, - SpvOpSLessThanEqual, - SpvOpFOrdEqual, - SpvOpFUnordEqual, - SpvOpFOrdNotEqual, - SpvOpFUnordNotEqual, - SpvOpFOrdLessThan, - SpvOpFUnordLessThan, - SpvOpFOrdGreaterThan, - SpvOpFUnordGreaterThan, - SpvOpFOrdLessThanEqual, - SpvOpFUnordLessThanEqual, - SpvOpFOrdGreaterThanEqual, - SpvOpFUnordGreaterThanEqual, - SpvOpShiftRightLogical, - SpvOpShiftRightArithmetic, - SpvOpShiftLeftLogical, - SpvOpBitwiseOr, - SpvOpBitwiseXor, - SpvOpBitwiseAnd, - SpvOpNot, - SpvOpBitFieldInsert, - SpvOpBitFieldSExtract, - SpvOpBitFieldUExtract, - SpvOpBitReverse, - SpvOpBitCount, - SpvOpDPdx, - SpvOpDPdy, - SpvOpFwidth, - SpvOpDPdxFine, - SpvOpDPdyFine, - SpvOpFwidthFine, - SpvOpDPdxCoarse, - SpvOpDPdyCoarse, - SpvOpFwidthCoarse, - SpvOpEmitVertex, - SpvOpEndPrimitive, - SpvOpEmitStreamVertex, - SpvOpEndStreamPrimitive, - SpvOpControlBarrier, - SpvOpMemoryBarrier, - SpvOpAtomicLoad, - SpvOpAtomicStore, - SpvOpAtomicExchange, - SpvOpAtomicCompareExchange, - SpvOpAtomicCompareExchangeWeak, - SpvOpAtomicIIncrement, - SpvOpAtomicIDecrement, - SpvOpAtomicIAdd, - SpvOpAtomicISub, - SpvOpAtomicSMin, - SpvOpAtomicUMin, - SpvOpAtomicSMax, - SpvOpAtomicUMax, - SpvOpAtomicAnd, - SpvOpAtomicOr, - SpvOpAtomicXor, - SpvOpPhi, - SpvOpLoopMerge, - SpvOpSelectionMerge, - SpvOpLabel, - SpvOpBranch, - SpvOpBranchConditional, - SpvOpSwitch, - SpvOpKill, - SpvOpReturn, - SpvOpReturnValue, - SpvOpUnreachable, - SpvOpLifetimeStart, - SpvOpLifetimeStop, - SpvOpGroupAsyncCopy, - SpvOpGroupWaitEvents, - SpvOpGroupAll, - SpvOpGroupAny, - SpvOpGroupBroadcast, - SpvOpGroupIAdd, - SpvOpGroupFAdd, - SpvOpGroupFMin, - SpvOpGroupUMin, - SpvOpGroupSMin, - SpvOpGroupFMax, - SpvOpGroupUMax, - SpvOpGroupSMax, - SpvOpReadPipe, - SpvOpWritePipe, - SpvOpReservedReadPipe, - SpvOpReservedWritePipe, - SpvOpReserveReadPipePackets, - SpvOpReserveWritePipePackets, - SpvOpCommitReadPipe, - SpvOpCommitWritePipe, - SpvOpIsValidReserveId, - SpvOpGetNumPipePackets, - SpvOpGetMaxPipePackets, - SpvOpGroupReserveReadPipePackets, - SpvOpGroupReserveWritePipePackets, - SpvOpGroupCommitReadPipe, - SpvOpGroupCommitWritePipe, - SpvOpEnqueueMarker, - SpvOpEnqueueKernel, - SpvOpGetKernelNDrangeSubGroupCount, - SpvOpGetKernelNDrangeMaxSubGroupSize, - SpvOpGetKernelWorkGroupSize, - SpvOpGetKernelPreferredWorkGroupSizeMultiple, - SpvOpRetainEvent, - SpvOpReleaseEvent, - SpvOpCreateUserEvent, - SpvOpIsValidEvent, - SpvOpSetUserEventStatus, - SpvOpCaptureEventProfilingInfo, - SpvOpGetDefaultQueue, - SpvOpBuildNDRange, - SpvOpImageSparseSampleImplicitLod, - SpvOpImageSparseSampleExplicitLod, - SpvOpImageSparseSampleDrefImplicitLod, - SpvOpImageSparseSampleDrefExplicitLod, - SpvOpImageSparseSampleProjImplicitLod, - SpvOpImageSparseSampleProjExplicitLod, - SpvOpImageSparseSampleProjDrefImplicitLod, - SpvOpImageSparseSampleProjDrefExplicitLod, - SpvOpImageSparseFetch, - SpvOpImageSparseGather, - SpvOpImageSparseDrefGather, - SpvOpImageSparseTexelsResident, - SpvOpNoLine, - SpvOpAtomicFlagTestAndSet, - SpvOpAtomicFlagClear, - SpvOpImageSparseRead, - SpvOpSizeOf, - SpvOpTypePipeStorage, - SpvOpConstantPipeStorage, - SpvOpCreatePipeFromPipeStorage, - SpvOpGetKernelLocalSizeForSubgroupCount, - SpvOpGetKernelMaxNumSubgroups, - SpvOpTypeNamedBarrier, - SpvOpNamedBarrierInitialize, - SpvOpMemoryNamedBarrier, - SpvOpModuleProcessed, - SpvOpExecutionModeId, - SpvOpDecorateId, - SpvOpSubgroupBallotKHR, - SpvOpSubgroupFirstInvocationKHR, - SpvOpSubgroupAllKHR, - SpvOpSubgroupAnyKHR, - SpvOpSubgroupAllEqualKHR, - SpvOpSubgroupReadInvocationKHR, - }); -} + comp::MarkvModel::GetMarkvNoneOfTheAbove(); std::string GetVersionString(uint32_t word) { std::stringstream ss; @@ -380,7 +58,7 @@ std::string GetOpcodeString(uint32_t word) { } std::string GetCapabilityString(uint32_t word) { - return spvtools::CapabilityToString(static_cast(word)); + return CapabilityToString(static_cast(word)); } template @@ -420,7 +98,7 @@ std::unordered_map GetPrevalence( // |label_from_key| is used to convert |Key| to label. template void WriteFreq(std::ostream& out, const std::unordered_map& freq, - std::string (*label_from_key)(Key), double threshold = 0.001) { + std::string (*label_from_key)(Key)) { std::vector> sorted_freq(freq.begin(), freq.end()); std::sort(sorted_freq.begin(), sorted_freq.end(), [](const std::pair& left, @@ -429,32 +107,12 @@ void WriteFreq(std::ostream& out, const std::unordered_map& freq, }); for (const auto& pair : sorted_freq) { - if (pair.second < threshold) break; + if (pair.second < 0.001) break; out << label_from_key(pair.first) << " " << pair.second * 100.0 << "%" << std::endl; } } -// Writes |hist| to |out| sorted by count in the following format: -// LABEL3 100 -// LABEL1 50 -// LABEL2 10 -// |label_from_key| is used to convert |Key| to label. -template -void WriteHist(std::ostream& out, const std::unordered_map& hist, - std::string (*label_from_key)(Key)) { - std::vector> sorted_hist(hist.begin(), hist.end()); - std::sort(sorted_hist.begin(), sorted_hist.end(), - [](const std::pair& left, - const std::pair& right) { - return left.second > right.second; - }); - - for (const auto& pair : sorted_hist) { - out << label_from_key(pair.first) << " " << pair.second << std::endl; - } -} - } // namespace StatsAnalyzer::StatsAnalyzer(const SpirvStats& stats) : stats_(stats) { @@ -573,302 +231,5 @@ void StatsAnalyzer::WriteOpcodeMarkov(std::ostream& out) { } } -void StatsAnalyzer::WriteCodegenOpcodeHist(std::ostream& out) { - auto all_opcodes = GetAllOpcodes(); - - // uint64_t is used because kMarkvNoneOfTheAbove is outside of uint32_t range. - out << "std::map GetOpcodeHist() {\n" - << " return std::map({\n"; - - uint32_t total = 0; - for (const auto& kv : stats_.opcode_hist) { - total += kv.second; - } - - for (uint32_t opcode : all_opcodes) { - const auto it = stats_.opcode_hist.find(opcode); - const uint32_t count = it == stats_.opcode_hist.end() ? 0 : it->second; - const double kMaxValue = 1000.0; - uint32_t value = uint32_t(kMaxValue * double(count) / double(total)); - if (value == 0) value = 1; - out << " { SpvOp" << GetOpcodeString(opcode) << ", " << value << " },\n"; - } - - // Add kMarkvNoneOfTheAbove as a signal for unknown opcode. - out << " { kMarkvNoneOfTheAbove, " << 10 << " },\n"; - out << " });\n}\n"; -} - -void StatsAnalyzer::WriteCodegenOpcodeAndNumOperandsHist(std::ostream& out) { - out << "std::map GetOpcodeAndNumOperandsHist() {\n" - << " return std::map({\n"; - - uint32_t total = 0; - for (const auto& kv : stats_.opcode_and_num_operands_hist) { - total += kv.second; - } - - uint32_t left_out = 0; - - for (const auto& kv : stats_.opcode_and_num_operands_hist) { - const uint32_t count = kv.second; - const double kFrequentEnoughToAnalyze = 0.001; - const uint32_t opcode_and_num_operands = kv.first; - const uint32_t opcode = opcode_and_num_operands & 0xFFFF; - const uint32_t num_operands = opcode_and_num_operands >> 16; - - if (opcode == SpvOpTypeStruct || - double(count) / double(total) < kFrequentEnoughToAnalyze) { - left_out += count; - continue; - } - - out << " { CombineOpcodeAndNumOperands(SpvOp" - << spvOpcodeString(SpvOp(opcode)) << ", " << num_operands << "), " - << count << " },\n"; - } - - // Heuristic. - const uint32_t none_of_the_above = std::max(1, int(left_out + total * 0.01)); - out << " { kMarkvNoneOfTheAbove, " << none_of_the_above << " },\n"; - out << " });\n}\n"; -} - -void StatsAnalyzer::WriteCodegenOpcodeAndNumOperandsMarkovHuffmanCodecs( - std::ostream& out) { - out << "std::map>>\n" - << "GetOpcodeAndNumOperandsMarkovHuffmanCodecs() {\n" - << " std::map>> " - << "codecs;\n"; - - for (const auto& kv : stats_.opcode_and_num_operands_markov_hist) { - const uint32_t prev_opcode = kv.first; - const double kFrequentEnoughToAnalyze = 0.001; - if (opcode_freq_[prev_opcode] < kFrequentEnoughToAnalyze) continue; - - const std::unordered_map& hist = kv.second; - - uint32_t total = 0; - for (const auto& pair : hist) { - total += pair.second; - } - - uint32_t left_out = 0; - - std::map processed_hist; - for (const auto& pair : hist) { - const uint32_t opcode_and_num_operands = pair.first; - const uint32_t opcode = opcode_and_num_operands & 0xFFFF; - - if (opcode == SpvOpTypeStruct) continue; - - const uint32_t num_operands = opcode_and_num_operands >> 16; - const uint32_t count = pair.second; - const double posterior_freq = double(count) / double(total); - - if (opcode_freq_[opcode] < kFrequentEnoughToAnalyze && - posterior_freq < kFrequentEnoughToAnalyze) { - left_out += count; - continue; - } - processed_hist.emplace(CombineOpcodeAndNumOperands(opcode, num_operands), - count); - } - - // Heuristic. - processed_hist.emplace(kMarkvNoneOfTheAbove, - std::max(1, int(left_out + total * 0.01))); - - HuffmanCodec codec(processed_hist); - - out << " {\n"; - out << " std::unique_ptr> " - << "codec(new HuffmanCodec"; - out << codec.SerializeToText(4); - out << ");\n" << std::endl; - out << " codecs.emplace(SpvOp" << GetOpcodeString(prev_opcode) - << ", std::move(codec));\n"; - out << " }\n\n"; - } - - out << " return codecs;\n}\n"; -} - -void StatsAnalyzer::WriteCodegenLiteralStringHuffmanCodecs(std::ostream& out) { - out << "std::map>>\n" - << "GetLiteralStringHuffmanCodecs() {\n" - << " std::map>> " - << "codecs;\n"; - - for (const auto& kv : stats_.literal_strings_hist) { - const uint32_t opcode = kv.first; - - if (opcode == SpvOpName || opcode == SpvOpMemberName) continue; - - const double kOpcodeFrequentEnoughToAnalyze = 0.001; - if (opcode_freq_[opcode] < kOpcodeFrequentEnoughToAnalyze) continue; - - const std::unordered_map& hist = kv.second; - - uint32_t total = 0; - for (const auto& pair : hist) { - total += pair.second; - } - - uint32_t left_out = 0; - - std::map processed_hist; - for (const auto& pair : hist) { - const uint32_t count = pair.second; - const double freq = double(count) / double(total); - const double kStringFrequentEnoughToAnalyze = 0.001; - if (freq < kStringFrequentEnoughToAnalyze) { - left_out += count; - continue; - } - processed_hist.emplace(pair.first, count); - } - - // Heuristic. - processed_hist.emplace("kMarkvNoneOfTheAbove", - std::max(1, int(left_out + total * 0.01))); - - HuffmanCodec codec(processed_hist); - - out << " {\n"; - out << " std::unique_ptr> " - << "codec(new HuffmanCodec"; - out << codec.SerializeToText(4); - out << ");\n" << std::endl; - out << " codecs.emplace(SpvOp" << spvOpcodeString(SpvOp(opcode)) - << ", std::move(codec));\n"; - out << " }\n\n"; - } - - out << " return codecs;\n}\n"; -} - -void StatsAnalyzer::WriteCodegenNonIdWordHuffmanCodecs(std::ostream& out) { - out << "std::map, " - << "std::unique_ptr>>\n" - << "GetNonIdWordHuffmanCodecs() {\n" - << " std::map, " - << "std::unique_ptr>> codecs;\n"; - - for (const auto& kv : stats_.operand_slot_non_id_words_hist) { - const auto& opcode_and_index = kv.first; - const uint32_t opcode = opcode_and_index.first; - const uint32_t index = opcode_and_index.second; - - const double kOpcodeFrequentEnoughToAnalyze = 0.001; - if (opcode_freq_[opcode] < kOpcodeFrequentEnoughToAnalyze) continue; - - const std::map& hist = kv.second; - - uint32_t total = 0; - for (const auto& pair : hist) { - total += pair.second; - } - - uint32_t left_out = 0; - - std::map processed_hist; - for (const auto& pair : hist) { - const uint32_t word = pair.first; - const uint32_t count = pair.second; - const double freq = double(count) / double(total); - const double kWordFrequentEnoughToAnalyze = 0.003; - if (freq < kWordFrequentEnoughToAnalyze) { - left_out += count; - continue; - } - processed_hist.emplace(word, count); - } - - // Heuristic. - processed_hist.emplace(kMarkvNoneOfTheAbove, - std::max(1, int(left_out + total * 0.01))); - - HuffmanCodec codec(processed_hist); - - out << " {\n"; - out << " std::unique_ptr> " - << "codec(new HuffmanCodec"; - out << codec.SerializeToText(4); - out << ");\n" << std::endl; - out << " codecs.emplace(std::pair(SpvOp" - << spvOpcodeString(SpvOp(opcode)) << ", " << index - << "), std::move(codec));\n"; - out << " }\n\n"; - } - - out << " return codecs;\n}\n"; -} - -void StatsAnalyzer::WriteCodegenIdDescriptorHuffmanCodecs(std::ostream& out) { - out << "std::map, " - << "std::unique_ptr>>\n" - << "GetIdDescriptorHuffmanCodecs() {\n" - << " std::map, " - << "std::unique_ptr>> codecs;\n"; - - std::unordered_set descriptors_with_coding_scheme; - - for (const auto& kv : stats_.operand_slot_id_descriptor_hist) { - const auto& opcode_and_index = kv.first; - const uint32_t opcode = opcode_and_index.first; - const uint32_t index = opcode_and_index.second; - - const double kOpcodeFrequentEnoughToAnalyze = 0.003; - if (opcode_freq_[opcode] < kOpcodeFrequentEnoughToAnalyze) continue; - - const std::map& hist = kv.second; - - uint32_t total = 0; - for (const auto& pair : hist) { - total += pair.second; - } - - uint32_t left_out = 0; - - std::map processed_hist; - for (const auto& pair : hist) { - const uint32_t descriptor = pair.first; - const uint32_t count = pair.second; - const double freq = double(count) / double(total); - const double kDescriptorFrequentEnoughToAnalyze = 0.003; - if (freq < kDescriptorFrequentEnoughToAnalyze) { - left_out += count; - continue; - } - processed_hist.emplace(descriptor, count); - descriptors_with_coding_scheme.insert(descriptor); - } - - // Heuristic. - processed_hist.emplace(kMarkvNoneOfTheAbove, - std::max(1, int(left_out + total * 0.01))); - - HuffmanCodec codec(processed_hist); - - out << " {\n"; - out << " std::unique_ptr> " - << "codec(new HuffmanCodec"; - out << codec.SerializeToText(4); - out << ");\n" << std::endl; - out << " codecs.emplace(std::pair(SpvOp" - << spvOpcodeString(SpvOp(opcode)) << ", " << index - << "), std::move(codec));\n"; - out << " }\n\n"; - } - - out << " return codecs;\n}\n"; - - out << "\nstd::unordered_set GetDescriptorsWithCodingScheme() {\n" - << " std::unordered_set descriptors_with_coding_scheme = {\n"; - for (uint32_t descriptor : descriptors_with_coding_scheme) { - out << " " << descriptor << ",\n"; - } - out << " };\n"; - out << " return descriptors_with_coding_scheme;\n}\n"; -} +} // namespace stats +} // namespace spvtools diff --git a/third_party/spirv-tools/tools/stats/stats_analyzer.h b/third_party/spirv-tools/tools/stats/stats_analyzer.h old mode 100755 new mode 100644 index 72662bd662..f1c37bfaa0 --- a/third_party/spirv-tools/tools/stats/stats_analyzer.h +++ b/third_party/spirv-tools/tools/stats/stats_analyzer.h @@ -12,16 +12,20 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSPIRV_TOOLS_STATS_STATS_ANALYZER_H_ -#define LIBSPIRV_TOOLS_STATS_STATS_ANALYZER_H_ +#ifndef TOOLS_STATS_STATS_ANALYZER_H_ +#define TOOLS_STATS_STATS_ANALYZER_H_ +#include #include -#include "source/spirv_stats.h" +#include "tools/stats/spirv_stats.h" + +namespace spvtools { +namespace stats { class StatsAnalyzer { public: - explicit StatsAnalyzer(const spvtools::SpirvStats& stats); + explicit StatsAnalyzer(const SpirvStats& stats); // Writes respective histograms to |out|. void WriteVersion(std::ostream& out); @@ -36,37 +40,8 @@ class StatsAnalyzer { // level. void WriteOpcodeMarkov(std::ostream& out); - // Writes C++ code containing a function returning opcode histogram. - void WriteCodegenOpcodeHist(std::ostream& out); - - // Writes C++ code containing a function returning opcode_and_num_operands - // histogram. - void WriteCodegenOpcodeAndNumOperandsHist(std::ostream& out); - - // Writes C++ code containing a function returning a map of Huffman codecs - // for opcode_and_num_operands. Each Huffman codec is created for a specific - // previous opcode. - // TODO(atgoo@github.com) Write code which would contain pregenerated Huffman - // codecs, instead of code which would generate them every time. - void WriteCodegenOpcodeAndNumOperandsMarkovHuffmanCodecs(std::ostream& out); - - // Writes C++ code containing a function returning a map of Huffman codecs - // for literal strings. Each Huffman codec is created for a specific opcode. - // I.e. OpExtension and OpExtInstImport would use different codecs. - void WriteCodegenLiteralStringHuffmanCodecs(std::ostream& out); - - // Writes C++ code containing a function returning a map of Huffman codecs - // for single-word non-id operands. Each Huffman codec is created for a - // specific operand slot (opcode and operand number). - void WriteCodegenNonIdWordHuffmanCodecs(std::ostream& out); - - // Writes C++ code containing a function returning a map of Huffman codecs - // for common id descriptors. Each Huffman codec is created for a - // specific operand slot (opcode and operand number). - void WriteCodegenIdDescriptorHuffmanCodecs(std::ostream& out); - private: - const spvtools::SpirvStats& stats_; + const SpirvStats& stats_; uint32_t num_modules_; @@ -77,4 +52,7 @@ class StatsAnalyzer { std::unordered_map opcode_freq_; }; -#endif // LIBSPIRV_TOOLS_STATS_STATS_ANALYZER_H_ +} // namespace stats +} // namespace spvtools + +#endif // TOOLS_STATS_STATS_ANALYZER_H_ diff --git a/third_party/spirv-tools/source/message.cpp b/third_party/spirv-tools/tools/util/cli_consumer.cpp old mode 100755 new mode 100644 similarity index 51% rename from third_party/spirv-tools/source/message.cpp rename to third_party/spirv-tools/tools/util/cli_consumer.cpp index 030fa4e232..77db734e81 --- a/third_party/spirv-tools/source/message.cpp +++ b/third_party/spirv-tools/tools/util/cli_consumer.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016 Google Inc. +// Copyright (c) 2018 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,43 +12,34 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "message.h" +#include "tools/util/cli_consumer.h" -#include +#include namespace spvtools { +namespace utils { -std::string StringifyMessage(spv_message_level_t level, const char* source, - const spv_position_t& position, - const char* message) { - const char* level_string = nullptr; +void CLIMessageConsumer(spv_message_level_t level, const char*, + const spv_position_t& position, const char* message) { switch (level) { case SPV_MSG_FATAL: - level_string = "fatal"; - break; case SPV_MSG_INTERNAL_ERROR: - level_string = "internal error"; - break; case SPV_MSG_ERROR: - level_string = "error"; + std::cerr << "error: line " << position.index << ": " << message + << std::endl; break; case SPV_MSG_WARNING: - level_string = "warning"; + std::cout << "warning: line " << position.index << ": " << message + << std::endl; break; case SPV_MSG_INFO: - level_string = "info"; + std::cout << "info: line " << position.index << ": " << message + << std::endl; break; - case SPV_MSG_DEBUG: - level_string = "debug"; + default: break; } - std::ostringstream oss; - oss << level_string << ": "; - if (source) oss << source << ":"; - oss << position.line << ":" << position.column << ":"; - oss << position.index << ": "; - if (message) oss << message; - return oss.str(); } +} // namespace utils } // namespace spvtools diff --git a/third_party/spirv-tools/source/message.h b/third_party/spirv-tools/tools/util/cli_consumer.h old mode 100755 new mode 100644 similarity index 53% rename from third_party/spirv-tools/source/message.h rename to third_party/spirv-tools/tools/util/cli_consumer.h index 60f5d5632b..ca3d91b95a --- a/third_party/spirv-tools/source/message.h +++ b/third_party/spirv-tools/tools/util/cli_consumer.h @@ -1,4 +1,4 @@ -// Copyright (c) 2016 Google Inc. +// Copyright (c) 2018 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,22 +12,20 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef SPIRV_TOOLS_MESSAGE_H_ -#define SPIRV_TOOLS_MESSAGE_H_ +#ifndef SOURCE_UTIL_CLI_CONSUMMER_H_ +#define SOURCE_UTIL_CLI_CONSUMMER_H_ -#include - -#include "spirv-tools/libspirv.h" +#include namespace spvtools { +namespace utils { -// A helper function to compose and return a string from the message in the -// following format: -// ": :::: " -std::string StringifyMessage(spv_message_level_t level, const char* source, - const spv_position_t& position, - const char* message); +// A message consumer that can be used by command line tools like spirv-opt and +// spirv-val to display messages. +void CLIMessageConsumer(spv_message_level_t level, const char*, + const spv_position_t& position, const char* message); +} // namespace utils } // namespace spvtools -#endif // SPIRV_TOOLS_MESSAGE_H_ +#endif // SOURCE_UTIL_CLI_CONSUMMER_H_ diff --git a/third_party/spirv-tools/tools/val/val.cpp b/third_party/spirv-tools/tools/val/val.cpp old mode 100755 new mode 100644 index 94f9833786..172dd121de --- a/third_party/spirv-tools/tools/val/val.cpp +++ b/third_party/spirv-tools/tools/val/val.cpp @@ -22,6 +22,7 @@ #include "source/spirv_validator_options.h" #include "spirv-tools/libspirv.hpp" #include "tools/io.h" +#include "tools/util/cli_consumer.h" void print_usage(char* argv0) { printf( @@ -164,28 +165,7 @@ int main(int argc, char** argv) { if (!ReadFile(inFile, "rb", &contents)) return 1; spvtools::SpirvTools tools(target_env); - tools.SetMessageConsumer([](spv_message_level_t level, const char*, - const spv_position_t& position, - const char* message) { - switch (level) { - case SPV_MSG_FATAL: - case SPV_MSG_INTERNAL_ERROR: - case SPV_MSG_ERROR: - std::cerr << "error: line " << position.index << ": " << message - << std::endl; - break; - case SPV_MSG_WARNING: - std::cout << "warning: line " << position.index << ": " << message - << std::endl; - break; - case SPV_MSG_INFO: - std::cout << "info: line " << position.index << ": " << message - << std::endl; - break; - default: - break; - } - }); + tools.SetMessageConsumer(spvtools::utils::CLIMessageConsumer); bool succeed = tools.Validate(contents.data(), contents.size(), options); diff --git a/third_party/spirv-tools/utils/fixup_fuzz_result.py b/third_party/spirv-tools/utils/fixup_fuzz_result.py new file mode 100755 index 0000000000..9fe54a3cc4 --- /dev/null +++ b/third_party/spirv-tools/utils/fixup_fuzz_result.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python +# Copyright (c) 2018 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import sys + +if len(sys.argv) < 1: + print("Need file to chop"); + +with open(sys.argv[1], mode='rb') as file: + file_content = file.read() + content = file_content[:len(file_content) - (len(file_content) % 4)] + sys.stdout.write(content) + diff --git a/tools/matc/src/matc/sca/GLSLPostProcessor.cpp b/tools/matc/src/matc/sca/GLSLPostProcessor.cpp index 2170a2de72..5b263059e4 100644 --- a/tools/matc/src/matc/sca/GLSLPostProcessor.cpp +++ b/tools/matc/src/matc/sca/GLSLPostProcessor.cpp @@ -284,7 +284,6 @@ void GLSLPostProcessor::fullOptimization(const TShader& tShader, void GLSLPostProcessor::registerPerformancePasses(Optimizer& optimizer) const { optimizer - // This pass can cause unncessary promotion to highp, disable for now .RegisterPass(CreateMergeReturnPass()) .RegisterPass(CreateInlineExhaustivePass()) .RegisterPass(CreateAggressiveDCEPass()) @@ -302,6 +301,7 @@ void GLSLPostProcessor::registerPerformancePasses(Optimizer& optimizer) const { .RegisterPass(CreateCCPPass()) .RegisterPass(CreateAggressiveDCEPass()) .RegisterPass(CreateRedundancyEliminationPass()) + .RegisterPass(CreateCombineAccessChainsPass()) .RegisterPass(CreateSimplificationPass()) .RegisterPass(CreateVectorDCEPass()) .RegisterPass(CreateDeadInsertElimPass()) @@ -320,7 +320,6 @@ void GLSLPostProcessor::registerPerformancePasses(Optimizer& optimizer) const { void GLSLPostProcessor::registerSizePasses(Optimizer& optimizer) const { optimizer - // This pass can cause unncessary promotion to highp, disable for now .RegisterPass(CreateMergeReturnPass()) .RegisterPass(CreateInlineExhaustivePass()) .RegisterPass(CreateAggressiveDCEPass()) diff --git a/tools/matinfo/CMakeLists.txt b/tools/matinfo/CMakeLists.txt index 8844abeb39..9cfa579c17 100644 --- a/tools/matinfo/CMakeLists.txt +++ b/tools/matinfo/CMakeLists.txt @@ -13,7 +13,7 @@ set(SRCS src/main.cpp) # ================================================================================================== add_executable(${TARGET} ${SRCS}) -target_link_libraries(${TARGET} filaflat filabridge utils getopt SPIRV spirv-cross-glsl) +target_link_libraries(${TARGET} filaflat filabridge utils getopt SPIRV SPIRV-Tools spirv-cross-glsl) # glslang contains a copy of the SPIRV headers, so let's just use those. The leading ".." in the # following variable refers to the project name that we define in glslang/tnt, and the trailing ".."