diff options
| author | 3gg <3gg@shellblade.net> | 2025-12-02 16:39:36 -0800 |
|---|---|---|
| committer | 3gg <3gg@shellblade.net> | 2025-12-02 16:39:36 -0800 |
| commit | 6c8ae19be66cee247980a48e736a4e05d14de179 (patch) | |
| tree | d860767907bf0cbe17ec66422e11bea700cf56d9 /contrib/DirectX-Headers-1.618.2/include/directx/D3D12TokenizedProgramFormat.hpp | |
| parent | 8f594c8ebd11f0e5f8a0c6369c3fe7383d250cbe (diff) | |
Diffstat (limited to 'contrib/DirectX-Headers-1.618.2/include/directx/D3D12TokenizedProgramFormat.hpp')
| -rw-r--r-- | contrib/DirectX-Headers-1.618.2/include/directx/D3D12TokenizedProgramFormat.hpp | 2634 |
1 files changed, 2634 insertions, 0 deletions
diff --git a/contrib/DirectX-Headers-1.618.2/include/directx/D3D12TokenizedProgramFormat.hpp b/contrib/DirectX-Headers-1.618.2/include/directx/D3D12TokenizedProgramFormat.hpp new file mode 100644 index 0000000..b951454 --- /dev/null +++ b/contrib/DirectX-Headers-1.618.2/include/directx/D3D12TokenizedProgramFormat.hpp | |||
| @@ -0,0 +1,2634 @@ | |||
| 1 | #pragma once | ||
| 2 | //********************************************************* | ||
| 3 | // | ||
| 4 | // Copyright (c) Microsoft Corporation. | ||
| 5 | // Licensed under the MIT License (MIT). | ||
| 6 | // | ||
| 7 | //********************************************************* | ||
| 8 | // | ||
| 9 | // High Level Goals | ||
| 10 | // | ||
| 11 | // - Serve as the runtime/DDI representation for all D3D11 tokenized code, | ||
| 12 | // for all classes of programs, including pixel program, vertex program, | ||
| 13 | // geometry program, etc. | ||
| 14 | // | ||
| 15 | // - Any information that HLSL needs to give to drivers is encoded in | ||
| 16 | // this token format in some form. | ||
| 17 | // | ||
| 18 | // - Enable common tools and source code for managing all tokenizable | ||
| 19 | // program formats. | ||
| 20 | // | ||
| 21 | // - Support extensible token definitions, allowing full customizations for | ||
| 22 | // specific program classes, while maintaining general conventions for all | ||
| 23 | // program models. | ||
| 24 | // | ||
| 25 | // - Binary backwards compatible with D3D10. Any token name that was originally | ||
| 26 | // defined with "D3D10" in it is unchanged; D3D11 only adds new tokens. | ||
| 27 | // | ||
| 28 | // ---------------------------------------------------------------------------- | ||
| 29 | // | ||
| 30 | // Low Level Feature Summary | ||
| 31 | // | ||
| 32 | // - DWORD based tokens always, for simplicity | ||
| 33 | // - Opcode token is generally a single DWORD, though there is a bit indicating | ||
| 34 | // if extended information (extra DWORD(s)) are present | ||
| 35 | // - Operand tokens are a completely self contained, extensible format, | ||
| 36 | // with scalar and 4-vector data types as first class citizens, but | ||
| 37 | // allowance for extension to n-component vectors. | ||
| 38 | // - Initial operand token identifies register type, register file | ||
| 39 | // structure/dimensionality and mode of indexing for each dimension, | ||
| 40 | // and choice of component selection mechanism (i.e. mask vs. swizzle etc). | ||
| 41 | // - Optional additional extended operand tokens can defined things like | ||
| 42 | // modifiers (which are not needed by default). | ||
| 43 | // - Operand's immediate index value(s), if needed, appear as subsequent DWORD | ||
| 44 | // values, and if relative addressing is specified, an additional completely | ||
| 45 | // self contained operand definition appears nested in the token sequence. | ||
| 46 | // | ||
| 47 | // ---------------------------------------------------------------------------- | ||
| 48 | |||
| 49 | #include <winapifamily.h> | ||
| 50 | |||
| 51 | #pragma region Application Family | ||
| 52 | #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_GAMES) | ||
| 53 | |||
| 54 | // ---------------------------------------------------------------------------- | ||
| 55 | // Version Token (VerTok) | ||
| 56 | // | ||
| 57 | // [07:00] minor version number (0-255) | ||
| 58 | // [15:08] major version number (0-255) | ||
| 59 | // [31:16] D3D10_SB_TOKENIZED_PROGRAM_TYPE | ||
| 60 | // | ||
| 61 | // ---------------------------------------------------------------------------- | ||
| 62 | |||
| 63 | typedef enum D3D10_SB_TOKENIZED_PROGRAM_TYPE | ||
| 64 | { | ||
| 65 | D3D10_SB_PIXEL_SHADER = 0, | ||
| 66 | D3D10_SB_VERTEX_SHADER = 1, | ||
| 67 | D3D10_SB_GEOMETRY_SHADER = 2, | ||
| 68 | |||
| 69 | // D3D11 Shaders | ||
| 70 | D3D11_SB_HULL_SHADER = 3, | ||
| 71 | D3D11_SB_DOMAIN_SHADER = 4, | ||
| 72 | D3D11_SB_COMPUTE_SHADER = 5, | ||
| 73 | |||
| 74 | // Subset of D3D12 Shaders where this field is referenced by runtime | ||
| 75 | // Entries from 6-12 are unique to state objects | ||
| 76 | // (e.g. library, callable and raytracing shaders) | ||
| 77 | D3D12_SB_MESH_SHADER = 13, | ||
| 78 | D3D12_SB_AMPLIFICATION_SHADER = 14, | ||
| 79 | |||
| 80 | D3D11_SB_RESERVED0 = 0xFFF0 | ||
| 81 | } D3D10_SB_TOKENIZED_PROGRAM_TYPE; | ||
| 82 | |||
| 83 | #define D3D10_SB_TOKENIZED_PROGRAM_TYPE_MASK 0xffff0000 | ||
| 84 | #define D3D10_SB_TOKENIZED_PROGRAM_TYPE_SHIFT 16 | ||
| 85 | |||
| 86 | // DECODER MACRO: Retrieve program type from version token | ||
| 87 | #define DECODE_D3D10_SB_TOKENIZED_PROGRAM_TYPE(VerTok) ((D3D10_SB_TOKENIZED_PROGRAM_TYPE)(((VerTok)&D3D10_SB_TOKENIZED_PROGRAM_TYPE_MASK)>>D3D10_SB_TOKENIZED_PROGRAM_TYPE_SHIFT)) | ||
| 88 | |||
| 89 | #define D3D10_SB_TOKENIZED_PROGRAM_MAJOR_VERSION_MASK 0x000000f0 | ||
| 90 | #define D3D10_SB_TOKENIZED_PROGRAM_MAJOR_VERSION_SHIFT 4 | ||
| 91 | #define D3D10_SB_TOKENIZED_PROGRAM_MINOR_VERSION_MASK 0x0000000f | ||
| 92 | |||
| 93 | // DECODER MACRO: Retrieve major version # from version token | ||
| 94 | #define DECODE_D3D10_SB_TOKENIZED_PROGRAM_MAJOR_VERSION(VerTok) (((VerTok)&D3D10_SB_TOKENIZED_PROGRAM_MAJOR_VERSION_MASK)>>D3D10_SB_TOKENIZED_PROGRAM_MAJOR_VERSION_SHIFT) | ||
| 95 | // DECODER MACRO: Retrieve minor version # from version token | ||
| 96 | #define DECODE_D3D10_SB_TOKENIZED_PROGRAM_MINOR_VERSION(VerTok) ((VerTok)&D3D10_SB_TOKENIZED_PROGRAM_MINOR_VERSION_MASK) | ||
| 97 | |||
| 98 | // ENCODER MACRO: Create complete VerTok | ||
| 99 | #define ENCODE_D3D10_SB_TOKENIZED_PROGRAM_VERSION_TOKEN(ProgType,MajorVer,MinorVer) ((((ProgType)<<D3D10_SB_TOKENIZED_PROGRAM_TYPE_SHIFT)&D3D10_SB_TOKENIZED_PROGRAM_TYPE_MASK)|\ | ||
| 100 | ((((MajorVer)<<D3D10_SB_TOKENIZED_PROGRAM_MAJOR_VERSION_SHIFT)&D3D10_SB_TOKENIZED_PROGRAM_MAJOR_VERSION_MASK))|\ | ||
| 101 | ((MinorVer)&D3D10_SB_TOKENIZED_PROGRAM_MINOR_VERSION_MASK)) | ||
| 102 | |||
| 103 | // ---------------------------------------------------------------------------- | ||
| 104 | // Length Token (LenTok) | ||
| 105 | // | ||
| 106 | // Always follows VerTok | ||
| 107 | // | ||
| 108 | // [31:00] Unsigned integer count of number of | ||
| 109 | // DWORDs in program code, including version | ||
| 110 | // and length tokens. So the minimum value | ||
| 111 | // is 0x00000002 (if an empty program is ever | ||
| 112 | // valid). | ||
| 113 | // | ||
| 114 | // ---------------------------------------------------------------------------- | ||
| 115 | |||
| 116 | // DECODER MACRO: Retrieve program length | ||
| 117 | #define DECODE_D3D10_SB_TOKENIZED_PROGRAM_LENGTH(LenTok) (LenTok) | ||
| 118 | // ENCODER MACRO: Create complete LenTok | ||
| 119 | #define ENCODE_D3D10_SB_TOKENIZED_PROGRAM_LENGTH(Length) (Length) | ||
| 120 | #define MAX_D3D10_SB_TOKENIZED_PROGRAM_LENGTH (0xffffffff) | ||
| 121 | |||
| 122 | // ---------------------------------------------------------------------------- | ||
| 123 | // Opcode Format (OpcodeToken0) | ||
| 124 | // | ||
| 125 | // [10:00] D3D10_SB_OPCODE_TYPE | ||
| 126 | // if( [10:00] == D3D10_SB_OPCODE_CUSTOMDATA ) | ||
| 127 | // { | ||
| 128 | // Token starts a custom-data block. See "Custom-Data Block Format". | ||
| 129 | // } | ||
| 130 | // else // standard opcode token | ||
| 131 | // { | ||
| 132 | // [23:11] Opcode-Specific Controls | ||
| 133 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 134 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 135 | // contains extended opcode token. | ||
| 136 | // } | ||
| 137 | // | ||
| 138 | // ---------------------------------------------------------------------------- | ||
| 139 | |||
| 140 | typedef enum D3D10_SB_OPCODE_TYPE { | ||
| 141 | D3D10_SB_OPCODE_ADD , | ||
| 142 | D3D10_SB_OPCODE_AND , | ||
| 143 | D3D10_SB_OPCODE_BREAK , | ||
| 144 | D3D10_SB_OPCODE_BREAKC , | ||
| 145 | D3D10_SB_OPCODE_CALL , | ||
| 146 | D3D10_SB_OPCODE_CALLC , | ||
| 147 | D3D10_SB_OPCODE_CASE , | ||
| 148 | D3D10_SB_OPCODE_CONTINUE , | ||
| 149 | D3D10_SB_OPCODE_CONTINUEC , | ||
| 150 | D3D10_SB_OPCODE_CUT , | ||
| 151 | D3D10_SB_OPCODE_DEFAULT , | ||
| 152 | D3D10_SB_OPCODE_DERIV_RTX , | ||
| 153 | D3D10_SB_OPCODE_DERIV_RTY , | ||
| 154 | D3D10_SB_OPCODE_DISCARD , | ||
| 155 | D3D10_SB_OPCODE_DIV , | ||
| 156 | D3D10_SB_OPCODE_DP2 , | ||
| 157 | D3D10_SB_OPCODE_DP3 , | ||
| 158 | D3D10_SB_OPCODE_DP4 , | ||
| 159 | D3D10_SB_OPCODE_ELSE , | ||
| 160 | D3D10_SB_OPCODE_EMIT , | ||
| 161 | D3D10_SB_OPCODE_EMITTHENCUT , | ||
| 162 | D3D10_SB_OPCODE_ENDIF , | ||
| 163 | D3D10_SB_OPCODE_ENDLOOP , | ||
| 164 | D3D10_SB_OPCODE_ENDSWITCH , | ||
| 165 | D3D10_SB_OPCODE_EQ , | ||
| 166 | D3D10_SB_OPCODE_EXP , | ||
| 167 | D3D10_SB_OPCODE_FRC , | ||
| 168 | D3D10_SB_OPCODE_FTOI , | ||
| 169 | D3D10_SB_OPCODE_FTOU , | ||
| 170 | D3D10_SB_OPCODE_GE , | ||
| 171 | D3D10_SB_OPCODE_IADD , | ||
| 172 | D3D10_SB_OPCODE_IF , | ||
| 173 | D3D10_SB_OPCODE_IEQ , | ||
| 174 | D3D10_SB_OPCODE_IGE , | ||
| 175 | D3D10_SB_OPCODE_ILT , | ||
| 176 | D3D10_SB_OPCODE_IMAD , | ||
| 177 | D3D10_SB_OPCODE_IMAX , | ||
| 178 | D3D10_SB_OPCODE_IMIN , | ||
| 179 | D3D10_SB_OPCODE_IMUL , | ||
| 180 | D3D10_SB_OPCODE_INE , | ||
| 181 | D3D10_SB_OPCODE_INEG , | ||
| 182 | D3D10_SB_OPCODE_ISHL , | ||
| 183 | D3D10_SB_OPCODE_ISHR , | ||
| 184 | D3D10_SB_OPCODE_ITOF , | ||
| 185 | D3D10_SB_OPCODE_LABEL , | ||
| 186 | D3D10_SB_OPCODE_LD , | ||
| 187 | D3D10_SB_OPCODE_LD_MS , | ||
| 188 | D3D10_SB_OPCODE_LOG , | ||
| 189 | D3D10_SB_OPCODE_LOOP , | ||
| 190 | D3D10_SB_OPCODE_LT , | ||
| 191 | D3D10_SB_OPCODE_MAD , | ||
| 192 | D3D10_SB_OPCODE_MIN , | ||
| 193 | D3D10_SB_OPCODE_MAX , | ||
| 194 | D3D10_SB_OPCODE_CUSTOMDATA , | ||
| 195 | D3D10_SB_OPCODE_MOV , | ||
| 196 | D3D10_SB_OPCODE_MOVC , | ||
| 197 | D3D10_SB_OPCODE_MUL , | ||
| 198 | D3D10_SB_OPCODE_NE , | ||
| 199 | D3D10_SB_OPCODE_NOP , | ||
| 200 | D3D10_SB_OPCODE_NOT , | ||
| 201 | D3D10_SB_OPCODE_OR , | ||
| 202 | D3D10_SB_OPCODE_RESINFO , | ||
| 203 | D3D10_SB_OPCODE_RET , | ||
| 204 | D3D10_SB_OPCODE_RETC , | ||
| 205 | D3D10_SB_OPCODE_ROUND_NE , | ||
| 206 | D3D10_SB_OPCODE_ROUND_NI , | ||
| 207 | D3D10_SB_OPCODE_ROUND_PI , | ||
| 208 | D3D10_SB_OPCODE_ROUND_Z , | ||
| 209 | D3D10_SB_OPCODE_RSQ , | ||
| 210 | D3D10_SB_OPCODE_SAMPLE , | ||
| 211 | D3D10_SB_OPCODE_SAMPLE_C , | ||
| 212 | D3D10_SB_OPCODE_SAMPLE_C_LZ , | ||
| 213 | D3D10_SB_OPCODE_SAMPLE_L , | ||
| 214 | D3D10_SB_OPCODE_SAMPLE_D , | ||
| 215 | D3D10_SB_OPCODE_SAMPLE_B , | ||
| 216 | D3D10_SB_OPCODE_SQRT , | ||
| 217 | D3D10_SB_OPCODE_SWITCH , | ||
| 218 | D3D10_SB_OPCODE_SINCOS , | ||
| 219 | D3D10_SB_OPCODE_UDIV , | ||
| 220 | D3D10_SB_OPCODE_ULT , | ||
| 221 | D3D10_SB_OPCODE_UGE , | ||
| 222 | D3D10_SB_OPCODE_UMUL , | ||
| 223 | D3D10_SB_OPCODE_UMAD , | ||
| 224 | D3D10_SB_OPCODE_UMAX , | ||
| 225 | D3D10_SB_OPCODE_UMIN , | ||
| 226 | D3D10_SB_OPCODE_USHR , | ||
| 227 | D3D10_SB_OPCODE_UTOF , | ||
| 228 | D3D10_SB_OPCODE_XOR , | ||
| 229 | D3D10_SB_OPCODE_DCL_RESOURCE , // DCL* opcodes have | ||
| 230 | D3D10_SB_OPCODE_DCL_CONSTANT_BUFFER , // custom operand formats. | ||
| 231 | D3D10_SB_OPCODE_DCL_SAMPLER , | ||
| 232 | D3D10_SB_OPCODE_DCL_INDEX_RANGE , | ||
| 233 | D3D10_SB_OPCODE_DCL_GS_OUTPUT_PRIMITIVE_TOPOLOGY , | ||
| 234 | D3D10_SB_OPCODE_DCL_GS_INPUT_PRIMITIVE , | ||
| 235 | D3D10_SB_OPCODE_DCL_MAX_OUTPUT_VERTEX_COUNT , | ||
| 236 | D3D10_SB_OPCODE_DCL_INPUT , | ||
| 237 | D3D10_SB_OPCODE_DCL_INPUT_SGV , | ||
| 238 | D3D10_SB_OPCODE_DCL_INPUT_SIV , | ||
| 239 | D3D10_SB_OPCODE_DCL_INPUT_PS , | ||
| 240 | D3D10_SB_OPCODE_DCL_INPUT_PS_SGV , | ||
| 241 | D3D10_SB_OPCODE_DCL_INPUT_PS_SIV , | ||
| 242 | D3D10_SB_OPCODE_DCL_OUTPUT , | ||
| 243 | D3D10_SB_OPCODE_DCL_OUTPUT_SGV , | ||
| 244 | D3D10_SB_OPCODE_DCL_OUTPUT_SIV , | ||
| 245 | D3D10_SB_OPCODE_DCL_TEMPS , | ||
| 246 | D3D10_SB_OPCODE_DCL_INDEXABLE_TEMP , | ||
| 247 | D3D10_SB_OPCODE_DCL_GLOBAL_FLAGS , | ||
| 248 | |||
| 249 | // ----------------------------------------------- | ||
| 250 | |||
| 251 | // This marks the end of D3D10.0 opcodes | ||
| 252 | D3D10_SB_OPCODE_RESERVED0, | ||
| 253 | |||
| 254 | // ---------- DX 10.1 op codes--------------------- | ||
| 255 | |||
| 256 | D3D10_1_SB_OPCODE_LOD, | ||
| 257 | D3D10_1_SB_OPCODE_GATHER4, | ||
| 258 | D3D10_1_SB_OPCODE_SAMPLE_POS, | ||
| 259 | D3D10_1_SB_OPCODE_SAMPLE_INFO, | ||
| 260 | |||
| 261 | // ----------------------------------------------- | ||
| 262 | |||
| 263 | // This marks the end of D3D10.1 opcodes | ||
| 264 | D3D10_1_SB_OPCODE_RESERVED1, | ||
| 265 | |||
| 266 | // ---------- DX 11 op codes--------------------- | ||
| 267 | D3D11_SB_OPCODE_HS_DECLS , // token marks beginning of HS sub-shader | ||
| 268 | D3D11_SB_OPCODE_HS_CONTROL_POINT_PHASE , // token marks beginning of HS sub-shader | ||
| 269 | D3D11_SB_OPCODE_HS_FORK_PHASE , // token marks beginning of HS sub-shader | ||
| 270 | D3D11_SB_OPCODE_HS_JOIN_PHASE , // token marks beginning of HS sub-shader | ||
| 271 | |||
| 272 | D3D11_SB_OPCODE_EMIT_STREAM , | ||
| 273 | D3D11_SB_OPCODE_CUT_STREAM , | ||
| 274 | D3D11_SB_OPCODE_EMITTHENCUT_STREAM , | ||
| 275 | D3D11_SB_OPCODE_INTERFACE_CALL , | ||
| 276 | |||
| 277 | D3D11_SB_OPCODE_BUFINFO , | ||
| 278 | D3D11_SB_OPCODE_DERIV_RTX_COARSE , | ||
| 279 | D3D11_SB_OPCODE_DERIV_RTX_FINE , | ||
| 280 | D3D11_SB_OPCODE_DERIV_RTY_COARSE , | ||
| 281 | D3D11_SB_OPCODE_DERIV_RTY_FINE , | ||
| 282 | D3D11_SB_OPCODE_GATHER4_C , | ||
| 283 | D3D11_SB_OPCODE_GATHER4_PO , | ||
| 284 | D3D11_SB_OPCODE_GATHER4_PO_C , | ||
| 285 | D3D11_SB_OPCODE_RCP , | ||
| 286 | D3D11_SB_OPCODE_F32TOF16 , | ||
| 287 | D3D11_SB_OPCODE_F16TOF32 , | ||
| 288 | D3D11_SB_OPCODE_UADDC , | ||
| 289 | D3D11_SB_OPCODE_USUBB , | ||
| 290 | D3D11_SB_OPCODE_COUNTBITS , | ||
| 291 | D3D11_SB_OPCODE_FIRSTBIT_HI , | ||
| 292 | D3D11_SB_OPCODE_FIRSTBIT_LO , | ||
| 293 | D3D11_SB_OPCODE_FIRSTBIT_SHI , | ||
| 294 | D3D11_SB_OPCODE_UBFE , | ||
| 295 | D3D11_SB_OPCODE_IBFE , | ||
| 296 | D3D11_SB_OPCODE_BFI , | ||
| 297 | D3D11_SB_OPCODE_BFREV , | ||
| 298 | D3D11_SB_OPCODE_SWAPC , | ||
| 299 | |||
| 300 | D3D11_SB_OPCODE_DCL_STREAM , | ||
| 301 | D3D11_SB_OPCODE_DCL_FUNCTION_BODY , | ||
| 302 | D3D11_SB_OPCODE_DCL_FUNCTION_TABLE , | ||
| 303 | D3D11_SB_OPCODE_DCL_INTERFACE , | ||
| 304 | |||
| 305 | D3D11_SB_OPCODE_DCL_INPUT_CONTROL_POINT_COUNT , | ||
| 306 | D3D11_SB_OPCODE_DCL_OUTPUT_CONTROL_POINT_COUNT , | ||
| 307 | D3D11_SB_OPCODE_DCL_TESS_DOMAIN , | ||
| 308 | D3D11_SB_OPCODE_DCL_TESS_PARTITIONING , | ||
| 309 | D3D11_SB_OPCODE_DCL_TESS_OUTPUT_PRIMITIVE , | ||
| 310 | D3D11_SB_OPCODE_DCL_HS_MAX_TESSFACTOR , | ||
| 311 | D3D11_SB_OPCODE_DCL_HS_FORK_PHASE_INSTANCE_COUNT , | ||
| 312 | D3D11_SB_OPCODE_DCL_HS_JOIN_PHASE_INSTANCE_COUNT , | ||
| 313 | |||
| 314 | D3D11_SB_OPCODE_DCL_THREAD_GROUP , | ||
| 315 | D3D11_SB_OPCODE_DCL_UNORDERED_ACCESS_VIEW_TYPED , | ||
| 316 | D3D11_SB_OPCODE_DCL_UNORDERED_ACCESS_VIEW_RAW , | ||
| 317 | D3D11_SB_OPCODE_DCL_UNORDERED_ACCESS_VIEW_STRUCTURED, | ||
| 318 | D3D11_SB_OPCODE_DCL_THREAD_GROUP_SHARED_MEMORY_RAW, | ||
| 319 | D3D11_SB_OPCODE_DCL_THREAD_GROUP_SHARED_MEMORY_STRUCTURED, | ||
| 320 | D3D11_SB_OPCODE_DCL_RESOURCE_RAW , | ||
| 321 | D3D11_SB_OPCODE_DCL_RESOURCE_STRUCTURED , | ||
| 322 | D3D11_SB_OPCODE_LD_UAV_TYPED , | ||
| 323 | D3D11_SB_OPCODE_STORE_UAV_TYPED , | ||
| 324 | D3D11_SB_OPCODE_LD_RAW , | ||
| 325 | D3D11_SB_OPCODE_STORE_RAW , | ||
| 326 | D3D11_SB_OPCODE_LD_STRUCTURED , | ||
| 327 | D3D11_SB_OPCODE_STORE_STRUCTURED , | ||
| 328 | D3D11_SB_OPCODE_ATOMIC_AND , | ||
| 329 | D3D11_SB_OPCODE_ATOMIC_OR , | ||
| 330 | D3D11_SB_OPCODE_ATOMIC_XOR , | ||
| 331 | D3D11_SB_OPCODE_ATOMIC_CMP_STORE , | ||
| 332 | D3D11_SB_OPCODE_ATOMIC_IADD , | ||
| 333 | D3D11_SB_OPCODE_ATOMIC_IMAX , | ||
| 334 | D3D11_SB_OPCODE_ATOMIC_IMIN , | ||
| 335 | D3D11_SB_OPCODE_ATOMIC_UMAX , | ||
| 336 | D3D11_SB_OPCODE_ATOMIC_UMIN , | ||
| 337 | D3D11_SB_OPCODE_IMM_ATOMIC_ALLOC , | ||
| 338 | D3D11_SB_OPCODE_IMM_ATOMIC_CONSUME , | ||
| 339 | D3D11_SB_OPCODE_IMM_ATOMIC_IADD , | ||
| 340 | D3D11_SB_OPCODE_IMM_ATOMIC_AND , | ||
| 341 | D3D11_SB_OPCODE_IMM_ATOMIC_OR , | ||
| 342 | D3D11_SB_OPCODE_IMM_ATOMIC_XOR , | ||
| 343 | D3D11_SB_OPCODE_IMM_ATOMIC_EXCH , | ||
| 344 | D3D11_SB_OPCODE_IMM_ATOMIC_CMP_EXCH , | ||
| 345 | D3D11_SB_OPCODE_IMM_ATOMIC_IMAX , | ||
| 346 | D3D11_SB_OPCODE_IMM_ATOMIC_IMIN , | ||
| 347 | D3D11_SB_OPCODE_IMM_ATOMIC_UMAX , | ||
| 348 | D3D11_SB_OPCODE_IMM_ATOMIC_UMIN , | ||
| 349 | D3D11_SB_OPCODE_SYNC , | ||
| 350 | |||
| 351 | D3D11_SB_OPCODE_DADD , | ||
| 352 | D3D11_SB_OPCODE_DMAX , | ||
| 353 | D3D11_SB_OPCODE_DMIN , | ||
| 354 | D3D11_SB_OPCODE_DMUL , | ||
| 355 | D3D11_SB_OPCODE_DEQ , | ||
| 356 | D3D11_SB_OPCODE_DGE , | ||
| 357 | D3D11_SB_OPCODE_DLT , | ||
| 358 | D3D11_SB_OPCODE_DNE , | ||
| 359 | D3D11_SB_OPCODE_DMOV , | ||
| 360 | D3D11_SB_OPCODE_DMOVC , | ||
| 361 | D3D11_SB_OPCODE_DTOF , | ||
| 362 | D3D11_SB_OPCODE_FTOD , | ||
| 363 | |||
| 364 | D3D11_SB_OPCODE_EVAL_SNAPPED , | ||
| 365 | D3D11_SB_OPCODE_EVAL_SAMPLE_INDEX , | ||
| 366 | D3D11_SB_OPCODE_EVAL_CENTROID , | ||
| 367 | |||
| 368 | D3D11_SB_OPCODE_DCL_GS_INSTANCE_COUNT , | ||
| 369 | |||
| 370 | D3D11_SB_OPCODE_ABORT , | ||
| 371 | D3D11_SB_OPCODE_DEBUG_BREAK , | ||
| 372 | |||
| 373 | // ----------------------------------------------- | ||
| 374 | |||
| 375 | // This marks the end of D3D11.0 opcodes | ||
| 376 | D3D11_SB_OPCODE_RESERVED0, | ||
| 377 | |||
| 378 | D3D11_1_SB_OPCODE_DDIV, | ||
| 379 | D3D11_1_SB_OPCODE_DFMA, | ||
| 380 | D3D11_1_SB_OPCODE_DRCP, | ||
| 381 | |||
| 382 | D3D11_1_SB_OPCODE_MSAD, | ||
| 383 | |||
| 384 | D3D11_1_SB_OPCODE_DTOI, | ||
| 385 | D3D11_1_SB_OPCODE_DTOU, | ||
| 386 | D3D11_1_SB_OPCODE_ITOD, | ||
| 387 | D3D11_1_SB_OPCODE_UTOD, | ||
| 388 | |||
| 389 | // ----------------------------------------------- | ||
| 390 | |||
| 391 | // This marks the end of D3D11.1 opcodes | ||
| 392 | D3D11_1_SB_OPCODE_RESERVED0, | ||
| 393 | |||
| 394 | D3DWDDM1_3_SB_OPCODE_GATHER4_FEEDBACK, | ||
| 395 | D3DWDDM1_3_SB_OPCODE_GATHER4_C_FEEDBACK, | ||
| 396 | D3DWDDM1_3_SB_OPCODE_GATHER4_PO_FEEDBACK, | ||
| 397 | D3DWDDM1_3_SB_OPCODE_GATHER4_PO_C_FEEDBACK, | ||
| 398 | D3DWDDM1_3_SB_OPCODE_LD_FEEDBACK, | ||
| 399 | D3DWDDM1_3_SB_OPCODE_LD_MS_FEEDBACK, | ||
| 400 | D3DWDDM1_3_SB_OPCODE_LD_UAV_TYPED_FEEDBACK, | ||
| 401 | D3DWDDM1_3_SB_OPCODE_LD_RAW_FEEDBACK, | ||
| 402 | D3DWDDM1_3_SB_OPCODE_LD_STRUCTURED_FEEDBACK, | ||
| 403 | D3DWDDM1_3_SB_OPCODE_SAMPLE_L_FEEDBACK, | ||
| 404 | D3DWDDM1_3_SB_OPCODE_SAMPLE_C_LZ_FEEDBACK, | ||
| 405 | |||
| 406 | D3DWDDM1_3_SB_OPCODE_SAMPLE_CLAMP_FEEDBACK, | ||
| 407 | D3DWDDM1_3_SB_OPCODE_SAMPLE_B_CLAMP_FEEDBACK, | ||
| 408 | D3DWDDM1_3_SB_OPCODE_SAMPLE_D_CLAMP_FEEDBACK, | ||
| 409 | D3DWDDM1_3_SB_OPCODE_SAMPLE_C_CLAMP_FEEDBACK, | ||
| 410 | |||
| 411 | D3DWDDM1_3_SB_OPCODE_CHECK_ACCESS_FULLY_MAPPED, | ||
| 412 | |||
| 413 | // ----------------------------------------------- | ||
| 414 | |||
| 415 | // This marks the end of WDDM 1.3 opcodes | ||
| 416 | D3DWDDM1_3_SB_OPCODE_RESERVED0, | ||
| 417 | |||
| 418 | D3D10_SB_NUM_OPCODES // Should be the last entry | ||
| 419 | } D3D10_SB_OPCODE_TYPE; | ||
| 420 | |||
| 421 | #define D3D10_SB_OPCODE_TYPE_MASK 0x00007ff | ||
| 422 | // DECODER MACRO: Retrieve program opcode | ||
| 423 | #define DECODE_D3D10_SB_OPCODE_TYPE(OpcodeToken0) ((D3D10_SB_OPCODE_TYPE)((OpcodeToken0)&D3D10_SB_OPCODE_TYPE_MASK)) | ||
| 424 | // ENCODER MACRO: Create the opcode-type portion of OpcodeToken0 | ||
| 425 | #define ENCODE_D3D10_SB_OPCODE_TYPE(OpcodeName) ((OpcodeName)&D3D10_SB_OPCODE_TYPE_MASK) | ||
| 426 | |||
| 427 | #define D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH_MASK 0x7f000000 | ||
| 428 | #define D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH_SHIFT 24 | ||
| 429 | // DECODER MACRO: Retrieve instruction length | ||
| 430 | // in # of DWORDs including the opcode token(s). | ||
| 431 | // The range is 1-127. | ||
| 432 | #define DECODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(OpcodeToken0) (((OpcodeToken0)&D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH_MASK)>> D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH_SHIFT) | ||
| 433 | |||
| 434 | // ENCODER MACRO: Store instruction length | ||
| 435 | // portion of OpcodeToken0, in # of DWORDs | ||
| 436 | // including the opcode token(s). | ||
| 437 | // Valid range is 1-127. | ||
| 438 | #define ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(Length) (((Length)<<D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH_SHIFT)&D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH_MASK) | ||
| 439 | #define MAX_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH 127 | ||
| 440 | |||
| 441 | #define D3D10_SB_INSTRUCTION_SATURATE_MASK 0x00002000 | ||
| 442 | // DECODER MACRO: Check OpcodeToken0 to see if an instruction | ||
| 443 | // is to saturate the result [0..1] | ||
| 444 | // This flag is indicated by one of the bits in the | ||
| 445 | // opcode specific control range. | ||
| 446 | #define DECODE_IS_D3D10_SB_INSTRUCTION_SATURATE_ENABLED(OpcodeToken0) ((OpcodeToken0)&D3D10_SB_INSTRUCTION_SATURATE_MASK) | ||
| 447 | // ENCODER MACRO: Encode in OpcodeToken0 if instruction is to saturate the result. | ||
| 448 | #define ENCODE_D3D10_SB_INSTRUCTION_SATURATE(bSat) (((bSat)!=0)?D3D10_SB_INSTRUCTION_SATURATE_MASK:0) | ||
| 449 | |||
| 450 | // Boolean test for conditional instructions such as if (if_z or if_nz) | ||
| 451 | // This is part of the opcode specific control range. | ||
| 452 | typedef enum D3D10_SB_INSTRUCTION_TEST_BOOLEAN | ||
| 453 | { | ||
| 454 | D3D10_SB_INSTRUCTION_TEST_ZERO = 0, | ||
| 455 | D3D10_SB_INSTRUCTION_TEST_NONZERO = 1 | ||
| 456 | } D3D10_SB_INSTRUCTION_TEST_BOOLEAN; | ||
| 457 | #define D3D10_SB_INSTRUCTION_TEST_BOOLEAN_MASK 0x00040000 | ||
| 458 | #define D3D10_SB_INSTRUCTION_TEST_BOOLEAN_SHIFT 18 | ||
| 459 | |||
| 460 | // DECODER MACRO: For an OpcodeToken0 for requires either a | ||
| 461 | // zero or non-zero test, determine which test was chosen. | ||
| 462 | #define DECODE_D3D10_SB_INSTRUCTION_TEST_BOOLEAN(OpcodeToken0) ((D3D10_SB_INSTRUCTION_TEST_BOOLEAN)(((OpcodeToken0)&D3D10_SB_INSTRUCTION_TEST_BOOLEAN_MASK)>>D3D10_SB_INSTRUCTION_TEST_BOOLEAN_SHIFT)) | ||
| 463 | // ENCODER MACRO: Store "zero" or "nonzero" in the opcode | ||
| 464 | // specific control range of OpcodeToken0 | ||
| 465 | #define ENCODE_D3D10_SB_INSTRUCTION_TEST_BOOLEAN(Boolean) (((Boolean)<<D3D10_SB_INSTRUCTION_TEST_BOOLEAN_SHIFT)&D3D10_SB_INSTRUCTION_TEST_BOOLEAN_MASK) | ||
| 466 | |||
| 467 | // Precise value mask (bits 19-22) | ||
| 468 | // This is part of the opcode specific control range. | ||
| 469 | // It's 1 bit per-channel of the output, for instructions with multiple | ||
| 470 | // output operands, it applies to that component in each operand. This | ||
| 471 | // uses the components defined in D3D10_SB_COMPONENT_NAME. | ||
| 472 | #define D3D11_SB_INSTRUCTION_PRECISE_VALUES_MASK 0x00780000 | ||
| 473 | #define D3D11_SB_INSTRUCTION_PRECISE_VALUES_SHIFT 19 | ||
| 474 | |||
| 475 | // DECODER MACRO: this macro extracts from OpcodeToken0 the 4 component | ||
| 476 | // (xyzw) mask, as a field of D3D10_SB_4_COMPONENT_[X|Y|Z|W] flags. | ||
| 477 | #define DECODE_D3D11_SB_INSTRUCTION_PRECISE_VALUES(OpcodeToken0) ((((OpcodeToken0)&D3D11_SB_INSTRUCTION_PRECISE_VALUES_MASK)>>D3D11_SB_INSTRUCTION_PRECISE_VALUES_SHIFT)) | ||
| 478 | // ENCODER MACRO: Given a set of | ||
| 479 | // D3D10_SB_OPERAND_4_COMPONENT_[X|Y|Z|W] values | ||
| 480 | // or'd together, encode them in OpcodeToken0. | ||
| 481 | #define ENCODE_D3D11_SB_INSTRUCTION_PRECISE_VALUES(ComponentMask) (((ComponentMask)<<D3D11_SB_INSTRUCTION_PRECISE_VALUES_SHIFT)&D3D11_SB_INSTRUCTION_PRECISE_VALUES_MASK) | ||
| 482 | |||
| 483 | // resinfo instruction return type | ||
| 484 | typedef enum D3D10_SB_RESINFO_INSTRUCTION_RETURN_TYPE | ||
| 485 | { | ||
| 486 | D3D10_SB_RESINFO_INSTRUCTION_RETURN_FLOAT = 0, | ||
| 487 | D3D10_SB_RESINFO_INSTRUCTION_RETURN_RCPFLOAT = 1, | ||
| 488 | D3D10_SB_RESINFO_INSTRUCTION_RETURN_UINT = 2 | ||
| 489 | } D3D10_SB_RESINFO_INSTRUCTION_RETURN_TYPE; | ||
| 490 | |||
| 491 | #define D3D10_SB_RESINFO_INSTRUCTION_RETURN_TYPE_MASK 0x00001800 | ||
| 492 | #define D3D10_SB_RESINFO_INSTRUCTION_RETURN_TYPE_SHIFT 11 | ||
| 493 | |||
| 494 | // DECODER MACRO: For an OpcodeToken0 for the resinfo instruction, | ||
| 495 | // determine the return type. | ||
| 496 | #define DECODE_D3D10_SB_RESINFO_INSTRUCTION_RETURN_TYPE(OpcodeToken0) ((D3D10_SB_RESINFO_INSTRUCTION_RETURN_TYPE)(((OpcodeToken0)&D3D10_SB_RESINFO_INSTRUCTION_RETURN_TYPE_MASK)>>D3D10_SB_RESINFO_INSTRUCTION_RETURN_TYPE_SHIFT)) | ||
| 497 | // ENCODER MACRO: Encode the return type for the resinfo instruction | ||
| 498 | // in the opcode specific control range of OpcodeToken0 | ||
| 499 | #define ENCODE_D3D10_SB_RESINFO_INSTRUCTION_RETURN_TYPE(ReturnType) (((ReturnType)<<D3D10_SB_RESINFO_INSTRUCTION_RETURN_TYPE_SHIFT)&D3D10_SB_RESINFO_INSTRUCTION_RETURN_TYPE_MASK) | ||
| 500 | |||
| 501 | // sync instruction flags | ||
| 502 | #define D3D11_SB_SYNC_THREADS_IN_GROUP 0x00000800 | ||
| 503 | #define D3D11_SB_SYNC_THREAD_GROUP_SHARED_MEMORY 0x00001000 | ||
| 504 | #define D3D11_SB_SYNC_UNORDERED_ACCESS_VIEW_MEMORY_GROUP 0x00002000 | ||
| 505 | #define D3D11_SB_SYNC_UNORDERED_ACCESS_VIEW_MEMORY_GLOBAL 0x00004000 | ||
| 506 | #define D3D11_SB_SYNC_FLAGS_MASK 0x00007800 | ||
| 507 | |||
| 508 | // DECODER MACRO: Retrieve flags for sync instruction from OpcodeToken0. | ||
| 509 | #define DECODE_D3D11_SB_SYNC_FLAGS(OperandToken0) ((OperandToken0)&D3D11_SB_SYNC_FLAGS_MASK) | ||
| 510 | |||
| 511 | // ENCODER MACRO: Given a set of sync instruciton flags, encode them in OpcodeToken0. | ||
| 512 | #define ENCODE_D3D11_SB_SYNC_FLAGS(Flags) ((Flags)&D3D11_SB_SYNC_FLAGS_MASK) | ||
| 513 | |||
| 514 | #define D3D10_SB_OPCODE_EXTENDED_MASK 0x80000000 | ||
| 515 | #define D3D10_SB_OPCODE_EXTENDED_SHIFT 31 | ||
| 516 | // DECODER MACRO: Determine if the opcode is extended | ||
| 517 | // by an additional opcode token. Currently there are no | ||
| 518 | // extended opcodes. | ||
| 519 | #define DECODE_IS_D3D10_SB_OPCODE_EXTENDED(OpcodeToken0) (((OpcodeToken0)&D3D10_SB_OPCODE_EXTENDED_MASK)>> D3D10_SB_OPCODE_EXTENDED_SHIFT) | ||
| 520 | // ENCODER MACRO: Store in OpcodeToken0 whether the opcode is extended | ||
| 521 | // by an additional opcode token. | ||
| 522 | #define ENCODE_D3D10_SB_OPCODE_EXTENDED(bExtended) (((bExtended)!=0)?D3D10_SB_OPCODE_EXTENDED_MASK:0) | ||
| 523 | |||
| 524 | // ---------------------------------------------------------------------------- | ||
| 525 | // Extended Opcode Format (OpcodeToken1) | ||
| 526 | // | ||
| 527 | // If bit31 of an opcode token is set, the | ||
| 528 | // opcode has an additional extended opcode token DWORD | ||
| 529 | // directly following OpcodeToken0. Other tokens | ||
| 530 | // expected for the opcode, such as the operand | ||
| 531 | // token(s) always follow | ||
| 532 | // OpcodeToken0 AND OpcodeToken1..n (extended | ||
| 533 | // opcode tokens, if present). | ||
| 534 | // | ||
| 535 | // [05:00] D3D10_SB_EXTENDED_OPCODE_TYPE | ||
| 536 | // [30:06] if([05:00] == D3D10_SB_EXTENDED_OPCODE_SAMPLE_CONTROLS) | ||
| 537 | // { | ||
| 538 | // This custom opcode contains controls for SAMPLE. | ||
| 539 | // [08:06] Ignored, 0. | ||
| 540 | // [12:09] U texel immediate offset (4 bit 2's comp) (0 default) | ||
| 541 | // [16:13] V texel immediate offset (4 bit 2's comp) (0 default) | ||
| 542 | // [20:17] W texel immediate offset (4 bit 2's comp) (0 default) | ||
| 543 | // [30:14] Ignored, 0. | ||
| 544 | // } | ||
| 545 | // else if( [05:00] == D3D11_SB_EXTENDED_OPCODE_RESOURCE_DIM ) | ||
| 546 | // { | ||
| 547 | // [10:06] D3D10_SB_RESOURCE_DIMENSION | ||
| 548 | // [22:11] When dimension is D3D11_SB_RESOURCE_DIMENSION_STRUCTURED_BUFFER this holds the buffer stride, otherwise 0 | ||
| 549 | // [30:23] Ignored, 0. | ||
| 550 | // } | ||
| 551 | // else if( [05:00] == D3D11_SB_EXTENDED_OPCODE_RESOURCE_RETURN_TYPE ) | ||
| 552 | // { | ||
| 553 | // [09:06] D3D10_SB_RESOURCE_RETURN_TYPE for component X | ||
| 554 | // [13:10] D3D10_SB_RESOURCE_RETURN_TYPE for component Y | ||
| 555 | // [17:14] D3D10_SB_RESOURCE_RETURN_TYPE for component Z | ||
| 556 | // [21:18] D3D10_SB_RESOURCE_RETURN_TYPE for component W | ||
| 557 | // [30:22] Ignored, 0. | ||
| 558 | // } | ||
| 559 | // else | ||
| 560 | // { | ||
| 561 | // [30:04] Ignored, 0. | ||
| 562 | // } | ||
| 563 | // [31] 0 normally. 1 there is another extended opcode. Any number | ||
| 564 | // of extended opcode tokens can be chained. It is possible that some extended | ||
| 565 | // opcode tokens could include multiple DWORDS - that is defined | ||
| 566 | // on a case by case basis. | ||
| 567 | // | ||
| 568 | // ---------------------------------------------------------------------------- | ||
| 569 | typedef enum D3D10_SB_EXTENDED_OPCODE_TYPE | ||
| 570 | { | ||
| 571 | D3D10_SB_EXTENDED_OPCODE_EMPTY = 0, | ||
| 572 | D3D10_SB_EXTENDED_OPCODE_SAMPLE_CONTROLS = 1, | ||
| 573 | D3D11_SB_EXTENDED_OPCODE_RESOURCE_DIM = 2, | ||
| 574 | D3D11_SB_EXTENDED_OPCODE_RESOURCE_RETURN_TYPE = 3, | ||
| 575 | } D3D10_SB_EXTENDED_OPCODE_TYPE; | ||
| 576 | #define D3D11_SB_MAX_SIMULTANEOUS_EXTENDED_OPCODES 3 | ||
| 577 | |||
| 578 | #define D3D10_SB_EXTENDED_OPCODE_TYPE_MASK 0x0000003f | ||
| 579 | |||
| 580 | // DECODER MACRO: Given an extended opcode | ||
| 581 | // token (OpcodeToken1), figure out what type | ||
| 582 | // of token it is (from D3D10_SB_EXTENDED_OPCODE_TYPE enum) | ||
| 583 | // to be able to interpret the rest of the token's contents. | ||
| 584 | #define DECODE_D3D10_SB_EXTENDED_OPCODE_TYPE(OpcodeToken1) ((D3D10_SB_EXTENDED_OPCODE_TYPE)((OpcodeToken1)&D3D10_SB_EXTENDED_OPCODE_TYPE_MASK)) | ||
| 585 | |||
| 586 | // ENCODER MACRO: Store extended opcode token | ||
| 587 | // type in OpcodeToken1. | ||
| 588 | #define ENCODE_D3D10_SB_EXTENDED_OPCODE_TYPE(ExtOpcodeType) ((ExtOpcodeType)&D3D10_SB_EXTENDED_OPCODE_TYPE_MASK) | ||
| 589 | |||
| 590 | typedef enum D3D10_SB_IMMEDIATE_ADDRESS_OFFSET_COORD | ||
| 591 | { | ||
| 592 | D3D10_SB_IMMEDIATE_ADDRESS_OFFSET_U = 0, | ||
| 593 | D3D10_SB_IMMEDIATE_ADDRESS_OFFSET_V = 1, | ||
| 594 | D3D10_SB_IMMEDIATE_ADDRESS_OFFSET_W = 2, | ||
| 595 | } D3D10_SB_IMMEDIATE_ADDRESS_OFFSET_COORD; | ||
| 596 | #define D3D10_SB_IMMEDIATE_ADDRESS_OFFSET_COORD_MASK (3) | ||
| 597 | #define D3D10_SB_IMMEDIATE_ADDRESS_OFFSET_SHIFT(Coord) (9+4*((Coord)&D3D10_SB_IMMEDIATE_ADDRESS_OFFSET_COORD_MASK)) | ||
| 598 | #define D3D10_SB_IMMEDIATE_ADDRESS_OFFSET_MASK(Coord) (0x0000000f<<D3D10_SB_IMMEDIATE_ADDRESS_OFFSET_SHIFT(Coord)) | ||
| 599 | |||
| 600 | // DECODER MACRO: Given an extended opcode token | ||
| 601 | // (OpcodeToken1), and extended token type == | ||
| 602 | // D3D10_SB_EXTENDED_OPCODE_SAMPLE_CONTROLS, determine the immediate | ||
| 603 | // texel address offset for u/v/w (D3D10_SB_ADDRESS_OFFSET_COORD) | ||
| 604 | // This macro returns a (signed) integer, by sign extending the | ||
| 605 | // decoded 4 bit 2's complement immediate value. | ||
| 606 | #define DECODE_IMMEDIATE_D3D10_SB_ADDRESS_OFFSET(Coord,OpcodeToken1) ((((OpcodeToken1)&D3D10_SB_IMMEDIATE_ADDRESS_OFFSET_MASK(Coord))>>(D3D10_SB_IMMEDIATE_ADDRESS_OFFSET_SHIFT(Coord)))) | ||
| 607 | |||
| 608 | // ENCODER MACRO: Store the immediate texel address offset | ||
| 609 | // for U or V or W Coord (D3D10_SB_ADDRESS_OFFSET_COORD) in an extended | ||
| 610 | // opcode token (OpcodeToken1) that has extended opcode | ||
| 611 | // type == D3D10_SB_EXTENDED_OPCODE_SAMPLE_CONTROLS (opcode type encoded separately) | ||
| 612 | // A 2's complement number is expected as input, from which the LSB 4 bits are extracted. | ||
| 613 | #define ENCODE_IMMEDIATE_D3D10_SB_ADDRESS_OFFSET(Coord,ImmediateOffset) (((ImmediateOffset)<<D3D10_SB_IMMEDIATE_ADDRESS_OFFSET_SHIFT(Coord))&D3D10_SB_IMMEDIATE_ADDRESS_OFFSET_MASK(Coord)) | ||
| 614 | |||
| 615 | #define D3D11_SB_EXTENDED_RESOURCE_DIMENSION_MASK 0x000007C0 | ||
| 616 | #define D3D11_SB_EXTENDED_RESOURCE_DIMENSION_SHIFT 6 | ||
| 617 | |||
| 618 | // DECODER MACRO: Given an extended resource declaration token, | ||
| 619 | // (D3D11_SB_EXTENDED_OPCODE_RESOURCE_DIM), determine the resource dimension | ||
| 620 | // (D3D10_SB_RESOURCE_DIMENSION enum) | ||
| 621 | #define DECODE_D3D11_SB_EXTENDED_RESOURCE_DIMENSION(OpcodeTokenN) ((D3D10_SB_RESOURCE_DIMENSION)(((OpcodeTokenN)&D3D11_SB_EXTENDED_RESOURCE_DIMENSION_MASK)>>D3D11_SB_EXTENDED_RESOURCE_DIMENSION_SHIFT)) | ||
| 622 | |||
| 623 | // ENCODER MACRO: Store resource dimension | ||
| 624 | // (D3D10_SB_RESOURCE_DIMENSION enum) into a | ||
| 625 | // an extended resource declaration token (D3D11_SB_EXTENDED_OPCODE_RESOURCE_DIM) | ||
| 626 | #define ENCODE_D3D11_SB_EXTENDED_RESOURCE_DIMENSION(ResourceDim) (((ResourceDim)<<D3D11_SB_EXTENDED_RESOURCE_DIMENSION_SHIFT)&D3D11_SB_EXTENDED_RESOURCE_DIMENSION_MASK) | ||
| 627 | |||
| 628 | #define D3D11_SB_EXTENDED_RESOURCE_DIMENSION_STRUCTURE_STRIDE_MASK 0x007FF800 | ||
| 629 | #define D3D11_SB_EXTENDED_RESOURCE_DIMENSION_STRUCTURE_STRIDE_SHIFT 11 | ||
| 630 | |||
| 631 | // DECODER MACRO: Given an extended resource declaration token for a structured buffer, | ||
| 632 | // (D3D11_SB_EXTENDED_OPCODE_RESOURCE_DIM), determine the structure stride | ||
| 633 | // (12-bit unsigned integer) | ||
| 634 | #define DECODE_D3D11_SB_EXTENDED_RESOURCE_DIMENSION_STRUCTURE_STRIDE(OpcodeTokenN) (((OpcodeTokenN)&D3D11_SB_EXTENDED_RESOURCE_DIMENSION_STRUCTURE_STRIDE_MASK)>>D3D11_SB_EXTENDED_RESOURCE_DIMENSION_STRUCTURE_STRIDE_SHIFT) | ||
| 635 | |||
| 636 | // ENCODER MACRO: Store resource dimension structure stride | ||
| 637 | // (12-bit unsigned integer) into a | ||
| 638 | // an extended resource declaration token (D3D11_SB_EXTENDED_OPCODE_RESOURCE_DIM) | ||
| 639 | #define ENCODE_D3D11_SB_EXTENDED_RESOURCE_DIMENSION_STRUCTURE_STRIDE(Stride) (((Stride)<<D3D11_SB_EXTENDED_RESOURCE_DIMENSION_STRUCTURE_STRIDE_SHIFT)&D3D11_SB_EXTENDED_RESOURCE_DIMENSION_STRUCTURE_STRIDE_MASK) | ||
| 640 | |||
| 641 | #define D3D10_SB_RESOURCE_RETURN_TYPE_MASK 0x0000000f | ||
| 642 | #define D3D10_SB_RESOURCE_RETURN_TYPE_NUMBITS 0x00000004 | ||
| 643 | #define D3D11_SB_EXTENDED_RESOURCE_RETURN_TYPE_SHIFT 6 | ||
| 644 | |||
| 645 | // DECODER MACRO: Get the resource return type for component (0-3) from | ||
| 646 | // an extended resource declaration token (D3D11_SB_EXTENDED_OPCODE_RESOURCE_RETURN_TYPE) | ||
| 647 | #define DECODE_D3D11_SB_EXTENDED_RESOURCE_RETURN_TYPE(OpcodeTokenN, Component) \ | ||
| 648 | ((D3D10_SB_RESOURCE_RETURN_TYPE)(((OpcodeTokenN) >> \ | ||
| 649 | (Component * D3D10_SB_RESOURCE_RETURN_TYPE_NUMBITS + D3D11_SB_EXTENDED_RESOURCE_RETURN_TYPE_SHIFT))&D3D10_SB_RESOURCE_RETURN_TYPE_MASK)) | ||
| 650 | |||
| 651 | // ENCODER MACRO: Generate a resource return type for a component in an extended | ||
| 652 | // resource delcaration token (D3D11_SB_EXTENDED_OPCODE_RESOURCE_RETURN_TYPE) | ||
| 653 | #define ENCODE_D3D11_SB_EXTENDED_RESOURCE_RETURN_TYPE(ReturnType, Component) \ | ||
| 654 | (((ReturnType)&D3D10_SB_RESOURCE_RETURN_TYPE_MASK) << (Component * D3D10_SB_RESOURCE_RETURN_TYPE_NUMBITS + D3D11_SB_EXTENDED_RESOURCE_RETURN_TYPE_SHIFT)) | ||
| 655 | |||
| 656 | // ---------------------------------------------------------------------------- | ||
| 657 | // Custom-Data Block Format | ||
| 658 | // | ||
| 659 | // DWORD 0 (CustomDataDescTok): | ||
| 660 | // [10:00] == D3D10_SB_OPCODE_CUSTOMDATA | ||
| 661 | // [31:11] == D3D10_SB_CUSTOMDATA_CLASS | ||
| 662 | // | ||
| 663 | // DWORD 1: | ||
| 664 | // 32-bit unsigned integer count of number | ||
| 665 | // of DWORDs in custom-data block, | ||
| 666 | // including DWORD 0 and DWORD 1. | ||
| 667 | // So the minimum value is 0x00000002, | ||
| 668 | // meaning empty custom-data. | ||
| 669 | // | ||
| 670 | // Layout of custom-data contents, for the various meta-data classes, | ||
| 671 | // not defined in this file. | ||
| 672 | // | ||
| 673 | // ---------------------------------------------------------------------------- | ||
| 674 | |||
| 675 | typedef enum D3D10_SB_CUSTOMDATA_CLASS | ||
| 676 | { | ||
| 677 | D3D10_SB_CUSTOMDATA_COMMENT = 0, | ||
| 678 | D3D10_SB_CUSTOMDATA_DEBUGINFO, | ||
| 679 | D3D10_SB_CUSTOMDATA_OPAQUE, | ||
| 680 | D3D10_SB_CUSTOMDATA_DCL_IMMEDIATE_CONSTANT_BUFFER, | ||
| 681 | D3D11_SB_CUSTOMDATA_SHADER_MESSAGE, | ||
| 682 | D3D11_SB_CUSTOMDATA_SHADER_CLIP_PLANE_CONSTANT_MAPPINGS_FOR_DX9, | ||
| 683 | } D3D10_SB_CUSTOMDATA_CLASS; | ||
| 684 | |||
| 685 | #define D3D10_SB_CUSTOMDATA_CLASS_MASK 0xfffff800 | ||
| 686 | #define D3D10_SB_CUSTOMDATA_CLASS_SHIFT 11 | ||
| 687 | // DECODER MACRO: Find out what class of custom-data is present. | ||
| 688 | // The contents of the custom-data block are defined | ||
| 689 | // for each class of custom-data. | ||
| 690 | #define DECODE_D3D10_SB_CUSTOMDATA_CLASS(CustomDataDescTok) ((D3D10_SB_CUSTOMDATA_CLASS)(((CustomDataDescTok)&D3D10_SB_CUSTOMDATA_CLASS_MASK)>>D3D10_SB_CUSTOMDATA_CLASS_SHIFT)) | ||
| 691 | // ENCODER MACRO: Create complete CustomDataDescTok | ||
| 692 | #define ENCODE_D3D10_SB_CUSTOMDATA_CLASS(CustomDataClass) (ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_CUSTOMDATA)|(((CustomDataClass)<<D3D10_SB_CUSTOMDATA_CLASS_SHIFT)&D3D10_SB_CUSTOMDATA_CLASS_MASK)) | ||
| 693 | |||
| 694 | // ---------------------------------------------------------------------------- | ||
| 695 | // Instruction Operand Format (OperandToken0) | ||
| 696 | // | ||
| 697 | // [01:00] D3D10_SB_OPERAND_NUM_COMPONENTS | ||
| 698 | // [11:02] Component Selection | ||
| 699 | // if([01:00] == D3D10_SB_OPERAND_0_COMPONENT) | ||
| 700 | // [11:02] = Ignored, 0 | ||
| 701 | // else if([01:00] == D3D10_SB_OPERAND_1_COMPONENT | ||
| 702 | // [11:02] = Ignored, 0 | ||
| 703 | // else if([01:00] == D3D10_SB_OPERAND_4_COMPONENT | ||
| 704 | // { | ||
| 705 | // [03:02] = D3D10_SB_OPERAND_4_COMPONENT_SELECTION_MODE | ||
| 706 | // if([03:02] == D3D10_SB_OPERAND_4_COMPONENT_MASK_MODE) | ||
| 707 | // { | ||
| 708 | // [07:04] = D3D10_SB_OPERAND_4_COMPONENT_MASK | ||
| 709 | // [11:08] = Ignored, 0 | ||
| 710 | // } | ||
| 711 | // else if([03:02] == D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE_MODE) | ||
| 712 | // { | ||
| 713 | // [11:04] = D3D10_SB_4_COMPONENT_SWIZZLE | ||
| 714 | // } | ||
| 715 | // else if([03:02] == D3D10_SB_OPERAND_4_COMPONENT_SELECT_1_MODE) | ||
| 716 | // { | ||
| 717 | // [05:04] = D3D10_SB_4_COMPONENT_NAME | ||
| 718 | // [11:06] = Ignored, 0 | ||
| 719 | // } | ||
| 720 | // } | ||
| 721 | // else if([01:00] == D3D10_SB_OPERAND_N_COMPONENT) | ||
| 722 | // { | ||
| 723 | // Currently not defined. | ||
| 724 | // } | ||
| 725 | // [19:12] D3D10_SB_OPERAND_TYPE | ||
| 726 | // [21:20] D3D10_SB_OPERAND_INDEX_DIMENSION: | ||
| 727 | // Number of dimensions in the register | ||
| 728 | // file (NOT the # of dimensions in the | ||
| 729 | // individual register or memory | ||
| 730 | // resource being referenced). | ||
| 731 | // [24:22] if( [21:20] >= D3D10_SB_OPERAND_INDEX_1D ) | ||
| 732 | // D3D10_SB_OPERAND_INDEX_REPRESENTATION for first operand index | ||
| 733 | // else | ||
| 734 | // Ignored, 0 | ||
| 735 | // [27:25] if( [21:20] >= D3D10_SB_OPERAND_INDEX_2D ) | ||
| 736 | // D3D10_SB_OPERAND_INDEX_REPRESENTATION for second operand index | ||
| 737 | // else | ||
| 738 | // Ignored, 0 | ||
| 739 | // [30:28] if( [21:20] == D3D10_SB_OPERAND_INDEX_3D ) | ||
| 740 | // D3D10_SB_OPERAND_INDEX_REPRESENTATION for third operand index | ||
| 741 | // else | ||
| 742 | // Ignored, 0 | ||
| 743 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 744 | // contains extended operand description. | ||
| 745 | // | ||
| 746 | // ---------------------------------------------------------------------------- | ||
| 747 | |||
| 748 | // Number of components in data vector referred to by operand. | ||
| 749 | typedef enum D3D10_SB_OPERAND_NUM_COMPONENTS | ||
| 750 | { | ||
| 751 | D3D10_SB_OPERAND_0_COMPONENT = 0, | ||
| 752 | D3D10_SB_OPERAND_1_COMPONENT = 1, | ||
| 753 | D3D10_SB_OPERAND_4_COMPONENT = 2, | ||
| 754 | D3D10_SB_OPERAND_N_COMPONENT = 3 // unused for now | ||
| 755 | } D3D10_SB_OPERAND_NUM_COMPONENTS; | ||
| 756 | #define D3D10_SB_OPERAND_NUM_COMPONENTS_MASK 0x00000003 | ||
| 757 | |||
| 758 | // DECODER MACRO: Extract from OperandToken0 how many components | ||
| 759 | // the data vector referred to by the operand contains. | ||
| 760 | // (D3D10_SB_OPERAND_NUM_COMPONENTS enum) | ||
| 761 | #define DECODE_D3D10_SB_OPERAND_NUM_COMPONENTS(OperandToken0) ((D3D10_SB_OPERAND_NUM_COMPONENTS)((OperandToken0)&D3D10_SB_OPERAND_NUM_COMPONENTS_MASK)) | ||
| 762 | |||
| 763 | // ENCODER MACRO: Define in OperandToken0 how many components | ||
| 764 | // the data vector referred to by the operand contains. | ||
| 765 | // (D3D10_SB_OPERAND_NUM_COMPONENTS enum). | ||
| 766 | #define ENCODE_D3D10_SB_OPERAND_NUM_COMPONENTS(NumComp) ((NumComp)&D3D10_SB_OPERAND_NUM_COMPONENTS_MASK) | ||
| 767 | |||
| 768 | typedef enum D3D10_SB_OPERAND_4_COMPONENT_SELECTION_MODE | ||
| 769 | { | ||
| 770 | D3D10_SB_OPERAND_4_COMPONENT_MASK_MODE = 0, // mask 4 components | ||
| 771 | D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE_MODE = 1, // swizzle 4 components | ||
| 772 | D3D10_SB_OPERAND_4_COMPONENT_SELECT_1_MODE = 2, // select 1 of 4 components | ||
| 773 | } D3D10_SB_OPERAND_4_COMPONENT_SELECTION_MODE; | ||
| 774 | |||
| 775 | #define D3D10_SB_OPERAND_4_COMPONENT_SELECTION_MODE_MASK 0x0000000c | ||
| 776 | #define D3D10_SB_OPERAND_4_COMPONENT_SELECTION_MODE_SHIFT 2 | ||
| 777 | |||
| 778 | // DECODER MACRO: For an operand representing 4component data, | ||
| 779 | // extract from OperandToken0 the method for selecting data from | ||
| 780 | // the 4 components (D3D10_SB_OPERAND_4_COMPONENT_SELECTION_MODE). | ||
| 781 | #define DECODE_D3D10_SB_OPERAND_4_COMPONENT_SELECTION_MODE(OperandToken0) ((D3D10_SB_OPERAND_4_COMPONENT_SELECTION_MODE)(((OperandToken0)&D3D10_SB_OPERAND_4_COMPONENT_SELECTION_MODE_MASK)>>D3D10_SB_OPERAND_4_COMPONENT_SELECTION_MODE_SHIFT)) | ||
| 782 | |||
| 783 | // ENCODER MACRO: For an operand representing 4component data, | ||
| 784 | // encode in OperandToken0 a value from D3D10_SB_OPERAND_4_COMPONENT_SELECTION_MODE | ||
| 785 | #define ENCODE_D3D10_SB_OPERAND_4_COMPONENT_SELECTION_MODE(SelectionMode) (((SelectionMode)<<D3D10_SB_OPERAND_4_COMPONENT_SELECTION_MODE_SHIFT)&D3D10_SB_OPERAND_4_COMPONENT_SELECTION_MODE_MASK) | ||
| 786 | |||
| 787 | typedef enum D3D10_SB_4_COMPONENT_NAME | ||
| 788 | { | ||
| 789 | D3D10_SB_4_COMPONENT_X = 0, | ||
| 790 | D3D10_SB_4_COMPONENT_Y = 1, | ||
| 791 | D3D10_SB_4_COMPONENT_Z = 2, | ||
| 792 | D3D10_SB_4_COMPONENT_W = 3, | ||
| 793 | D3D10_SB_4_COMPONENT_R = 0, | ||
| 794 | D3D10_SB_4_COMPONENT_G = 1, | ||
| 795 | D3D10_SB_4_COMPONENT_B = 2, | ||
| 796 | D3D10_SB_4_COMPONENT_A = 3 | ||
| 797 | } D3D10_SB_4_COMPONENT_NAME; | ||
| 798 | #define D3D10_SB_4_COMPONENT_NAME_MASK 3 | ||
| 799 | |||
| 800 | // MACROS FOR USE IN D3D10_SB_OPERAND_4_COMPONENT_MASK_MODE: | ||
| 801 | |||
| 802 | #define D3D10_SB_OPERAND_4_COMPONENT_MASK_MASK 0x000000f0 | ||
| 803 | #define D3D10_SB_OPERAND_4_COMPONENT_MASK_SHIFT 4 | ||
| 804 | #define D3D10_SB_OPERAND_4_COMPONENT_MASK_X 0x00000010 | ||
| 805 | #define D3D10_SB_OPERAND_4_COMPONENT_MASK_Y 0x00000020 | ||
| 806 | #define D3D10_SB_OPERAND_4_COMPONENT_MASK_Z 0x00000040 | ||
| 807 | #define D3D10_SB_OPERAND_4_COMPONENT_MASK_W 0x00000080 | ||
| 808 | #define D3D10_SB_OPERAND_4_COMPONENT_MASK_R D3D10_SB_OPERAND_4_COMPONENT_MASK_X | ||
| 809 | #define D3D10_SB_OPERAND_4_COMPONENT_MASK_G D3D10_SB_OPERAND_4_COMPONENT_MASK_Y | ||
| 810 | #define D3D10_SB_OPERAND_4_COMPONENT_MASK_B D3D10_SB_OPERAND_4_COMPONENT_MASK_Z | ||
| 811 | #define D3D10_SB_OPERAND_4_COMPONENT_MASK_A D3D10_SB_OPERAND_4_COMPONENT_MASK_W | ||
| 812 | #define D3D10_SB_OPERAND_4_COMPONENT_MASK_ALL D3D10_SB_OPERAND_4_COMPONENT_MASK_MASK | ||
| 813 | |||
| 814 | // DECODER MACRO: When 4 component selection mode is | ||
| 815 | // D3D10_SB_OPERAND_4_COMPONENT_MASK_MODE, this macro | ||
| 816 | // extracts from OperandToken0 the 4 component (xyzw) mask, | ||
| 817 | // as a field of D3D10_SB_OPERAND_4_COMPONENT_MASK_[X|Y|Z|W] flags. | ||
| 818 | // Alternatively, the D3D10_SB_OPERAND_4_COMPONENT_MASK_[X|Y|Z|W] masks | ||
| 819 | // can be tested on OperandToken0 directly, without this macro. | ||
| 820 | #define DECODE_D3D10_SB_OPERAND_4_COMPONENT_MASK(OperandToken0) ((OperandToken0)&D3D10_SB_OPERAND_4_COMPONENT_MASK_MASK) | ||
| 821 | |||
| 822 | // ENCODER MACRO: Given a set of | ||
| 823 | // D3D10_SB_OPERAND_4_COMPONENT_MASK_[X|Y|Z|W] values | ||
| 824 | // or'd together, encode them in OperandToken0. | ||
| 825 | #define ENCODE_D3D10_SB_OPERAND_4_COMPONENT_MASK(ComponentMask) ((ComponentMask)&D3D10_SB_OPERAND_4_COMPONENT_MASK_MASK) | ||
| 826 | |||
| 827 | // ENCODER/DECODER MACRO: Given a D3D10_SB_4_COMPONENT_NAME, | ||
| 828 | // generate the 4-component mask for it. | ||
| 829 | // This can be used in loops that build masks or read masks. | ||
| 830 | // Alternatively, the D3D10_SB_OPERAND_4_COMPONENT_MASK_[X|Y|Z|W] masks | ||
| 831 | // can be used directly, without this macro. | ||
| 832 | #define D3D10_SB_OPERAND_4_COMPONENT_MASK(ComponentName) ((1<<(D3D10_SB_OPERAND_4_COMPONENT_MASK_SHIFT+ComponentName))&D3D10_SB_OPERAND_4_COMPONENT_MASK_MASK) | ||
| 833 | |||
| 834 | // MACROS FOR USE IN D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE_MODE: | ||
| 835 | |||
| 836 | #define D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE_MASK 0x00000ff0 | ||
| 837 | #define D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE_SHIFT 4 | ||
| 838 | |||
| 839 | // DECODER MACRO: When 4 component selection mode is | ||
| 840 | // D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE_MODE, this macro | ||
| 841 | // extracts from OperandToken0 the 4 component swizzle, | ||
| 842 | // as a field of D3D10_SB_OPERAND_4_COMPONENT_MASK_[X|Y|Z|W] flags. | ||
| 843 | #define DECODE_D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE(OperandToken0) ((OperandToken0)&D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE_MASK) | ||
| 844 | |||
| 845 | // DECODER MACRO: Pass a D3D10_SB_4_COMPONENT_NAME as "DestComp" in following | ||
| 846 | // macro to extract, from OperandToken0 or from a decoded swizzle, | ||
| 847 | // the swizzle source component (D3D10_SB_4_COMPONENT_NAME enum): | ||
| 848 | #define DECODE_D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE_SOURCE(OperandToken0,DestComp) ((D3D10_SB_4_COMPONENT_NAME)(((OperandToken0)>>(D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE_SHIFT+2*((DestComp)&D3D10_SB_4_COMPONENT_NAME_MASK)))&D3D10_SB_4_COMPONENT_NAME_MASK)) | ||
| 849 | |||
| 850 | // ENCODER MACRO: Generate a 4 component swizzle given | ||
| 851 | // 4 D3D10_SB_4_COMPONENT_NAME source values for dest | ||
| 852 | // components x, y, z, w respectively. | ||
| 853 | #define ENCODE_D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE(XSrc,YSrc,ZSrc,WSrc) ((((XSrc)&D3D10_SB_4_COMPONENT_NAME_MASK)| \ | ||
| 854 | (((YSrc)&D3D10_SB_4_COMPONENT_NAME_MASK)<<2)| \ | ||
| 855 | (((ZSrc)&D3D10_SB_4_COMPONENT_NAME_MASK)<<4)| \ | ||
| 856 | (((WSrc)&D3D10_SB_4_COMPONENT_NAME_MASK)<<6) \ | ||
| 857 | )<<D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE_SHIFT) | ||
| 858 | |||
| 859 | // ENCODER/DECODER MACROS: Various common swizzle patterns | ||
| 860 | // (noswizzle and replicate of each channels) | ||
| 861 | #define D3D10_SB_OPERAND_4_COMPONENT_NOSWIZZLE ENCODE_D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE(D3D10_SB_4_COMPONENT_X,\ | ||
| 862 | D3D10_SB_4_COMPONENT_Y,\ | ||
| 863 | D3D10_SB_4_COMPONENT_Z,\ | ||
| 864 | D3D10_SB_4_COMPONENT_W) | ||
| 865 | |||
| 866 | #define D3D10_SB_OPERAND_4_COMPONENT_REPLICATEX ENCODE_D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE(D3D10_SB_4_COMPONENT_X,\ | ||
| 867 | D3D10_SB_4_COMPONENT_X,\ | ||
| 868 | D3D10_SB_4_COMPONENT_X,\ | ||
| 869 | D3D10_SB_4_COMPONENT_X) | ||
| 870 | |||
| 871 | #define D3D10_SB_OPERAND_4_COMPONENT_REPLICATEY ENCODE_D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE(D3D10_SB_4_COMPONENT_Y,\ | ||
| 872 | D3D10_SB_4_COMPONENT_Y,\ | ||
| 873 | D3D10_SB_4_COMPONENT_Y,\ | ||
| 874 | D3D10_SB_4_COMPONENT_Y) | ||
| 875 | |||
| 876 | #define D3D10_SB_OPERAND_4_COMPONENT_REPLICATEZ ENCODE_D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE(D3D10_SB_4_COMPONENT_Z,\ | ||
| 877 | D3D10_SB_4_COMPONENT_Z,\ | ||
| 878 | D3D10_SB_4_COMPONENT_Z,\ | ||
| 879 | D3D10_SB_4_COMPONENT_Z) | ||
| 880 | |||
| 881 | #define D3D10_SB_OPERAND_4_COMPONENT_REPLICATEW ENCODE_D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE(D3D10_SB_4_COMPONENT_W,\ | ||
| 882 | D3D10_SB_4_COMPONENT_W,\ | ||
| 883 | D3D10_SB_4_COMPONENT_W,\ | ||
| 884 | D3D10_SB_4_COMPONENT_W) | ||
| 885 | |||
| 886 | #define D3D10_SB_OPERAND_4_COMPONENT_REPLICATERED D3D10_SB_OPERAND_4_COMPONENT_REPLICATEX | ||
| 887 | #define D3D10_SB_OPERAND_4_COMPONENT_REPLICATEGREEN D3D10_SB_OPERAND_4_COMPONENT_REPLICATEY | ||
| 888 | #define D3D10_SB_OPERAND_4_COMPONENT_REPLICATEBLUE D3D10_SB_OPERAND_4_COMPONENT_REPLICATEZ | ||
| 889 | #define D3D10_SB_OPERAND_4_COMPONENT_REPLICATEALPHA D3D10_SB_OPERAND_4_COMPONENT_REPLICATEW | ||
| 890 | |||
| 891 | // MACROS FOR USE IN D3D10_SB_OPERAND_4_COMPONENT_SELECT_1_MODE: | ||
| 892 | #define D3D10_SB_OPERAND_4_COMPONENT_SELECT_1_MASK 0x00000030 | ||
| 893 | #define D3D10_SB_OPERAND_4_COMPONENT_SELECT_1_SHIFT 4 | ||
| 894 | |||
| 895 | // DECODER MACRO: When 4 component selection mode is | ||
| 896 | // D3D10_SB_OPERAND_4_COMPONENT_SELECT_1_MODE, this macro | ||
| 897 | // extracts from OperandToken0 a D3D10_SB_4_COMPONENT_NAME | ||
| 898 | // which picks one of the 4 components. | ||
| 899 | #define DECODE_D3D10_SB_OPERAND_4_COMPONENT_SELECT_1(OperandToken0) ((D3D10_SB_4_COMPONENT_NAME)(((OperandToken0)&D3D10_SB_OPERAND_4_COMPONENT_SELECT_1_MASK)>>D3D10_SB_OPERAND_4_COMPONENT_SELECT_1_SHIFT)) | ||
| 900 | |||
| 901 | // ENCODER MACRO: Given a D3D10_SB_4_COMPONENT_NAME selecting | ||
| 902 | // a single component for D3D10_SB_OPERAND_4_COMPONENT_SELECT_1_MODE, | ||
| 903 | // encode it into OperandToken0 | ||
| 904 | #define ENCODE_D3D10_SB_OPERAND_4_COMPONENT_SELECT_1(SelectedComp) (((SelectedComp)<<D3D10_SB_OPERAND_4_COMPONENT_SELECT_1_SHIFT)&D3D10_SB_OPERAND_4_COMPONENT_SELECT_1_MASK) | ||
| 905 | |||
| 906 | // MACROS FOR DETERMINING OPERAND TYPE: | ||
| 907 | |||
| 908 | typedef enum D3D10_SB_OPERAND_TYPE | ||
| 909 | { | ||
| 910 | D3D10_SB_OPERAND_TYPE_TEMP = 0, // Temporary Register File | ||
| 911 | D3D10_SB_OPERAND_TYPE_INPUT = 1, // General Input Register File | ||
| 912 | D3D10_SB_OPERAND_TYPE_OUTPUT = 2, // General Output Register File | ||
| 913 | D3D10_SB_OPERAND_TYPE_INDEXABLE_TEMP = 3, // Temporary Register File (indexable) | ||
| 914 | D3D10_SB_OPERAND_TYPE_IMMEDIATE32 = 4, // 32bit/component immediate value(s) | ||
| 915 | // If for example, operand token bits | ||
| 916 | // [01:00]==D3D10_SB_OPERAND_4_COMPONENT, | ||
| 917 | // this means that the operand type: | ||
| 918 | // D3D10_SB_OPERAND_TYPE_IMMEDIATE32 | ||
| 919 | // results in 4 additional 32bit | ||
| 920 | // DWORDS present for the operand. | ||
| 921 | D3D10_SB_OPERAND_TYPE_IMMEDIATE64 = 5, // 64bit/comp.imm.val(s)HI:LO | ||
| 922 | D3D10_SB_OPERAND_TYPE_SAMPLER = 6, // Reference to sampler state | ||
| 923 | D3D10_SB_OPERAND_TYPE_RESOURCE = 7, // Reference to memory resource (e.g. texture) | ||
| 924 | D3D10_SB_OPERAND_TYPE_CONSTANT_BUFFER= 8, // Reference to constant buffer | ||
| 925 | D3D10_SB_OPERAND_TYPE_IMMEDIATE_CONSTANT_BUFFER= 9, // Reference to immediate constant buffer | ||
| 926 | D3D10_SB_OPERAND_TYPE_LABEL = 10, // Label | ||
| 927 | D3D10_SB_OPERAND_TYPE_INPUT_PRIMITIVEID = 11, // Input primitive ID | ||
| 928 | D3D10_SB_OPERAND_TYPE_OUTPUT_DEPTH = 12, // Output Depth | ||
| 929 | D3D10_SB_OPERAND_TYPE_NULL = 13, // Null register, used to discard results of operations | ||
| 930 | // Below Are operands new in DX 10.1 | ||
| 931 | D3D10_SB_OPERAND_TYPE_RASTERIZER = 14, // DX10.1 Rasterizer register, used to denote the depth/stencil and render target resources | ||
| 932 | D3D10_SB_OPERAND_TYPE_OUTPUT_COVERAGE_MASK = 15, // DX10.1 PS output MSAA coverage mask (scalar) | ||
| 933 | // Below Are operands new in DX 11 | ||
| 934 | D3D11_SB_OPERAND_TYPE_STREAM = 16, // Reference to GS stream output resource | ||
| 935 | D3D11_SB_OPERAND_TYPE_FUNCTION_BODY = 17, // Reference to a function definition | ||
| 936 | D3D11_SB_OPERAND_TYPE_FUNCTION_TABLE = 18, // Reference to a set of functions used by a class | ||
| 937 | D3D11_SB_OPERAND_TYPE_INTERFACE = 19, // Reference to an interface | ||
| 938 | D3D11_SB_OPERAND_TYPE_FUNCTION_INPUT = 20, // Reference to an input parameter to a function | ||
| 939 | D3D11_SB_OPERAND_TYPE_FUNCTION_OUTPUT = 21, // Reference to an output parameter to a function | ||
| 940 | D3D11_SB_OPERAND_TYPE_OUTPUT_CONTROL_POINT_ID = 22, // HS Control Point phase input saying which output control point ID this is | ||
| 941 | D3D11_SB_OPERAND_TYPE_INPUT_FORK_INSTANCE_ID = 23, // HS Fork Phase input instance ID | ||
| 942 | D3D11_SB_OPERAND_TYPE_INPUT_JOIN_INSTANCE_ID = 24, // HS Join Phase input instance ID | ||
| 943 | D3D11_SB_OPERAND_TYPE_INPUT_CONTROL_POINT = 25, // HS Fork+Join, DS phase input control points (array of them) | ||
| 944 | D3D11_SB_OPERAND_TYPE_OUTPUT_CONTROL_POINT = 26, // HS Fork+Join phase output control points (array of them) | ||
| 945 | D3D11_SB_OPERAND_TYPE_INPUT_PATCH_CONSTANT = 27, // DS+HSJoin Input Patch Constants (array of them) | ||
| 946 | D3D11_SB_OPERAND_TYPE_INPUT_DOMAIN_POINT = 28, // DS Input Domain point | ||
| 947 | D3D11_SB_OPERAND_TYPE_THIS_POINTER = 29, // Reference to an interface this pointer | ||
| 948 | D3D11_SB_OPERAND_TYPE_UNORDERED_ACCESS_VIEW = 30, // Reference to UAV u# | ||
| 949 | D3D11_SB_OPERAND_TYPE_THREAD_GROUP_SHARED_MEMORY = 31, // Reference to Thread Group Shared Memory g# | ||
| 950 | D3D11_SB_OPERAND_TYPE_INPUT_THREAD_ID = 32, // Compute Shader Thread ID | ||
| 951 | D3D11_SB_OPERAND_TYPE_INPUT_THREAD_GROUP_ID = 33, // Compute Shader Thread Group ID | ||
| 952 | D3D11_SB_OPERAND_TYPE_INPUT_THREAD_ID_IN_GROUP = 34, // Compute Shader Thread ID In Thread Group | ||
| 953 | D3D11_SB_OPERAND_TYPE_INPUT_COVERAGE_MASK = 35, // Pixel shader coverage mask input | ||
| 954 | D3D11_SB_OPERAND_TYPE_INPUT_THREAD_ID_IN_GROUP_FLATTENED = 36, // Compute Shader Thread ID In Group Flattened to a 1D value. | ||
| 955 | D3D11_SB_OPERAND_TYPE_INPUT_GS_INSTANCE_ID = 37, // Input GS instance ID | ||
| 956 | D3D11_SB_OPERAND_TYPE_OUTPUT_DEPTH_GREATER_EQUAL = 38, // Output Depth, forced to be greater than or equal than current depth | ||
| 957 | D3D11_SB_OPERAND_TYPE_OUTPUT_DEPTH_LESS_EQUAL = 39, // Output Depth, forced to be less than or equal to current depth | ||
| 958 | D3D11_SB_OPERAND_TYPE_CYCLE_COUNTER = 40, // Cycle counter | ||
| 959 | D3D11_SB_OPERAND_TYPE_OUTPUT_STENCIL_REF = 41, // DX11 PS output stencil reference (scalar) | ||
| 960 | D3D11_SB_OPERAND_TYPE_INNER_COVERAGE = 42, // DX11 PS input inner coverage (scalar) | ||
| 961 | } D3D10_SB_OPERAND_TYPE; | ||
| 962 | |||
| 963 | #define D3D10_SB_OPERAND_TYPE_MASK 0x000ff000 | ||
| 964 | #define D3D10_SB_OPERAND_TYPE_SHIFT 12 | ||
| 965 | |||
| 966 | // DECODER MACRO: Determine operand type from OperandToken0. | ||
| 967 | #define DECODE_D3D10_SB_OPERAND_TYPE(OperandToken0) ((D3D10_SB_OPERAND_TYPE)(((OperandToken0)&D3D10_SB_OPERAND_TYPE_MASK)>>D3D10_SB_OPERAND_TYPE_SHIFT)) | ||
| 968 | |||
| 969 | // ENCODER MACRO: Store operand type in OperandToken0. | ||
| 970 | #define ENCODE_D3D10_SB_OPERAND_TYPE(OperandType) (((OperandType)<<D3D10_SB_OPERAND_TYPE_SHIFT)&D3D10_SB_OPERAND_TYPE_MASK) | ||
| 971 | |||
| 972 | typedef enum D3D10_SB_OPERAND_INDEX_DIMENSION | ||
| 973 | { | ||
| 974 | D3D10_SB_OPERAND_INDEX_0D = 0, // e.g. Position | ||
| 975 | D3D10_SB_OPERAND_INDEX_1D = 1, // Most common. e.g. Temp registers. | ||
| 976 | D3D10_SB_OPERAND_INDEX_2D = 2, // e.g. Geometry Program Input registers. | ||
| 977 | D3D10_SB_OPERAND_INDEX_3D = 3, // 3D rarely if ever used. | ||
| 978 | } D3D10_SB_OPERAND_INDEX_DIMENSION; | ||
| 979 | #define D3D10_SB_OPERAND_INDEX_DIMENSION_MASK 0x00300000 | ||
| 980 | #define D3D10_SB_OPERAND_INDEX_DIMENSION_SHIFT 20 | ||
| 981 | |||
| 982 | // DECODER MACRO: Determine operand index dimension from OperandToken0. | ||
| 983 | #define DECODE_D3D10_SB_OPERAND_INDEX_DIMENSION(OperandToken0) ((D3D10_SB_OPERAND_INDEX_DIMENSION)(((OperandToken0)&D3D10_SB_OPERAND_INDEX_DIMENSION_MASK)>>D3D10_SB_OPERAND_INDEX_DIMENSION_SHIFT)) | ||
| 984 | |||
| 985 | // ENCODER MACRO: Store operand index dimension | ||
| 986 | // (D3D10_SB_OPERAND_INDEX_DIMENSION enum) in OperandToken0. | ||
| 987 | #define ENCODE_D3D10_SB_OPERAND_INDEX_DIMENSION(OperandIndexDim) (((OperandIndexDim)<<D3D10_SB_OPERAND_INDEX_DIMENSION_SHIFT)&D3D10_SB_OPERAND_INDEX_DIMENSION_MASK) | ||
| 988 | |||
| 989 | typedef enum D3D10_SB_OPERAND_INDEX_REPRESENTATION | ||
| 990 | { | ||
| 991 | D3D10_SB_OPERAND_INDEX_IMMEDIATE32 = 0, // Extra DWORD | ||
| 992 | D3D10_SB_OPERAND_INDEX_IMMEDIATE64 = 1, // 2 Extra DWORDs | ||
| 993 | // (HI32:LO32) | ||
| 994 | D3D10_SB_OPERAND_INDEX_RELATIVE = 2, // Extra operand | ||
| 995 | D3D10_SB_OPERAND_INDEX_IMMEDIATE32_PLUS_RELATIVE = 3, // Extra DWORD followed by | ||
| 996 | // extra operand | ||
| 997 | D3D10_SB_OPERAND_INDEX_IMMEDIATE64_PLUS_RELATIVE = 4, // 2 Extra DWORDS | ||
| 998 | // (HI32:LO32) followed | ||
| 999 | // by extra operand | ||
| 1000 | } D3D10_SB_OPERAND_INDEX_REPRESENTATION; | ||
| 1001 | #define D3D10_SB_OPERAND_INDEX_REPRESENTATION_SHIFT(Dim) (22+3*((Dim)&3)) | ||
| 1002 | #define D3D10_SB_OPERAND_INDEX_REPRESENTATION_MASK(Dim) (0x3<<D3D10_SB_OPERAND_INDEX_REPRESENTATION_SHIFT(Dim)) | ||
| 1003 | |||
| 1004 | // DECODER MACRO: Determine from OperandToken0 what representation | ||
| 1005 | // an operand index is provided as (D3D10_SB_OPERAND_INDEX_REPRESENTATION enum), | ||
| 1006 | // for index dimension [0], [1] or [2], depending on D3D10_SB_OPERAND_INDEX_DIMENSION. | ||
| 1007 | #define DECODE_D3D10_SB_OPERAND_INDEX_REPRESENTATION(Dim,OperandToken0) ((D3D10_SB_OPERAND_INDEX_REPRESENTATION)(((OperandToken0)&D3D10_SB_OPERAND_INDEX_REPRESENTATION_MASK(Dim))>>D3D10_SB_OPERAND_INDEX_REPRESENTATION_SHIFT(Dim))) | ||
| 1008 | |||
| 1009 | // ENCODER MACRO: Store in OperandToken0 what representation | ||
| 1010 | // an operand index is provided as (D3D10_SB_OPERAND_INDEX_REPRESENTATION enum), | ||
| 1011 | // for index dimension [0], [1] or [2], depending on D3D10_SB_OPERAND_INDEX_DIMENSION. | ||
| 1012 | #define ENCODE_D3D10_SB_OPERAND_INDEX_REPRESENTATION(Dim,IndexRepresentation) (((IndexRepresentation)<<D3D10_SB_OPERAND_INDEX_REPRESENTATION_SHIFT(Dim))&D3D10_SB_OPERAND_INDEX_REPRESENTATION_MASK(Dim)) | ||
| 1013 | |||
| 1014 | #define D3D10_SB_OPERAND_EXTENDED_MASK 0x80000000 | ||
| 1015 | #define D3D10_SB_OPERAND_EXTENDED_SHIFT 31 | ||
| 1016 | |||
| 1017 | // DECODER MACRO: Determine if the operand is extended | ||
| 1018 | // by an additional opcode token. | ||
| 1019 | #define DECODE_IS_D3D10_SB_OPERAND_EXTENDED(OperandToken0) (((OperandToken0)&D3D10_SB_OPERAND_EXTENDED_MASK)>>D3D10_SB_OPERAND_EXTENDED_SHIFT) | ||
| 1020 | |||
| 1021 | // ENCODER MACRO: Store in OperandToken0 whether the operand is extended | ||
| 1022 | // by an additional operand token. | ||
| 1023 | #define ENCODE_D3D10_SB_OPERAND_EXTENDED(bExtended) (((bExtended)!=0)?D3D10_SB_OPERAND_EXTENDED_MASK:0) | ||
| 1024 | |||
| 1025 | // ---------------------------------------------------------------------------- | ||
| 1026 | // Extended Instruction Operand Format (OperandToken1) | ||
| 1027 | // | ||
| 1028 | // If bit31 of an operand token is set, the | ||
| 1029 | // operand has additional data in a second DWORD | ||
| 1030 | // directly following OperandToken0. Other tokens | ||
| 1031 | // expected for the operand, such as immmediate | ||
| 1032 | // values or relative address operands (full | ||
| 1033 | // operands in themselves) always follow | ||
| 1034 | // OperandToken0 AND OperandToken1..n (extended | ||
| 1035 | // operand tokens, if present). | ||
| 1036 | // | ||
| 1037 | // [05:00] D3D10_SB_EXTENDED_OPERAND_TYPE | ||
| 1038 | // [16:06] if([05:00] == D3D10_SB_EXTENDED_OPERAND_MODIFIER) | ||
| 1039 | // { | ||
| 1040 | // [13:06] D3D10_SB_OPERAND_MODIFIER | ||
| 1041 | // [16:14] Min Precision: D3D11_SB_OPERAND_MIN_PRECISION | ||
| 1042 | // [17:17] Non-uniform: D3D12_SB_OPERAND_NON_UNIFORM | ||
| 1043 | // } | ||
| 1044 | // else | ||
| 1045 | // { | ||
| 1046 | // [17:06] Ignored, 0. | ||
| 1047 | // } | ||
| 1048 | // [30:18] Ignored, 0. | ||
| 1049 | // [31] 0 normally. 1 if second order extended operand definition, | ||
| 1050 | // meaning next DWORD contains yet ANOTHER extended operand | ||
| 1051 | // description. Currently no second order extensions defined. | ||
| 1052 | // This would be useful if a particular extended operand does | ||
| 1053 | // not have enough space to store the required information in | ||
| 1054 | // a single token and so is extended further. | ||
| 1055 | // | ||
| 1056 | // ---------------------------------------------------------------------------- | ||
| 1057 | |||
| 1058 | typedef enum D3D10_SB_EXTENDED_OPERAND_TYPE | ||
| 1059 | { | ||
| 1060 | D3D10_SB_EXTENDED_OPERAND_EMPTY = 0, // Might be used if this | ||
| 1061 | // enum is full and | ||
| 1062 | // further extended opcode | ||
| 1063 | // is needed. | ||
| 1064 | D3D10_SB_EXTENDED_OPERAND_MODIFIER = 1, | ||
| 1065 | } D3D10_SB_EXTENDED_OPERAND_TYPE; | ||
| 1066 | #define D3D10_SB_EXTENDED_OPERAND_TYPE_MASK 0x0000003f | ||
| 1067 | |||
| 1068 | // DECODER MACRO: Given an extended operand | ||
| 1069 | // token (OperandToken1), figure out what type | ||
| 1070 | // of token it is (from D3D10_SB_EXTENDED_OPERAND_TYPE enum) | ||
| 1071 | // to be able to interpret the rest of the token's contents. | ||
| 1072 | #define DECODE_D3D10_SB_EXTENDED_OPERAND_TYPE(OperandToken1) ((D3D10_SB_EXTENDED_OPERAND_TYPE)((OperandToken1)&D3D10_SB_EXTENDED_OPERAND_TYPE_MASK)) | ||
| 1073 | |||
| 1074 | // ENCODER MACRO: Store extended operand token | ||
| 1075 | // type in OperandToken1. | ||
| 1076 | #define ENCODE_D3D10_SB_EXTENDED_OPERAND_TYPE(ExtOperandType) ((ExtOperandType)&D3D10_SB_EXTENDED_OPERAND_TYPE_MASK) | ||
| 1077 | |||
| 1078 | typedef enum D3D10_SB_OPERAND_MODIFIER | ||
| 1079 | { | ||
| 1080 | D3D10_SB_OPERAND_MODIFIER_NONE = 0, // Nop. This is the implied | ||
| 1081 | // default if the extended | ||
| 1082 | // operand is not present for | ||
| 1083 | // an operand for which source | ||
| 1084 | // modifiers are meaningful | ||
| 1085 | D3D10_SB_OPERAND_MODIFIER_NEG = 1, // Negate | ||
| 1086 | D3D10_SB_OPERAND_MODIFIER_ABS = 2, // Absolute value, abs() | ||
| 1087 | D3D10_SB_OPERAND_MODIFIER_ABSNEG = 3, // -abs() | ||
| 1088 | } D3D10_SB_OPERAND_MODIFIER; | ||
| 1089 | #define D3D10_SB_OPERAND_MODIFIER_MASK 0x00003fc0 | ||
| 1090 | #define D3D10_SB_OPERAND_MODIFIER_SHIFT 6 | ||
| 1091 | |||
| 1092 | // DECODER MACRO: Given a D3D10_SB_EXTENDED_OPERAND_MODIFIER | ||
| 1093 | // extended token (OperandToken1), determine the source modifier | ||
| 1094 | // (D3D10_SB_OPERAND_MODIFIER enum) | ||
| 1095 | #define DECODE_D3D10_SB_OPERAND_MODIFIER(OperandToken1) ((D3D10_SB_OPERAND_MODIFIER)(((OperandToken1)&D3D10_SB_OPERAND_MODIFIER_MASK)>>D3D10_SB_OPERAND_MODIFIER_SHIFT)) | ||
| 1096 | |||
| 1097 | // ENCODER MACRO: Generate a complete source modifier extended token | ||
| 1098 | // (OperandToken1), given D3D10_SB_OPERAND_MODIFIER enum (the | ||
| 1099 | // ext. operand type is also set to D3D10_SB_EXTENDED_OPERAND_MODIFIER). | ||
| 1100 | #define ENCODE_D3D10_SB_EXTENDED_OPERAND_MODIFIER(SourceMod) ((((SourceMod)<<D3D10_SB_OPERAND_MODIFIER_SHIFT)&D3D10_SB_OPERAND_MODIFIER_MASK)| \ | ||
| 1101 | ENCODE_D3D10_SB_EXTENDED_OPERAND_TYPE(D3D10_SB_EXTENDED_OPERAND_MODIFIER) | \ | ||
| 1102 | ENCODE_D3D10_SB_OPERAND_DOUBLE_EXTENDED(0)) | ||
| 1103 | |||
| 1104 | // Min precision specifier for source/dest operands. This | ||
| 1105 | // fits in the extended operand token field. Implementations are free to | ||
| 1106 | // execute at higher precision than the min - details spec'ed elsewhere. | ||
| 1107 | // This is part of the opcode specific control range. | ||
| 1108 | typedef enum D3D11_SB_OPERAND_MIN_PRECISION | ||
| 1109 | { | ||
| 1110 | D3D11_SB_OPERAND_MIN_PRECISION_DEFAULT = 0, // Default precision | ||
| 1111 | // for the shader model | ||
| 1112 | D3D11_SB_OPERAND_MIN_PRECISION_FLOAT_16 = 1, // Min 16 bit/component float | ||
| 1113 | D3D11_SB_OPERAND_MIN_PRECISION_FLOAT_2_8 = 2, // Min 10(2.8)bit/comp. float | ||
| 1114 | D3D11_SB_OPERAND_MIN_PRECISION_SINT_16 = 4, // Min 16 bit/comp. signed integer | ||
| 1115 | D3D11_SB_OPERAND_MIN_PRECISION_UINT_16 = 5, // Min 16 bit/comp. unsigned integer | ||
| 1116 | } D3D11_SB_OPERAND_MIN_PRECISION; | ||
| 1117 | #define D3D11_SB_OPERAND_MIN_PRECISION_MASK 0x0001C000 | ||
| 1118 | #define D3D11_SB_OPERAND_MIN_PRECISION_SHIFT 14 | ||
| 1119 | |||
| 1120 | // DECODER MACRO: For an OperandToken1 that can specify | ||
| 1121 | // a minimum precision for execution, find out what it is. | ||
| 1122 | #define DECODE_D3D11_SB_OPERAND_MIN_PRECISION(OperandToken1) ((D3D11_SB_OPERAND_MIN_PRECISION)(((OperandToken1)& D3D11_SB_OPERAND_MIN_PRECISION_MASK)>> D3D11_SB_OPERAND_MIN_PRECISION_SHIFT)) | ||
| 1123 | |||
| 1124 | // ENCODER MACRO: Encode minimum precision for execution | ||
| 1125 | // into the extended operand token, OperandToken1 | ||
| 1126 | #define ENCODE_D3D11_SB_OPERAND_MIN_PRECISION(MinPrecision) (((MinPrecision)<< D3D11_SB_OPERAND_MIN_PRECISION_SHIFT)& D3D11_SB_OPERAND_MIN_PRECISION_MASK) | ||
| 1127 | |||
| 1128 | |||
| 1129 | // Non-uniform extended operand modifier. | ||
| 1130 | #define D3D12_SB_OPERAND_NON_UNIFORM_MASK 0x00020000 | ||
| 1131 | #define D3D12_SB_OPERAND_NON_UNIFORM_SHIFT 17 | ||
| 1132 | |||
| 1133 | // DECODER MACRO: For an OperandToken1 that can specify a non-uniform operand | ||
| 1134 | #define DECODE_D3D12_SB_OPERAND_NON_UNIFORM(OperandToken1) (((OperandToken1)& D3D12_SB_OPERAND_NON_UNIFORM_MASK)>> D3D12_SB_OPERAND_NON_UNIFORM_SHIFT) | ||
| 1135 | |||
| 1136 | // ENCODER MACRO: Encode non-uniform state into the extended operand token, OperandToken1 | ||
| 1137 | #define ENCODE_D3D12_SB_OPERAND_NON_UNIFORM(NonUniform) (((NonUniform)<< D3D12_SB_OPERAND_NON_UNIFORM_SHIFT)& D3D12_SB_OPERAND_NON_UNIFORM_MASK) | ||
| 1138 | |||
| 1139 | |||
| 1140 | #define D3D10_SB_OPERAND_DOUBLE_EXTENDED_MASK 0x80000000 | ||
| 1141 | #define D3D10_SB_OPERAND_DOUBLE_EXTENDED_SHIFT 31 | ||
| 1142 | // DECODER MACRO: Determine if an extended operand token | ||
| 1143 | // (OperandToken1) is further extended by yet another token | ||
| 1144 | // (OperandToken2). Currently there are no secondary | ||
| 1145 | // extended operand tokens. | ||
| 1146 | #define DECODE_IS_D3D10_SB_OPERAND_DOUBLE_EXTENDED(OperandToken1) (((OperandToken1)&D3D10_SB_OPERAND_DOUBLE_EXTENDED_MASK)>>D3D10_SB_OPERAND_DOUBLE_EXTENDED_SHIFT) | ||
| 1147 | |||
| 1148 | // ENCODER MACRO: Store in OperandToken1 whether the operand is extended | ||
| 1149 | // by an additional operand token. Currently there are no secondary | ||
| 1150 | // extended operand tokens. | ||
| 1151 | #define ENCODE_D3D10_SB_OPERAND_DOUBLE_EXTENDED(bExtended) (((bExtended)!=0)?D3D10_SB_OPERAND_DOUBLE_EXTENDED_MASK:0) | ||
| 1152 | |||
| 1153 | // ---------------------------------------------------------------------------- | ||
| 1154 | // Name Token (NameToken) (used in declaration statements) | ||
| 1155 | // | ||
| 1156 | // [15:00] D3D10_SB_NAME enumeration | ||
| 1157 | // [31:16] Reserved, 0 | ||
| 1158 | // | ||
| 1159 | // ---------------------------------------------------------------------------- | ||
| 1160 | #define D3D10_SB_NAME_MASK 0x0000ffff | ||
| 1161 | |||
| 1162 | // DECODER MACRO: Get the name from NameToken | ||
| 1163 | #define DECODE_D3D10_SB_NAME(NameToken) ((D3D10_SB_NAME)((NameToken)&D3D10_SB_NAME_MASK)) | ||
| 1164 | |||
| 1165 | // ENCODER MACRO: Generate a complete NameToken given a D3D10_SB_NAME | ||
| 1166 | #define ENCODE_D3D10_SB_NAME(Name) ((Name)&D3D10_SB_NAME_MASK) | ||
| 1167 | |||
| 1168 | //--------------------------------------------------------------------- | ||
| 1169 | // Declaration Statements | ||
| 1170 | // | ||
| 1171 | // Declarations start with a standard opcode token, | ||
| 1172 | // having opcode type being D3D10_SB_OPCODE_DCL*. | ||
| 1173 | // Each particular declaration type has custom | ||
| 1174 | // operand token(s), described below. | ||
| 1175 | //--------------------------------------------------------------------- | ||
| 1176 | |||
| 1177 | // ---------------------------------------------------------------------------- | ||
| 1178 | // Global Flags Declaration | ||
| 1179 | // | ||
| 1180 | // OpcodeToken0: | ||
| 1181 | // | ||
| 1182 | // [10:00] D3D10_SB_OPCODE_DCL_GLOBAL_FLAGS | ||
| 1183 | // [11:11] Refactoring allowed if bit set. | ||
| 1184 | // [12:12] Enable double precision float ops. | ||
| 1185 | // [13:13] Force early depth-stencil test. | ||
| 1186 | // [14:14] Enable RAW and structured buffers in non-CS 4.x shaders. | ||
| 1187 | // [15:15] Skip optimizations of shader IL when translating to native code | ||
| 1188 | // [16:16] Enable minimum-precision data types | ||
| 1189 | // [17:17] Enable 11.1 double-precision floating-point instruction extensions | ||
| 1190 | // [18:18] Enable 11.1 non-double instruction extensions | ||
| 1191 | // [23:19] Reserved for future flags. | ||
| 1192 | // [30:24] Instruction length in DWORDs including the opcode token. == 1 | ||
| 1193 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 1194 | // contains extended operand description. This dcl is currently not | ||
| 1195 | // extended. | ||
| 1196 | // | ||
| 1197 | // OpcodeToken0 is followed by no operands. | ||
| 1198 | // | ||
| 1199 | // ---------------------------------------------------------------------------- | ||
| 1200 | #define D3D10_SB_GLOBAL_FLAG_REFACTORING_ALLOWED (1<<11) | ||
| 1201 | #define D3D11_SB_GLOBAL_FLAG_ENABLE_DOUBLE_PRECISION_FLOAT_OPS (1<<12) | ||
| 1202 | #define D3D11_SB_GLOBAL_FLAG_FORCE_EARLY_DEPTH_STENCIL (1<<13) | ||
| 1203 | #define D3D11_SB_GLOBAL_FLAG_ENABLE_RAW_AND_STRUCTURED_BUFFERS (1<<14) | ||
| 1204 | #define D3D11_1_SB_GLOBAL_FLAG_SKIP_OPTIMIZATION (1<<15) | ||
| 1205 | #define D3D11_1_SB_GLOBAL_FLAG_ENABLE_MINIMUM_PRECISION (1<<16) | ||
| 1206 | #define D3D11_1_SB_GLOBAL_FLAG_ENABLE_DOUBLE_EXTENSIONS (1<<17) | ||
| 1207 | #define D3D11_1_SB_GLOBAL_FLAG_ENABLE_SHADER_EXTENSIONS (1<<18) | ||
| 1208 | #define D3D12_SB_GLOBAL_FLAG_ALL_RESOURCES_BOUND (1<<19) | ||
| 1209 | |||
| 1210 | #define D3D10_SB_GLOBAL_FLAGS_MASK 0x00fff800 | ||
| 1211 | |||
| 1212 | // DECODER MACRO: Get global flags | ||
| 1213 | #define DECODE_D3D10_SB_GLOBAL_FLAGS(OpcodeToken0) ((OpcodeToken0)&D3D10_SB_GLOBAL_FLAGS_MASK) | ||
| 1214 | |||
| 1215 | // ENCODER MACRO: Encode global flags | ||
| 1216 | #define ENCODE_D3D10_SB_GLOBAL_FLAGS(Flags) ((Flags)&D3D10_SB_GLOBAL_FLAGS_MASK) | ||
| 1217 | |||
| 1218 | // ---------------------------------------------------------------------------- | ||
| 1219 | // Resource Declaration (non multisampled) | ||
| 1220 | // | ||
| 1221 | // OpcodeToken0: | ||
| 1222 | // | ||
| 1223 | // [10:00] D3D10_SB_OPCODE_DCL_RESOURCE | ||
| 1224 | // [15:11] D3D10_SB_RESOURCE_DIMENSION | ||
| 1225 | // [23:16] Ignored, 0 | ||
| 1226 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 1227 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 1228 | // contains extended operand description. This dcl is currently not | ||
| 1229 | // extended. | ||
| 1230 | // | ||
| 1231 | // OpcodeToken0 is followed by 2 operands on Shader Models 4.0 through 5.0: | ||
| 1232 | // (1) an operand, starting with OperandToken0, defining which | ||
| 1233 | // t# register (D3D10_SB_OPERAND_TYPE_RESOURCE) is being declared. | ||
| 1234 | // (2) a Resource Return Type token (ResourceReturnTypeToken) | ||
| 1235 | // | ||
| 1236 | // OpcodeToken0 is followed by 3 operands on Shader Model 5.1 and later: | ||
| 1237 | // (1) an operand, starting with OperandToken0, defining which | ||
| 1238 | // t# register (D3D10_SB_OPERAND_TYPE_RESOURCE) is being declared. | ||
| 1239 | // The indexing dimension for the register must be D3D10_SB_OPERAND_INDEX_DIMENSION_3D, | ||
| 1240 | // and the meaning of the index dimensions are as follows: (t<id>[<lbound>:<ubound>]) | ||
| 1241 | // 1 <id>: variable ID being declared | ||
| 1242 | // 2 <lbound>: the lower bound of the range of resources in the space | ||
| 1243 | // 3 <ubound>: the upper bound (inclusive) of this range | ||
| 1244 | // As opposed to when the t# is used in shader instructions, where the register | ||
| 1245 | // must be D3D10_SB_OPERAND_INDEX_DIMENSION_2D, and the meaning of the index | ||
| 1246 | // dimensions are as follows: (t<id>[<idx>]): | ||
| 1247 | // 1 <id>: variable ID being used (matches dcl) | ||
| 1248 | // 2 <idx>: absolute index of resource within space (may be dynamically indexed) | ||
| 1249 | // (2) a Resource Return Type token (ResourceReturnTypeToken) | ||
| 1250 | // (3) a DWORD indicating the space index. | ||
| 1251 | // | ||
| 1252 | // ---------------------------------------------------------------------------- | ||
| 1253 | #define D3D10_SB_RESOURCE_DIMENSION_MASK 0x0000F800 | ||
| 1254 | #define D3D10_SB_RESOURCE_DIMENSION_SHIFT 11 | ||
| 1255 | |||
| 1256 | // DECODER MACRO: Given a resource declaration token, | ||
| 1257 | // (OpcodeToken0), determine the resource dimension | ||
| 1258 | // (D3D10_SB_RESOURCE_DIMENSION enum) | ||
| 1259 | #define DECODE_D3D10_SB_RESOURCE_DIMENSION(OpcodeToken0) ((D3D10_SB_RESOURCE_DIMENSION)(((OpcodeToken0)&D3D10_SB_RESOURCE_DIMENSION_MASK)>>D3D10_SB_RESOURCE_DIMENSION_SHIFT)) | ||
| 1260 | |||
| 1261 | // ENCODER MACRO: Store resource dimension | ||
| 1262 | // (D3D10_SB_RESOURCE_DIMENSION enum) into a | ||
| 1263 | // a resource declaration token (OpcodeToken0) | ||
| 1264 | #define ENCODE_D3D10_SB_RESOURCE_DIMENSION(ResourceDim) (((ResourceDim)<<D3D10_SB_RESOURCE_DIMENSION_SHIFT)&D3D10_SB_RESOURCE_DIMENSION_MASK) | ||
| 1265 | |||
| 1266 | // ---------------------------------------------------------------------------- | ||
| 1267 | // Resource Declaration (multisampled) | ||
| 1268 | // | ||
| 1269 | // OpcodeToken0: | ||
| 1270 | // | ||
| 1271 | // [10:00] D3D10_SB_OPCODE_DCL_RESOURCE (same opcode as non-multisampled case) | ||
| 1272 | // [15:11] D3D10_SB_RESOURCE_DIMENSION (must be TEXTURE2DMS or TEXTURE2DMSARRAY) | ||
| 1273 | // [22:16] Sample count 1...127. 0 is currently disallowed, though | ||
| 1274 | // in future versions 0 could mean "configurable" sample count | ||
| 1275 | // [23:23] Ignored, 0 | ||
| 1276 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 1277 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 1278 | // contains extended operand description. This dcl is currently not | ||
| 1279 | // extended. | ||
| 1280 | // | ||
| 1281 | // OpcodeToken0 is followed by 2 operands on Shader Models 4.0 through 5.0: | ||
| 1282 | // (1) an operand, starting with OperandToken0, defining which | ||
| 1283 | // t# register (D3D10_SB_OPERAND_TYPE_RESOURCE) is being declared. | ||
| 1284 | // (2) a Resource Return Type token (ResourceReturnTypeToken) | ||
| 1285 | // | ||
| 1286 | // OpcodeToken0 is followed by 3 operands on Shader Model 5.1 and later: | ||
| 1287 | // (1) an operand, starting with OperandToken0, defining which | ||
| 1288 | // t# register (D3D10_SB_OPERAND_TYPE_RESOURCE) is being declared. | ||
| 1289 | // The indexing dimension for the register must be D3D10_SB_OPERAND_INDEX_DIMENSION_3D, | ||
| 1290 | // and the meaning of the index dimensions are as follows: (t<id>[<lbound>:<ubound>]) | ||
| 1291 | // 1 <id>: variable ID being declared | ||
| 1292 | // 2 <lbound>: the lower bound of the range of resources in the space | ||
| 1293 | // 3 <ubound>: the upper bound (inclusive) of this range | ||
| 1294 | // As opposed to when the t# is used in shader instructions, where the register | ||
| 1295 | // must be D3D10_SB_OPERAND_INDEX_DIMENSION_2D, and the meaning of the index | ||
| 1296 | // dimensions are as follows: (t<id>[<idx>]): | ||
| 1297 | // 1 <id>: variable ID being used (matches dcl) | ||
| 1298 | // 2 <idx>: absolute index of resource within space (may be dynamically indexed) | ||
| 1299 | // (2) a Resource Return Type token (ResourceReturnTypeToken) | ||
| 1300 | // (3) a DWORD indicating the space index. | ||
| 1301 | // | ||
| 1302 | // ---------------------------------------------------------------------------- | ||
| 1303 | |||
| 1304 | // use same macro for encoding/decoding resource dimension aas the non-msaa declaration | ||
| 1305 | |||
| 1306 | #define D3D10_SB_RESOURCE_SAMPLE_COUNT_MASK 0x07F0000 | ||
| 1307 | #define D3D10_SB_RESOURCE_SAMPLE_COUNT_SHIFT 16 | ||
| 1308 | |||
| 1309 | // DECODER MACRO: Given a resource declaration token, | ||
| 1310 | // (OpcodeToken0), determine the resource sample count (1..127) | ||
| 1311 | #define DECODE_D3D10_SB_RESOURCE_SAMPLE_COUNT(OpcodeToken0) ((UINT)(((OpcodeToken0)&D3D10_SB_RESOURCE_SAMPLE_COUNT_MASK)>>D3D10_SB_RESOURCE_SAMPLE_COUNT_SHIFT)) | ||
| 1312 | |||
| 1313 | // ENCODER MACRO: Store resource sample count up to 127 into a | ||
| 1314 | // a resource declaration token (OpcodeToken0) | ||
| 1315 | #define ENCODE_D3D10_SB_RESOURCE_SAMPLE_COUNT(SampleCount) (((SampleCount > 127 ? 127 : SampleCount)<<D3D10_SB_RESOURCE_SAMPLE_COUNT_SHIFT)&D3D10_SB_RESOURCE_SAMPLE_COUNT_MASK) | ||
| 1316 | |||
| 1317 | // ---------------------------------------------------------------------------- | ||
| 1318 | // Resource Return Type Token (ResourceReturnTypeToken) (used in resource | ||
| 1319 | // declaration statements) | ||
| 1320 | // | ||
| 1321 | // [03:00] D3D10_SB_RESOURCE_RETURN_TYPE for component X | ||
| 1322 | // [07:04] D3D10_SB_RESOURCE_RETURN_TYPE for component Y | ||
| 1323 | // [11:08] D3D10_SB_RESOURCE_RETURN_TYPE for component Z | ||
| 1324 | // [15:12] D3D10_SB_RESOURCE_RETURN_TYPE for component W | ||
| 1325 | // [31:16] Reserved, 0 | ||
| 1326 | // | ||
| 1327 | // ---------------------------------------------------------------------------- | ||
| 1328 | // DECODER MACRO: Get the resource return type for component (0-3) from | ||
| 1329 | // ResourceReturnTypeToken | ||
| 1330 | #define DECODE_D3D10_SB_RESOURCE_RETURN_TYPE(ResourceReturnTypeToken, Component) \ | ||
| 1331 | ((D3D10_SB_RESOURCE_RETURN_TYPE)(((ResourceReturnTypeToken) >> \ | ||
| 1332 | (Component * D3D10_SB_RESOURCE_RETURN_TYPE_NUMBITS))&D3D10_SB_RESOURCE_RETURN_TYPE_MASK)) | ||
| 1333 | |||
| 1334 | // ENCODER MACRO: Generate a resource return type for a component | ||
| 1335 | #define ENCODE_D3D10_SB_RESOURCE_RETURN_TYPE(ReturnType, Component) \ | ||
| 1336 | (((ReturnType)&D3D10_SB_RESOURCE_RETURN_TYPE_MASK) << (Component * D3D10_SB_RESOURCE_RETURN_TYPE_NUMBITS)) | ||
| 1337 | |||
| 1338 | // ---------------------------------------------------------------------------- | ||
| 1339 | // Sampler Declaration | ||
| 1340 | // | ||
| 1341 | // OpcodeToken0: | ||
| 1342 | // | ||
| 1343 | // [10:00] D3D10_SB_OPCODE_DCL_SAMPLER | ||
| 1344 | // [14:11] D3D10_SB_SAMPLER_MODE | ||
| 1345 | // [23:15] Ignored, 0 | ||
| 1346 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 1347 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 1348 | // contains extended operand description. This dcl is currently not | ||
| 1349 | // extended. | ||
| 1350 | // | ||
| 1351 | // OpcodeToken0 is followed by 1 operand on Shader Models 4.0 through 5.0: | ||
| 1352 | // (1) Operand starting with OperandToken0, defining which sampler | ||
| 1353 | // (D3D10_SB_OPERAND_TYPE_SAMPLER) register # is being declared. | ||
| 1354 | // | ||
| 1355 | // OpcodeToken0 is followed by 2 operands on Shader Model 5.1 and later: | ||
| 1356 | // (1) an operand, starting with OperandToken0, defining which | ||
| 1357 | // s# register (D3D10_SB_OPERAND_TYPE_SAMPLER) is being declared. | ||
| 1358 | // The indexing dimension for the register must be D3D10_SB_OPERAND_INDEX_DIMENSION_3D, | ||
| 1359 | // and the meaning of the index dimensions are as follows: (s<id>[<lbound>:<ubound>]) | ||
| 1360 | // 1 <id>: variable ID being declared | ||
| 1361 | // 2 <lbound>: the lower bound of the range of samplers in the space | ||
| 1362 | // 3 <ubound>: the upper bound (inclusive) of this range | ||
| 1363 | // As opposed to when the s# is used in shader instructions, where the register | ||
| 1364 | // must be D3D10_SB_OPERAND_INDEX_DIMENSION_2D, and the meaning of the index | ||
| 1365 | // dimensions are as follows: (s<id>[<idx>]): | ||
| 1366 | // 1 <id>: variable ID being used (matches dcl) | ||
| 1367 | // 2 <idx>: absolute index of sampler within space (may be dynamically indexed) | ||
| 1368 | // (2) a DWORD indicating the space index. | ||
| 1369 | // | ||
| 1370 | // ---------------------------------------------------------------------------- | ||
| 1371 | typedef enum D3D10_SB_SAMPLER_MODE | ||
| 1372 | { | ||
| 1373 | D3D10_SB_SAMPLER_MODE_DEFAULT = 0, | ||
| 1374 | D3D10_SB_SAMPLER_MODE_COMPARISON = 1, | ||
| 1375 | D3D10_SB_SAMPLER_MODE_MONO = 2, | ||
| 1376 | } D3D10_SB_SAMPLER_MODE; | ||
| 1377 | |||
| 1378 | #define D3D10_SB_SAMPLER_MODE_MASK 0x00007800 | ||
| 1379 | #define D3D10_SB_SAMPLER_MODE_SHIFT 11 | ||
| 1380 | |||
| 1381 | // DECODER MACRO: Find out if a Constant Buffer is going to be indexed or not | ||
| 1382 | #define DECODE_D3D10_SB_SAMPLER_MODE(OpcodeToken0) ((D3D10_SB_SAMPLER_MODE)(((OpcodeToken0)&D3D10_SB_SAMPLER_MODE_MASK)>>D3D10_SB_SAMPLER_MODE_SHIFT)) | ||
| 1383 | |||
| 1384 | // ENCODER MACRO: Generate a resource return type for a component | ||
| 1385 | #define ENCODE_D3D10_SB_SAMPLER_MODE(SamplerMode) (((SamplerMode)<<D3D10_SB_SAMPLER_MODE_SHIFT)&D3D10_SB_SAMPLER_MODE_MASK) | ||
| 1386 | |||
| 1387 | // ---------------------------------------------------------------------------- | ||
| 1388 | // Input Register Declaration (see separate declarations for Pixel Shaders) | ||
| 1389 | // | ||
| 1390 | // OpcodeToken0: | ||
| 1391 | // | ||
| 1392 | // [10:00] D3D10_SB_OPCODE_DCL_INPUT | ||
| 1393 | // [23:11] Ignored, 0 | ||
| 1394 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 1395 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 1396 | // contains extended operand description. This dcl is currently not | ||
| 1397 | // extended. | ||
| 1398 | // | ||
| 1399 | // OpcodeToken0 is followed by 1 operand: | ||
| 1400 | // (1) Operand, starting with OperandToken0, defining which input | ||
| 1401 | // v# register (D3D10_SB_OPERAND_TYPE_INPUT) is being declared, | ||
| 1402 | // including writemask. | ||
| 1403 | // | ||
| 1404 | // ---------------------------------------------------------------------------- | ||
| 1405 | |||
| 1406 | // ---------------------------------------------------------------------------- | ||
| 1407 | // Input Register Declaration w/System Interpreted Value | ||
| 1408 | // (see separate declarations for Pixel Shaders) | ||
| 1409 | // | ||
| 1410 | // OpcodeToken0: | ||
| 1411 | // | ||
| 1412 | // [10:00] D3D10_SB_OPCODE_DCL_INPUT_SIV | ||
| 1413 | // [23:11] Ignored, 0 | ||
| 1414 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 1415 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 1416 | // contains extended operand description. This dcl is currently not | ||
| 1417 | // extended. | ||
| 1418 | // | ||
| 1419 | // OpcodeToken0 is followed by 2 operands: | ||
| 1420 | // (1) Operand, starting with OperandToken0, defining which input | ||
| 1421 | // v# register (D3D10_SB_OPERAND_TYPE_INPUT) is being declared, | ||
| 1422 | // including writemask. For Geometry Shaders, the input is | ||
| 1423 | // v[vertex][attribute], and this declaration is only for which register | ||
| 1424 | // on the attribute axis is being declared. The vertex axis value must | ||
| 1425 | // be equal to the # of vertices in the current input primitive for the GS | ||
| 1426 | // (i.e. 6 for triangle + adjacency). | ||
| 1427 | // (2) a System Interpreted Value Name (NameToken) | ||
| 1428 | // | ||
| 1429 | // ---------------------------------------------------------------------------- | ||
| 1430 | |||
| 1431 | // ---------------------------------------------------------------------------- | ||
| 1432 | // Input Register Declaration w/System Generated Value | ||
| 1433 | // (available for all shaders incl. Pixel Shader, no interpolation mode needed) | ||
| 1434 | // | ||
| 1435 | // OpcodeToken0: | ||
| 1436 | // | ||
| 1437 | // [10:00] D3D10_SB_OPCODE_DCL_INPUT_SGV | ||
| 1438 | // [23:11] Ignored, 0 | ||
| 1439 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 1440 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 1441 | // contains extended operand description. This dcl is currently not | ||
| 1442 | // extended. | ||
| 1443 | // | ||
| 1444 | // OpcodeToken0 is followed by 2 operands: | ||
| 1445 | // (1) Operand, starting with OperandToken0, defining which input | ||
| 1446 | // v# register (D3D10_SB_OPERAND_TYPE_INPUT) is being declared, | ||
| 1447 | // including writemask. | ||
| 1448 | // (2) a System Generated Value Name (NameToken) | ||
| 1449 | // | ||
| 1450 | // ---------------------------------------------------------------------------- | ||
| 1451 | |||
| 1452 | // ---------------------------------------------------------------------------- | ||
| 1453 | // Pixel Shader Input Register Declaration | ||
| 1454 | // | ||
| 1455 | // OpcodeToken0: | ||
| 1456 | // | ||
| 1457 | // [10:00] D3D10_SB_OPCODE_DCL_INPUT_PS | ||
| 1458 | // [14:11] D3D10_SB_INTERPOLATION_MODE | ||
| 1459 | // [23:15] Ignored, 0 | ||
| 1460 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 1461 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 1462 | // contains extended operand description. This dcl is currently not | ||
| 1463 | // extended. | ||
| 1464 | // | ||
| 1465 | // OpcodeToken0 is followed by 1 operand: | ||
| 1466 | // (1) Operand, starting with OperandToken0, defining which input | ||
| 1467 | // v# register (D3D10_SB_OPERAND_TYPE_INPUT) is being declared, | ||
| 1468 | // including writemask. | ||
| 1469 | // | ||
| 1470 | // ---------------------------------------------------------------------------- | ||
| 1471 | #define D3D10_SB_INPUT_INTERPOLATION_MODE_MASK 0x00007800 | ||
| 1472 | #define D3D10_SB_INPUT_INTERPOLATION_MODE_SHIFT 11 | ||
| 1473 | |||
| 1474 | // DECODER MACRO: Find out interpolation mode for the input register | ||
| 1475 | #define DECODE_D3D10_SB_INPUT_INTERPOLATION_MODE(OpcodeToken0) ((D3D10_SB_INTERPOLATION_MODE)(((OpcodeToken0)&D3D10_SB_INPUT_INTERPOLATION_MODE_MASK)>>D3D10_SB_INPUT_INTERPOLATION_MODE_SHIFT)) | ||
| 1476 | |||
| 1477 | // ENCODER MACRO: Encode interpolation mode for a register. | ||
| 1478 | #define ENCODE_D3D10_SB_INPUT_INTERPOLATION_MODE(InterpolationMode) (((InterpolationMode)<<D3D10_SB_INPUT_INTERPOLATION_MODE_SHIFT)&D3D10_SB_INPUT_INTERPOLATION_MODE_MASK) | ||
| 1479 | |||
| 1480 | // ---------------------------------------------------------------------------- | ||
| 1481 | // Pixel Shader Input Register Declaration w/System Interpreted Value | ||
| 1482 | // | ||
| 1483 | // OpcodeToken0: | ||
| 1484 | // | ||
| 1485 | // [10:00] D3D10_SB_OPCODE_DCL_INPUT_PS_SIV | ||
| 1486 | // [14:11] D3D10_SB_INTERPOLATION_MODE | ||
| 1487 | // [23:15] Ignored, 0 | ||
| 1488 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 1489 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 1490 | // contains extended operand description. This dcl is currently not | ||
| 1491 | // extended. | ||
| 1492 | // | ||
| 1493 | // OpcodeToken0 is followed by 2 operands: | ||
| 1494 | // (1) Operand, starting with OperandToken0, defining which input | ||
| 1495 | // v# register (D3D10_SB_OPERAND_TYPE_INPUT) is being declared. | ||
| 1496 | // (2) a System Interpreted Value Name (NameToken) | ||
| 1497 | // | ||
| 1498 | // ---------------------------------------------------------------------------- | ||
| 1499 | |||
| 1500 | // ---------------------------------------------------------------------------- | ||
| 1501 | // Pixel Shader Input Register Declaration w/System Generated Value | ||
| 1502 | // | ||
| 1503 | // OpcodeToken0: | ||
| 1504 | // | ||
| 1505 | // [10:00] D3D10_SB_OPCODE_DCL_INPUT_PS_SGV | ||
| 1506 | // [23:11] Ignored, 0 | ||
| 1507 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 1508 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 1509 | // contains extended operand description. This dcl is currently not | ||
| 1510 | // extended. | ||
| 1511 | // | ||
| 1512 | // OpcodeToken0 is followed by 2 operands: | ||
| 1513 | // (1) Operand, starting with OperandToken0, defining which input | ||
| 1514 | // v# register (D3D10_SB_OPERAND_TYPE_INPUT) is being declared. | ||
| 1515 | // (2) a System Generated Value Name (NameToken) | ||
| 1516 | // | ||
| 1517 | // ---------------------------------------------------------------------------- | ||
| 1518 | |||
| 1519 | // ---------------------------------------------------------------------------- | ||
| 1520 | // Output Register Declaration | ||
| 1521 | // | ||
| 1522 | // OpcodeToken0: | ||
| 1523 | // | ||
| 1524 | // [10:00] D3D10_SB_OPCODE_DCL_OUTPUT | ||
| 1525 | // [23:11] Ignored, 0 | ||
| 1526 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 1527 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 1528 | // contains extended operand description. This dcl is currently not | ||
| 1529 | // extended. | ||
| 1530 | // | ||
| 1531 | // OpcodeToken0 is followed by 1 operand: | ||
| 1532 | // (1) Operand, starting with OperandToken0, defining which | ||
| 1533 | // o# register (D3D10_SB_OPERAND_TYPE_OUTPUT) is being declared, | ||
| 1534 | // including writemask. | ||
| 1535 | // (in Pixel Shader, output can also be one of | ||
| 1536 | // D3D10_SB_OPERAND_TYPE_OUTPUT_DEPTH, | ||
| 1537 | // D3D11_SB_OPERAND_TYPE_OUTPUT_DEPTH_GREATER_EQUAL, or | ||
| 1538 | // D3D11_SB_OPERAND_TYPE_OUTPUT_DEPTH_LESS_EQUAL ) | ||
| 1539 | // | ||
| 1540 | // ---------------------------------------------------------------------------- | ||
| 1541 | |||
| 1542 | // ---------------------------------------------------------------------------- | ||
| 1543 | // Output Register Declaration w/System Interpreted Value | ||
| 1544 | // | ||
| 1545 | // OpcodeToken0: | ||
| 1546 | // | ||
| 1547 | // [10:00] D3D10_SB_OPCODE_DCL_OUTPUT_SIV | ||
| 1548 | // [23:11] Ignored, 0 | ||
| 1549 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 1550 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 1551 | // contains extended operand description. This dcl is currently not | ||
| 1552 | // extended. | ||
| 1553 | // | ||
| 1554 | // OpcodeToken0 is followed by 2 operands: | ||
| 1555 | // (1) an operand, starting with OperandToken0, defining which | ||
| 1556 | // o# register (D3D10_SB_OPERAND_TYPE_OUTPUT) is being declared, | ||
| 1557 | // including writemask. | ||
| 1558 | // (2) a System Interpreted Name token (NameToken) | ||
| 1559 | // | ||
| 1560 | // ---------------------------------------------------------------------------- | ||
| 1561 | |||
| 1562 | // ---------------------------------------------------------------------------- | ||
| 1563 | // Output Register Declaration w/System Generated Value | ||
| 1564 | // | ||
| 1565 | // OpcodeToken0: | ||
| 1566 | // | ||
| 1567 | // [10:00] D3D10_SB_OPCODE_DCL_OUTPUT_SGV | ||
| 1568 | // [23:11] Ignored, 0 | ||
| 1569 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 1570 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 1571 | // contains extended operand description. This dcl is currently not | ||
| 1572 | // extended. | ||
| 1573 | // | ||
| 1574 | // OpcodeToken0 is followed by 2 operands: | ||
| 1575 | // (1) an operand, starting with OperandToken0, defining which | ||
| 1576 | // o# register (D3D10_SB_OPERAND_TYPE_OUTPUT) is being declared, | ||
| 1577 | // including writemask. | ||
| 1578 | // (2) a System Generated Name token (NameToken) | ||
| 1579 | // | ||
| 1580 | // ---------------------------------------------------------------------------- | ||
| 1581 | |||
| 1582 | |||
| 1583 | // ---------------------------------------------------------------------------- | ||
| 1584 | // Input or Output Register Indexing Range Declaration | ||
| 1585 | // | ||
| 1586 | // OpcodeToken0: | ||
| 1587 | // | ||
| 1588 | // [10:00] D3D10_SB_OPCODE_DCL_INDEX_RANGE | ||
| 1589 | // [23:11] Ignored, 0 | ||
| 1590 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 1591 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 1592 | // contains extended operand description. This dcl is currently not | ||
| 1593 | // extended. | ||
| 1594 | // | ||
| 1595 | // OpcodeToken0 is followed by 2 operands: | ||
| 1596 | // (1) an operand, starting with OperandToken0, defining which | ||
| 1597 | // input (v#) or output (o#) register is having its array indexing range | ||
| 1598 | // declared, including writemask. For Geometry Shader inputs, | ||
| 1599 | // it is assumed that the vertex axis is always fully indexable, | ||
| 1600 | // and 0 must be specified as the vertex# in this declaration, so that | ||
| 1601 | // only the a range of attributes are having their index range defined. | ||
| 1602 | // | ||
| 1603 | // (2) a DWORD representing the count of registers starting from the one | ||
| 1604 | // indicated in (1). | ||
| 1605 | // | ||
| 1606 | // ---------------------------------------------------------------------------- | ||
| 1607 | |||
| 1608 | // ---------------------------------------------------------------------------- | ||
| 1609 | // Temp Register Declaration r0...r(n-1) | ||
| 1610 | // | ||
| 1611 | // OpcodeToken0: | ||
| 1612 | // | ||
| 1613 | // [10:00] D3D10_SB_OPCODE_DCL_TEMPS | ||
| 1614 | // [23:11] Ignored, 0 | ||
| 1615 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 1616 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 1617 | // contains extended operand description. This dcl is currently not | ||
| 1618 | // extended. | ||
| 1619 | // | ||
| 1620 | // OpcodeToken0 is followed by 1 operand: | ||
| 1621 | // (1) DWORD (unsigned int) indicating how many temps are being declared. | ||
| 1622 | // i.e. 5 means r0...r4 are declared. | ||
| 1623 | // | ||
| 1624 | // ---------------------------------------------------------------------------- | ||
| 1625 | |||
| 1626 | // ---------------------------------------------------------------------------- | ||
| 1627 | // Indexable Temp Register (x#[size]) Declaration | ||
| 1628 | // | ||
| 1629 | // OpcodeToken0: | ||
| 1630 | // | ||
| 1631 | // [10:00] D3D10_SB_OPCODE_DCL_INDEXABLE_TEMP | ||
| 1632 | // [23:11] Ignored, 0 | ||
| 1633 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 1634 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 1635 | // contains extended operand description. This dcl is currently not | ||
| 1636 | // extended. | ||
| 1637 | // | ||
| 1638 | // OpcodeToken0 is followed by 3 DWORDs: | ||
| 1639 | // (1) Register index (defines which x# register is declared) | ||
| 1640 | // (2) Number of registers in this register bank | ||
| 1641 | // (3) Number of components in the array (1-4). 1 means .x, 2 means .xy etc. | ||
| 1642 | // | ||
| 1643 | // ---------------------------------------------------------------------------- | ||
| 1644 | |||
| 1645 | // ---------------------------------------------------------------------------- | ||
| 1646 | // Constant Buffer Declaration | ||
| 1647 | // | ||
| 1648 | // OpcodeToken0: | ||
| 1649 | // | ||
| 1650 | // [10:00] D3D10_SB_OPCODE_DCL_CONSTANT_BUFFER | ||
| 1651 | // [11] D3D10_SB_CONSTANT_BUFFER_ACCESS_PATTERN | ||
| 1652 | // [23:12] Ignored, 0 | ||
| 1653 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 1654 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 1655 | // contains extended operand description. This dcl is currently not | ||
| 1656 | // extended. | ||
| 1657 | // | ||
| 1658 | // OpcodeToken0 is followed by 1 operand on Shader Model 4.0 through 5.0: | ||
| 1659 | // (1) Operand, starting with OperandToken0, defining which CB slot (cb#[size]) | ||
| 1660 | // is being declared. (operand type: D3D10_SB_OPERAND_TYPE_CONSTANT_BUFFER) | ||
| 1661 | // The indexing dimension for the register must be | ||
| 1662 | // D3D10_SB_OPERAND_INDEX_DIMENSION_2D, where the first index specifies | ||
| 1663 | // which cb#[] is being declared, and the second (array) index specifies the size | ||
| 1664 | // of the buffer, as a count of 32-bit*4 elements. (As opposed to when the | ||
| 1665 | // cb#[] is used in shader instructions, and the array index represents which | ||
| 1666 | // location in the constant buffer is being referenced.) | ||
| 1667 | // If the size is specified as 0, the CB size is not known (any size CB | ||
| 1668 | // can be bound to the slot). | ||
| 1669 | // | ||
| 1670 | // The order of constant buffer declarations in a shader indicates their | ||
| 1671 | // relative priority from highest to lowest (hint to driver). | ||
| 1672 | // | ||
| 1673 | // OpcodeToken0 is followed by 3 operands on Shader Model 5.1 and later: | ||
| 1674 | // (1) Operand, starting with OperandToken0, defining which CB range (ID and bounds) | ||
| 1675 | // is being declared. (operand type: D3D10_SB_OPERAND_TYPE_CONSTANT_BUFFER) | ||
| 1676 | // The indexing dimension for the register must be D3D10_SB_OPERAND_INDEX_DIMENSION_3D, | ||
| 1677 | // and the meaning of the index dimensions are as follows: (cb<id>[<lbound>:<ubound>]) | ||
| 1678 | // 1 <id>: variable ID being declared | ||
| 1679 | // 2 <lbound>: the lower bound of the range of constant buffers in the space | ||
| 1680 | // 3 <ubound>: the upper bound (inclusive) of this range | ||
| 1681 | // As opposed to when the cb#[] is used in shader instructions: (cb<id>[<idx>][<loc>]) | ||
| 1682 | // 1 <id>: variable ID being used (matches dcl) | ||
| 1683 | // 2 <idx>: absolute index of constant buffer within space (may be dynamically indexed) | ||
| 1684 | // 3 <loc>: location of vector within constant buffer being referenced, | ||
| 1685 | // which may also be dynamically indexed, with no access pattern flag required. | ||
| 1686 | // (2) a DWORD indicating the size of the constant buffer as a count of 16-byte vectors. | ||
| 1687 | // Each vector is 32-bit*4 elements == 128-bits == 16 bytes. | ||
| 1688 | // If the size is specified as 0, the CB size is not known (any size CB | ||
| 1689 | // can be bound to the slot). | ||
| 1690 | // (3) a DWORD indicating the space index. | ||
| 1691 | // | ||
| 1692 | // ---------------------------------------------------------------------------- | ||
| 1693 | |||
| 1694 | typedef enum D3D10_SB_CONSTANT_BUFFER_ACCESS_PATTERN | ||
| 1695 | { | ||
| 1696 | D3D10_SB_CONSTANT_BUFFER_IMMEDIATE_INDEXED = 0, | ||
| 1697 | D3D10_SB_CONSTANT_BUFFER_DYNAMIC_INDEXED = 1 | ||
| 1698 | } D3D10_SB_CONSTANT_BUFFER_ACCESS_PATTERN; | ||
| 1699 | |||
| 1700 | #define D3D10_SB_CONSTANT_BUFFER_ACCESS_PATTERN_MASK 0x00000800 | ||
| 1701 | #define D3D10_SB_CONSTANT_BUFFER_ACCESS_PATTERN_SHIFT 11 | ||
| 1702 | |||
| 1703 | // DECODER MACRO: Find out if a Constant Buffer is going to be indexed or not | ||
| 1704 | #define DECODE_D3D10_SB_CONSTANT_BUFFER_ACCESS_PATTERN(OpcodeToken0) ((D3D10_SB_CONSTANT_BUFFER_ACCESS_PATTERN)(((OpcodeToken0)&D3D10_SB_CONSTANT_BUFFER_ACCESS_PATTERN_MASK)>>D3D10_SB_CONSTANT_BUFFER_ACCESS_PATTERN_SHIFT)) | ||
| 1705 | |||
| 1706 | // ENCODER MACRO: Encode the access pattern for the Constant Buffer | ||
| 1707 | #define ENCODE_D3D10_SB_D3D10_SB_CONSTANT_BUFFER_ACCESS_PATTERN(AccessPattern) (((AccessPattern)<<D3D10_SB_CONSTANT_BUFFER_ACCESS_PATTERN_SHIFT)&D3D10_SB_CONSTANT_BUFFER_ACCESS_PATTERN_MASK) | ||
| 1708 | |||
| 1709 | // ---------------------------------------------------------------------------- | ||
| 1710 | // Immediate Constant Buffer Declaration | ||
| 1711 | // | ||
| 1712 | // OpcodeToken0: | ||
| 1713 | // | ||
| 1714 | // [10:00] D3D10_SB_OPCODE_CUSTOMDATA | ||
| 1715 | // [31:11] == D3D10_SB_CUSTOMDATA_DCL_IMMEDIATE_CONSTANT_BUFFER | ||
| 1716 | // | ||
| 1717 | // OpcodeToken0 is followed by: | ||
| 1718 | // (1) DWORD indicating length of declaration, including OpcodeToken0. | ||
| 1719 | // This length must = 2(for OpcodeToken0 and 1) + a multiple of 4 | ||
| 1720 | // (# of immediate constants) | ||
| 1721 | // (2) Sequence of 4-tuples of DWORDs defining the Immediate Constant Buffer. | ||
| 1722 | // The number of 4-tuples is (length above - 1) / 4 | ||
| 1723 | // ---------------------------------------------------------------------------- | ||
| 1724 | |||
| 1725 | // ---------------------------------------------------------------------------- | ||
| 1726 | // Shader Message Declaration | ||
| 1727 | // | ||
| 1728 | // OpcodeToken0: | ||
| 1729 | // | ||
| 1730 | // [10:00] D3D10_SB_OPCODE_CUSTOMDATA | ||
| 1731 | // [31:11] == D3D11_SB_CUSTOMDATA_SHADER_MESSAGE | ||
| 1732 | // | ||
| 1733 | // OpcodeToken0 is followed by: | ||
| 1734 | // (1) DWORD indicating length of declaration, including OpcodeToken0. | ||
| 1735 | // (2) DWORD (D3D11_SB_SHADER_MESSAGE_ID) indicating shader message or error. | ||
| 1736 | // (3) D3D11_SB_SHADER_MESSAGE_FORMAT indicating the convention for formatting the message. | ||
| 1737 | // (4) DWORD indicating the number of characters in the string without the terminator. | ||
| 1738 | // (5) DWORD indicating the number of operands. | ||
| 1739 | // (6) DWORD indicating length of operands. | ||
| 1740 | // (7) Encoded operands. | ||
| 1741 | // (8) String with trailing zero, padded to a multiple of DWORDs. | ||
| 1742 | // The string is in the given format and the operands given should | ||
| 1743 | // be used for argument substitutions when formatting. | ||
| 1744 | // ---------------------------------------------------------------------------- | ||
| 1745 | |||
| 1746 | typedef enum D3D11_SB_SHADER_MESSAGE_ID | ||
| 1747 | { | ||
| 1748 | D3D11_SB_SHADER_MESSAGE_ID_MESSAGE = 0x00200102, | ||
| 1749 | D3D11_SB_SHADER_MESSAGE_ID_ERROR = 0x00200103 | ||
| 1750 | } D3D11_SB_SHADER_MESSAGE_ID; | ||
| 1751 | |||
| 1752 | typedef enum D3D11_SB_SHADER_MESSAGE_FORMAT | ||
| 1753 | { | ||
| 1754 | // No formatting, just a text string. Operands are ignored. | ||
| 1755 | D3D11_SB_SHADER_MESSAGE_FORMAT_ANSI_TEXT, | ||
| 1756 | // Format string follows C/C++ printf conventions. | ||
| 1757 | D3D11_SB_SHADER_MESSAGE_FORMAT_ANSI_PRINTF, | ||
| 1758 | } D3D11_SB_SHADER_MESSAGE_FORMAT; | ||
| 1759 | |||
| 1760 | // ---------------------------------------------------------------------------- | ||
| 1761 | // Shader Clip Plane Constant Mappings for DX9 hardware | ||
| 1762 | // | ||
| 1763 | // OpcodeToken0: | ||
| 1764 | // | ||
| 1765 | // [10:00] D3D10_SB_OPCODE_CUSTOMDATA | ||
| 1766 | // [31:11] == D3D11_SB_CUSTOMDATA_SHADER_CLIP_PLANE_CONSTANT_MAPPINGS_FOR_DX9 | ||
| 1767 | // | ||
| 1768 | // OpcodeToken0 is followed by: | ||
| 1769 | // (1) DWORD indicating length of declaration, including OpcodeToken0. | ||
| 1770 | // (2) DWORD indicating number of constant mappings (up to 6 mappings). | ||
| 1771 | // (3+) Constant mapping tables in following format. | ||
| 1772 | // | ||
| 1773 | // struct _Clip_Plane_Constant_Mapping | ||
| 1774 | // { | ||
| 1775 | // WORD ConstantBufferIndex; // cb[n] | ||
| 1776 | // WORD StartConstantElement; // starting index of cb[n][m] | ||
| 1777 | // WORD ConstantElemntCount; // number of elements cb[n][m] ~ cb[n][m+l] | ||
| 1778 | // WORD Reserved; // | ||
| 1779 | // }; | ||
| 1780 | // ---------------------------------------------------------------------------- | ||
| 1781 | |||
| 1782 | // ---------------------------------------------------------------------------- | ||
| 1783 | // Geometry Shader Input Primitive Declaration | ||
| 1784 | // | ||
| 1785 | // OpcodeToken0: | ||
| 1786 | // | ||
| 1787 | // [10:00] D3D10_SB_OPCODE_DCL_GS_INPUT_PRIMITIVE | ||
| 1788 | // [16:11] D3D10_SB_PRIMITIVE [not D3D10_SB_PRIMITIVE_TOPOLOGY] | ||
| 1789 | // [23:17] Ignored, 0 | ||
| 1790 | // [30:24] Instruction length in DWORDs including the opcode token. == 1 | ||
| 1791 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 1792 | // contains extended operand description. This dcl is currently not | ||
| 1793 | // extended. | ||
| 1794 | // | ||
| 1795 | // ---------------------------------------------------------------------------- | ||
| 1796 | |||
| 1797 | #define D3D10_SB_GS_INPUT_PRIMITIVE_MASK 0x0001f800 | ||
| 1798 | #define D3D10_SB_GS_INPUT_PRIMITIVE_SHIFT 11 | ||
| 1799 | |||
| 1800 | // DECODER MACRO: Given a primitive topology declaration, | ||
| 1801 | // (OpcodeToken0), determine the primitive topology | ||
| 1802 | // (D3D10_SB_PRIMITIVE enum) | ||
| 1803 | #define DECODE_D3D10_SB_GS_INPUT_PRIMITIVE(OpcodeToken0) ((D3D10_SB_PRIMITIVE)(((OpcodeToken0)&D3D10_SB_GS_INPUT_PRIMITIVE_MASK)>>D3D10_SB_GS_INPUT_PRIMITIVE_SHIFT)) | ||
| 1804 | |||
| 1805 | // ENCODER MACRO: Store primitive topology | ||
| 1806 | // (D3D10_SB_PRIMITIVE enum) into a | ||
| 1807 | // a primitive topology declaration token (OpcodeToken0) | ||
| 1808 | #define ENCODE_D3D10_SB_GS_INPUT_PRIMITIVE(Prim) (((Prim)<<D3D10_SB_GS_INPUT_PRIMITIVE_SHIFT)&D3D10_SB_GS_INPUT_PRIMITIVE_MASK) | ||
| 1809 | |||
| 1810 | // ---------------------------------------------------------------------------- | ||
| 1811 | // Geometry Shader Output Topology Declaration | ||
| 1812 | // | ||
| 1813 | // OpcodeToken0: | ||
| 1814 | // | ||
| 1815 | // [10:00] D3D10_SB_OPCODE_DCL_GS_OUTPUT_PRIMITIVE_TOPOLOGY | ||
| 1816 | // [17:11] D3D10_SB_PRIMITIVE_TOPOLOGY | ||
| 1817 | // [23:18] Ignored, 0 | ||
| 1818 | // [30:24] Instruction length in DWORDs including the opcode token. == 1 | ||
| 1819 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 1820 | // contains extended operand description. This dcl is currently not | ||
| 1821 | // extended. | ||
| 1822 | // | ||
| 1823 | // ---------------------------------------------------------------------------- | ||
| 1824 | |||
| 1825 | #define D3D10_SB_GS_OUTPUT_PRIMITIVE_TOPOLOGY_MASK 0x0001f800 | ||
| 1826 | #define D3D10_SB_GS_OUTPUT_PRIMITIVE_TOPOLOGY_SHIFT 11 | ||
| 1827 | |||
| 1828 | // DECODER MACRO: Given a primitive topology declaration, | ||
| 1829 | // (OpcodeToken0), determine the primitive topology | ||
| 1830 | // (D3D10_SB_PRIMITIVE_TOPOLOGY enum) | ||
| 1831 | #define DECODE_D3D10_SB_GS_OUTPUT_PRIMITIVE_TOPOLOGY(OpcodeToken0) ((D3D10_SB_PRIMITIVE_TOPOLOGY)(((OpcodeToken0)&D3D10_SB_GS_OUTPUT_PRIMITIVE_TOPOLOGY_MASK)>>D3D10_SB_GS_OUTPUT_PRIMITIVE_TOPOLOGY_SHIFT)) | ||
| 1832 | |||
| 1833 | // ENCODER MACRO: Store primitive topology | ||
| 1834 | // (D3D10_SB_PRIMITIVE_TOPOLOGY enum) into a | ||
| 1835 | // a primitive topology declaration token (OpcodeToken0) | ||
| 1836 | #define ENCODE_D3D10_SB_GS_OUTPUT_PRIMITIVE_TOPOLOGY(PrimTopology) (((PrimTopology)<<D3D10_SB_GS_OUTPUT_PRIMITIVE_TOPOLOGY_SHIFT)&D3D10_SB_GS_OUTPUT_PRIMITIVE_TOPOLOGY_MASK) | ||
| 1837 | |||
| 1838 | // ---------------------------------------------------------------------------- | ||
| 1839 | // Geometry Shader Maximum Output Vertex Count Declaration | ||
| 1840 | // | ||
| 1841 | // OpcodeToken0: | ||
| 1842 | // | ||
| 1843 | // [10:00] D3D10_SB_OPCODE_DCL_MAX_OUTPUT_VERTEX_COUNT | ||
| 1844 | // [23:11] Ignored, 0 | ||
| 1845 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 1846 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 1847 | // contains extended operand description. This dcl is currently not | ||
| 1848 | // extended. | ||
| 1849 | // | ||
| 1850 | // OpcodeToken0 is followed by a DWORD representing the | ||
| 1851 | // maximum number of primitives that could be output | ||
| 1852 | // by the Geometry Shader. | ||
| 1853 | // | ||
| 1854 | // ---------------------------------------------------------------------------- | ||
| 1855 | |||
| 1856 | // ---------------------------------------------------------------------------- | ||
| 1857 | // Geometry Shader Instance Count Declaration | ||
| 1858 | // | ||
| 1859 | // OpcodeToken0: | ||
| 1860 | // | ||
| 1861 | // [10:00] D3D11_SB_OPCODE_DCL_GS_INSTANCE_COUNT | ||
| 1862 | // [23:11] Ignored, 0 | ||
| 1863 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 1864 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 1865 | // contains extended operand description. This dcl is currently not | ||
| 1866 | // extended. | ||
| 1867 | // | ||
| 1868 | // OpcodeToken0 is followed by a UINT32 representing the | ||
| 1869 | // number of instances of the geometry shader program to execute. | ||
| 1870 | // | ||
| 1871 | // ---------------------------------------------------------------------------- | ||
| 1872 | |||
| 1873 | // ---------------------------------------------------------------------------- | ||
| 1874 | // Hull Shader Declaration Phase: HS/DS Input Control Point Count | ||
| 1875 | // | ||
| 1876 | // OpcodeToken0: | ||
| 1877 | // | ||
| 1878 | // [10:00] D3D11_SB_OPCODE_DCL_INPUT_CONTROL_POINT_COUNT | ||
| 1879 | // [16:11] Control point count | ||
| 1880 | // [23:17] Ignored, 0 | ||
| 1881 | // [30:24] Instruction length in DWORDs including the opcode token. == 1 | ||
| 1882 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 1883 | // contains extended operand description. This dcl is currently not | ||
| 1884 | // extended. | ||
| 1885 | // | ||
| 1886 | // ---------------------------------------------------------------------------- | ||
| 1887 | #define D3D11_SB_INPUT_CONTROL_POINT_COUNT_MASK 0x0001f800 | ||
| 1888 | #define D3D11_SB_INPUT_CONTROL_POINT_COUNT_SHIFT 11 | ||
| 1889 | |||
| 1890 | // DECODER MACRO: Given an input control point count declaration token, | ||
| 1891 | // (OpcodeToken0), determine the control point count | ||
| 1892 | #define DECODE_D3D11_SB_INPUT_CONTROL_POINT_COUNT(OpcodeToken0) ((UINT)(((OpcodeToken0)&D3D11_SB_INPUT_CONTROL_POINT_COUNT_MASK)>>D3D11_SB_INPUT_CONTROL_POINT_COUNT_SHIFT)) | ||
| 1893 | |||
| 1894 | // ENCODER MACRO: Store input control point count into a declaration token | ||
| 1895 | #define ENCODE_D3D11_SB_INPUT_CONTROL_POINT_COUNT(Count) (((Count)<<D3D11_SB_INPUT_CONTROL_POINT_COUNT_SHIFT)&D3D11_SB_INPUT_CONTROL_POINT_COUNT_MASK) | ||
| 1896 | |||
| 1897 | // ---------------------------------------------------------------------------- | ||
| 1898 | // Hull Shader Declaration Phase: HS Output Control Point Count | ||
| 1899 | // | ||
| 1900 | // OpcodeToken0: | ||
| 1901 | // | ||
| 1902 | // [10:00] D3D11_SB_OPCODE_DCL_OUTPUT_CONTROL_POINT_COUNT | ||
| 1903 | // [16:11] Control point count | ||
| 1904 | // [23:17] Ignored, 0 | ||
| 1905 | // [30:24] Instruction length in DWORDs including the opcode token. == 1 | ||
| 1906 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 1907 | // contains extended operand description. This dcl is currently not | ||
| 1908 | // extended. | ||
| 1909 | // | ||
| 1910 | // ---------------------------------------------------------------------------- | ||
| 1911 | #define D3D11_SB_OUTPUT_CONTROL_POINT_COUNT_MASK 0x0001f800 | ||
| 1912 | #define D3D11_SB_OUTPUT_CONTROL_POINT_COUNT_SHIFT 11 | ||
| 1913 | |||
| 1914 | // DECODER MACRO: Given an output control point count declaration token, | ||
| 1915 | // (OpcodeToken0), determine the control point count | ||
| 1916 | #define DECODE_D3D11_SB_OUTPUT_CONTROL_POINT_COUNT(OpcodeToken0) ((UINT)(((OpcodeToken0)&D3D11_SB_OUTPUT_CONTROL_POINT_COUNT_MASK)>>D3D11_SB_OUTPUT_CONTROL_POINT_COUNT_SHIFT)) | ||
| 1917 | |||
| 1918 | // ENCODER MACRO: Store output control point count into a declaration token | ||
| 1919 | #define ENCODE_D3D11_SB_OUTPUT_CONTROL_POINT_COUNT(Count) (((Count)<<D3D11_SB_OUTPUT_CONTROL_POINT_COUNT_SHIFT)&D3D11_SB_OUTPUT_CONTROL_POINT_COUNT_MASK) | ||
| 1920 | |||
| 1921 | // ---------------------------------------------------------------------------- | ||
| 1922 | // Hull Shader Declaration Phase: Tessellator Domain | ||
| 1923 | // | ||
| 1924 | // OpcodeToken0: | ||
| 1925 | // | ||
| 1926 | // [10:00] D3D11_SB_OPCODE_DCL_TESS_DOMAIN | ||
| 1927 | // [12:11] Domain | ||
| 1928 | // [23:13] Ignored, 0 | ||
| 1929 | // [30:24] Instruction length in DWORDs including the opcode token. == 1 | ||
| 1930 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 1931 | // contains extended operand description. This dcl is currently not | ||
| 1932 | // extended. | ||
| 1933 | // | ||
| 1934 | // ---------------------------------------------------------------------------- | ||
| 1935 | typedef enum D3D11_SB_TESSELLATOR_DOMAIN | ||
| 1936 | { | ||
| 1937 | D3D11_SB_TESSELLATOR_DOMAIN_UNDEFINED = 0, | ||
| 1938 | D3D11_SB_TESSELLATOR_DOMAIN_ISOLINE = 1, | ||
| 1939 | D3D11_SB_TESSELLATOR_DOMAIN_TRI = 2, | ||
| 1940 | D3D11_SB_TESSELLATOR_DOMAIN_QUAD = 3 | ||
| 1941 | } D3D11_SB_TESSELLATOR_DOMAIN; | ||
| 1942 | |||
| 1943 | #define D3D11_SB_TESS_DOMAIN_MASK 0x00001800 | ||
| 1944 | #define D3D11_SB_TESS_DOMAIN_SHIFT 11 | ||
| 1945 | |||
| 1946 | // DECODER MACRO: Given a tessellator domain declaration, | ||
| 1947 | // (OpcodeToken0), determine the domain | ||
| 1948 | // (D3D11_SB_TESSELLATOR_DOMAIN enum) | ||
| 1949 | #define DECODE_D3D11_SB_TESS_DOMAIN(OpcodeToken0) ((D3D11_SB_TESSELLATOR_DOMAIN)(((OpcodeToken0)&D3D11_SB_TESS_DOMAIN_MASK)>>D3D11_SB_TESS_DOMAIN_SHIFT)) | ||
| 1950 | |||
| 1951 | // ENCODER MACRO: Store tessellator domain | ||
| 1952 | // (D3D11_SB_TESSELLATOR_DOMAIN enum) into a | ||
| 1953 | // a tessellator domain declaration token (OpcodeToken0) | ||
| 1954 | #define ENCODE_D3D11_SB_TESS_DOMAIN(Domain) (((Domain)<<D3D11_SB_TESS_DOMAIN_SHIFT)&D3D11_SB_TESS_DOMAIN_MASK) | ||
| 1955 | |||
| 1956 | // ---------------------------------------------------------------------------- | ||
| 1957 | // Hull Shader Declaration Phase: Tessellator Partitioning | ||
| 1958 | // | ||
| 1959 | // OpcodeToken0: | ||
| 1960 | // | ||
| 1961 | // [10:00] D3D11_SB_OPCODE_DCL_TESS_PARTITIONING | ||
| 1962 | // [13:11] Partitioning | ||
| 1963 | // [23:14] Ignored, 0 | ||
| 1964 | // [30:24] Instruction length in DWORDs including the opcode token. == 1 | ||
| 1965 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 1966 | // contains extended operand description. This dcl is currently not | ||
| 1967 | // extended. | ||
| 1968 | // | ||
| 1969 | // ---------------------------------------------------------------------------- | ||
| 1970 | typedef enum D3D11_SB_TESSELLATOR_PARTITIONING | ||
| 1971 | { | ||
| 1972 | D3D11_SB_TESSELLATOR_PARTITIONING_UNDEFINED = 0, | ||
| 1973 | D3D11_SB_TESSELLATOR_PARTITIONING_INTEGER = 1, | ||
| 1974 | D3D11_SB_TESSELLATOR_PARTITIONING_POW2 = 2, | ||
| 1975 | D3D11_SB_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD = 3, | ||
| 1976 | D3D11_SB_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN = 4 | ||
| 1977 | } D3D11_SB_TESSELLATOR_PARTITIONING; | ||
| 1978 | |||
| 1979 | #define D3D11_SB_TESS_PARTITIONING_MASK 0x00003800 | ||
| 1980 | #define D3D11_SB_TESS_PARTITIONING_SHIFT 11 | ||
| 1981 | |||
| 1982 | // DECODER MACRO: Given a tessellator partitioning declaration, | ||
| 1983 | // (OpcodeToken0), determine the domain | ||
| 1984 | // (D3D11_SB_TESSELLATOR_PARTITIONING enum) | ||
| 1985 | #define DECODE_D3D11_SB_TESS_PARTITIONING(OpcodeToken0) ((D3D11_SB_TESSELLATOR_PARTITIONING)(((OpcodeToken0)&D3D11_SB_TESS_PARTITIONING_MASK)>>D3D11_SB_TESS_PARTITIONING_SHIFT)) | ||
| 1986 | |||
| 1987 | // ENCODER MACRO: Store tessellator partitioning | ||
| 1988 | // (D3D11_SB_TESSELLATOR_PARTITIONING enum) into a | ||
| 1989 | // a tessellator partitioning declaration token (OpcodeToken0) | ||
| 1990 | #define ENCODE_D3D11_SB_TESS_PARTITIONING(Partitioning) (((Partitioning)<<D3D11_SB_TESS_PARTITIONING_SHIFT)&D3D11_SB_TESS_PARTITIONING_MASK) | ||
| 1991 | |||
| 1992 | // ---------------------------------------------------------------------------- | ||
| 1993 | // Hull Shader Declaration Phase: Tessellator Output Primitive | ||
| 1994 | // | ||
| 1995 | // OpcodeToken0: | ||
| 1996 | // | ||
| 1997 | // [10:00] D3D11_SB_OPCODE_DCL_TESS_OUTPUT_PRIMITIVE | ||
| 1998 | // [13:11] Output Primitive | ||
| 1999 | // [23:14] Ignored, 0 | ||
| 2000 | // [30:24] Instruction length in DWORDs including the opcode token. == 1 | ||
| 2001 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 2002 | // contains extended operand description. This dcl is currently not | ||
| 2003 | // extended. | ||
| 2004 | // | ||
| 2005 | // ---------------------------------------------------------------------------- | ||
| 2006 | typedef enum D3D11_SB_TESSELLATOR_OUTPUT_PRIMITIVE | ||
| 2007 | { | ||
| 2008 | D3D11_SB_TESSELLATOR_OUTPUT_UNDEFINED = 0, | ||
| 2009 | D3D11_SB_TESSELLATOR_OUTPUT_POINT = 1, | ||
| 2010 | D3D11_SB_TESSELLATOR_OUTPUT_LINE = 2, | ||
| 2011 | D3D11_SB_TESSELLATOR_OUTPUT_TRIANGLE_CW = 3, | ||
| 2012 | D3D11_SB_TESSELLATOR_OUTPUT_TRIANGLE_CCW = 4 | ||
| 2013 | } D3D11_SB_TESSELLATOR_OUTPUT_PRIMITIVE; | ||
| 2014 | |||
| 2015 | #define D3D11_SB_TESS_OUTPUT_PRIMITIVE_MASK 0x00003800 | ||
| 2016 | #define D3D11_SB_TESS_OUTPUT_PRIMITIVE_SHIFT 11 | ||
| 2017 | |||
| 2018 | // DECODER MACRO: Given a tessellator output primitive declaration, | ||
| 2019 | // (OpcodeToken0), determine the domain | ||
| 2020 | // (D3D11_SB_TESSELLATOR_OUTPUT_PRIMITIVE enum) | ||
| 2021 | #define DECODE_D3D11_SB_TESS_OUTPUT_PRIMITIVE(OpcodeToken0) ((D3D11_SB_TESSELLATOR_OUTPUT_PRIMITIVE)(((OpcodeToken0)&D3D11_SB_TESS_OUTPUT_PRIMITIVE_MASK)>>D3D11_SB_TESS_OUTPUT_PRIMITIVE_SHIFT)) | ||
| 2022 | |||
| 2023 | // ENCODER MACRO: Store tessellator output primitive | ||
| 2024 | // (D3D11_SB_TESSELLATOR_OUTPUT_PRIMITIVE enum) into a | ||
| 2025 | // a tessellator output primitive declaration token (OpcodeToken0) | ||
| 2026 | #define ENCODE_D3D11_SB_TESS_OUTPUT_PRIMITIVE(OutputPrimitive) (((OutputPrimitive)<<D3D11_SB_TESS_OUTPUT_PRIMITIVE_SHIFT)&D3D11_SB_TESS_OUTPUT_PRIMITIVE_MASK) | ||
| 2027 | |||
| 2028 | |||
| 2029 | // ---------------------------------------------------------------------------- | ||
| 2030 | // Hull Shader Declaration Phase: Hull Shader Max Tessfactor | ||
| 2031 | // | ||
| 2032 | // OpcodeToken0: | ||
| 2033 | // | ||
| 2034 | // [10:00] D3D11_SB_OPCODE_DCL_HS_MAX_TESSFACTOR | ||
| 2035 | // [23:11] Ignored, 0 | ||
| 2036 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 2037 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 2038 | // contains extended operand description. This dcl is currently not | ||
| 2039 | // extended. | ||
| 2040 | // | ||
| 2041 | // OpcodeToken0 is followed by a float32 representing the | ||
| 2042 | // maximum TessFactor. | ||
| 2043 | // | ||
| 2044 | // ---------------------------------------------------------------------------- | ||
| 2045 | |||
| 2046 | // ---------------------------------------------------------------------------- | ||
| 2047 | // Hull Shader Declaration Phase: Hull Shader Fork Phase Instance Count | ||
| 2048 | // | ||
| 2049 | // OpcodeToken0: | ||
| 2050 | // | ||
| 2051 | // [10:00] D3D11_SB_OPCODE_DCL_HS_FORK_PHASE_INSTANCE_COUNT | ||
| 2052 | // [23:11] Ignored, 0 | ||
| 2053 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 2054 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 2055 | // contains extended operand description. This dcl is currently not | ||
| 2056 | // extended. | ||
| 2057 | // | ||
| 2058 | // OpcodeToken0 is followed by a UINT32 representing the | ||
| 2059 | // number of instances of the current fork phase program to execute. | ||
| 2060 | // | ||
| 2061 | // ---------------------------------------------------------------------------- | ||
| 2062 | |||
| 2063 | typedef enum D3D10_SB_INTERPOLATION_MODE | ||
| 2064 | { | ||
| 2065 | D3D10_SB_INTERPOLATION_UNDEFINED = 0, | ||
| 2066 | D3D10_SB_INTERPOLATION_CONSTANT = 1, | ||
| 2067 | D3D10_SB_INTERPOLATION_LINEAR = 2, | ||
| 2068 | D3D10_SB_INTERPOLATION_LINEAR_CENTROID = 3, | ||
| 2069 | D3D10_SB_INTERPOLATION_LINEAR_NOPERSPECTIVE = 4, | ||
| 2070 | D3D10_SB_INTERPOLATION_LINEAR_NOPERSPECTIVE_CENTROID = 5, | ||
| 2071 | D3D10_SB_INTERPOLATION_LINEAR_SAMPLE = 6, // DX10.1 | ||
| 2072 | D3D10_SB_INTERPOLATION_LINEAR_NOPERSPECTIVE_SAMPLE = 7, // DX10.1 | ||
| 2073 | } D3D10_SB_INTERPOLATION_MODE; | ||
| 2074 | |||
| 2075 | // Keep PRIMITIVE_TOPOLOGY values in sync with earlier DX versions (HW consumes values directly). | ||
| 2076 | typedef enum D3D10_SB_PRIMITIVE_TOPOLOGY | ||
| 2077 | { | ||
| 2078 | D3D10_SB_PRIMITIVE_TOPOLOGY_UNDEFINED = 0, | ||
| 2079 | D3D10_SB_PRIMITIVE_TOPOLOGY_POINTLIST = 1, | ||
| 2080 | D3D10_SB_PRIMITIVE_TOPOLOGY_LINELIST = 2, | ||
| 2081 | D3D10_SB_PRIMITIVE_TOPOLOGY_LINESTRIP = 3, | ||
| 2082 | D3D10_SB_PRIMITIVE_TOPOLOGY_TRIANGLELIST = 4, | ||
| 2083 | D3D10_SB_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = 5, | ||
| 2084 | // 6 is reserved for legacy triangle fans | ||
| 2085 | // Adjacency values should be equal to (0x8 & non-adjacency): | ||
| 2086 | D3D10_SB_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = 10, | ||
| 2087 | D3D10_SB_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = 11, | ||
| 2088 | D3D10_SB_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = 12, | ||
| 2089 | D3D10_SB_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = 13, | ||
| 2090 | } D3D10_SB_PRIMITIVE_TOPOLOGY; | ||
| 2091 | |||
| 2092 | typedef enum D3D10_SB_PRIMITIVE | ||
| 2093 | { | ||
| 2094 | D3D10_SB_PRIMITIVE_UNDEFINED = 0, | ||
| 2095 | D3D10_SB_PRIMITIVE_POINT = 1, | ||
| 2096 | D3D10_SB_PRIMITIVE_LINE = 2, | ||
| 2097 | D3D10_SB_PRIMITIVE_TRIANGLE = 3, | ||
| 2098 | // Adjacency values should be equal to (0x4 & non-adjacency): | ||
| 2099 | D3D10_SB_PRIMITIVE_LINE_ADJ = 6, | ||
| 2100 | D3D10_SB_PRIMITIVE_TRIANGLE_ADJ = 7, | ||
| 2101 | D3D11_SB_PRIMITIVE_1_CONTROL_POINT_PATCH = 8, | ||
| 2102 | D3D11_SB_PRIMITIVE_2_CONTROL_POINT_PATCH = 9, | ||
| 2103 | D3D11_SB_PRIMITIVE_3_CONTROL_POINT_PATCH = 10, | ||
| 2104 | D3D11_SB_PRIMITIVE_4_CONTROL_POINT_PATCH = 11, | ||
| 2105 | D3D11_SB_PRIMITIVE_5_CONTROL_POINT_PATCH = 12, | ||
| 2106 | D3D11_SB_PRIMITIVE_6_CONTROL_POINT_PATCH = 13, | ||
| 2107 | D3D11_SB_PRIMITIVE_7_CONTROL_POINT_PATCH = 14, | ||
| 2108 | D3D11_SB_PRIMITIVE_8_CONTROL_POINT_PATCH = 15, | ||
| 2109 | D3D11_SB_PRIMITIVE_9_CONTROL_POINT_PATCH = 16, | ||
| 2110 | D3D11_SB_PRIMITIVE_10_CONTROL_POINT_PATCH = 17, | ||
| 2111 | D3D11_SB_PRIMITIVE_11_CONTROL_POINT_PATCH = 18, | ||
| 2112 | D3D11_SB_PRIMITIVE_12_CONTROL_POINT_PATCH = 19, | ||
| 2113 | D3D11_SB_PRIMITIVE_13_CONTROL_POINT_PATCH = 20, | ||
| 2114 | D3D11_SB_PRIMITIVE_14_CONTROL_POINT_PATCH = 21, | ||
| 2115 | D3D11_SB_PRIMITIVE_15_CONTROL_POINT_PATCH = 22, | ||
| 2116 | D3D11_SB_PRIMITIVE_16_CONTROL_POINT_PATCH = 23, | ||
| 2117 | D3D11_SB_PRIMITIVE_17_CONTROL_POINT_PATCH = 24, | ||
| 2118 | D3D11_SB_PRIMITIVE_18_CONTROL_POINT_PATCH = 25, | ||
| 2119 | D3D11_SB_PRIMITIVE_19_CONTROL_POINT_PATCH = 26, | ||
| 2120 | D3D11_SB_PRIMITIVE_20_CONTROL_POINT_PATCH = 27, | ||
| 2121 | D3D11_SB_PRIMITIVE_21_CONTROL_POINT_PATCH = 28, | ||
| 2122 | D3D11_SB_PRIMITIVE_22_CONTROL_POINT_PATCH = 29, | ||
| 2123 | D3D11_SB_PRIMITIVE_23_CONTROL_POINT_PATCH = 30, | ||
| 2124 | D3D11_SB_PRIMITIVE_24_CONTROL_POINT_PATCH = 31, | ||
| 2125 | D3D11_SB_PRIMITIVE_25_CONTROL_POINT_PATCH = 32, | ||
| 2126 | D3D11_SB_PRIMITIVE_26_CONTROL_POINT_PATCH = 33, | ||
| 2127 | D3D11_SB_PRIMITIVE_27_CONTROL_POINT_PATCH = 34, | ||
| 2128 | D3D11_SB_PRIMITIVE_28_CONTROL_POINT_PATCH = 35, | ||
| 2129 | D3D11_SB_PRIMITIVE_29_CONTROL_POINT_PATCH = 36, | ||
| 2130 | D3D11_SB_PRIMITIVE_30_CONTROL_POINT_PATCH = 37, | ||
| 2131 | D3D11_SB_PRIMITIVE_31_CONTROL_POINT_PATCH = 38, | ||
| 2132 | D3D11_SB_PRIMITIVE_32_CONTROL_POINT_PATCH = 39, | ||
| 2133 | } D3D10_SB_PRIMITIVE; | ||
| 2134 | |||
| 2135 | typedef enum D3D10_SB_COMPONENT_MASK | ||
| 2136 | { | ||
| 2137 | D3D10_SB_COMPONENT_MASK_X = 1, | ||
| 2138 | D3D10_SB_COMPONENT_MASK_Y = 2, | ||
| 2139 | D3D10_SB_COMPONENT_MASK_Z = 4, | ||
| 2140 | D3D10_SB_COMPONENT_MASK_W = 8, | ||
| 2141 | D3D10_SB_COMPONENT_MASK_R = 1, | ||
| 2142 | D3D10_SB_COMPONENT_MASK_G = 2, | ||
| 2143 | D3D10_SB_COMPONENT_MASK_B = 4, | ||
| 2144 | D3D10_SB_COMPONENT_MASK_A = 8, | ||
| 2145 | D3D10_SB_COMPONENT_MASK_ALL = 15, | ||
| 2146 | } D3D10_SB_COMPONENT_MASK; | ||
| 2147 | |||
| 2148 | typedef enum D3D10_SB_NAME | ||
| 2149 | { | ||
| 2150 | D3D10_SB_NAME_UNDEFINED = 0, | ||
| 2151 | D3D10_SB_NAME_POSITION = 1, | ||
| 2152 | D3D10_SB_NAME_CLIP_DISTANCE = 2, | ||
| 2153 | D3D10_SB_NAME_CULL_DISTANCE = 3, | ||
| 2154 | D3D10_SB_NAME_RENDER_TARGET_ARRAY_INDEX = 4, | ||
| 2155 | D3D10_SB_NAME_VIEWPORT_ARRAY_INDEX = 5, | ||
| 2156 | D3D10_SB_NAME_VERTEX_ID = 6, | ||
| 2157 | D3D10_SB_NAME_PRIMITIVE_ID = 7, | ||
| 2158 | D3D10_SB_NAME_INSTANCE_ID = 8, | ||
| 2159 | D3D10_SB_NAME_IS_FRONT_FACE = 9, | ||
| 2160 | D3D10_SB_NAME_SAMPLE_INDEX = 10, | ||
| 2161 | // The following are added for D3D11 | ||
| 2162 | D3D11_SB_NAME_FINAL_QUAD_U_EQ_0_EDGE_TESSFACTOR = 11, | ||
| 2163 | D3D11_SB_NAME_FINAL_QUAD_V_EQ_0_EDGE_TESSFACTOR = 12, | ||
| 2164 | D3D11_SB_NAME_FINAL_QUAD_U_EQ_1_EDGE_TESSFACTOR = 13, | ||
| 2165 | D3D11_SB_NAME_FINAL_QUAD_V_EQ_1_EDGE_TESSFACTOR = 14, | ||
| 2166 | D3D11_SB_NAME_FINAL_QUAD_U_INSIDE_TESSFACTOR = 15, | ||
| 2167 | D3D11_SB_NAME_FINAL_QUAD_V_INSIDE_TESSFACTOR = 16, | ||
| 2168 | D3D11_SB_NAME_FINAL_TRI_U_EQ_0_EDGE_TESSFACTOR = 17, | ||
| 2169 | D3D11_SB_NAME_FINAL_TRI_V_EQ_0_EDGE_TESSFACTOR = 18, | ||
| 2170 | D3D11_SB_NAME_FINAL_TRI_W_EQ_0_EDGE_TESSFACTOR = 19, | ||
| 2171 | D3D11_SB_NAME_FINAL_TRI_INSIDE_TESSFACTOR = 20, | ||
| 2172 | D3D11_SB_NAME_FINAL_LINE_DETAIL_TESSFACTOR = 21, | ||
| 2173 | D3D11_SB_NAME_FINAL_LINE_DENSITY_TESSFACTOR = 22, | ||
| 2174 | // The following are added for D3D12 | ||
| 2175 | D3D12_SB_NAME_BARYCENTRICS = 23, | ||
| 2176 | D3D12_SB_NAME_SHADINGRATE = 24, | ||
| 2177 | D3D12_SB_NAME_CULLPRIMITIVE = 25, | ||
| 2178 | } D3D10_SB_NAME; | ||
| 2179 | |||
| 2180 | typedef enum D3D10_SB_RESOURCE_DIMENSION | ||
| 2181 | { | ||
| 2182 | D3D10_SB_RESOURCE_DIMENSION_UNKNOWN = 0, | ||
| 2183 | D3D10_SB_RESOURCE_DIMENSION_BUFFER = 1, | ||
| 2184 | D3D10_SB_RESOURCE_DIMENSION_TEXTURE1D = 2, | ||
| 2185 | D3D10_SB_RESOURCE_DIMENSION_TEXTURE2D = 3, | ||
| 2186 | D3D10_SB_RESOURCE_DIMENSION_TEXTURE2DMS = 4, | ||
| 2187 | D3D10_SB_RESOURCE_DIMENSION_TEXTURE3D = 5, | ||
| 2188 | D3D10_SB_RESOURCE_DIMENSION_TEXTURECUBE = 6, | ||
| 2189 | D3D10_SB_RESOURCE_DIMENSION_TEXTURE1DARRAY = 7, | ||
| 2190 | D3D10_SB_RESOURCE_DIMENSION_TEXTURE2DARRAY = 8, | ||
| 2191 | D3D10_SB_RESOURCE_DIMENSION_TEXTURE2DMSARRAY = 9, | ||
| 2192 | D3D10_SB_RESOURCE_DIMENSION_TEXTURECUBEARRAY = 10, | ||
| 2193 | D3D11_SB_RESOURCE_DIMENSION_RAW_BUFFER = 11, | ||
| 2194 | D3D11_SB_RESOURCE_DIMENSION_STRUCTURED_BUFFER = 12, | ||
| 2195 | } D3D10_SB_RESOURCE_DIMENSION; | ||
| 2196 | |||
| 2197 | typedef enum D3D10_SB_RESOURCE_RETURN_TYPE | ||
| 2198 | { | ||
| 2199 | D3D10_SB_RETURN_TYPE_UNORM = 1, | ||
| 2200 | D3D10_SB_RETURN_TYPE_SNORM = 2, | ||
| 2201 | D3D10_SB_RETURN_TYPE_SINT = 3, | ||
| 2202 | D3D10_SB_RETURN_TYPE_UINT = 4, | ||
| 2203 | D3D10_SB_RETURN_TYPE_FLOAT = 5, | ||
| 2204 | D3D10_SB_RETURN_TYPE_MIXED = 6, | ||
| 2205 | D3D11_SB_RETURN_TYPE_DOUBLE = 7, | ||
| 2206 | D3D11_SB_RETURN_TYPE_CONTINUED = 8, | ||
| 2207 | D3D11_SB_RETURN_TYPE_UNUSED = 9, | ||
| 2208 | } D3D10_SB_RESOURCE_RETURN_TYPE; | ||
| 2209 | |||
| 2210 | typedef enum D3D10_SB_REGISTER_COMPONENT_TYPE | ||
| 2211 | { | ||
| 2212 | D3D10_SB_REGISTER_COMPONENT_UNKNOWN = 0, | ||
| 2213 | D3D10_SB_REGISTER_COMPONENT_UINT32 = 1, | ||
| 2214 | D3D10_SB_REGISTER_COMPONENT_SINT32 = 2, | ||
| 2215 | D3D10_SB_REGISTER_COMPONENT_FLOAT32 = 3, | ||
| 2216 | // Below types aren't used in DXBC, only signatures from DXIL shaders | ||
| 2217 | D3D10_SB_REGISTER_COMPONENT_UINT16 = 4, | ||
| 2218 | D3D10_SB_REGISTER_COMPONENT_SINT16 = 5, | ||
| 2219 | D3D10_SB_REGISTER_COMPONENT_FLOAT16 = 6, | ||
| 2220 | D3D10_SB_REGISTER_COMPONENT_UINT64 = 7, | ||
| 2221 | D3D10_SB_REGISTER_COMPONENT_SINT64 = 8, | ||
| 2222 | D3D10_SB_REGISTER_COMPONENT_FLOAT64 = 9, | ||
| 2223 | } D3D10_SB_REGISTER_COMPONENT_TYPE; | ||
| 2224 | |||
| 2225 | typedef enum D3D10_SB_INSTRUCTION_RETURN_TYPE | ||
| 2226 | { | ||
| 2227 | D3D10_SB_INSTRUCTION_RETURN_FLOAT = 0, | ||
| 2228 | D3D10_SB_INSTRUCTION_RETURN_UINT = 1 | ||
| 2229 | } D3D10_SB_INSTRUCTION_RETURN_TYPE; | ||
| 2230 | |||
| 2231 | #define D3D10_SB_INSTRUCTION_RETURN_TYPE_MASK 0x00001800 | ||
| 2232 | #define D3D10_SB_INSTRUCTION_RETURN_TYPE_SHIFT 11 | ||
| 2233 | |||
| 2234 | // DECODER MACRO: For an OpcodeToken0 with the return type | ||
| 2235 | // determine the return type. | ||
| 2236 | #define DECODE_D3D10_SB_INSTRUCTION_RETURN_TYPE(OpcodeToken0) ((D3D10_SB_INSTRUCTION_RETURN_TYPE)(((OpcodeToken0)&D3D10_SB_INSTRUCTION_RETURN_TYPE_MASK)>>D3D10_SB_INSTRUCTION_RETURN_TYPE_SHIFT)) | ||
| 2237 | // ENCODER MACRO: Encode the return type for instructions | ||
| 2238 | // in the opcode specific control range of OpcodeToken0 | ||
| 2239 | #define ENCODE_D3D10_SB_INSTRUCTION_RETURN_TYPE(ReturnType) (((ReturnType)<<D3D10_SB_INSTRUCTION_RETURN_TYPE_SHIFT)&D3D10_SB_INSTRUCTION_RETURN_TYPE_MASK) | ||
| 2240 | |||
| 2241 | // ---------------------------------------------------------------------------- | ||
| 2242 | // Interface function body Declaration | ||
| 2243 | // | ||
| 2244 | // OpcodeToken0: | ||
| 2245 | // | ||
| 2246 | // [10:00] D3D10_SB_OPCODE_DCL_FUNCTION_BODY | ||
| 2247 | // [23:11] Ignored, 0 | ||
| 2248 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 2249 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 2250 | // contains extended operand description. If it is extended, then | ||
| 2251 | // it contains the actual instruction length in DWORDs, since | ||
| 2252 | // it may not fit into 7 bits if enough operands are defined. | ||
| 2253 | // | ||
| 2254 | // OpcodeToken0 is followed by a DWORD that represents the function body | ||
| 2255 | // identifier. | ||
| 2256 | // | ||
| 2257 | // ---------------------------------------------------------------------------- | ||
| 2258 | |||
| 2259 | // ---------------------------------------------------------------------------- | ||
| 2260 | // Interface function table Declaration | ||
| 2261 | // | ||
| 2262 | // OpcodeToken0: | ||
| 2263 | // | ||
| 2264 | // [10:00] D3D10_SB_OPCODE_DCL_FUNCTION_TABLE | ||
| 2265 | // [23:11] Ignored, 0 | ||
| 2266 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 2267 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 2268 | // contains extended operand description. If it is extended, then | ||
| 2269 | // it contains the actual instruction length in DWORDs, since | ||
| 2270 | // it may not fit into 7 bits if enough functions are defined. | ||
| 2271 | // | ||
| 2272 | // OpcodeToken0 is followed by a DWORD that represents the function table | ||
| 2273 | // identifier and another DWORD (TableLength) that gives the number of | ||
| 2274 | // functions in the table. | ||
| 2275 | // | ||
| 2276 | // This is followed by TableLength DWORDs which are function body indices. | ||
| 2277 | // | ||
| 2278 | // ---------------------------------------------------------------------------- | ||
| 2279 | |||
| 2280 | // ---------------------------------------------------------------------------- | ||
| 2281 | // Interface Declaration | ||
| 2282 | // | ||
| 2283 | // OpcodeToken0: | ||
| 2284 | // | ||
| 2285 | // [10:00] D3D10_SB_OPCODE_DCL_INTERFACE | ||
| 2286 | // [11] 1 if the interface is indexed dynamically, 0 otherwise. | ||
| 2287 | // [23:12] Ignored, 0 | ||
| 2288 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 2289 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 2290 | // contains extended operand description. If it is extended, then | ||
| 2291 | // it contains the actual instruction length in DWORDs, since | ||
| 2292 | // it may not fit into 7 bits if enough types are used. | ||
| 2293 | // | ||
| 2294 | // OpcodeToken0 is followed by a DWORD that represents the interface | ||
| 2295 | // identifier. Next is a DWORD that gives the expected function table | ||
| 2296 | // length. Then another DWORD (OpcodeToken3) with the following layout: | ||
| 2297 | // | ||
| 2298 | // [15:00] TableLength, the number of types that implement this interface | ||
| 2299 | // [31:16] ArrayLength, the number of interfaces that are defined in this array. | ||
| 2300 | // | ||
| 2301 | // This is followed by TableLength DWORDs which are function table | ||
| 2302 | // identifiers, representing possible tables for a given interface. | ||
| 2303 | // | ||
| 2304 | // ---------------------------------------------------------------------------- | ||
| 2305 | |||
| 2306 | #define D3D11_SB_INTERFACE_INDEXED_BIT_MASK 0x00000800 | ||
| 2307 | #define D3D11_SB_INTERFACE_INDEXED_BIT_SHIFT 11 | ||
| 2308 | |||
| 2309 | #define D3D11_SB_INTERFACE_TABLE_LENGTH_MASK 0x0000ffff | ||
| 2310 | #define D3D11_SB_INTERFACE_TABLE_LENGTH_SHIFT 0 | ||
| 2311 | |||
| 2312 | #define D3D11_SB_INTERFACE_ARRAY_LENGTH_MASK 0xffff0000 | ||
| 2313 | #define D3D11_SB_INTERFACE_ARRAY_LENGTH_SHIFT 16 | ||
| 2314 | |||
| 2315 | // get/set the indexed bit for an interface definition | ||
| 2316 | #define DECODE_D3D11_SB_INTERFACE_INDEXED_BIT(OpcodeToken0) ((((OpcodeToken0)&D3D11_SB_INTERFACE_INDEXED_BIT_MASK)>>D3D11_SB_INTERFACE_INDEXED_BIT_SHIFT) ? true : false) | ||
| 2317 | #define ENCODE_D3D11_SB_INTERFACE_INDEXED_BIT(IndexedBit) (((IndexedBit)<<D3D11_SB_INTERFACE_INDEXED_BIT_SHIFT)&D3D11_SB_INTERFACE_INDEXED_BIT_MASK) | ||
| 2318 | |||
| 2319 | // get/set the table length for an interface definition | ||
| 2320 | #define DECODE_D3D11_SB_INTERFACE_TABLE_LENGTH(OpcodeToken0) ((UINT)(((OpcodeToken0)&D3D11_SB_INTERFACE_TABLE_LENGTH_MASK)>>D3D11_SB_INTERFACE_TABLE_LENGTH_SHIFT)) | ||
| 2321 | #define ENCODE_D3D11_SB_INTERFACE_TABLE_LENGTH(TableLength) (((TableLength)<<D3D11_SB_INTERFACE_TABLE_LENGTH_SHIFT)&D3D11_SB_INTERFACE_TABLE_LENGTH_MASK) | ||
| 2322 | |||
| 2323 | // get/set the array length for an interface definition | ||
| 2324 | #define DECODE_D3D11_SB_INTERFACE_ARRAY_LENGTH(OpcodeToken0) ((UINT)(((OpcodeToken0)&D3D11_SB_INTERFACE_ARRAY_LENGTH_MASK)>>D3D11_SB_INTERFACE_ARRAY_LENGTH_SHIFT)) | ||
| 2325 | #define ENCODE_D3D11_SB_INTERFACE_ARRAY_LENGTH(ArrayLength) (((ArrayLength)<<D3D11_SB_INTERFACE_ARRAY_LENGTH_SHIFT)&D3D11_SB_INTERFACE_ARRAY_LENGTH_MASK) | ||
| 2326 | |||
| 2327 | // ---------------------------------------------------------------------------- | ||
| 2328 | // Interface call | ||
| 2329 | // | ||
| 2330 | // OpcodeToken0: | ||
| 2331 | // | ||
| 2332 | // [10:00] D3D10_SB_OPCODE_INTERFACE_CALL | ||
| 2333 | // [23:11] Ignored, 0 | ||
| 2334 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 2335 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 2336 | // contains extended operand description. If it is extended, then | ||
| 2337 | // it contains the actual instruction length in DWORDs, since | ||
| 2338 | // it may not fit into 7 bits if enough types are used. | ||
| 2339 | // | ||
| 2340 | // OpcodeToken0 is followed by a DWORD that gives the function index to | ||
| 2341 | // call in the function table specified for the given interface. | ||
| 2342 | // Next is the interface operand. | ||
| 2343 | // | ||
| 2344 | // ---------------------------------------------------------------------------- | ||
| 2345 | |||
| 2346 | // ---------------------------------------------------------------------------- | ||
| 2347 | // Thread Group Declaration (Compute Shader) | ||
| 2348 | // | ||
| 2349 | // OpcodeToken0: | ||
| 2350 | // | ||
| 2351 | // [10:00] D3D11_SB_OPCODE_DCL_THREAD_GROUP | ||
| 2352 | // [23:11] Ignored, 0 | ||
| 2353 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 2354 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 2355 | // contains extended operand description. If it is extended, then | ||
| 2356 | // it contains the actual instruction length in DWORDs, since | ||
| 2357 | // it may not fit into 7 bits if enough types are used. | ||
| 2358 | // | ||
| 2359 | // OpcodeToken0 is followed by 3 DWORDs, the Thread Group dimensions as UINT32: | ||
| 2360 | // x, y, z | ||
| 2361 | // | ||
| 2362 | // ---------------------------------------------------------------------------- | ||
| 2363 | |||
| 2364 | // ---------------------------------------------------------------------------- | ||
| 2365 | // Typed Unordered Access View Declaration | ||
| 2366 | // | ||
| 2367 | // OpcodeToken0: | ||
| 2368 | // | ||
| 2369 | // [10:00] D3D11_SB_OPCODE_DCL_UNORDERED_ACCESS_VIEW_TYPED | ||
| 2370 | // [15:11] D3D10_SB_RESOURCE_DIMENSION | ||
| 2371 | // [16:16] D3D11_SB_GLOBALLY_COHERENT_ACCESS or 0 (LOCALLY_COHERENT) | ||
| 2372 | // [17:17] D3D11_SB_RASTERIZER_ORDERED_ACCESS or 0 | ||
| 2373 | // [23:18] Ignored, 0 | ||
| 2374 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 2375 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 2376 | // contains extended operand description. This dcl is currently not | ||
| 2377 | // extended. | ||
| 2378 | // | ||
| 2379 | // OpcodeToken0 is followed by 2 operands on Shader Models 4.0 through 5.0: | ||
| 2380 | // (1) an operand, starting with OperandToken0, defining which | ||
| 2381 | // u# register (D3D11_SB_OPERAND_TYPE_UNORDERED_ACCESS_VIEW) is being declared. | ||
| 2382 | // (2) a Resource Return Type token (ResourceReturnTypeToken) | ||
| 2383 | // | ||
| 2384 | // OpcodeToken0 is followed by 3 operands on Shader Model 5.1 and later: | ||
| 2385 | // (1) an operand, starting with OperandToken0, defining which | ||
| 2386 | // u# register (D3D11_SB_OPERAND_TYPE_UNORDERED_ACCESS_VIEW) is being declared. | ||
| 2387 | // The indexing dimension for the register must be D3D10_SB_OPERAND_INDEX_DIMENSION_3D, | ||
| 2388 | // and the meaning of the index dimensions are as follows: (u<id>[<lbound>:<ubound>]) | ||
| 2389 | // 1 <id>: variable ID being declared | ||
| 2390 | // 2 <lbound>: the lower bound of the range of UAV's in the space | ||
| 2391 | // 3 <ubound>: the upper bound (inclusive) of this range | ||
| 2392 | // As opposed to when the u# is used in shader instructions, where the register | ||
| 2393 | // must be D3D10_SB_OPERAND_INDEX_DIMENSION_2D, and the meaning of the index | ||
| 2394 | // dimensions are as follows: (u<id>[<idx>]): | ||
| 2395 | // 1 <id>: variable ID being used (matches dcl) | ||
| 2396 | // 2 <idx>: absolute index of uav within space (may be dynamically indexed) | ||
| 2397 | // (2) a Resource Return Type token (ResourceReturnTypeToken) | ||
| 2398 | // (3) a DWORD indicating the space index. | ||
| 2399 | // | ||
| 2400 | // ---------------------------------------------------------------------------- | ||
| 2401 | // UAV access scope flags | ||
| 2402 | #define D3D11_SB_GLOBALLY_COHERENT_ACCESS 0x00010000 | ||
| 2403 | #define D3D11_SB_ACCESS_COHERENCY_MASK 0x00010000 | ||
| 2404 | |||
| 2405 | // DECODER MACRO: Retrieve flags for sync instruction from OpcodeToken0. | ||
| 2406 | #define DECODE_D3D11_SB_ACCESS_COHERENCY_FLAGS(OperandToken0) ((OperandToken0)&D3D11_SB_ACCESS_COHERENCY_MASK) | ||
| 2407 | |||
| 2408 | // ENCODER MACRO: Given a set of sync instruciton flags, encode them in OpcodeToken0. | ||
| 2409 | #define ENCODE_D3D11_SB_ACCESS_COHERENCY_FLAGS(Flags) ((Flags)&D3D11_SB_ACCESS_COHERENCY_MASK) | ||
| 2410 | |||
| 2411 | // Additional UAV access flags | ||
| 2412 | #define D3D11_SB_RASTERIZER_ORDERED_ACCESS 0x00020000 | ||
| 2413 | |||
| 2414 | // Resource flags mask. Use to retrieve all resource flags, including the order preserving counter. | ||
| 2415 | #define D3D11_SB_RESOURCE_FLAGS_MASK (D3D11_SB_GLOBALLY_COHERENT_ACCESS|D3D11_SB_RASTERIZER_ORDERED_ACCESS|D3D11_SB_UAV_HAS_ORDER_PRESERVING_COUNTER) | ||
| 2416 | |||
| 2417 | // DECODER MACRO: Retrieve UAV access flags for from OpcodeToken0. | ||
| 2418 | #define DECODE_D3D11_SB_RESOURCE_FLAGS(OperandToken0) ((OperandToken0)&D3D11_SB_RESOURCE_FLAGS_MASK) | ||
| 2419 | |||
| 2420 | // ENCODER MACRO: Given UAV access flags, encode them in OpcodeToken0. | ||
| 2421 | #define ENCODE_D3D11_SB_RESOURCE_FLAGS(Flags) ((Flags)&D3D11_SB_RESOURCE_FLAGS_MASK) | ||
| 2422 | |||
| 2423 | // ---------------------------------------------------------------------------- | ||
| 2424 | // Raw Unordered Access View Declaration | ||
| 2425 | // | ||
| 2426 | // OpcodeToken0: | ||
| 2427 | // | ||
| 2428 | // [10:00] D3D11_SB_OPCODE_DCL_UNORDERED_ACCESS_VIEW_RAW | ||
| 2429 | // [15:11] Ignored, 0 | ||
| 2430 | // [16:16] D3D11_SB_GLOBALLY_COHERENT_ACCESS or 0 (LOCALLY_COHERENT) | ||
| 2431 | // [17:17] D3D11_SB_RASTERIZER_ORDERED_ACCESS or 0 | ||
| 2432 | // [23:18] Ignored, 0 | ||
| 2433 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 2434 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 2435 | // contains extended operand description. This dcl is currently not | ||
| 2436 | // extended. | ||
| 2437 | // | ||
| 2438 | // OpcodeToken0 is followed by 1 operand on Shader Models 4.0 through 5.0: | ||
| 2439 | // (1) an operand, starting with OperandToken0, defining which | ||
| 2440 | // u# register (D3D11_SB_OPERAND_TYPE_UNORDERED_ACCESS_VIEW) is being declared. | ||
| 2441 | // | ||
| 2442 | // OpcodeToken0 is followed by 2 operands on Shader Model 5.1 and later: | ||
| 2443 | // (1) an operand, starting with OperandToken0, defining which | ||
| 2444 | // u# register (D3D11_SB_OPERAND_TYPE_UNORDERED_ACCESS_VIEW) is being declared. | ||
| 2445 | // The indexing dimension for the register must be D3D10_SB_OPERAND_INDEX_DIMENSION_3D, | ||
| 2446 | // and the meaning of the index dimensions are as follows: (u<id>[<lbound>:<ubound>]) | ||
| 2447 | // 1 <id>: variable ID being declared | ||
| 2448 | // 2 <lbound>: the lower bound of the range of UAV's in the space | ||
| 2449 | // 3 <ubound>: the upper bound (inclusive) of this range | ||
| 2450 | // As opposed to when the u# is used in shader instructions, where the register | ||
| 2451 | // must be D3D10_SB_OPERAND_INDEX_DIMENSION_2D, and the meaning of the index | ||
| 2452 | // dimensions are as follows: (u<id>[<idx>]): | ||
| 2453 | // 1 <id>: variable ID being used (matches dcl) | ||
| 2454 | // 2 <idx>: absolute index of uav within space (may be dynamically indexed) | ||
| 2455 | // (2) a DWORD indicating the space index. | ||
| 2456 | // | ||
| 2457 | // ---------------------------------------------------------------------------- | ||
| 2458 | |||
| 2459 | // ---------------------------------------------------------------------------- | ||
| 2460 | // Structured Unordered Access View Declaration | ||
| 2461 | // | ||
| 2462 | // OpcodeToken0: | ||
| 2463 | // | ||
| 2464 | // [10:00] D3D11_SB_OPCODE_DCL_UNORDERED_ACCESS_VIEW_STRUCTURED | ||
| 2465 | // [15:11] Ignored, 0 | ||
| 2466 | // [16:16] D3D11_SB_GLOBALLY_COHERENT_ACCESS or 0 (LOCALLY_COHERENT) | ||
| 2467 | // [17:17] D3D11_SB_RASTERIZER_ORDERED_ACCESS or 0 | ||
| 2468 | // [22:18] Ignored, 0 | ||
| 2469 | // [23:23] D3D11_SB_UAV_HAS_ORDER_PRESERVING_COUNTER or 0 | ||
| 2470 | // | ||
| 2471 | // The presence of this flag means that if a UAV is bound to the | ||
| 2472 | // corresponding slot, it must have been created with | ||
| 2473 | // D3D11_BUFFER_UAV_FLAG_COUNTER at the API. Also, the shader | ||
| 2474 | // can contain either imm_atomic_alloc or _consume instructions | ||
| 2475 | // operating on the given UAV. | ||
| 2476 | // | ||
| 2477 | // If this flag is not present, the shader can still contain | ||
| 2478 | // either imm_atomic_alloc or imm_atomic_consume instructions for | ||
| 2479 | // this UAV. But if such instructions are present in this case, | ||
| 2480 | // and a UAV is bound corresponding slot, it must have been created | ||
| 2481 | // with the D3D11_BUFFER_UAV_FLAG_APPEND flag at the API. | ||
| 2482 | // Append buffers have a counter as well, but values returned | ||
| 2483 | // to the shader are only valid for the lifetime of the shader | ||
| 2484 | // invocation. | ||
| 2485 | // | ||
| 2486 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 2487 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 2488 | // contains extended operand description. This dcl is currently not | ||
| 2489 | // extended. | ||
| 2490 | // | ||
| 2491 | // OpcodeToken0 is followed by 2 operands: | ||
| 2492 | // (1) an operand, starting with OperandToken0, defining which | ||
| 2493 | // u# register (D3D11_SB_OPERAND_TYPE_UNORDERED_ACCESS_VIEW) is | ||
| 2494 | // being declared. | ||
| 2495 | // (2) a DWORD indicating UINT32 byte stride | ||
| 2496 | // | ||
| 2497 | // OpcodeToken0 is followed by 3 operands on Shader Model 5.1 and later: | ||
| 2498 | // (1) an operand, starting with OperandToken0, defining which | ||
| 2499 | // u# register (D3D11_SB_OPERAND_TYPE_UNORDERED_ACCESS_VIEW) is being declared. | ||
| 2500 | // The indexing dimension for the register must be D3D10_SB_OPERAND_INDEX_DIMENSION_3D, | ||
| 2501 | // and the meaning of the index dimensions are as follows: (u<id>[<lbound>:<ubound>]) | ||
| 2502 | // 1 <id>: variable ID being declared | ||
| 2503 | // 2 <lbound>: the lower bound of the range of UAV's in the space | ||
| 2504 | // 3 <ubound>: the upper bound (inclusive) of this range | ||
| 2505 | // As opposed to when the u# is used in shader instructions, where the register | ||
| 2506 | // must be D3D10_SB_OPERAND_INDEX_DIMENSION_2D, and the meaning of the index | ||
| 2507 | // dimensions are as follows: (u<id>[<idx>]): | ||
| 2508 | // 1 <id>: variable ID being used (matches dcl) | ||
| 2509 | // 2 <idx>: absolute index of uav within space (may be dynamically indexed) | ||
| 2510 | // (2) a DWORD indicating UINT32 byte stride | ||
| 2511 | // (3) a DWORD indicating the space index. | ||
| 2512 | // | ||
| 2513 | // ---------------------------------------------------------------------------- | ||
| 2514 | // UAV flags | ||
| 2515 | #define D3D11_SB_UAV_HAS_ORDER_PRESERVING_COUNTER 0x00800000 | ||
| 2516 | #define D3D11_SB_UAV_FLAGS_MASK 0x00800000 | ||
| 2517 | |||
| 2518 | // DECODER MACRO: Retrieve flags about UAV from OpcodeToken0. | ||
| 2519 | #define DECODE_D3D11_SB_UAV_FLAGS(OperandToken0) ((OperandToken0)&D3D11_SB_UAV_FLAGS_MASK) | ||
| 2520 | |||
| 2521 | // ENCODER MACRO: Given a set of UAV flags, encode them in OpcodeToken0. | ||
| 2522 | #define ENCODE_D3D11_SB_UAV_FLAGS(Flags) ((Flags)&D3D11_SB_UAV_FLAGS_MASK) | ||
| 2523 | |||
| 2524 | // ---------------------------------------------------------------------------- | ||
| 2525 | // Raw Thread Group Shared Memory Declaration | ||
| 2526 | // | ||
| 2527 | // OpcodeToken0: | ||
| 2528 | // | ||
| 2529 | // [10:00] D3D11_SB_OPCODE_DCL_THREAD_GROUP_SHARED_MEMORY_RAW | ||
| 2530 | // [23:11] Ignored, 0 | ||
| 2531 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 2532 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 2533 | // contains extended operand description. This dcl is currently not | ||
| 2534 | // extended. | ||
| 2535 | // | ||
| 2536 | // OpcodeToken0 is followed by 2 operands: | ||
| 2537 | // (1) an operand, starting with OperandToken0, defining which | ||
| 2538 | // g# register (D3D11_SB_OPERAND_TYPE_THREAD_GROUP_SHARED_MEMORY) is being declared. | ||
| 2539 | // (2) a DWORD indicating the byte count, which must be a multiple of 4. | ||
| 2540 | // | ||
| 2541 | // ---------------------------------------------------------------------------- | ||
| 2542 | |||
| 2543 | // ---------------------------------------------------------------------------- | ||
| 2544 | // Structured Thread Group Shared Memory Declaration | ||
| 2545 | // | ||
| 2546 | // OpcodeToken0: | ||
| 2547 | // | ||
| 2548 | // [10:00] D3D11_SB_OPCODE_DCL_THREAD_GROUP_SHARED_MEMORY_STRUCTURED | ||
| 2549 | // [23:11] Ignored, 0 | ||
| 2550 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 2551 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 2552 | // contains extended operand description. This dcl is currently not | ||
| 2553 | // extended. | ||
| 2554 | // | ||
| 2555 | // OpcodeToken0 is followed by 3 operands: | ||
| 2556 | // (1) an operand, starting with OperandToken0, defining which | ||
| 2557 | // g# register (D3D11_SB_OPERAND_TYPE_THREAD_GROUP_SHARED_MEMORY) is | ||
| 2558 | // being declared. | ||
| 2559 | // (2) a DWORD indicating UINT32 struct byte stride | ||
| 2560 | // (3) a DWORD indicating UINT32 struct count | ||
| 2561 | // | ||
| 2562 | // ---------------------------------------------------------------------------- | ||
| 2563 | |||
| 2564 | // ---------------------------------------------------------------------------- | ||
| 2565 | // Raw Shader Resource View Declaration | ||
| 2566 | // | ||
| 2567 | // OpcodeToken0: | ||
| 2568 | // | ||
| 2569 | // [10:00] D3D11_SB_OPCODE_DCL_RESOURCE_RAW | ||
| 2570 | // [23:11] Ignored, 0 | ||
| 2571 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 2572 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 2573 | // contains extended operand description. This dcl is currently not | ||
| 2574 | // extended. | ||
| 2575 | // | ||
| 2576 | // OpcodeToken0 is followed by 1 operand: | ||
| 2577 | // (1) an operand, starting with OperandToken0, defining which | ||
| 2578 | // t# register (D3D10_SB_OPERAND_TYPE_RESOURCE) is being declared. | ||
| 2579 | // | ||
| 2580 | // OpcodeToken0 is followed by 2 operands on Shader Model 5.1 and later: | ||
| 2581 | // (1) an operand, starting with OperandToken0, defining which | ||
| 2582 | // t# register (D3D10_SB_OPERAND_TYPE_RESOURCE) is being declared. | ||
| 2583 | // The indexing dimension for the register must be D3D10_SB_OPERAND_INDEX_DIMENSION_3D, | ||
| 2584 | // and the meaning of the index dimensions are as follows: (t<id>[<lbound>:<ubound>]) | ||
| 2585 | // 1 <id>: variable ID being declared | ||
| 2586 | // 2 <lbound>: the lower bound of the range of resources in the space | ||
| 2587 | // 3 <ubound>: the upper bound (inclusive) of this range | ||
| 2588 | // As opposed to when the t# is used in shader instructions, where the register | ||
| 2589 | // must be D3D10_SB_OPERAND_INDEX_DIMENSION_2D, and the meaning of the index | ||
| 2590 | // dimensions are as follows: (t<id>[<idx>]): | ||
| 2591 | // 1 <id>: variable ID being used (matches dcl) | ||
| 2592 | // 2 <idx>: absolute index of resource within space (may be dynamically indexed) | ||
| 2593 | // (2) a DWORD indicating the space index. | ||
| 2594 | // | ||
| 2595 | // ---------------------------------------------------------------------------- | ||
| 2596 | |||
| 2597 | // ---------------------------------------------------------------------------- | ||
| 2598 | // Structured Shader Resource View Declaration | ||
| 2599 | // | ||
| 2600 | // OpcodeToken0: | ||
| 2601 | // | ||
| 2602 | // [10:00] D3D11_SB_OPCODE_DCL_RESOURCE_STRUCTURED | ||
| 2603 | // [23:11] Ignored, 0 | ||
| 2604 | // [30:24] Instruction length in DWORDs including the opcode token. | ||
| 2605 | // [31] 0 normally. 1 if extended operand definition, meaning next DWORD | ||
| 2606 | // contains extended operand description. This dcl is currently not | ||
| 2607 | // extended. | ||
| 2608 | // | ||
| 2609 | // OpcodeToken0 is followed by 2 operands: | ||
| 2610 | // (1) an operand, starting with OperandToken0, defining which | ||
| 2611 | // g# register (D3D10_SB_OPERAND_TYPE_RESOURCE) is | ||
| 2612 | // being declared. | ||
| 2613 | // (2) a DWORD indicating UINT32 struct byte stride | ||
| 2614 | // | ||
| 2615 | // OpcodeToken0 is followed by 3 operands on Shader Model 5.1 and later: | ||
| 2616 | // (1) an operand, starting with OperandToken0, defining which | ||
| 2617 | // t# register (D3D10_SB_OPERAND_TYPE_RESOURCE) is being declared. | ||
| 2618 | // The indexing dimension for the register must be D3D10_SB_OPERAND_INDEX_DIMENSION_3D, | ||
| 2619 | // and the meaning of the index dimensions are as follows: (t<id>[<lbound>:<ubound>]) | ||
| 2620 | // 1 <id>: variable ID being declared | ||
| 2621 | // 2 <lbound>: the lower bound of the range of resources in the space | ||
| 2622 | // 3 <ubound>: the upper bound (inclusive) of this range | ||
| 2623 | // As opposed to when the t# is used in shader instructions, where the register | ||
| 2624 | // must be D3D10_SB_OPERAND_INDEX_DIMENSION_2D, and the meaning of the index | ||
| 2625 | // dimensions are as follows: (t<id>[<idx>]): | ||
| 2626 | // 1 <id>: variable ID being used (matches dcl) | ||
| 2627 | // 2 <idx>: absolute index of resource within space (may be dynamically indexed) | ||
| 2628 | // (2) a DWORD indicating UINT32 struct byte stride | ||
| 2629 | // (3) a DWORD indicating the space index. | ||
| 2630 | // | ||
| 2631 | // ---------------------------------------------------------------------------- | ||
| 2632 | |||
| 2633 | #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_GAMES) */ | ||
| 2634 | #pragma endregion | ||
