diff options
author | Pierre Moreau <dev@pmoreau.org> | 2016-03-05 17:45:38 +0100 |
---|---|---|
committer | Pierre Moreau <dev@pmoreau.org> | 2016-03-13 18:51:19 +0100 |
commit | 15f631c1814145bcb5ae428f84eb1edd1d233f33 (patch) | |
tree | 9931e023d1b8ed0fc4a6fc00e25a214d31231e60 /tools | |
parent | 553076d7dc5d6fe74199c807de80f7070aabc912 (diff) |
gen_spirv: Generate `isValid*Mask()` functions
Diffstat (limited to 'tools')
-rw-r--r-- | tools/spirv-tool/gen_spirv.bash | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/tools/spirv-tool/gen_spirv.bash b/tools/spirv-tool/gen_spirv.bash index 91f307f..5e070c9 100644 --- a/tools/spirv-tool/gen_spirv.bash +++ b/tools/spirv-tool/gen_spirv.bash @@ -49,7 +49,25 @@ echo " return true; } } " +} +genMaskIsValid() { +prefix=$1 +subprefix=`echo $prefix | sed -e "s:Mask::g"` +echo "inline bool +isValid$prefix(SPIRVWord Mask) { + SPIRVWord ValidMask = 0u;" + cat $spirvHeader | sed -n -e "/^ *${subprefix}[^a-z]/s:^ *${subprefix}\([^= ][^= ]*\)Mask[= ][= ]*\(.*\).*:\1 \2:p" | while read a b; do + if [[ $a == None ]]; then + continue + fi + printf " ValidMask |= ${subprefix}%sMask;\n" $a +done + +echo " + return (Mask & ~ValidMask) == 0; +} +" } ############################## @@ -88,8 +106,8 @@ fi gen() { type=$1 for prefix in SourceLanguage ExecutionModel AddressingModel MemoryModel ExecutionMode StorageClass Dim SamplerAddressingMode SamplerFilterMode ImageFormat \ - ImageChannelOrder ImageChannelDataType ImageOperands FPFastMathMode FPRoundingMode LinkageType AccessQualifier FunctionParameterAttribute Decoration BuiltIn SelectionControl \ - LoopControl FunctionControl MemorySemantics MemoryAccess Scope GroupOperation KernelEnqueueFlags KernelProfilingInfo Capability Op; do + ImageChannelOrder ImageChannelDataType FPRoundingMode LinkageType AccessQualifier FunctionParameterAttribute Decoration BuiltIn Scope GroupOperation \ + KernelEnqueueFlags Capability Op; do if [[ "$type" == NameMap ]]; then genNameMap $prefix elif [[ "$type" == isValid ]]; then @@ -101,6 +119,12 @@ for prefix in SourceLanguage ExecutionModel AddressingModel MemoryModel Executio exit fi done +for prefix in ImageOperandsMask FPFastMathModeMask SelectionControlMask LoopControlMask FunctionControlMask MemorySemanticsMask MemoryAccessMask \ + KernelProfilingInfoMask; do + if [[ "$type" == isValid ]]; then + genMaskIsValid $prefix + fi +done } #################### |