|
| 1 | +//===--- HLSLRootSignature.def - Tokens and Enum Database -------*- C++ -*-===// |
| 2 | +// |
| 3 | +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | +// See https://llvm.org/LICENSE.txt for license information. |
| 5 | +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | +// |
| 7 | +//===----------------------------------------------------------------------===// |
| 8 | +// |
| 9 | +// This file defines the TokenKinds used in the Root Signature DSL. This |
| 10 | +// includes keywords, enums and a small subset of punctuators. Users of this |
| 11 | +// file must optionally #define the TOK, KEYWORD, ENUM or specific ENUM macros |
| 12 | +// to make use of this file. |
| 13 | +// |
| 14 | +//===----------------------------------------------------------------------===// |
| 15 | + |
| 16 | +#ifndef TOK |
| 17 | +#define TOK(X) |
| 18 | +#endif |
| 19 | +#ifndef PUNCTUATOR |
| 20 | +#define PUNCTUATOR(X,Y) TOK(pu_ ## X) |
| 21 | +#endif |
| 22 | +#ifndef KEYWORD |
| 23 | +#define KEYWORD(X) TOK(kw_ ## X) |
| 24 | +#endif |
| 25 | +#ifndef ENUM |
| 26 | +#define ENUM(NAME, LIT) TOK(en_ ## NAME) |
| 27 | +#endif |
| 28 | + |
| 29 | +// Defines the various types of enum |
| 30 | +#ifndef DESCRIPTOR_RANGE_OFFSET_ENUM |
| 31 | +#define DESCRIPTOR_RANGE_OFFSET_ENUM(NAME, LIT) ENUM(NAME, LIT) |
| 32 | +#endif |
| 33 | +#ifndef ROOT_DESCRIPTOR_FLAG_ENUM |
| 34 | +#define ROOT_DESCRIPTOR_FLAG_ENUM(NAME, LIT) ENUM(NAME, LIT) |
| 35 | +#endif |
| 36 | +// Note: ON denotes that the flag is unique from the above Root Descriptor |
| 37 | +// Flags. This is required to avoid token kind enum conflicts. |
| 38 | +#ifndef DESCRIPTOR_RANGE_FLAG_ENUM_OFF |
| 39 | +#define DESCRIPTOR_RANGE_FLAG_ENUM_OFF(NAME, LIT) |
| 40 | +#endif |
| 41 | +#ifndef DESCRIPTOR_RANGE_FLAG_ENUM_ON |
| 42 | +#define DESCRIPTOR_RANGE_FLAG_ENUM_ON(NAME, LIT) ENUM(NAME, LIT) |
| 43 | +#endif |
| 44 | +#ifndef DESCRIPTOR_RANGE_FLAG_ENUM |
| 45 | +#define DESCRIPTOR_RANGE_FLAG_ENUM(NAME, LIT, ON) DESCRIPTOR_RANGE_FLAG_ENUM_##ON(NAME, LIT) |
| 46 | +#endif |
| 47 | +#ifndef SHADER_VISIBILITY_ENUM |
| 48 | +#define SHADER_VISIBILITY_ENUM(NAME, LIT) ENUM(NAME, LIT) |
| 49 | +#endif |
| 50 | + |
| 51 | +// General Tokens: |
| 52 | +TOK(invalid) |
| 53 | +TOK(end_of_stream) |
| 54 | +TOK(int_literal) |
| 55 | + |
| 56 | +// Register Tokens: |
| 57 | +TOK(bReg) |
| 58 | +TOK(tReg) |
| 59 | +TOK(uReg) |
| 60 | +TOK(sReg) |
| 61 | + |
| 62 | +// Punctuators: |
| 63 | +PUNCTUATOR(l_paren, '(') |
| 64 | +PUNCTUATOR(r_paren, ')') |
| 65 | +PUNCTUATOR(comma, ',') |
| 66 | +PUNCTUATOR(or, '|') |
| 67 | +PUNCTUATOR(equal, '=') |
| 68 | +PUNCTUATOR(plus, '+') |
| 69 | +PUNCTUATOR(minus, '-') |
| 70 | + |
| 71 | +// RootElement Keywords: |
| 72 | +KEYWORD(DescriptorTable) |
| 73 | + |
| 74 | +// DescriptorTable Keywords: |
| 75 | +KEYWORD(CBV) |
| 76 | +KEYWORD(SRV) |
| 77 | +KEYWORD(UAV) |
| 78 | +KEYWORD(Sampler) |
| 79 | + |
| 80 | +// General Parameter Keywords: |
| 81 | +KEYWORD(space) |
| 82 | +KEYWORD(visibility) |
| 83 | +KEYWORD(flags) |
| 84 | + |
| 85 | +// View Parameter Keywords: |
| 86 | +KEYWORD(numDescriptors) |
| 87 | +KEYWORD(offset) |
| 88 | + |
| 89 | +// Descriptor Range Offset Enum: |
| 90 | +DESCRIPTOR_RANGE_OFFSET_ENUM(DescriptorRangeOffsetAppend, "DESCRIPTOR_RANGE_OFFSET_APPEND") |
| 91 | + |
| 92 | +// Root Descriptor Flag Enums: |
| 93 | +ROOT_DESCRIPTOR_FLAG_ENUM(DataVolatile, "DATA_VOLATILE") |
| 94 | +ROOT_DESCRIPTOR_FLAG_ENUM(DataStaticWhileSetAtExecute, "DATA_STATIC_WHILE_SET_AT_EXECUTE") |
| 95 | +ROOT_DESCRIPTOR_FLAG_ENUM(DataStatic, "DATA_STATIC") |
| 96 | + |
| 97 | +// Descriptor Range Flag Enums: |
| 98 | +DESCRIPTOR_RANGE_FLAG_ENUM(DescriptorsVolatile, "DESCRIPTORS_VOLATILE", ON) |
| 99 | +DESCRIPTOR_RANGE_FLAG_ENUM(DataVolatile, "DATA_VOLATILE", OFF) |
| 100 | +DESCRIPTOR_RANGE_FLAG_ENUM(DataStaticWhileSetAtExecute, "DATA_STATIC_WHILE_SET_AT_EXECUTE", OFF) |
| 101 | +DESCRIPTOR_RANGE_FLAG_ENUM(DataStatic, "DATA_STATIC", OFF) |
| 102 | +DESCRIPTOR_RANGE_FLAG_ENUM(DescriptorsStaticKeepingBufferBoundsChecks, "DESCRIPTORS_STATIC_KEEPING_BUFFER_BOUNDS_CHECKS", ON) |
| 103 | + |
| 104 | +// Shader Visibiliy Enums: |
| 105 | +SHADER_VISIBILITY_ENUM(All, "SHADER_VISIBILITY_ALL") |
| 106 | +SHADER_VISIBILITY_ENUM(Vertex, "SHADER_VISIBILITY_VERTEX") |
| 107 | +SHADER_VISIBILITY_ENUM(Hull, "SHADER_VISIBILITY_HULL") |
| 108 | +SHADER_VISIBILITY_ENUM(Domain, "SHADER_VISIBILITY_DOMAIN") |
| 109 | +SHADER_VISIBILITY_ENUM(Geometry, "SHADER_VISIBILITY_GEOMETRY") |
| 110 | +SHADER_VISIBILITY_ENUM(Pixel, "SHADER_VISIBILITY_PIXEL") |
| 111 | +SHADER_VISIBILITY_ENUM(Amplification, "SHADER_VISIBILITY_AMPLIFICATION") |
| 112 | +SHADER_VISIBILITY_ENUM(Mesh, "SHADER_VISIBILITY_MESH") |
| 113 | + |
| 114 | +#undef SHADER_VISIBILITY_ENUM |
| 115 | +#undef DESCRIPTOR_RANGE_FLAG_ENUM |
| 116 | +#undef DESCRIPTOR_RANGE_FLAG_ENUM_OFF |
| 117 | +#undef DESCRIPTOR_RANGE_FLAG_ENUM_ON |
| 118 | +#undef ROOT_DESCRIPTOR_FLAG_ENUM |
| 119 | +#undef DESCRIPTOR_RANGE_OFFSET_ENUM |
| 120 | +#undef ENUM |
| 121 | +#undef KEYWORD |
| 122 | +#undef PUNCTUATOR |
| 123 | +#undef TOK |
0 commit comments