| 1 | #pragma once |
| 2 | |
| 3 | #include <nvn/nvn.h> |
| 4 | |
| 5 | #define GLSLC_PTR(type, var) \ |
| 6 | union { \ |
| 7 | type var; \ |
| 8 | uint64_t ptr##var; \ |
| 9 | } |
| 10 | |
| 11 | enum GLSLCpiqUniformKind { |
| 12 | GLSLC_PIQ_UNIFORM_KIND_PLAIN, |
| 13 | GLSLC_PIQ_UNIFORM_KIND_SAMPLER, |
| 14 | GLSLC_PIQ_UNIFORM_KIND_IMAGE, |
| 15 | GLSLC_PIQ_UNIFORM_KIND_TEXTURE, |
| 16 | GLSLC_PIQ_UNIFORM_KIND_INVALID = -1 |
| 17 | }; |
| 18 | |
| 19 | enum GLSLCpiqTypeEnum { |
| 20 | GLSLC_PIQ_TYPE_BOOL, |
| 21 | GLSLC_PIQ_TYPE_BVEC2, |
| 22 | GLSLC_PIQ_TYPE_BVEC3, |
| 23 | GLSLC_PIQ_TYPE_BVEC4, |
| 24 | GLSLC_PIQ_TYPE_INT, |
| 25 | GLSLC_PIQ_TYPE_INT_VEC2, |
| 26 | GLSLC_PIQ_TYPE_INT_VEC3, |
| 27 | GLSLC_PIQ_TYPE_INT_VEC4, |
| 28 | GLSLC_PIQ_TYPE_INT8, |
| 29 | GLSLC_PIQ_TYPE_INT8_VEC2, |
| 30 | GLSLC_PIQ_TYPE_INT8_VEC3, |
| 31 | GLSLC_PIQ_TYPE_INT8_VEC4, |
| 32 | GLSLC_PIQ_TYPE_INT16, |
| 33 | GLSLC_PIQ_TYPE_INT16_VEC2, |
| 34 | GLSLC_PIQ_TYPE_INT16_VEC3, |
| 35 | GLSLC_PIQ_TYPE_INT16_VEC4, |
| 36 | GLSLC_PIQ_TYPE_INT64, |
| 37 | GLSLC_PIQ_TYPE_INT64_VEC2, |
| 38 | GLSLC_PIQ_TYPE_INT64_VEC3, |
| 39 | GLSLC_PIQ_TYPE_INT64_VEC4, |
| 40 | GLSLC_PIQ_TYPE_UINT, |
| 41 | GLSLC_PIQ_TYPE_UIN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PLER_1D, |
| 103 | GLSLC_PIQ_TYPE_INT_SAMPLER_2D, |
| 104 | GLSLC_PIQ_TYPE_INT_SAMPLER_3D, |
| 105 | GLSLC_PIQ_TYPE_INT_SAMPLER_CUBE, |
| 106 | GLSLC_PIQ_TYPE_INT_SAMPLER_1D_ARRAY, |
| 107 | GLSLC_PIQ_TYPE_INT_SAMPLER_2D_ARRAY, |
| 108 | GLSLC_PIQ_TYPE_INT_SAMPLER_2D_MULTISAMPLE, |
| 109 | GLSLC_PIQ_TYPE_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, |
| 110 | GLSLC_PIQ_TYPE_INT_SAMPLER_BUFFER, |
| 111 | GLSLC_PIQ_TYPE_INT_SAMPLER_2D_RECT, |
| 112 | GLSLC_PIQ_TYPE_UINT_SAMPLER_1D, |
| 113 | GLSLC_PIQ_TYPE_UINT_SAMPLER_2D, |
| 114 | GLSLC_PIQ_TYPE_UINT_SAMPLER_3D, |
| 115 | GLSLC_PIQ_TYPE_UINT_SAMPLER_CUBE, |
| 116 | GLSLC_PIQ_TYPE_UINT_SAMPLER_1D_ARRAY, |
| 117 | GLSLC_PIQ_TYPE_UINT_SAMPLER_2D_ARRAY, |
| 118 | GLSLC_PIQ_TYPE_UINT_SAMPLER_2D_MULTISAMPLE, |
| 119 | GLSLC_PIQ_TYPE_UINT_SAMPLER_2D_MULTISAMPLE_ARRAY, |
| 120 | GLSLC_PIQ_TYPE_UINT_SAMPLER_BUFFER, |
| 121 | GLSLC_PIQ_TYPE_UINT_SAMPLER_2D_RECT, |
| 122 | GLSLC_PIQ_TYPE_IMAGE_1D, |
| 123 | GLSLC_PIQ_TYPE_IMAGE_2D, |
| 124 | GLSLC_PIQ_TYPE_IMAGE_3D, |
| 125 | GLSLC_PIQ_TYPE_IMAGE_2D_RECT, |
| 126 | GLSLC_PIQ_TYPE_IMAGE_CUBE, |
| 127 | GLSLC_PIQ_TYPE_IMAGE_BUFFER, |
| 128 | GLSLC_PIQ_TYPE_IMAGE_1D_ARRAY, |
| 129 | GLSLC_PIQ_TYPE_IMAGE_2D_ARRAY, |
| 130 | GLSLC_PIQ_TYPE_IMAGE_CUBE_MAP_ARRAY, |
| 131 | GLSLC_PIQ_TYPE_IMAGE_2D_MULTISAMPLE, |
| 132 | GLSLC_PIQ_TYPE_IMAGE_2D_MULTISAMPLE_ARRAY, |
| 133 | GLSLC_PIQ_TYPE_INT_IMAGE_1D, |
| 134 | GLSLC_PIQ_TYPE_INT_IMAGE_2D, |
| 135 | GLSLC_PIQ_TYPE_INT_IMAGE_3D, |
| 136 | GLSLC_PIQ_TYPE_INT_IMAGE_2D_RECT, |
| 137 | GLSLC_PIQ_TYPE_INT_IMAGE_CUBE, |
| 138 | GLSLC_PIQ_TYPE_INT_IMAGE_BUFFER, |
| 139 | GLSLC_PIQ_TYPE_INT_IMAGE_1D_ARRAY, |
| 140 | GLSLC_PIQ_TYPE_INT_IMAGE_2D_ARRAY, |
| 141 | GLSLC_PIQ_TYPE_INT_IMAGE_CUBE_MAP_ARRAY, |
| 142 | GLSLC_PIQ_TYPE_INT_IMAGE_2D_MULTISAMPLE, |
| 143 | GLSLC_PIQ_TYPE_INT_IMAGE_2D_MULTISAMPLE_ARRAY, |
| 144 | GLSLC_PIQ_TYPE_UINT_IMAGE_1D, |
| 145 | GLSLC_PIQ_TYPE_UINT_IMAGE_2D, |
| 146 | GLSLC_PIQ_TYPE_UINT_IMAGE_3D, |
| 147 | GLSLC_PIQ_TYPE_UINT_IMAGE_2D_RECT, |
| 148 | GLSLC_PIQ_TYPE_UINT_IMAGE_CUBE, |
| 149 | GLSLC_PIQ_TYPE_UINT_IMAGE_BUFFER, |
| 150 | GLSLC_PIQ_TYPE_UINT_IMAGE_1D_ARRAY, |
| 151 | GLSLC_PIQ_TYPE_UINT_IMAGE_2D_ARRAY, |
| 152 | GLSLC_PIQ_TYPE_UINT_IMAGE_CUBE_MAP_ARRAY, |
| 153 | GLSLC_PIQ_TYPE_UINT_IMAGE_2D_MULTISAMPLE, |
| 154 | GLSLC_PIQ_TYPE_UINT_IMAGE_2D_MULTISAMPLE_ARRAY, |
| 155 | GLSLC_PIQ_TYPE_SAMPLER_CUBE_MAP_ARRAY, |
| 156 | GLSLC_PIQ_TYPE_INT_SAMPLER_CUBE_MAP_ARRAY, |
| 157 | GLSLC_PIQ_TYPE_UINT_SAMPLER_CUBE_MAP_ARRAY, |
| 158 | GLSLC_PIQ_TYPE_SAMPLER_CUBE_MAP_ARRAY_SHADOW, |
| 159 | GLSLC_PIQ_TYPE_SAMPLER, |
| 160 | GLSLC_PIQ_TYPE_TEXTURE_1D, |
| 161 | GLSLC_PIQ_TYPE_TEXTURE_2D, |
| 162 | GLSLC_PIQ_TYPE_TEXTURE_3D, |
| 163 | GLSLC_PIQ_TYPE_TEXTURE_CUBE, |
| 164 | GLSLC_PIQ_TYPE_TEXTURE_1D_SHADOW, |
| 165 | GLSLC_PIQ_TYPE_TEXTURE_2D_SHADOW, |
| 166 | GLSLC_PIQ_TYPE_TEXTURE_1D_ARRAY, |
| 167 | GLSLC_PIQ_TYPE_TEXTURE_2D_ARRAY, |
| 168 | GLSLC_PIQ_TYPE_TEXTURE_1D_ARRAY_SHADOW, |
| 169 | GLSLC_PIQ_TYPE_TEXTURE_2D_ARRAY_SHADOW, |
| 170 | GLSLC_PIQ_TYPE_TEXTURE_2D_MULTISAMPLE, |
| 171 | GLSLC_PIQ_TYPE_TEXTURE_2D_MULTISAMPLE_ARRAY, |
| 172 | GLSLC_PIQ_TYPE_TEXTURE_CUBE_SHADOW, |
| 173 | GLSLC_PIQ_TYPE_TEXTURE_BUFFER, |
| 174 | GLSLC_PIQ_TYPE_TEXTURE_2D_RECT, |
| 175 | GLSLC_PIQ_TYPE_TEXTURE_2D_RECT_SHADOW, |
| 176 | GLSLC_PIQ_TYPE_TEXTURE_CUBE_MAP_ARRAY, |
| 177 | GLSLC_PIQ_TYPE_TEXTURE_CUBE_MAP_ARRAY_SHADOW, |
| 178 | GLSLC_PIQ_TYPE_INT_TEXTURE_1D, |
| 179 | GLSLC_PIQ_TYPE_INT_TEXTURE_2D, |
| 180 | GLSLC_PIQ_TYPE_INT_TEXTURE_3D, |
| 181 | GLSLC_PIQ_TYPE_INT_TEXTURE_CUBE, |
| 182 | GLSLC_PIQ_TYPE_INT_TEXTURE_1D_ARRAY, |
| 183 | GLSLC_PIQ_TYPE_INT_TEXTURE_2D_ARRAY, |
| 184 | GLSLC_PIQ_TYPE_INT_TEXTURE_2D_MULTISAMPLE, |
| 185 | GLSLC_PIQ_TYPE_INT_TEXTURE_2D_MULTISAMPLE_ARRAY, |
| 186 | GLSLC_PIQ_TYPE_INT_TEXTURE_BUFFER, |
| 187 | GLSLC_PIQ_TYPE_INT_TEXTURE_2D_RECT, |
| 188 | GLSLC_PIQ_TYPE_INT_TEXTURE_CUBE_MAP_ARRAY, |
| 189 | GLSLC_PIQ_TYPE_UINT_TEXTURE_1D, |
| 190 | GLSLC_PIQ_TYPE_UINT_TEXTURE_2D, |
| 191 | GLSLC_PIQ_TYPE_UINT_TEXTURE_3D, |
| 192 | GLSLC_PIQ_TYPE_UINT_TEXTURE_CUBE, |
| 193 | GLSLC_PIQ_TYPE_UINT_TEXTURE_1D_ARRAY, |
| 194 | GLSLC_PIQ_TYPE_UINT_TEXTURE_2D_ARRAY, |
| 195 | GLSLC_PIQ_TYPE_UINT_TEXTURE_2D_MULTISAMPLE, |
| 196 | GLSLC_PIQ_TYPE_UINT_TEXTURE_2D_MULTISAMPLE_ARRAY, |
| 197 | GLSLC_PIQ_TYPE_UINT_TEXTURE_BUFFER, |
| 198 | GLSLC_PIQ_TYPE_UINT_TEXTURE_2D_RECT, |
| 199 | GLSLC_PIQ_TYPE_UINT_TEXTURE_CUBE_MAP_ARRAY, |
| 200 | GLSLC_PIQ_INVALID_TYPE = -1 |
| 201 | }; |
| 202 | |
| 203 | typedef enum GLSLCdebugInfoLevel_enum { |
| 204 | GLSLC_DEBUG_LEVEL_NONE, |
| 205 | GLSLC_DEBUG_LEVEL_G0, |
| 206 | GLSLC_DEBUG_LEVEL_G1, |
| 207 | GLSLC_DEBUG_LEVEL_G2 |
| 208 | } GLSLCdebugInfoLevelEnum; |
| 209 | |
| 210 | typedef enum GLSLClanguageTypeEnum_enum { |
| 211 | GLSLC_LANGUAGE_GLSL, |
| 212 | GLSLC_LANGUAGE_GLES, |
| 213 | GLSLC_LANGUAGE_SPIRV |
| 214 | } GLSLClanguageTypeEnum; |
| 215 | |
| 216 | typedef enum SpillControlEnum_enum { DEFAULT_SPILL, NO_SPILL } SpillControlEnum; |
| 217 | |
| 218 | typedef enum GLSLCoptLevel_enum { GLSLC_OPTLEVEL_DEFAULT, GLSLC_OPTLEVEL_NONE } GLSLCoptLevelEnum; |
| 219 | |
| 220 | typedef enum GLSLCunrollControl_enum { |
| 221 | GLSLC_LOOP_UNROLL_DEFAULT, |
| 222 | GLSLC_LOOP_UNROLL_NONE, |
| 223 | GLSLC_LOOP_UNROLL_ALL |
| 224 | } GLSLCunrollControlEnum; |
| 225 | |
| 226 | typedef enum GLSLCwarnUninitControl_enum { |
| 227 | GLSLC_WARN_UNINIT_DEFAULT, |
| 228 | GLSLC_WARN_UNINIT_NONE, |
| 229 | GLSLC_WARN_UNINIT_ALL |
| 230 | } GLSLCwarnUninitControlEnum; |
| 231 | |
| 232 | typedef enum GLSLCsectionTypeEnum_enum { |
| 233 | GLSLC_SECTION_TYPE_GPU_CODE, |
| 234 | GLSLC_SECTION_TYPE_ASM_DUMP, |
| 235 | GLSLC_SECTION_TYPE_PERF_STATS, |
| 236 | GLSLC_SECTION_TYPE_REFLECTION, |
| 237 | GLSLC_SECTION_TYPE_DEBUG_INFO, |
| 238 | GLSLC_NUM_SECTION_TYPES, |
| 239 | GLSLC_SECTION_TYPE_ENUM_LARGE = -1 |
| 240 | } GLSLCsectionTypeEnum; |
| 241 | |
| 242 | typedef struct GLSLCpiqName_rec { |
| 243 | uint32_t nameOffset; |
| 244 | uint32_t nameLength; |
| 245 | uint8_t reserved[32]; |
| 246 | } GLSLCpiqName; |
| 247 | |
| 248 | typedef struct GLSLCuniformBlockInfo_rec { |
| 249 | GLSLCpiqName nameInfo; |
| 250 | uint32_t size; |
| 251 | uint32_t numActiveVariables; |
| 252 | NVNshaderStageBits stagesReferencedIn; |
| 253 | int32_t bindings[6]; |
| 254 | uint8_t reserved[32]; |
| 255 | } GLSLCuniformBlockInfo; |
| 256 | |
| 257 | typedef struct GLSLCuniform_rec { |
| 258 | GLSLCpiqName nameInfo; |
| 259 | GLSLCpiqTypeEnum type; |
| 260 | int32_t blockNdx; |
| 261 | int32_t blockOffset; |
| 262 | uint32_t sizeOfArray; |
| 263 | uint32_t arrayStride; |
| 264 | int32_t matrixStride; |
| 265 | uint32_t isRowMajor; |
| 266 | NVNshaderStageBits stagesReferencedIn; |
| 267 | int32_t bindings[6]; |
| 268 | GLSLCpiqUniformKind kind; |
| 269 | uint8_t isInUBO; |
| 270 | uint8_t isArray; |
| 271 | uint8_t reserved[62]; |
| 272 | } GLSLCuniformInfo; |
| 273 | |
| 274 | typedef struct GLSLCProgramInputInfo_rec { |
| 275 | GLSLCpiqName nameInfo; |
| 276 | GLSLCpiqTypeEnum type; |
| 277 | uint32_t sizeOfArray; |
| 278 | int32_t location; |
| 279 | NVNshaderStageBits stagesReferencedIn; |
| 280 | uint8_t isArray; |
| 281 | uint8_t isPerPatch; |
| 282 | uint8_t reserved[34]; |
| 283 | } GLSLCProgramInputInfo; |
| 284 | |
| 285 | typedef struct GLSLCProgramOutput_rec { |
| 286 | GLSLCpiqName nameInfo; |
| 287 | GLSLCpiqTypeEnum type; |
| 288 | uint32_t sizeOfArray; |
| 289 | int32_t location; |
| 290 | int32_t locationNdx; |
| 291 | NVNshaderStageBits stagesReferencedIn; |
| 292 | uint8_t isArray; |
| 293 | uint8_t isPerPatch; |
| 294 | uint8_t reserved[30]; |
| 295 | } GLSLCProgramOutputInfo; |
| 296 | |
| 297 | typedef struct GLSLCssboInfo_rec { |
| 298 | GLSLCpiqName nameInfo; |
| 299 | uint32_t size; |
| 300 | uint32_t numActiveVariables; |
| 301 | int32_t bindings[6]; |
| 302 | NVNshaderStageBits stagesReferencedIn; |
| 303 | uint8_t reserved[32]; |
| 304 | } GLSLCssboInfo; |
| 305 | |
| 306 | typedef struct GLSLCxfbInfo_rec { |
| 307 | GLSLC_PTR(const char* const*, varyings); |
| 308 | |
| 309 | uint32_t numVaryings; |
| 310 | uint8_t reserved[32]; |
| 311 | } GLSLCxfbInfo; |
| 312 | |
| 313 | typedef struct GLSLCincludeInfo_rec { |
| 314 | GLSLC_PTR(const char* const*, paths); |
| 315 | |
| 316 | uint32_t numPaths; |
| 317 | uint8_t reserved[32]; |
| 318 | } GLSLCincludeInfo; |
| 319 | |
| 320 | typedef struct GLSLCspecializationBatch_rec { |
| 321 | // todo: reverse from nnSdk, type never used |
| 322 | } GLSLCspecializationBatch; |
| 323 | |
| 324 | typedef struct GLSLCoptionFlags_rec { |
| 325 | uint32_t glslSeparable : 1; |
| 326 | uint32_t outputAssembly : 1; |
| 327 | uint32_t outputGpuBinaries : 1; |
| 328 | uint32_t outputPerfStats : 1; |
| 329 | uint32_t outputShaderReflection : 1; |
| 330 | GLSLClanguageTypeEnum language : 4; |
| 331 | GLSLCdebugInfoLevelEnum outputDebugInfo : 4; |
| 332 | SpillControlEnum spillControl : 4; |
| 333 | uint32_t outputThinGpuBinaries : 1; |
| 334 | uint32_t tessellationAndPassthroughGS : 1; |
| 335 | uint32_t prioritizeConsecutiveTextureInstructions : 1; |
| 336 | uint32_t enableFastMathMask : 6; |
| 337 | GLSLCoptLevelEnum optLevel : 3; |
| 338 | GLSLCunrollControlEnum unrollControl : 3; |
| 339 | uint32_t errorOnScratchMemUsage : 1; |
| 340 | uint32_t enableCBFOptimization : 1; |
| 341 | uint32_t enableWarpCulling : 1; |
| 342 | uint32_t enableMultithreadCompilation : 1; |
| 343 | GLSLCwarnUninitControlEnum warnUninitControl : 3; |
| 344 | } GLSLCoptionFlags; |
| 345 | |
| 346 | typedef struct GLSLCoptions_rec { |
| 347 | GLSLC_PTR(const char*, ); |
| 348 | |
| 349 | GLSLCoptionFlags optionFlags; |
| 350 | GLSLCincludeInfo includeInfo; |
| 351 | GLSLCxfbInfo xfbVaryingInfo; |
| 352 | uint8_t reserved[32]; |
| 353 | } GLSLCoptions; |
| 354 | |
| 355 | typedef struct GLSLCcompilationStatus_rec { |
| 356 | GLSLC_PTR(const char*, infoLog); |
| 357 | |
| 358 | uint32_t infoLogLength; |
| 359 | uint8_t success; |
| 360 | uint8_t allocError; |
| 361 | uint8_t usedMTSpecialization; |
| 362 | uint8_t reserved[1]; |
| 363 | uint32_t numEntriesInBatch; |
| 364 | uint8_t reserved2[24]; |
| 365 | } GLSLCcompilationStatus; |
| 366 | |
| 367 | typedef struct GLSLCspirvSpecializationInfo_rec { |
| 368 | // todo: reverse from nnSdk, type never used |
| 369 | } GLSLCspirvSpecializationInfo; |
| 370 | |
| 371 | typedef struct GLSLCinput_rec { |
| 372 | GLSLC_PTR(const char* const*, sources); |
| 373 | GLSLC_PTR(const NVNshaderStage*, stages); |
| 374 | |
| 375 | uint8_t count; |
| 376 | uint8_t reserved[7]; |
| 377 | |
| 378 | GLSLC_PTR(const char* const*, spirvEntryPointNames); |
| 379 | GLSLC_PTR(const uint32_t*, spirvModuleSizes); |
| 380 | GLSLC_PTR(const GLSLCspirvSpecializationInfo* const*, spirvSpecInfo); |
| 381 | } GLSLCinput; |
| 382 | |
| 383 | typedef struct { |
| 384 | uint32_t ; |
| 385 | uint32_t ; |
| 386 | GLSLCsectionTypeEnum ; |
| 387 | uint8_t [32]; |
| 388 | } ; |
| 389 | |
| 390 | typedef struct GLSLCshaderInfoCompute_rec { |
| 391 | uint32_t workGroupSize[3]; |
| 392 | uint8_t reserved[32]; |
| 393 | } GLSLCshaderInfoCompute; |
| 394 | |
| 395 | typedef union GLSLCshaderInfoUnion_rec { |
| 396 | GLSLCshaderInfoCompute compute; |
| 397 | } GLSLCshaderInfoUnion; |
| 398 | |
| 399 | typedef struct GLSLCperStageShaderInfo_rec { |
| 400 | GLSLCshaderInfoUnion shaderInfo[6]; |
| 401 | } GLSLCperStageShaderInfo; |
| 402 | |
| 403 | typedef struct { |
| 404 | GLSLCsectionHeaderCommon ; |
| 405 | uint32_t ; |
| 406 | uint32_t ; |
| 407 | uint32_t ; |
| 408 | uint32_t ; |
| 409 | uint32_t ; |
| 410 | uint32_t ; |
| 411 | uint32_t ; |
| 412 | uint32_t ; |
| 413 | uint32_t ; |
| 414 | uint32_t ; |
| 415 | uint32_t ; |
| 416 | uint32_t ; |
| 417 | uint32_t ; |
| 418 | uint32_t ; |
| 419 | uint32_t ; |
| 420 | uint32_t ; |
| 421 | uint32_t ; |
| 422 | uint32_t ; |
| 423 | uint32_t ; |
| 424 | uint32_t ; |
| 425 | uint32_t ; |
| 426 | uint32_t ; |
| 427 | uint32_t ; |
| 428 | uint8_t [4]; |
| 429 | } ; |
| 430 | |
| 431 | typedef struct { |
| 432 | GLSLCsectionHeaderCommon ; |
| 433 | NVNshaderStage ; |
| 434 | uint32_t ; |
| 435 | uint32_t ; |
| 436 | uint32_t ; |
| 437 | uint32_t ; |
| 438 | uint32_t ; |
| 439 | uint32_t ; |
| 440 | uint32_t ; |
| 441 | uint32_t ; |
| 442 | uint32_t ; |
| 443 | uint32_t ; |
| 444 | uint8_t [56]; |
| 445 | } ; |
| 446 | |
| 447 | typedef struct { |
| 448 | GLSLCsectionHeaderCommon ; |
| 449 | NVNshaderStage ; |
| 450 | uint8_t [60]; |
| 451 | } ; |
| 452 | |
| 453 | typedef struct { |
| 454 | GLSLCsectionHeaderCommon ; |
| 455 | uint8_t [32]; |
| 456 | } ; |
| 457 | |
| 458 | typedef struct { |
| 459 | GLSLCsectionHeaderCommon ; |
| 460 | uint8_t [32]; |
| 461 | } ; |
| 462 | |
| 463 | typedef struct GLSLCdebugDataHash_rec { |
| 464 | uint32_t buildId[4]; |
| 465 | uint32_t debugHashLo32; |
| 466 | uint32_t debugHashHi32; |
| 467 | } GLSLCdebugDataHash; |
| 468 | |
| 469 | typedef struct { |
| 470 | GLSLCsectionHeaderCommon ; |
| 471 | GLSLCdebugDataHash ; |
| 472 | uint8_t [40]; |
| 473 | } ; |
| 474 | |
| 475 | typedef union { |
| 476 | GLSLCgenericHeader ; |
| 477 | GLSLCgpuCodeHeader ; |
| 478 | GLSLCasmDumpHeader ; |
| 479 | GLSLCperfStatsHeader ; |
| 480 | GLSLCprogramReflectionHeader ; |
| 481 | GLSLCdebugInfoHeader ; |
| 482 | } ; |
| 483 | |
| 484 | typedef struct GLSLCversion_rec { |
| 485 | uint32_t apiMajor; |
| 486 | uint32_t apiMinor; |
| 487 | uint32_t gpuCodeVersionMajor; |
| 488 | uint32_t gpuCodeVersionMinor; |
| 489 | uint32_t package; |
| 490 | uint8_t reserved[32]; |
| 491 | } GLSLCversion; |
| 492 | |
| 493 | typedef struct GLSLCoutput_rec { |
| 494 | uint32_t magic; |
| 495 | uint32_t reservedBits; |
| 496 | GLSLCoptionFlags optionFlags; |
| 497 | GLSLCversion versionInfo; |
| 498 | uint32_t size; |
| 499 | uint32_t dataOffset; |
| 500 | uint32_t numSections; |
| 501 | uint8_t reserved[64]; |
| 502 | GLSLCsectionHeaderUnion [1]; |
| 503 | } GLSLCoutput; |
| 504 | |
| 505 | typedef struct GLSLCresults_rec { |
| 506 | GLSLC_PTR(GLSLCcompilationStatus*, compilationStatus); |
| 507 | GLSLC_PTR(GLSLCoutput*, glslcOutput); |
| 508 | uint8_t reserved[32]; |
| 509 | } GLSLCresults; |
| 510 | |
| 511 | typedef enum GLSLCinitializationStatus_enum { |
| 512 | GLSLC_INIT_ERROR_UNINITIALIZED, |
| 513 | GLSLC_INIT_SUCCESS, |
| 514 | GLSLC_INIT_ERROR_ALLOC_FAILURE, |
| 515 | GLSLC_INIT_ERROR_NO_ALLOC_CALLBACKS_SET |
| 516 | } GLSLCinitializationStatus; |
| 517 | |
| 518 | typedef struct GLSLCcompileObject { |
| 519 | GLSLC_PTR(GLSLCresults*, lastCompiledResults); |
| 520 | GLSLC_PTR(GLSLCprogramReflectionHeader*, reflectionSection); |
| 521 | GLSLC_PTR(void*, privateData); |
| 522 | |
| 523 | GLSLCoptions options; |
| 524 | GLSLCinput input; |
| 525 | GLSLCinitializationStatus initStatus; |
| 526 | uint8_t reserved[28]; |
| 527 | } GLSLCcompileObject; |
| 528 | |
| 529 | typedef void* (*GLSLCallocateFunction)(size_t, size_t, void*); |
| 530 | typedef void (*GLSLCfreeFunction)(void*, void*); |
| 531 | typedef void* (*GLSLCreallocateFunction)(void*, size_t, void*); |