| 1 |
//===- SPIRVIsValidEnum.h - SPIR-V isValid enums ----------------*- C++ -*-===// |
| 2 |
// |
| 3 |
// The LLVM/SPIRV Translator |
| 4 |
// |
| 5 |
// This file is distributed under the University of Illinois Open Source |
| 6 |
// License. See LICENSE.TXT for details. |
| 7 |
// |
| 8 |
// Copyright (c) 2014 Advanced Micro Devices, Inc. All rights reserved. |
| 9 |
// |
| 10 |
// Permission is hereby granted, free of charge, to any person obtaining a |
| 11 |
// copy of this software and associated documentation files (the "Software"), |
| 12 |
// to deal with the Software without restriction, including without limitation |
| 13 |
// the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 14 |
// and/or sell copies of the Software, and to permit persons to whom the |
| 15 |
// Software is furnished to do so, subject to the following conditions: |
| 16 |
// |
| 17 |
// Redistributions of source code must retain the above copyright notice, |
| 18 |
// this list of conditions and the following disclaimers. |
| 19 |
// Redistributions in binary form must reproduce the above copyright notice, |
| 20 |
// this list of conditions and the following disclaimers in the documentation |
| 21 |
// and/or other materials provided with the distribution. |
| 22 |
// Neither the names of Advanced Micro Devices, Inc., nor the names of its |
| 23 |
// contributors may be used to endorse or promote products derived from this |
| 24 |
// Software without specific prior written permission. |
| 25 |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 26 |
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 27 |
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 28 |
// CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 29 |
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 30 |
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH |
| 31 |
// THE SOFTWARE. |
| 32 |
// |
| 33 |
//===----------------------------------------------------------------------===// |
| 34 |
/// \file |
| 35 |
/// |
| 36 |
/// This file defines SPIR-V isValid enums. |
| 37 |
/// |
| 38 |
//===----------------------------------------------------------------------===// |
| 39 |
// WARNING: |
| 40 |
// |
| 41 |
// This file has been generated using `tools/spirv-tool/gen_spirv.bash` and |
| 42 |
// should not be modified manually. If the file needs to be updated, edit the |
| 43 |
// script and any other source file instead, before re-generating this file. |
| 44 |
//===----------------------------------------------------------------------===// |
| 45 |
|
| 46 |
#ifndef SPIRV_LIBSPIRV_SPIRVISVALIDENUM_H |
| 47 |
#define SPIRV_LIBSPIRV_SPIRVISVALIDENUM_H |
| 48 |
|
| 49 |
#include "SPIRVEnum.h" |
| 50 |
#include "spirv/unified1/spirv.hpp" |
| 51 |
#include "spirv_internal.hpp" |
| 52 |
|
| 53 |
using namespace spv; |
| 54 |
|
| 55 |
namespace SPIRV { |
| 56 |
|
| 57 |
inline bool isValid(spv::ExecutionModel V) { |
| 58 |
switch (static_cast<uint32_t>(V)) { |
| 59 |
case ExecutionModelVertex: |
| 60 |
case ExecutionModelTessellationControl: |
| 61 |
case ExecutionModelTessellationEvaluation: |
| 62 |
case ExecutionModelGeometry: |
| 63 |
case ExecutionModelFragment: |
| 64 |
case ExecutionModelGLCompute: |
| 65 |
case ExecutionModelKernel: |
| 66 |
case ExecutionModelTaskNV: |
| 67 |
case ExecutionModelMeshNV: |
| 68 |
case ExecutionModelRayGenerationKHR: |
| 69 |
case ExecutionModelIntersectionKHR: |
| 70 |
case ExecutionModelAnyHitKHR: |
| 71 |
case ExecutionModelClosestHitKHR: |
| 72 |
case ExecutionModelMissKHR: |
| 73 |
case ExecutionModelCallableKHR: |
| 74 |
case ExecutionModeStreamingInterfaceINTEL: |
| 75 |
case ExecutionModeMaximumRegistersINTEL: |
| 76 |
case ExecutionModeMaximumRegistersIdINTEL: |
| 77 |
case ExecutionModeNamedMaximumRegistersINTEL: |
| 78 |
return true; |
| 79 |
default: |
| 80 |
return false; |
| 81 |
} |
| 82 |
} |
| 83 |
|
| 84 |
inline bool isValid(spv::AddressingModel V) { |
| 85 |
switch (V) { |
| 86 |
case AddressingModelLogical: |
| 87 |
case AddressingModelPhysical32: |
| 88 |
case AddressingModelPhysical64: |
| 89 |
case AddressingModelPhysicalStorageBuffer64: |
| 90 |
return true; |
| 91 |
default: |
| 92 |
return false; |
| 93 |
} |
| 94 |
} |
| 95 |
|
| 96 |
inline bool isValid(spv::MemoryModel V) { |
| 97 |
switch (V) { |
| 98 |
case MemoryModelSimple: |
| 99 |
case MemoryModelGLSL450: |
| 100 |
case MemoryModelOpenCL: |
| 101 |
case MemoryModelVulkan: |
| 102 |
return true; |
| 103 |
default: |
| 104 |
return false; |
| 105 |
} |
| 106 |
} |
| 107 |
|
| 108 |
inline bool isValid(spv::StorageClass V) { |
| 109 |
switch (V) { |
| 110 |
case StorageClassUniformConstant: |
| 111 |
case StorageClassInput: |
| 112 |
case StorageClassUniform: |
| 113 |
case StorageClassOutput: |
| 114 |
case StorageClassWorkgroup: |
| 115 |
case StorageClassCrossWorkgroup: |
| 116 |
case StorageClassPrivate: |
| 117 |
case StorageClassFunction: |
| 118 |
case StorageClassGeneric: |
| 119 |
case StorageClassPushConstant: |
| 120 |
case StorageClassAtomicCounter: |
| 121 |
case StorageClassImage: |
| 122 |
case StorageClassStorageBuffer: |
| 123 |
case StorageClassCallableDataKHR: |
| 124 |
case StorageClassIncomingCallableDataKHR: |
| 125 |
case StorageClassRayPayloadKHR: |
| 126 |
case StorageClassHitAttributeKHR: |
| 127 |
case StorageClassIncomingRayPayloadKHR: |
| 128 |
case StorageClassShaderRecordBufferKHR: |
| 129 |
case StorageClassPhysicalStorageBuffer: |
| 130 |
case StorageClassCodeSectionINTEL: |
| 131 |
case StorageClassDeviceOnlyINTEL: |
| 132 |
case StorageClassHostOnlyINTEL: |
| 133 |
return true; |
| 134 |
default: |
| 135 |
return false; |
| 136 |
} |
| 137 |
} |
| 138 |
|
| 139 |
inline bool isValid(spv::LinkageType V) { |
| 140 |
int LT = V; |
| 141 |
switch (LT) { |
| 142 |
case LinkageTypeExport: |
| 143 |
case LinkageTypeImport: |
| 144 |
case LinkageTypeLinkOnceODR: |
| 145 |
case internal::LinkageTypeInternal: |
| 146 |
return true; |
| 147 |
default: |
| 148 |
return false; |
| 149 |
} |
| 150 |
} |
| 151 |
|
| 152 |
inline bool isValid(spv::AccessQualifier V) { |
| 153 |
switch (V) { |
| 154 |
case AccessQualifierReadOnly: |
| 155 |
case AccessQualifierWriteOnly: |
| 156 |
case AccessQualifierReadWrite: |
| 157 |
return true; |
| 158 |
default: |
| 159 |
return false; |
| 160 |
} |
| 161 |
} |
| 162 |
|
| 163 |
inline bool isValid(spv::FunctionParameterAttribute V) { |
| 164 |
switch (V) { |
| 165 |
case FunctionParameterAttributeZext: |
| 166 |
case FunctionParameterAttributeSext: |
| 167 |
case FunctionParameterAttributeByVal: |
| 168 |
case FunctionParameterAttributeSret: |
| 169 |
case FunctionParameterAttributeNoAlias: |
| 170 |
case FunctionParameterAttributeNoCapture: |
| 171 |
case FunctionParameterAttributeNoWrite: |
| 172 |
case FunctionParameterAttributeNoReadWrite: |
| 173 |
case FunctionParameterAttributeRuntimeAlignedINTEL: |
| 174 |
return true; |
| 175 |
default: |
| 176 |
return false; |
| 177 |
} |
| 178 |
} |
| 179 |
|
| 180 |
inline bool isValid(spv::BuiltIn V) { |
| 181 |
switch (static_cast<uint32_t>(V)) { |
| 182 |
case BuiltInPosition: |
| 183 |
case BuiltInPointSize: |
| 184 |
case BuiltInClipDistance: |
| 185 |
case BuiltInCullDistance: |
| 186 |
case BuiltInVertexId: |
| 187 |
case BuiltInInstanceId: |
| 188 |
case BuiltInPrimitiveId: |
| 189 |
case BuiltInInvocationId: |
| 190 |
case BuiltInLayer: |
| 191 |
case BuiltInViewportIndex: |
| 192 |
case BuiltInTessLevelOuter: |
| 193 |
case BuiltInTessLevelInner: |
| 194 |
case BuiltInTessCoord: |
| 195 |
case BuiltInPatchVertices: |
| 196 |
case BuiltInFragCoord: |
| 197 |
case BuiltInPointCoord: |
| 198 |
case BuiltInFrontFacing: |
| 199 |
case BuiltInSampleId: |
| 200 |
case BuiltInSamplePosition: |
| 201 |
case BuiltInSampleMask: |
| 202 |
case BuiltInFragDepth: |
| 203 |
case BuiltInHelperInvocation: |
| 204 |
case BuiltInNumWorkgroups: |
| 205 |
case BuiltInWorkgroupSize: |
| 206 |
case BuiltInWorkgroupId: |
| 207 |
case BuiltInLocalInvocationId: |
| 208 |
case BuiltInGlobalInvocationId: |
| 209 |
case BuiltInLocalInvocationIndex: |
| 210 |
case BuiltInWorkDim: |
| 211 |
case BuiltInGlobalSize: |
| 212 |
case BuiltInEnqueuedWorkgroupSize: |
| 213 |
case BuiltInGlobalOffset: |
| 214 |
case BuiltInGlobalLinearId: |
| 215 |
case BuiltInSubgroupSize: |
| 216 |
case BuiltInSubgroupMaxSize: |
| 217 |
case BuiltInNumSubgroups: |
| 218 |
case BuiltInNumEnqueuedSubgroups: |
| 219 |
case BuiltInSubgroupId: |
| 220 |
case BuiltInSubgroupLocalInvocationId: |
| 221 |
case BuiltInVertexIndex: |
| 222 |
case BuiltInInstanceIndex: |
| 223 |
case BuiltInSubgroupEqMask: |
| 224 |
case BuiltInSubgroupGeMask: |
| 225 |
case BuiltInSubgroupGtMask: |
| 226 |
case BuiltInSubgroupLeMask: |
| 227 |
case BuiltInSubgroupLtMask: |
| 228 |
case BuiltInBaseVertex: |
| 229 |
case BuiltInBaseInstance: |
| 230 |
case BuiltInDrawIndex: |
| 231 |
case BuiltInPrimitiveShadingRateKHR: |
| 232 |
case BuiltInDeviceIndex: |
| 233 |
case BuiltInViewIndex: |
| 234 |
case BuiltInShadingRateKHR: |
| 235 |
case BuiltInBaryCoordNoPerspAMD: |
| 236 |
case BuiltInBaryCoordNoPerspCentroidAMD: |
| 237 |
case BuiltInBaryCoordNoPerspSampleAMD: |
| 238 |
case BuiltInBaryCoordSmoothAMD: |
| 239 |
case BuiltInBaryCoordSmoothCentroidAMD: |
| 240 |
case BuiltInBaryCoordSmoothSampleAMD: |
| 241 |
case BuiltInBaryCoordPullModelAMD: |
| 242 |
case BuiltInFragStencilRefEXT: |
| 243 |
case BuiltInViewportMaskNV: |
| 244 |
case BuiltInSecondaryPositionNV: |
| 245 |
case BuiltInSecondaryViewportMaskNV: |
| 246 |
case BuiltInPositionPerViewNV: |
| 247 |
case BuiltInViewportMaskPerViewNV: |
| 248 |
case BuiltInFullyCoveredEXT: |
| 249 |
case BuiltInTaskCountNV: |
| 250 |
case BuiltInPrimitiveCountNV: |
| 251 |
case BuiltInPrimitiveIndicesNV: |
| 252 |
case BuiltInClipDistancePerViewNV: |
| 253 |
case BuiltInCullDistancePerViewNV: |
| 254 |
case BuiltInLayerPerViewNV: |
| 255 |
case BuiltInMeshViewCountNV: |
| 256 |
case BuiltInMeshViewIndicesNV: |
| 257 |
case BuiltInBaryCoordKHR: |
| 258 |
case BuiltInBaryCoordNoPerspKHR: |
| 259 |
case BuiltInFragSizeEXT: |
| 260 |
case BuiltInFragInvocationCountEXT: |
| 261 |
case BuiltInLaunchIdKHR: |
| 262 |
case BuiltInLaunchSizeKHR: |
| 263 |
case BuiltInWorldRayOriginKHR: |
| 264 |
case BuiltInWorldRayDirectionKHR: |
| 265 |
case BuiltInObjectRayOriginKHR: |
| 266 |
case BuiltInObjectRayDirectionKHR: |
| 267 |
case BuiltInRayTminKHR: |
| 268 |
case BuiltInRayTmaxKHR: |
| 269 |
case BuiltInInstanceCustomIndexKHR: |
| 270 |
case BuiltInObjectToWorldKHR: |
| 271 |
case BuiltInWorldToObjectKHR: |
| 272 |
case BuiltInHitTNV: |
| 273 |
case BuiltInHitKindKHR: |
| 274 |
case BuiltInCurrentRayTimeNV: |
| 275 |
case BuiltInIncomingRayFlagsKHR: |
| 276 |
case BuiltInRayGeometryIndexKHR: |
| 277 |
case BuiltInWarpsPerSMNV: |
| 278 |
case BuiltInSMCountNV: |
| 279 |
case BuiltInWarpIDNV: |
| 280 |
case BuiltInSMIDNV: |
| 281 |
case BuiltInCullMaskKHR: |
| 282 |
case internal::BuiltInSubDeviceIDINTEL: |
| 283 |
case internal::BuiltInGlobalHWThreadIDINTEL: |
| 284 |
case internal::BuiltInDeviceBarrierValidINTEL: |
| 285 |
return true; |
| 286 |
default: |
| 287 |
return false; |
| 288 |
} |
| 289 |
} |
| 290 |
|
| 291 |
inline bool isValidFunctionControlMask(SPIRVWord Mask) { |
| 292 |
SPIRVWord ValidMask = 0u; |
| 293 |
ValidMask |= FunctionControlInlineMask; |
| 294 |
ValidMask |= FunctionControlDontInlineMask; |
| 295 |
ValidMask |= FunctionControlPureMask; |
| 296 |
ValidMask |= FunctionControlConstMask; |
| 297 |
ValidMask |= FunctionControlOptNoneEXTMask; |
| 298 |
|
| 299 |
return (Mask & ~ValidMask) == 0; |
| 300 |
} |
| 301 |
|
| 302 |
} /* namespace SPIRV */ |
| 303 |
|
| 304 |
#endif // SPIRV_LIBSPIRV_SPIRVISVALIDENUM_H |