瀏覽代碼

Thirdparty: Harmonize patches to document downstream changes

Rémi Verschelde 7 月之前
父節點
當前提交
91907a89f7
共有 100 個文件被更改,包括 1086 次插入3599 次删除
  1. 10 10
      COPYRIGHT.txt
  2. 2 2
      misc/error_suppressions/ubsan.txt
  3. 1 1
      modules/enet/SCsub
  4. 1 1
      modules/noise/fastnoise_lite.h
  5. 1 1
      platform/windows/gl_manager_windows_native.cpp
  6. 161 111
      thirdparty/README.md
  7. 0 4
      thirdparty/amd-fsr2/ffx_fsr2.cpp
  8. 0 3
      thirdparty/amd-fsr2/ffx_fsr2.h
  9. 0 2
      thirdparty/amd-fsr2/ffx_fsr2_private.h
  10. 0 2
      thirdparty/amd-fsr2/ffx_types.h
  11. 136 0
      thirdparty/amd-fsr2/patches/0001-build-fixes.patch
  12. 121 0
      thirdparty/amd-fsr2/patches/0002-godot-fsr2-options.patch
  13. 二進制
      thirdparty/amd-fsr2/patches/godot-changes.patch
  14. 2 3
      thirdparty/amd-fsr2/shaders/ffx_fsr2_accumulate_pass.glsl
  15. 1 1
      thirdparty/amd-fsr2/shaders/ffx_fsr2_autogen_reactive_pass.glsl
  16. 1 7
      thirdparty/amd-fsr2/shaders/ffx_fsr2_callbacks_glsl.h
  17. 1 1
      thirdparty/amd-fsr2/shaders/ffx_fsr2_compute_luminance_pyramid_pass.glsl
  18. 1 1
      thirdparty/amd-fsr2/shaders/ffx_fsr2_depth_clip_pass.glsl
  19. 1 1
      thirdparty/amd-fsr2/shaders/ffx_fsr2_lock_pass.glsl
  20. 1 1
      thirdparty/amd-fsr2/shaders/ffx_fsr2_rcas_pass.glsl
  21. 1 1
      thirdparty/amd-fsr2/shaders/ffx_fsr2_reconstruct_previous_depth_pass.glsl
  22. 1 3
      thirdparty/amd-fsr2/shaders/ffx_fsr2_tcr_autogen_pass.glsl
  23. 1 1
      thirdparty/basis_universal/encoder/basisu_gpu_texture.cpp
  24. 26 0
      thirdparty/basis_universal/patches/0001-external-zstd-pr344.patch
  25. 2 2
      thirdparty/basis_universal/patches/0002-external-jpgd.patch
  26. 1 1
      thirdparty/basis_universal/patches/0003-external-tinyexr.patch
  27. 4 6
      thirdparty/basis_universal/patches/0004-remove-tinydds-qoi.patch
  28. 0 43
      thirdparty/basis_universal/patches/basisu-pr344.patch
  29. 7 9
      thirdparty/clipper2/include/clipper2/clipper.core.h
  30. 1 1
      thirdparty/clipper2/patches/0001-disable-exceptions.patch
  31. 9 11
      thirdparty/clipper2/patches/0002-llvm-disable-int1280-math.patch
  32. 0 0
      thirdparty/cvtt/patches/0001-revert-bc6h-reorg.patch
  33. 0 6
      thirdparty/d3d12ma/D3D12MemAlloc.cpp
  34. 45 0
      thirdparty/d3d12ma/patches/0001-mingw-support.patch
  35. 0 2627
      thirdparty/directx_headers/include/directx/D3D12TokenizedProgramFormat.hpp
  36. 1 1
      thirdparty/directx_headers/include/directx/d3dx12_check_feature_support.h
  37. 0 4
      thirdparty/directx_headers/include/directx/d3dx12_pipeline_state_stream.h
  38. 1 15
      thirdparty/directx_headers/include/directx/d3dx12_root_signature.h
  39. 25 0
      thirdparty/directx_headers/patches/0001-mingw-pragma.patch
  40. 8 22
      thirdparty/directx_headers/patches/0002-win7-8-dynamic-load.patch
  41. 4 8
      thirdparty/embree/common/algorithms/parallel_reduce.h
  42. 1 3
      thirdparty/embree/common/lexers/stringstream.cpp
  43. 0 6
      thirdparty/embree/common/simd/arm/sse2neon.h
  44. 20 42
      thirdparty/embree/common/sys/alloc.cpp
  45. 1 3
      thirdparty/embree/common/sys/alloc.h
  46. 4 8
      thirdparty/embree/common/sys/platform.h
  47. 17 4
      thirdparty/embree/common/sys/sysinfo.cpp
  48. 6 8
      thirdparty/embree/common/tasking/taskschedulerinternal.cpp
  49. 4 8
      thirdparty/embree/common/tasking/taskschedulerinternal.h
  50. 1 3
      thirdparty/embree/kernels/bvh/bvh_statistics.cpp
  51. 4 8
      thirdparty/embree/kernels/common/alloc.h
  52. 9 13
      thirdparty/embree/kernels/common/rtcore.cpp
  53. 9 11
      thirdparty/embree/kernels/common/rtcore.h
  54. 8 10
      thirdparty/embree/kernels/common/scene.cpp
  55. 6 8
      thirdparty/embree/kernels/common/state.cpp
  56. 115 183
      thirdparty/embree/patches/0001-disable-exceptions.patch
  57. 0 0
      thirdparty/embree/patches/0002-godot-config.patch
  58. 32 0
      thirdparty/embree/patches/0003-emscripten-nthreads.patch
  59. 1 1
      thirdparty/embree/patches/0004-mingw-no-cpuidex.patch
  60. 18 24
      thirdparty/embree/patches/0005-mingw-llvm-arm64.patch
  61. 0 0
      thirdparty/embree/patches/0006-include-order-dllexport.patch
  62. 0 42
      thirdparty/embree/patches/emscripten-nthreads.patch
  63. 2 8
      thirdparty/enet/enet/enet.h
  64. 2 2
      thirdparty/enet/enet/enet_godot.h
  65. 53 0
      thirdparty/enet/enet/enet_godot_ext.h
  66. 0 18
      thirdparty/enet/enet/godot_ext.h
  67. 2 2
      thirdparty/enet/enet_godot.cpp
  68. 6 12
      thirdparty/enet/patches/0001-godot-socket.patch
  69. 0 0
      thirdparty/etcpak/patches/0001-remove-bc7enc.patch
  70. 2 2
      thirdparty/glad/patches/0001-enable-both-gl-and-gles.patch
  71. 1 1
      thirdparty/glslang/patches/0001-apple-disable-absolute-paths.patch
  72. 0 0
      thirdparty/glslang/patches/0002-gcc15-include-fix.patch
  73. 0 0
      thirdparty/jpeg-compressor/patches/0001-clang-fortify-fix.patch
  74. 5 12
      thirdparty/libbacktrace/patches/0001-big-files-support.patch
  75. 1 8
      thirdparty/libbacktrace/read.c
  76. 30 0
      thirdparty/libktx/patches/0001-external-basisu.patch
  77. 0 30
      thirdparty/libktx/patches/0002-disable-astc-block-ext.patch
  78. 4 6
      thirdparty/libwebp/patches/0001-msvc-node-debug-rename.patch
  79. 2 4
      thirdparty/libwebp/patches/0002-msvc-arm64-fpstrict.patch
  80. 0 0
      thirdparty/libwebp/patches/0003-clang-cl-sse2-sse41.patch
  81. 0 2
      thirdparty/libwebp/sharpyuv/sharpyuv_gamma.c
  82. 0 2
      thirdparty/libwebp/src/enc/quant_enc.c
  83. 4 1
      thirdparty/linuxbsd_headers/README.md
  84. 13 0
      thirdparty/linuxbsd_headers/alsa/patches/0001-musl-standard-poll.patch
  85. 0 0
      thirdparty/linuxbsd_headers/alsa/patches/0002-freebsd-sys-endian.patch
  86. 0 11
      thirdparty/linuxbsd_headers/alsa/patches/use-standard-poll-h.diff
  87. 0 0
      thirdparty/mbedtls/patches/0001-msvc-2019-psa-redeclaration.patch
  88. 0 0
      thirdparty/meshoptimizer/patches/0001-simplifier-distance-only-error.patch
  89. 4 53
      thirdparty/mingw-std-threads/patches/0001-disable-exceptions.patch
  90. 65 0
      thirdparty/mingw-std-threads/patches/0002-clang-std-replacements-leak.patch
  91. 5 9
      thirdparty/minimp3/minimp3.h
  92. 8 12
      thirdparty/minimp3/patches/0001-msvc-arm.patch
  93. 0 0
      thirdparty/minimp3/patches/0002-msvc-warnings.patch
  94. 3 8
      thirdparty/minizip/ioapi.c
  95. 0 4
      thirdparty/minizip/ioapi.h
  96. 34 63
      thirdparty/minizip/patches/0001-godot-seek.patch
  97. 6 23
      thirdparty/minizip/unzip.c
  98. 0 4
      thirdparty/minizip/unzip.h
  99. 0 4
      thirdparty/minizip/zip.c
  100. 0 0
      thirdparty/misc/FastNoiseLite.h

+ 10 - 10
COPYRIGHT.txt

@@ -411,6 +411,11 @@ Comment: FastLZ
 Copyright: 2005-2020, Ariya Hidayat
 License: Expat
 
+Files: thirdparty/misc/FastNoiseLite.h
+Comment: FastNoise Lite
+Copyright: 2023, Jordan Peck and contributors
+License: Expat
+
 Files: thirdparty/misc/ifaddrs-android.cc
  thirdparty/misc/ifaddrs-android.h
 Comment: libjingle
@@ -423,17 +428,17 @@ Comment: Tangent Space Normal Maps implementation
 Copyright: 2011, Morten S. Mikkelsen
 License: Zlib
 
+Files: thirdparty/misc/nvapi_minimal.h
+Comment: NVIDIA NVAPI (minimal excerpt)
+Copyright: 2019-2022, NVIDIA Corporation
+License: Expat
+
 Files: thirdparty/misc/ok_color.h
  thirdparty/misc/ok_color_shader.h
 Comment: OK Lab color space
 Copyright: 2021, Björn Ottosson
 License: Expat
 
-Files: thirdparty/noise/FastNoiseLite.h
-Comment: FastNoise Lite
-Copyright: 2023, Jordan Peck and contributors
-License: Expat
-
 Files: thirdparty/misc/pcg.cpp
  thirdparty/misc/pcg.h
 Comment: Minimal PCG32 implementation
@@ -484,11 +489,6 @@ Comment: Multi-channel signed distance field generator
 Copyright: 2014-2024, Viktor Chlumsky
 License: Expat
 
-Files: thirdparty/nvapi/nvapi_minimal.h
-Comment: Stripped down version of "nvapi.h" from the NVIDIA NVAPI SDK
-Copyright: 2019-2022, NVIDIA Corporation
-License: Expat
-
 Files: thirdparty/openxr/*
 Comment: OpenXR Loader
 Copyright: 2020-2023, The Khronos Group Inc.

+ 2 - 2
misc/error_suppressions/ubsan.txt

@@ -57,7 +57,7 @@ nonnull-attribute:thirdparty/spirv-reflect/spirv_reflect.c
 pointer-overflow:thirdparty/libogg/framing.c
 shift-base:thirdparty/libogg/bitwise.c
 shift-base:thirdparty/libvorbis/sharedbook.c
-shift-base:thirdparty/noise/FastNoiseLite.h
+shift-base:thirdparty/misc/FastNoiseLite.h
 shift-base:thirdparty/tinyexr/tinyexr.h
 shift-exponent:thirdparty/misc/mikktspace.c
-signed-integer-overflow:thirdparty/noise/FastNoiseLite.h
+signed-integer-overflow:thirdparty/misc/FastNoiseLite.h

+ 1 - 1
modules/enet/SCsub

@@ -13,7 +13,7 @@ thirdparty_obj = []
 if env["builtin_enet"]:
     thirdparty_dir = "#thirdparty/enet/"
     thirdparty_sources = [
-        "godot.cpp",
+        "enet_godot.cpp",
         "callbacks.c",
         "compress.c",
         "host.c",

+ 1 - 1
modules/noise/fastnoise_lite.h

@@ -33,7 +33,7 @@
 
 #include "noise.h"
 
-#include <thirdparty/noise/FastNoiseLite.h>
+#include "thirdparty/misc/FastNoiseLite.h"
 
 typedef fastnoiselite::FastNoiseLite _FastNoiseLite;
 

+ 1 - 1
platform/windows/gl_manager_windows_native.cpp

@@ -35,7 +35,7 @@
 #include "core/config/project_settings.h"
 #include "core/version.h"
 
-#include "thirdparty/nvapi/nvapi_minimal.h"
+#include "thirdparty/misc/nvapi_minimal.h"
 
 #include <dwmapi.h>
 #include <stdio.h>

+ 161 - 111
thirdparty/README.md

@@ -29,7 +29,10 @@ Files extracted from upstream source:
 - `shaders` folder from `src/ffx-fsr2-api` with `ffx_*.hlsl` files excluded
 - `LICENSE.txt`
 
-Apply `patches` to add the new options required by Godot and general compilation fixes.
+Patches:
+
+- `0001-build-fixes.patch` (GH-81197)
+- `0002-godot-fsr2-options.patch` (GH-81197)
 
 
 ## angle
@@ -68,8 +71,13 @@ Files extracted from upstream source:
   `jpgd.{cpp,h}`, `3rdparty/{qoi.h,tinydds.h,tinyexr.cpp,tinyexr.h}`
 - `LICENSE`
 
-Applied upstream PR https://github.com/BinomialLLC/basis_universal/pull/344 to
-fix build with our own copy of zstd (patch in `patches`).
+Patches:
+
+- `0001-external-zstd-pr344.patch` (GH-73441)
+- `0002-external-jpgd.patch` (GH-88508)
+- `0003-external-tinyexr.patch` (GH-97582)
+- `0004-remove-tinydds-qoi.patch` (GH-97582)
+
 
 ## brotli
 
@@ -107,8 +115,10 @@ Files extracted from upstream source:
 - `CPP/Clipper2Lib/` folder (in root)
 - `LICENSE`
 
-Apply the patches in the `patches/` folder when syncing on newer upstream
-commits.
+Patches:
+
+- `0001-disable-exceptions.patch` (GH-80796)
+- `0002-llvm-disable-int1280-math.patch` (GH-95964)
 
 
 ## cvtt
@@ -122,10 +132,9 @@ Files extracted from upstream source:
 - All `.cpp` and `.h` files except the folders `MakeTables` and `etc2packer`
 - `LICENSE.txt`
 
-Changes related to BC6H packing and unpacking made upstream in
-https://github.com/elasota/cvtt/commit/2e4b6b2747aec11f4cc6dd09ef43fa8ce769f6e2
-have been removed as they caused massive quality regressions. Apply the patches
-in the `patches/` folder when syncing on newer upstream commits.
+Patches:
+
+- `0001-revert-bc6h-reorg.patch` (GH-73715)
 
 
 ## d3d12ma
@@ -140,9 +149,9 @@ Files extracted from upstream source:
 - `include/D3D12MemAlloc.h`
 - `LICENSE.txt`, `NOTICES.txt`
 
-Important: Some files have Godot-made changes for use with MinGW.
-They are marked with `/* GODOT start */` and `/* GODOT end */`
-comments.
+Patches:
+
+- `0001-mingw-support.patch` (GH-83452)
 
 
 ## directx_headers
@@ -157,9 +166,10 @@ Files extracted from upstream source:
 - `include/dxguids/*.h`
 - `LICENSE`
 
-Important: Some files have Godot-made changes for use with MinGW.
-They are marked with `/* GODOT start */` and `/* GODOT end */`
-comments.
+Patches:
+
+- `0001-mingw-pragma.patch` (GH-83452)
+- `0002-win7-8-dynamic-load.patch` (GH-88496)
 
 
 ## doctest
@@ -187,13 +197,17 @@ Files extracted from upstream:
 - All config files listed in `modules/raycast/godot_update_embree.py`
 - `LICENSE.txt`
 
-The `modules/raycast/godot_update_embree.py` script can be used to pull the
-relevant files from the latest Embree release and apply some automatic changes.
+Patches:
 
-Some changes have been made in order to remove exceptions and fix minor build errors.
-They are marked with `// -- GODOT start --` and `// -- GODOT end --`
-comments. Apply the patches in the `patches/` folder when syncing on newer upstream
-commits.
+- `0001-disable-exceptions.patch` (GH-48050)
+- `0002-godot-config.patch` (GH-88783)
+- `0003-emscripten-nthreads.patch` (GH-69799)
+- `0004-mingw-no-cpuidex.patch` (GH-92488)
+- `0005-mingw-llvm-arm64.patch` (GH-93364)
+- `0006-include-order-dllexport.patch` (GH-94256)
+
+The `modules/raycast/godot_update_embree.py` script can be used to pull the
+relevant files from the latest Embree release and apply patches automatically.
 
 
 ## enet
@@ -207,17 +221,15 @@ Files extracted from upstream source:
 - All `.c` files in the main directory (except `unix.c` and `win32.c`)
 - The `include/enet/` folder as `enet/` (except `unix.h` and `win32.h`)
 - `LICENSE` file
+- Added 3 files `enet_godot.cpp`, `enet/enet_godot.h`, and `enet/enet_godot_ext.h`,
+  providing ENet socket implementation using Godot classes, allowing IPv6 and DTLS.
 
-Important: `enet.h`, `host.c`, `protocol.c` have been slightly modified
-to be usable by Godot's socket implementation and allow IPv6 and DTLS.
-Apply the patches in the `patches/` folder when syncing on newer upstream
-commits.
+Patches:
 
-Three files (`godot.cpp`, `enet/godot.h`, `enet/godot_ext.h`) have been added to
-provide ENet socket implementation using Godot classes.
+- `0001-godot-socket.patch` (GH-7985)
 
-It is still possible to build against a system wide ENet but doing so will limit
-its functionality to IPv4 only.
+Important: Building against a system wide ENet is possible, but will limit its
+functionality to IPv4 only and no DTLS. We recommend against it.
 
 
 ## etcpak
@@ -236,6 +248,11 @@ Files extracted from upstream source:
 - The files `DecodeRGB.{cpp.hpp}` are based on the code from the original repository.
 - `AUTHORS.txt` and `LICENSE.txt`
 
+Patches:
+
+- `0001-remove-bc7enc.patch` (GH-101362)
+
+
 ## fonts
 
 - `DroidSans*.woff2`:
@@ -340,11 +357,12 @@ Files generated from [upstream web instance](https://gen.glad.sh/):
 - `glx.c`
 - `glad/glx.h`
 
-See the permalinks in `glad/gl.h` and `glad/glx.h` to regenrate the files with
+See the permalinks in `glad/gl.h` and `glad/glx.h` to regenerate the files with
 a new version of the web instance.
 
-Some changes have been made in order to allow loading OpenGL and OpenGLES APIs at the same time.
-See the patches in the `patches` directory.
+Patches:
+
+- `0001-enable-both-gl-and-gles.patch` (GH-72831)
 
 
 ## glslang
@@ -366,6 +384,11 @@ Files extracted from upstream source:
 - `LICENSE.txt`
 - Unnecessary files like `CMakeLists.txt` or `updateGrammar` removed
 
+Patches:
+
+- `0001-apple-disable-absolute-paths.patch` (GH-92010)
+- `0002-gcc15-include-fix.patch` (GH-102022)
+
 
 ## graphite
 
@@ -445,6 +468,10 @@ Files extracted from upstream source:
 - `jpgd*.{c,h}`
 - `jpge*.{c,h}`
 
+Patches:
+
+- `0001-clang-fortify-fix.patch` (GH-101927)
+
 
 ## libbacktrace
 
@@ -459,9 +486,9 @@ Files extracted from upstream source:
   * `elf.c`, `macho.c`, `mmap.c`, `mmapio.c`, `nounwind.c`, `unknown.c`, `xcoff.c`
 - `LICENSE`
 
-Important: Some files have Godot-made changes to load big debug symbol files.
-They are marked with `/* GODOT start */` and `/* GODOT end */`
-comments and a patch is provided in the `patches` folder.
+Patches:
+
+- `0001-big-files-support.patch` (GH-100281)
 
 
 ## libktx
@@ -481,7 +508,10 @@ Files extracted from upstream source:
 - `other_include/KHR/`
 - `utils/unused.h`
 
-Some Godot-specific changes are applied via patches included in the `patches` folder.
+Patches:
+
+- `0001-external-basisu.patch` (GH-76572)
+- `0002-disable-astc-block-ext.patch` (GH-76572)
 
 
 ## libogg
@@ -549,8 +579,16 @@ Files extracted from upstream source:
 - `src/` and `sharpyuv/` except from `.am`, `.rc` and `.in` files
 - `AUTHORS`, `COPYING`, `PATENTS`
 
-Patch `godot-node-debug-fix.patch` workarounds shadowing of Godot's Node class
-in the MSVC debugger.
+Patches:
+
+- `0001-msvc-node-debug-rename.patch`
+- `0002-msvc-arm64-fpstrict.patch`
+- `0003-clang-cl-sse2-sse41.patch`
+
+
+## linuxbsd_headers
+
+See `linuxbsd_headers/README.md`.
 
 
 ## manifold
@@ -581,13 +619,15 @@ File extracted from upstream release tarball:
   - Except `bignum_mod.c`, `block_cipher.c`, `ecp_curves_new.c`, `lmots.c`,
   `lms.c`
 - The `LICENSE` file (edited to keep only the Apache 2.0 variant)
-- Applied the patch `msvc-redeclaration-bug.diff` to fix a compilation error
-  with some MSVC versions
 - Added 2 files `godot_core_mbedtls_platform.c` and `godot_core_mbedtls_config.h`
   providing configuration for light bundling with core
 - Added the file `godot_module_mbedtls_config.h` to customize the build
   configuration when bundling the full library
 
+Patches:
+
+- `0001-msvc-2019-psa-redeclaration.patch` (GH-90535)
+
 
 ## meshoptimizer
 
@@ -600,8 +640,9 @@ Files extracted from upstream repository:
 - All files in `src/`
 - `LICENSE.md`
 
-A patch is included to modify the simplifier to report only distance error
-metrics instead of a combination of distance and attribute errors.
+Patches:
+
+- `0001-simplifier-distance-only-error.patch` (GH-98529)
 
 
 ## mingw-std-threads
@@ -619,8 +660,10 @@ Files extracted from upstream repository:
 - `mingw.shared_mutex.h`
 - `mingw.thread.h`
 
-Once copied, apply `godot.patch` (needed because Godot is built without exceptions
-and to avoid std:: replacements leak in Clang builds).
+Patches:
+
+- `0001-disable-exceptions.patch` (GH-85039)
+- `0002-clang-std-replacements-leak.patch` (GH-85208)
 
 
 ## minimp3
@@ -635,8 +678,10 @@ Files extracted from upstream repository:
 - `minimp3_ex.h`
 - `LICENSE`
 
-Some changes have been made in order to fix Windows on ARM build errors, and
-to solve some MSVC warnings. See the patches in the `patches` directory.
+Patches:
+
+- `0001-msvc-arm.patch` (GH-64921)
+- `0002-msvc-warnings.patch` (GH-66545)
 
 
 ## miniupnpc
@@ -652,10 +697,8 @@ Files extracted from upstream source:
 - Remove the following test or sample files:
   `listdevices.c,minihttptestserver.c,miniupnpcmodule.c,upnpc.c,upnperrors.*,test*`
 - `LICENSE`
-
-The only modified file is `src/miniupnpcstrings.h`, which was created for Godot
-(it is usually autogenerated by cmake). Bump the version number for miniupnpc in
-that file when upgrading.
+- `src/miniupnpcstrings.h` was created manually for Godot (it is usually generated
+  by CMake). Bump the version number for miniupnpc in that file when upgrading.
 
 
 ## minizip
@@ -670,9 +713,9 @@ Files extracted from the upstream source:
   `{crypt.h,ioapi.{c,h},unzip.{c,h},zip.{c,h}}`
   `MiniZip64_info.txt`
 
-Important: Some files have Godot-made changes for use in core/io.
-They are marked with `/* GODOT start */` and `/* GODOT end */`
-comments and a patch is provided in the `patches` folder.
+Patches:
+
+- `0001-godot-seek.patch` (GH-10428)
 
 
 ## misc
@@ -683,10 +726,6 @@ Collection of single-file libraries used in Godot components.
   * Upstream: https://github.com/iOrange/bcdec
   * Version: git (3b29f8f44466c7d59852670f82f53905cf627d48, 2024)
   * License: MIT
-- `clipper.{cpp,hpp}`
-  * Upstream: https://sourceforge.net/projects/polyclipping
-  * Version: 6.4.2 (2017) + Godot changes (added optional exceptions handling)
-  * License: BSL-1.0
 - `cubemap_coeffs.h`
   * Upstream: https://research.activision.com/publications/archives/fast-filtering-of-reflection-probes
     File coeffs_const_8.txt (retrieved April 2020)
@@ -695,14 +734,27 @@ Collection of single-file libraries used in Godot components.
   * Upstream: https://github.com/ariya/FastLZ
   * Version: 0.5.0 (4f20f54d46f5a6dd4fae4def134933369b7602d2, 2020)
   * License: MIT
+- `FastNoiseLite.h`
+  * Upstream: https://github.com/Auburn/FastNoiseLite
+  * Version: 1.1.0 (f7af54b56518aa659e1cf9fb103c0b6e36a833d9, 2023)
+  * License: MIT
+  * Patches:
+    - `FastNoiseLite-0001-namespace-warnings.patch` (GH-88526)
 - `ifaddrs-android.{cc,h}`
   * Upstream: https://chromium.googlesource.com/external/webrtc/stable/talk/+/master/base/ifaddrs-android.h
   * Version: git (5976650443d68ccfadf1dea24999ee459dd2819d, 2013)
   * License: BSD-3-Clause
+  * Patches:
+    - `ifaddrs-android-0001-complete-struct.patch` (GH-34101)
 - `mikktspace.{c,h}`
   * Upstream: https://archive.blender.org/wiki/index.php/Dev:Shading/Tangent_Space_Normal_Maps/
   * Version: 1.0 (2011)
   * License: zlib
+- `nvapi_minimal.h`
+  * Upstream: http://download.nvidia.com/XFree86/nvapi-open-source-sdk
+  * Version: R525
+  * License: MIT
+  * Modifications: Created from upstream `nvapi.h` by removing unnecessary code.
 - `ok_color.h`
   * Upstream: https://github.com/bottosson/bottosson.github.io/blob/master/misc/ok_color.h
   * Version: git (d69831edb90ffdcd08b7e64da3c5405acd48ad2c, 2022)
@@ -719,13 +771,15 @@ Collection of single-file libraries used in Godot components.
 - `polypartition.{cpp,h}`
   * Upstream: https://github.com/ivanfratric/polypartition (`src/polypartition.{cpp,h}`)
   * Version: git (7bdffb428b2b19ad1c43aa44c714dcc104177e84, 2021)
-  * Modifications: Change from STL to Godot types (see provided patch).
   * License: MIT
-- `qoa.h`
+  * Patches:
+    - `polypartition-0001-godot-types.patch` (2185c018f)
+    - `polypartition-0002-shadow-warning.patch` (GH-66808)
+- `qoa.{c,h}`
   * Upstream: https://github.com/phoboslab/qoa
   * Version: git (a2d927f8ce78a85e903676a33e0f956e53b89f7d, 2024)
-  * Modifications: Added implementation through `qoa.c`.
   * License: MIT
+  * Modifications: Added implementation through `qoa.c`.
 - `r128.{c,h}`
   * Upstream: https://github.com/fahickman/r128
   * Version: git (6fc177671c47640d5bb69af10cf4ee91050015a1, 2023)
@@ -734,7 +788,9 @@ Collection of single-file libraries used in Godot components.
   * Upstream: https://github.com/antirez/smaz
   * Version: git (2f625846a775501fb69456567409a8b12f10ea25, 2012)
   * License: BSD-3-Clause
-  * Modifications: use `const char*` instead of `char*` for input string
+  * Modifications: License included in header.
+  * Patches:
+    - `smaz-0001-write-string-warning.patch` (GH-8572)
 - `smolv.{cpp,h}`
   * Upstream: https://github.com/aras-p/smol-v
   * Version: git (9dd54c379ac29fa148cb1b829bb939ba7381d8f4, 2024)
@@ -762,31 +818,6 @@ Files extracted from the upstream source:
 - `LICENSE.txt`
 
 
-## noise
-
-- Upstream: https://github.com/Auburn/FastNoiseLite
-- Version: 1.1.0 (f7af54b56518aa659e1cf9fb103c0b6e36a833d9, 2023)
-- License: MIT
-
-Files extracted from the upstream source:
-
-- `FastNoiseLite.h`
-- `LICENSE`
-
-Some custom changes were made to fix compiler warnings, and can be re-applied
-with the provided patch.
-
-
-## nvapi
-
-- Upstream: http://download.nvidia.com/XFree86/nvapi-open-source-sdk
-- Version: R525
-- License: MIT
-
-- `nvapi_minimal.h` was created by using `nvapi.h` from upstream and removing
-  unnecessary code.
-
-
 ## openxr
 
 - Upstream: https://github.com/KhronosGroup/OpenXR-SDK
@@ -814,6 +845,10 @@ Exclude:
   `*.{def,expsym,in,json,map,pom,rc,txt}`
 - All dotfiles
 
+Patches:
+
+- `0001-glad-egl.patch` (GH-98824)
+
 
 ## pcre2
 
@@ -900,38 +935,42 @@ Files extracted from upstream source:
 - `include/` folder
 - `LICENSE`
 
-Some downstream changes have been made and are identified by
-`// -- GODOT begin --` and `// -- GODOT end --` comments.
-They can be reapplied using the patches included in the `patches`
-folder, in order.
+Patches:
 
+- `0001-specialization-constants.patch` (GH-50325)
+- `0002-zero-size-for-sc-sized-arrays.patch` (GH-94985)
 
-## tinyexr
 
-- Upstream: https://github.com/syoyo/tinyexr
-- Version: 1.0.9 (5fcb4dcb6e3abf96214b67e5c54db1ceec6a455c, 2024)
-- License: BSD-3-Clause
+## thorvg
+
+- Upstream: https://github.com/thorvg/thorvg
+- Version: 0.15.8 (bd8c2fca7663a22fba7a339937cb60f2f6247a2e, 2025)
+- License: MIT
 
 Files extracted from upstream source:
 
-- `tinyexr.{cc,h}`
+- See `thorvg/update-thorvg.sh` for extraction instructions.
+  Set the version number and run the script.
 
-The `tinyexr.cc` file was modified to include `zlib.h` which we provide,
-instead of `miniz.h` as an external dependency.
+Patches:
 
+- `0001-revert-tvglines-bezier-precision.patch` (GH-96658)
+- `0002-gcc15-include-fix.patch` (GH-102022)
 
-## thorvg
 
-- Upstream: https://github.com/thorvg/thorvg
-- Version: 0.15.8 (bd8c2fca7663a22fba7a339937cb60f2f6247a2e, 2025)
-- License: MIT
+## tinyexr
+
+- Upstream: https://github.com/syoyo/tinyexr
+- Version: 1.0.9 (5fcb4dcb6e3abf96214b67e5c54db1ceec6a455c, 2024)
+- License: BSD-3-Clause
 
 Files extracted from upstream source:
 
-See `thorvg/update-thorvg.sh` for extraction instructions. Set the version
-number and run the script.
+- `tinyexr.{cc,h}`
+
+Patches:
 
-Patches in the `patches/` directory should be re-applied after updating.
+- `0001-external-zlib.patch` (GH-55115)
 
 
 ## ufbx
@@ -957,10 +996,14 @@ Files extracted from upstream source:
 - From `src/VHACD_Lib/`: `inc`, `public` and `src`
 - `LICENSE`
 
-Some downstream changes have been made and are identified by
-`// -- GODOT start --` and `// -- GODOT end --` comments.
-They can be reapplied using the patches included in the `vhacd`
-folder.
+Patches:
+
+- `0001-bullet-namespace.patch` (GH-27929)
+- `0002-fpermissive-fix.patch` (GH-27929)
+- `0003-fix-musl-build.patch` (GH-34250)
+- `0004-fix-msvc-arm-build.patch` (GH-34331)
+- `0005-fix-scale-calculation.patch` (GH-38506)
+- `0006-gcc13-include-fix.patch` (GH-77949)
 
 
 ## volk
@@ -1004,7 +1047,12 @@ SDK release: https://github.com/KhronosGroup/Vulkan-Utility-Libraries/blob/main/
 Version: 3.1.0 (009ecd192c1289c7529bff248a16cfe896254816, 2024)
 `vk_mem_alloc.cpp` is a Godot file and should be preserved on updates.
 
-Patches in the `patches` directory should be re-applied after updates.
+Patches:
+
+- `0001-VKEnumStringHelper-godot-vulkan.patch` (GH-97510)
+- `0002-VMA-godot-vulkan.patch` (GH-97510)
+- `0003-VMA-add-vmaCalculateLazilyAllocatedBytes.patch` (GH-99257)
+
 
 
 ## wayland
@@ -1069,10 +1117,12 @@ File extracted from upstream release tarball:
   Contents might need tweaking for Godot, review diff
 - All `.c` and `.h` files from `lib/`
 - All `.h` in `lib/includes/wslay/` as `wslay/`
-- `wslay/wslay.h` has a small Godot addition to fix MSVC build
-  See `patches/msvcfix.diff`
 - `COPYING`
 
+Patches:
+
+- `0001-msvc-build-fix.patch` (GH-30263)
+
 
 ## xatlas
 

+ 0 - 4
thirdparty/amd-fsr2/ffx_fsr2.cpp

@@ -36,7 +36,6 @@
 #pragma clang diagnostic ignored "-Wunused-variable"
 #endif
 
-// -- GODOT start --
 #ifndef _countof
 #define _countof(array) (sizeof(array) / sizeof(array[0]))
 #endif
@@ -45,7 +44,6 @@
 #include <wchar.h>
 #define wcscpy_s wcscpy
 #endif
-// -- GODOT end --
 
 // max queued frames for descriptor management
 static const uint32_t FSR2_MAX_QUEUED_FRAMES = 16;
@@ -954,9 +952,7 @@ static FfxErrorCode fsr2Dispatch(FfxFsr2Context_Private* context, const FfxFsr2D
     context->constants.lumaMipDimensions[0] = uint32_t(context->constants.maxRenderSize[0] / mipDiv);
     context->constants.lumaMipDimensions[1] = uint32_t(context->constants.maxRenderSize[1] / mipDiv);
 
-	// -- GODOT start --
     memcpy(context->constants.reprojectionMatrix, params->reprojectionMatrix, sizeof(context->constants.reprojectionMatrix));
-	// -- GODOT end --
 
     // reactive mask bias
     const int32_t threadGroupWorkRegionDim = 8;

+ 0 - 3
thirdparty/amd-fsr2/ffx_fsr2.h

@@ -146,10 +146,7 @@ typedef struct FfxFsr2DispatchDescription {
     float                       autoReactiveScale;                  ///< A value to scale the reactive mask
     float                       autoReactiveMax;                    ///< A value to clamp the reactive mask
 
-    // -- GODOT start --
     float                       reprojectionMatrix[16];             ///< The matrix used for reprojecting pixels with invalid motion vectors by using the depth.
-	// -- GODOT end --
-
 } FfxFsr2DispatchDescription;
 
 /// A structure encapsulating the parameters for automatic generation of a reactive mask

+ 0 - 2
thirdparty/amd-fsr2/ffx_fsr2_private.h

@@ -45,10 +45,8 @@ typedef struct Fsr2Constants {
     float                       dynamicResChangeFactor;
     float                       viewSpaceToMetersFactor;
 
-	// -- GODOT start --
     float                       pad;
     float                       reprojectionMatrix[16];
-	// -- GODOT end --
 } Fsr2Constants;
 
 struct FfxFsr2ContextDescription;

+ 0 - 2
thirdparty/amd-fsr2/ffx_types.h

@@ -22,9 +22,7 @@
 #pragma once
 
 #include <stdint.h>
-// -- GODOT start --
 #include <stdlib.h>
-// -- GODOT end --
 
 #if defined (FFX_GCC)
 /// FidelityFX exported functions

+ 136 - 0
thirdparty/amd-fsr2/patches/0001-build-fixes.patch

@@ -0,0 +1,136 @@
+diff --git a/thirdparty/amd-fsr2/ffx_fsr2.cpp b/thirdparty/amd-fsr2/ffx_fsr2.cpp
+index 051018e437..3970aa7f5b 100644
+--- a/thirdparty/amd-fsr2/ffx_fsr2.cpp
++++ b/thirdparty/amd-fsr2/ffx_fsr2.cpp
+@@ -36,6 +36,15 @@
+ #pragma clang diagnostic ignored "-Wunused-variable"
+ #endif
+ 
++#ifndef _countof
++#define _countof(array) (sizeof(array) / sizeof(array[0]))
++#endif
++
++#ifndef _MSC_VER
++#include <wchar.h>
++#define wcscpy_s wcscpy
++#endif
++
+ // max queued frames for descriptor management
+ static const uint32_t FSR2_MAX_QUEUED_FRAMES = 16;
+ 
+diff --git a/thirdparty/amd-fsr2/ffx_types.h b/thirdparty/amd-fsr2/ffx_types.h
+index 74edd192c4..f71b259cce 100644
+--- a/thirdparty/amd-fsr2/ffx_types.h
++++ b/thirdparty/amd-fsr2/ffx_types.h
+@@ -22,6 +22,7 @@
+ #pragma once
+ 
+ #include <stdint.h>
++#include <stdlib.h>
+ 
+ #if defined (FFX_GCC)
+ /// FidelityFX exported functions
+diff --git a/thirdparty/amd-fsr2/shaders/ffx_fsr2_accumulate_pass.glsl b/thirdparty/amd-fsr2/shaders/ffx_fsr2_accumulate_pass.glsl
+index ebbe610ffa..31d68292d4 100644
+--- a/thirdparty/amd-fsr2/shaders/ffx_fsr2_accumulate_pass.glsl
++++ b/thirdparty/amd-fsr2/shaders/ffx_fsr2_accumulate_pass.glsl
+@@ -19,7 +19,7 @@
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ // THE SOFTWARE.
+ 
+-#version 450
++//#version 450
+ 
+ #extension GL_GOOGLE_include_directive : require
+ #extension GL_EXT_samplerless_texture_functions : require
+diff --git a/thirdparty/amd-fsr2/shaders/ffx_fsr2_autogen_reactive_pass.glsl b/thirdparty/amd-fsr2/shaders/ffx_fsr2_autogen_reactive_pass.glsl
+index 7ae41cf0c1..3b86c17d4d 100644
+--- a/thirdparty/amd-fsr2/shaders/ffx_fsr2_autogen_reactive_pass.glsl
++++ b/thirdparty/amd-fsr2/shaders/ffx_fsr2_autogen_reactive_pass.glsl
+@@ -19,7 +19,7 @@
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ // THE SOFTWARE.
+ 
+-#version 450
++//#version 450
+ 
+ #extension GL_GOOGLE_include_directive : require
+ #extension GL_EXT_samplerless_texture_functions : require
+diff --git a/thirdparty/amd-fsr2/shaders/ffx_fsr2_compute_luminance_pyramid_pass.glsl b/thirdparty/amd-fsr2/shaders/ffx_fsr2_compute_luminance_pyramid_pass.glsl
+index 15186e3bb6..8439c4e9d4 100644
+--- a/thirdparty/amd-fsr2/shaders/ffx_fsr2_compute_luminance_pyramid_pass.glsl
++++ b/thirdparty/amd-fsr2/shaders/ffx_fsr2_compute_luminance_pyramid_pass.glsl
+@@ -19,7 +19,7 @@
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ // THE SOFTWARE.
+ 
+-#version 450
++//#version 450
+ 
+ #extension GL_GOOGLE_include_directive : require
+ #extension GL_EXT_samplerless_texture_functions : require
+diff --git a/thirdparty/amd-fsr2/shaders/ffx_fsr2_depth_clip_pass.glsl b/thirdparty/amd-fsr2/shaders/ffx_fsr2_depth_clip_pass.glsl
+index fcb2b76528..45ec5bdb86 100644
+--- a/thirdparty/amd-fsr2/shaders/ffx_fsr2_depth_clip_pass.glsl
++++ b/thirdparty/amd-fsr2/shaders/ffx_fsr2_depth_clip_pass.glsl
+@@ -19,7 +19,7 @@
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ // THE SOFTWARE.
+ 
+-#version 450
++//#version 450
+ 
+ #extension GL_GOOGLE_include_directive : require
+ #extension GL_EXT_samplerless_texture_functions : require
+diff --git a/thirdparty/amd-fsr2/shaders/ffx_fsr2_lock_pass.glsl b/thirdparty/amd-fsr2/shaders/ffx_fsr2_lock_pass.glsl
+index f7cad59c20..7c3a4c2740 100644
+--- a/thirdparty/amd-fsr2/shaders/ffx_fsr2_lock_pass.glsl
++++ b/thirdparty/amd-fsr2/shaders/ffx_fsr2_lock_pass.glsl
+@@ -19,7 +19,7 @@
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ // THE SOFTWARE.
+ 
+-#version 450
++//#version 450
+ 
+ #extension GL_GOOGLE_include_directive : require
+ #extension GL_EXT_samplerless_texture_functions : require
+diff --git a/thirdparty/amd-fsr2/shaders/ffx_fsr2_rcas_pass.glsl b/thirdparty/amd-fsr2/shaders/ffx_fsr2_rcas_pass.glsl
+index f0823c2bc8..8b4ebc6afc 100644
+--- a/thirdparty/amd-fsr2/shaders/ffx_fsr2_rcas_pass.glsl
++++ b/thirdparty/amd-fsr2/shaders/ffx_fsr2_rcas_pass.glsl
+@@ -19,7 +19,7 @@
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ // THE SOFTWARE.
+ 
+-#version 450
++//#version 450
+ 
+ #extension GL_GOOGLE_include_directive : require
+ #extension GL_EXT_samplerless_texture_functions : require
+diff --git a/thirdparty/amd-fsr2/shaders/ffx_fsr2_reconstruct_previous_depth_pass.glsl b/thirdparty/amd-fsr2/shaders/ffx_fsr2_reconstruct_previous_depth_pass.glsl
+index 20e17eef8c..be4395aaed 100644
+--- a/thirdparty/amd-fsr2/shaders/ffx_fsr2_reconstruct_previous_depth_pass.glsl
++++ b/thirdparty/amd-fsr2/shaders/ffx_fsr2_reconstruct_previous_depth_pass.glsl
+@@ -19,7 +19,7 @@
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ // THE SOFTWARE.
+ 
+-#version 450
++//#version 450
+ 
+ #extension GL_GOOGLE_include_directive : require
+ #extension GL_EXT_samplerless_texture_functions : require
+diff --git a/thirdparty/amd-fsr2/shaders/ffx_fsr2_tcr_autogen_pass.glsl b/thirdparty/amd-fsr2/shaders/ffx_fsr2_tcr_autogen_pass.glsl
+index bebca91099..7d6a66b8ac 100644
+--- a/thirdparty/amd-fsr2/shaders/ffx_fsr2_tcr_autogen_pass.glsl
++++ b/thirdparty/amd-fsr2/shaders/ffx_fsr2_tcr_autogen_pass.glsl
+@@ -19,7 +19,7 @@
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ // THE SOFTWARE.
+ 
+-#version 450
++//#version 450
+ 
+ #extension GL_GOOGLE_include_directive : require
+ #extension GL_EXT_samplerless_texture_functions : require

+ 121 - 0
thirdparty/amd-fsr2/patches/0002-godot-fsr2-options.patch

@@ -0,0 +1,121 @@
+diff --git a/thirdparty/amd-fsr2/ffx_fsr2.cpp b/thirdparty/amd-fsr2/ffx_fsr2.cpp
+index 3970aa7f5b..ec571b9cd2 100644
+--- a/thirdparty/amd-fsr2/ffx_fsr2.cpp
++++ b/thirdparty/amd-fsr2/ffx_fsr2.cpp
+@@ -952,6 +952,8 @@ static FfxErrorCode fsr2Dispatch(FfxFsr2Context_Private* context, const FfxFsr2D
+     context->constants.lumaMipDimensions[0] = uint32_t(context->constants.maxRenderSize[0] / mipDiv);
+     context->constants.lumaMipDimensions[1] = uint32_t(context->constants.maxRenderSize[1] / mipDiv);
+ 
++    memcpy(context->constants.reprojectionMatrix, params->reprojectionMatrix, sizeof(context->constants.reprojectionMatrix));
++
+     // reactive mask bias
+     const int32_t threadGroupWorkRegionDim = 8;
+     const int32_t dispatchSrcX = (context->constants.renderSize[0] + (threadGroupWorkRegionDim - 1)) / threadGroupWorkRegionDim;
+diff --git a/thirdparty/amd-fsr2/ffx_fsr2.h b/thirdparty/amd-fsr2/ffx_fsr2.h
+index 2a1c74abb1..dfcd4caf35 100644
+--- a/thirdparty/amd-fsr2/ffx_fsr2.h
++++ b/thirdparty/amd-fsr2/ffx_fsr2.h
+@@ -146,6 +146,7 @@ typedef struct FfxFsr2DispatchDescription {
+     float                       autoReactiveScale;                  ///< A value to scale the reactive mask
+     float                       autoReactiveMax;                    ///< A value to clamp the reactive mask
+ 
++    float                       reprojectionMatrix[16];             ///< The matrix used for reprojecting pixels with invalid motion vectors by using the depth.
+ } FfxFsr2DispatchDescription;
+ 
+ /// A structure encapsulating the parameters for automatic generation of a reactive mask
+diff --git a/thirdparty/amd-fsr2/ffx_fsr2_private.h b/thirdparty/amd-fsr2/ffx_fsr2_private.h
+index 6b5fbc5117..8a9aec5778 100644
+--- a/thirdparty/amd-fsr2/ffx_fsr2_private.h
++++ b/thirdparty/amd-fsr2/ffx_fsr2_private.h
+@@ -44,6 +44,9 @@ typedef struct Fsr2Constants {
+     float                       deltaTime;
+     float                       dynamicResChangeFactor;
+     float                       viewSpaceToMetersFactor;
++
++    float                       pad;
++    float                       reprojectionMatrix[16];
+ } Fsr2Constants;
+ 
+ struct FfxFsr2ContextDescription;
+diff --git a/thirdparty/amd-fsr2/shaders/ffx_fsr2_accumulate_pass.glsl b/thirdparty/amd-fsr2/shaders/ffx_fsr2_accumulate_pass.glsl
+index 31d68292d4..2e98c8a6c5 100644
+--- a/thirdparty/amd-fsr2/shaders/ffx_fsr2_accumulate_pass.glsl
++++ b/thirdparty/amd-fsr2/shaders/ffx_fsr2_accumulate_pass.glsl
+@@ -35,7 +35,7 @@
+ #endif
+ #define FSR2_BIND_SRV_INTERNAL_UPSCALED                      3
+ #define FSR2_BIND_SRV_LOCK_STATUS                            4
+-#define FSR2_BIND_SRV_INPUT_DEPTH_CLIP                       5
++//#define FSR2_BIND_SRV_INPUT_DEPTH_CLIP                       5
+ #define FSR2_BIND_SRV_PREPARED_INPUT_COLOR                   6
+ #define FSR2_BIND_SRV_LUMA_INSTABILITY                       7
+ #define FSR2_BIND_SRV_LANCZOS_LUT                            8
+@@ -52,6 +52,10 @@
+ 
+ #define FSR2_BIND_CB_FSR2                                    18
+ 
++#if FFX_FSR2_OPTION_GODOT_DERIVE_INVALID_MOTION_VECTORS
++#define FSR2_BIND_SRV_INPUT_DEPTH                            5
++#endif
++
+ #include "ffx_fsr2_callbacks_glsl.h"
+ #include "ffx_fsr2_common.h"
+ #include "ffx_fsr2_sample.h"
+diff --git a/thirdparty/amd-fsr2/shaders/ffx_fsr2_callbacks_glsl.h b/thirdparty/amd-fsr2/shaders/ffx_fsr2_callbacks_glsl.h
+index 10da13fb81..b610037cc6 100644
+--- a/thirdparty/amd-fsr2/shaders/ffx_fsr2_callbacks_glsl.h
++++ b/thirdparty/amd-fsr2/shaders/ffx_fsr2_callbacks_glsl.h
+@@ -52,6 +52,9 @@
+ 		FfxFloat32    fDeltaTime;
+ 		FfxFloat32    fDynamicResChangeFactor;
+ 		FfxFloat32    fViewSpaceToMetersFactor;
++
++		FfxFloat32    fPad;
++		mat4          mReprojectionMatrix;
+ 	} cbFSR2;
+ #endif
+ 
+@@ -317,7 +320,11 @@ FfxFloat32 LoadInputDepth(FfxInt32x2 iPxPos)
+ #if defined(FSR2_BIND_SRV_REACTIVE_MASK) 
+ FfxFloat32 LoadReactiveMask(FfxInt32x2 iPxPos)
+ {
++#if FFX_FSR2_OPTION_GODOT_REACTIVE_MASK_CLAMP
++	return min(texelFetch(r_reactive_mask, FfxInt32x2(iPxPos), 0).r, 0.9f);
++#else
+ 	return texelFetch(r_reactive_mask, FfxInt32x2(iPxPos), 0).r;
++#endif
+ }
+ #endif
+ 
+@@ -354,6 +361,16 @@ FfxFloat32x2 LoadInputMotionVector(FfxInt32x2 iPxDilatedMotionVectorPos)
+ {
+ 	FfxFloat32x2 fSrcMotionVector = texelFetch(r_input_motion_vectors, iPxDilatedMotionVectorPos, 0).xy;
+ 
++#if FFX_FSR2_OPTION_GODOT_DERIVE_INVALID_MOTION_VECTORS
++	bool bInvalidMotionVector = all(lessThanEqual(fSrcMotionVector, vec2(-1.0f, -1.0f)));
++	if (bInvalidMotionVector)
++	{
++		FfxFloat32 fSrcDepth = LoadInputDepth(iPxDilatedMotionVectorPos);
++		FfxFloat32x2 fUv = (iPxDilatedMotionVectorPos + FfxFloat32(0.5)) / RenderSize();
++		fSrcMotionVector = FFX_FSR2_OPTION_GODOT_DERIVE_INVALID_MOTION_VECTORS_FUNCTION(fUv, fSrcDepth, cbFSR2.mReprojectionMatrix);
++	}
++#endif
++
+ 	FfxFloat32x2 fUvMotionVector = fSrcMotionVector * MotionVectorScale();
+ 
+ #if FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS
+diff --git a/thirdparty/amd-fsr2/shaders/ffx_fsr2_tcr_autogen_pass.glsl b/thirdparty/amd-fsr2/shaders/ffx_fsr2_tcr_autogen_pass.glsl
+index 7d6a66b8ac..5c042c332a 100644
+--- a/thirdparty/amd-fsr2/shaders/ffx_fsr2_tcr_autogen_pass.glsl
++++ b/thirdparty/amd-fsr2/shaders/ffx_fsr2_tcr_autogen_pass.glsl
+@@ -40,6 +40,10 @@
+ #define FSR2_BIND_CB_FSR2									11
+ #define FSR2_BIND_CB_REACTIVE                               12
+ 
++#if FFX_FSR2_OPTION_GODOT_DERIVE_INVALID_MOTION_VECTORS
++#define FSR2_BIND_SRV_INPUT_DEPTH                           13
++#endif
++
+ #include "ffx_fsr2_callbacks_glsl.h"
+ #include "ffx_fsr2_common.h"
+ 

二進制
thirdparty/amd-fsr2/patches/godot-changes.patch


+ 2 - 3
thirdparty/amd-fsr2/shaders/ffx_fsr2_accumulate_pass.glsl

@@ -19,7 +19,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-
+//#version 450
 
 #extension GL_GOOGLE_include_directive : require
 #extension GL_EXT_samplerless_texture_functions : require
@@ -35,6 +35,7 @@
 #endif
 #define FSR2_BIND_SRV_INTERNAL_UPSCALED                      3
 #define FSR2_BIND_SRV_LOCK_STATUS                            4
+//#define FSR2_BIND_SRV_INPUT_DEPTH_CLIP                       5
 #define FSR2_BIND_SRV_PREPARED_INPUT_COLOR                   6
 #define FSR2_BIND_SRV_LUMA_INSTABILITY                       7
 #define FSR2_BIND_SRV_LANCZOS_LUT                            8
@@ -51,11 +52,9 @@
 
 #define FSR2_BIND_CB_FSR2                                    18
 
-// -- GODOT start --
 #if FFX_FSR2_OPTION_GODOT_DERIVE_INVALID_MOTION_VECTORS
 #define FSR2_BIND_SRV_INPUT_DEPTH                            5
 #endif
-// -- GODOT end --
 
 #include "ffx_fsr2_callbacks_glsl.h"
 #include "ffx_fsr2_common.h"

+ 1 - 1
thirdparty/amd-fsr2/shaders/ffx_fsr2_autogen_reactive_pass.glsl

@@ -19,7 +19,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-
+//#version 450
 
 #extension GL_GOOGLE_include_directive : require
 #extension GL_EXT_samplerless_texture_functions : require

+ 1 - 7
thirdparty/amd-fsr2/shaders/ffx_fsr2_callbacks_glsl.h

@@ -52,11 +52,9 @@
 		FfxFloat32    fDeltaTime;
 		FfxFloat32    fDynamicResChangeFactor;
 		FfxFloat32    fViewSpaceToMetersFactor;
-		
-		// -- GODOT start --
+
 		FfxFloat32    fPad;
 		mat4          mReprojectionMatrix;
-		// -- GODOT end --
 	} cbFSR2;
 #endif
 
@@ -322,13 +320,11 @@ FfxFloat32 LoadInputDepth(FfxInt32x2 iPxPos)
 #if defined(FSR2_BIND_SRV_REACTIVE_MASK) 
 FfxFloat32 LoadReactiveMask(FfxInt32x2 iPxPos)
 {
-// -- GODOT start --
 #if FFX_FSR2_OPTION_GODOT_REACTIVE_MASK_CLAMP
 	return min(texelFetch(r_reactive_mask, FfxInt32x2(iPxPos), 0).r, 0.9f);
 #else
 	return texelFetch(r_reactive_mask, FfxInt32x2(iPxPos), 0).r;
 #endif
-// -- GODOT end --
 }
 #endif
 
@@ -365,7 +361,6 @@ FfxFloat32x2 LoadInputMotionVector(FfxInt32x2 iPxDilatedMotionVectorPos)
 {
 	FfxFloat32x2 fSrcMotionVector = texelFetch(r_input_motion_vectors, iPxDilatedMotionVectorPos, 0).xy;
 
-// -- GODOT start --
 #if FFX_FSR2_OPTION_GODOT_DERIVE_INVALID_MOTION_VECTORS
 	bool bInvalidMotionVector = all(lessThanEqual(fSrcMotionVector, vec2(-1.0f, -1.0f)));
 	if (bInvalidMotionVector)
@@ -375,7 +370,6 @@ FfxFloat32x2 LoadInputMotionVector(FfxInt32x2 iPxDilatedMotionVectorPos)
 		fSrcMotionVector = FFX_FSR2_OPTION_GODOT_DERIVE_INVALID_MOTION_VECTORS_FUNCTION(fUv, fSrcDepth, cbFSR2.mReprojectionMatrix);
 	}
 #endif
-// -- GODOT end --
 
 	FfxFloat32x2 fUvMotionVector = fSrcMotionVector * MotionVectorScale();
 

+ 1 - 1
thirdparty/amd-fsr2/shaders/ffx_fsr2_compute_luminance_pyramid_pass.glsl

@@ -19,7 +19,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-
+//#version 450
 
 #extension GL_GOOGLE_include_directive : require
 #extension GL_EXT_samplerless_texture_functions : require

+ 1 - 1
thirdparty/amd-fsr2/shaders/ffx_fsr2_depth_clip_pass.glsl

@@ -19,7 +19,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-
+//#version 450
 
 #extension GL_GOOGLE_include_directive : require
 #extension GL_EXT_samplerless_texture_functions : require

+ 1 - 1
thirdparty/amd-fsr2/shaders/ffx_fsr2_lock_pass.glsl

@@ -19,7 +19,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-
+//#version 450
 
 #extension GL_GOOGLE_include_directive : require
 #extension GL_EXT_samplerless_texture_functions : require

+ 1 - 1
thirdparty/amd-fsr2/shaders/ffx_fsr2_rcas_pass.glsl

@@ -19,7 +19,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-
+//#version 450
 
 #extension GL_GOOGLE_include_directive : require
 #extension GL_EXT_samplerless_texture_functions : require

+ 1 - 1
thirdparty/amd-fsr2/shaders/ffx_fsr2_reconstruct_previous_depth_pass.glsl

@@ -19,7 +19,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-
+//#version 450
 
 #extension GL_GOOGLE_include_directive : require
 #extension GL_EXT_samplerless_texture_functions : require

+ 1 - 3
thirdparty/amd-fsr2/shaders/ffx_fsr2_tcr_autogen_pass.glsl

@@ -19,7 +19,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-
+//#version 450
 
 #extension GL_GOOGLE_include_directive : require
 #extension GL_EXT_samplerless_texture_functions : require
@@ -40,11 +40,9 @@
 #define FSR2_BIND_CB_FSR2									11
 #define FSR2_BIND_CB_REACTIVE                               12
 
-// -- GODOT start --
 #if FFX_FSR2_OPTION_GODOT_DERIVE_INVALID_MOTION_VECTORS
 #define FSR2_BIND_SRV_INPUT_DEPTH                           13
 #endif
-// -- GODOT end --
 
 #include "ffx_fsr2_callbacks_glsl.h"
 #include "ffx_fsr2_common.h"

+ 1 - 1
thirdparty/basis_universal/encoder/basisu_gpu_texture.cpp

@@ -1976,7 +1976,7 @@ namespace basisu
 	// Accepts 2D, 2D mipmapped, 2D array, 2D array mipmapped
 	// and cubemap, cubemap mipmapped, and cubemap array mipmapped.
 	bool write_dds_file(uint8_vec &dds_data, const basisu::vector<gpu_image_vec>& gpu_images, bool cubemap_flag, bool use_srgb_format)
-	{		
+	{
 		return false;
 	}
 

+ 26 - 0
thirdparty/basis_universal/patches/0001-external-zstd-pr344.patch

@@ -0,0 +1,26 @@
+diff --git a/thirdparty/basis_universal/encoder/basisu_comp.cpp b/thirdparty/basis_universal/encoder/basisu_comp.cpp
+index f16e75bd46..81813257cd 100644
+--- a/thirdparty/basis_universal/encoder/basisu_comp.cpp
++++ b/thirdparty/basis_universal/encoder/basisu_comp.cpp
+@@ -33,7 +33,7 @@
+ #endif
+ 
+ #if BASISD_SUPPORT_KTX2_ZSTD
+-#include "../zstd/zstd.h"
++#include <zstd.h>
+ #endif
+ 
+ // Set to 1 to disable the mipPadding alignment workaround (which only seems to be needed when no key-values are written at all)
+diff --git a/thirdparty/basis_universal/transcoder/basisu_transcoder.cpp b/thirdparty/basis_universal/transcoder/basisu_transcoder.cpp
+index ea994b0c4f..32018cd282 100644
+--- a/thirdparty/basis_universal/transcoder/basisu_transcoder.cpp
++++ b/thirdparty/basis_universal/transcoder/basisu_transcoder.cpp
+@@ -164,7 +164,7 @@
+    // If BASISD_SUPPORT_KTX2_ZSTD is 0, UASTC files compressed with Zstd cannot be loaded.
+ 	#if BASISD_SUPPORT_KTX2_ZSTD
+ 		// We only use two Zstd API's: ZSTD_decompress() and ZSTD_isError()
+-		#include "../zstd/zstd.h"
++		#include <zstd.h>
+ 	#endif
+ #endif
+ 

+ 2 - 2
thirdparty/basis_universal/patches/external-jpgd.patch → thirdparty/basis_universal/patches/0002-external-jpgd.patch

@@ -1,8 +1,8 @@
 diff --git a/thirdparty/basis_universal/encoder/basisu_enc.cpp b/thirdparty/basis_universal/encoder/basisu_enc.cpp
-index c431ceaf12..e87dd636a2 100644
+index 47e8981bc3..6c0ac0ad37 100644
 --- a/thirdparty/basis_universal/encoder/basisu_enc.cpp
 +++ b/thirdparty/basis_universal/encoder/basisu_enc.cpp
-@@ -409,7 +409,7 @@ namespace basisu
+@@ -458,7 +458,7 @@ namespace basisu
  	bool load_jpg(const char *pFilename, image& img)
  	{
  		int width = 0, height = 0, actual_comps = 0;

+ 1 - 1
thirdparty/basis_universal/patches/external-tinyexr.patch → thirdparty/basis_universal/patches/0003-external-tinyexr.patch

@@ -1,5 +1,5 @@
 diff --git a/thirdparty/basis_universal/encoder/basisu_enc.cpp b/thirdparty/basis_universal/encoder/basisu_enc.cpp
-index 6c0ac0ad370..2bf486a0287 100644
+index 6c0ac0ad37..2bf486a028 100644
 --- a/thirdparty/basis_universal/encoder/basisu_enc.cpp
 +++ b/thirdparty/basis_universal/encoder/basisu_enc.cpp
 @@ -27,7 +27,7 @@

+ 4 - 6
thirdparty/basis_universal/patches/remove-tinydds-qoi.patch → thirdparty/basis_universal/patches/0004-remove-tinydds-qoi.patch

@@ -1,5 +1,5 @@
 diff --git a/thirdparty/basis_universal/encoder/basisu_enc.cpp b/thirdparty/basis_universal/encoder/basisu_enc.cpp
-index 2bf486a0287..fff98e83014 100644
+index 2bf486a028..fff98e8301 100644
 --- a/thirdparty/basis_universal/encoder/basisu_enc.cpp
 +++ b/thirdparty/basis_universal/encoder/basisu_enc.cpp
 @@ -37,9 +37,6 @@
@@ -31,7 +31,7 @@ index 2bf486a0287..fff98e83014 100644
  
  	bool load_png(const uint8_t *pBuf, size_t buf_size, image &img, const char *pFilename)
 diff --git a/thirdparty/basis_universal/encoder/basisu_gpu_texture.cpp b/thirdparty/basis_universal/encoder/basisu_gpu_texture.cpp
-index 000869a5337..342446b8fd4 100644
+index 000869a533..648cfb47ae 100644
 --- a/thirdparty/basis_universal/encoder/basisu_gpu_texture.cpp
 +++ b/thirdparty/basis_universal/encoder/basisu_gpu_texture.cpp
 @@ -19,9 +19,6 @@
@@ -44,11 +44,10 @@ index 000869a5337..342446b8fd4 100644
  namespace basisu
  {
  	//------------------------------------------------------------------------------------------------
-@@ -1979,208 +1976,8 @@ namespace basisu
- 	// Accepts 2D, 2D mipmapped, 2D array, 2D array mipmapped
+@@ -1980,207 +1977,7 @@ namespace basisu
  	// and cubemap, cubemap mipmapped, and cubemap array mipmapped.
  	bool write_dds_file(uint8_vec &dds_data, const basisu::vector<gpu_image_vec>& gpu_images, bool cubemap_flag, bool use_srgb_format)
--	{
+ 	{
 -		if (!gpu_images.size())
 -		{
 -			assert(0);
@@ -250,7 +249,6 @@ index 000869a5337..342446b8fd4 100644
 -		}
 -								
 -		return true;
-+	{		
 +		return false;
  	}
  

+ 0 - 43
thirdparty/basis_universal/patches/basisu-pr344.patch

@@ -1,43 +0,0 @@
-From b4a0fa23c13da413d94b99f307e401c3b83e0108 Mon Sep 17 00:00:00 2001
-From: Ondrej Stava <[email protected]>
-Date: Fri, 23 Apr 2021 18:59:45 -0700
-Subject: [PATCH] Made it easier to use the library with external zstdlib
- implementations (mostly in non CMake builds).
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-In our internal repository, we have our own version of zstdlib and introducing extra copy is both undesirable and potentially dangerous (due to ODR violations).
-
-Co-authored-by: Rémi Verschelde <[email protected]>
----
- encoder/basisu_comp.cpp          | 2 +-
- transcoder/basisu_transcoder.cpp | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/encoder/basisu_comp.cpp b/encoder/basisu_comp.cpp
-index 41eae2b7..4e69e9e2 100644
---- a/encoder/basisu_comp.cpp
-+++ b/encoder/basisu_comp.cpp
-@@ -28,7 +28,7 @@
- #endif
- 
- #if BASISD_SUPPORT_KTX2_ZSTD
--#include "../zstd/zstd.h"
-+#include <zstd.h>
- #endif
- 
- // Set to 1 to disable the mipPadding alignment workaround (which only seems to be needed when no key-values are written at all)
-diff --git a/transcoder/basisu_transcoder.cpp b/transcoder/basisu_transcoder.cpp
-index 3aeba0ee..c698861f 100644
---- a/transcoder/basisu_transcoder.cpp
-+++ b/transcoder/basisu_transcoder.cpp
-@@ -155,7 +155,7 @@
-    // If BASISD_SUPPORT_KTX2_ZSTD is 0, UASTC files compressed with Zstd cannot be loaded.
- 	#if BASISD_SUPPORT_KTX2_ZSTD
- 		// We only use two Zstd API's: ZSTD_decompress() and ZSTD_isError()
--		#include "../zstd/zstd.h"
-+		#include <zstd.h>
- 	#endif
- #endif
- 

+ 7 - 9
thirdparty/clipper2/include/clipper2/clipper.core.h

@@ -695,13 +695,13 @@ namespace Clipper2Lib
   // returns true if (and only if) a * b == c * d
   inline bool ProductsAreEqual(int64_t a, int64_t b, int64_t c, int64_t d)
   {
-// -- GODOT start --
-// #if (defined(__clang__) || defined(__GNUC__)) && UINTPTR_MAX >= UINT64_MAX
-//     const auto ab = static_cast<__int128_t>(a) * static_cast<__int128_t>(b);
-//     const auto cd = static_cast<__int128_t>(c) * static_cast<__int128_t>(d);
-//     return ab == cd;
-// #else
-// -- GODOT end --
+// Work around LLVM issue: https://github.com/llvm/llvm-project/issues/16778
+// Details: https://github.com/godotengine/godot/pull/95964#issuecomment-2306581804
+//#if (defined(__clang__) || defined(__GNUC__)) && UINTPTR_MAX >= UINT64_MAX
+//    const auto ab = static_cast<__int128_t>(a) * static_cast<__int128_t>(b);
+//    const auto cd = static_cast<__int128_t>(c) * static_cast<__int128_t>(d);
+//    return ab == cd;
+//#else
     // nb: unsigned values needed for calculating overflow carry
     const auto abs_a = static_cast<uint64_t>(std::abs(a));
     const auto abs_b = static_cast<uint64_t>(std::abs(b));
@@ -716,9 +716,7 @@ namespace Clipper2Lib
     const auto sign_cd = TriSign(c) * TriSign(d);
 
     return abs_ab == abs_cd && sign_ab == sign_cd;
-// -- GODOT start --
 // #endif
-// -- GODOT end --
   }
 
   template <typename T>

+ 1 - 1
thirdparty/clipper2/patches/clipper2-exceptions.patch → thirdparty/clipper2/patches/0001-disable-exceptions.patch

@@ -1,5 +1,5 @@
 diff --git a/thirdparty/clipper2/include/clipper2/clipper.core.h b/thirdparty/clipper2/include/clipper2/clipper.core.h
-index 925c04685e..d0d159b949 100644
+index 925c04685e..67dd731af6 100644
 --- a/thirdparty/clipper2/include/clipper2/clipper.core.h
 +++ b/thirdparty/clipper2/include/clipper2/clipper.core.h
 @@ -22,6 +22,8 @@

+ 9 - 11
thirdparty/clipper2/patches/llvm-error.patch → thirdparty/clipper2/patches/0002-llvm-disable-int1280-math.patch

@@ -1,5 +1,5 @@
 diff --git a/thirdparty/clipper2/include/clipper2/clipper.core.h b/thirdparty/clipper2/include/clipper2/clipper.core.h
-index 67dd731af6..0f69bf2d9f 100644
+index 67dd731af6..dd1b873d5d 100644
 --- a/thirdparty/clipper2/include/clipper2/clipper.core.h
 +++ b/thirdparty/clipper2/include/clipper2/clipper.core.h
 @@ -695,11 +695,13 @@ namespace Clipper2Lib
@@ -11,24 +11,22 @@ index 67dd731af6..0f69bf2d9f 100644
 -    const auto cd = static_cast<__int128_t>(c) * static_cast<__int128_t>(d);
 -    return ab == cd;
 -#else
-+// -- GODOT start --
-+// #if (defined(__clang__) || defined(__GNUC__)) && UINTPTR_MAX >= UINT64_MAX
-+//     const auto ab = static_cast<__int128_t>(a) * static_cast<__int128_t>(b);
-+//     const auto cd = static_cast<__int128_t>(c) * static_cast<__int128_t>(d);
-+//     return ab == cd;
-+// #else
-+// -- GODOT end --
++// Work around LLVM issue: https://github.com/llvm/llvm-project/issues/16778
++// Details: https://github.com/godotengine/godot/pull/95964#issuecomment-2306581804
++//#if (defined(__clang__) || defined(__GNUC__)) && UINTPTR_MAX >= UINT64_MAX
++//    const auto ab = static_cast<__int128_t>(a) * static_cast<__int128_t>(b);
++//    const auto cd = static_cast<__int128_t>(c) * static_cast<__int128_t>(d);
++//    return ab == cd;
++//#else
      // nb: unsigned values needed for calculating overflow carry
      const auto abs_a = static_cast<uint64_t>(std::abs(a));
      const auto abs_b = static_cast<uint64_t>(std::abs(b));
-@@ -714,7 +716,9 @@ namespace Clipper2Lib
+@@ -714,7 +716,7 @@ namespace Clipper2Lib
      const auto sign_cd = TriSign(c) * TriSign(d);
  
      return abs_ab == abs_cd && sign_ab == sign_cd;
 -#endif
-+// -- GODOT start --
 +// #endif
-+// -- GODOT end --
    }
  
    template <typename T>

+ 0 - 0
thirdparty/cvtt/patches/revert_BC6H_reorg.patch → thirdparty/cvtt/patches/0001-revert-bc6h-reorg.patch


+ 0 - 6
thirdparty/d3d12ma/D3D12MemAlloc.cpp

@@ -33,13 +33,11 @@
     #include <shared_mutex>
 #endif
 
-/* GODOT start */
 #if !defined(_MSC_VER)
 #include <guiddef.h>
 
 #include <dxguids.h>
 #endif
-/* GODOT end */
 
 ////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////
@@ -8186,7 +8184,6 @@ HRESULT AllocatorPimpl::UpdateD3D12Budget()
 
 D3D12_RESOURCE_ALLOCATION_INFO AllocatorPimpl::GetResourceAllocationInfoNative(const D3D12_RESOURCE_DESC& resourceDesc) const
 {
-/* GODOT start */
 #if defined(_MSC_VER) || !defined(_WIN32)
     return m_Device->GetResourceAllocationInfo(0, 1, &resourceDesc);
 #else
@@ -8194,7 +8191,6 @@ D3D12_RESOURCE_ALLOCATION_INFO AllocatorPimpl::GetResourceAllocationInfoNative(c
     m_Device->GetResourceAllocationInfo(&ret, 0, 1, &resourceDesc);
     return ret;
 #endif
-/* GODOT end */
 }
 
 #ifdef __ID3D12Device8_INTERFACE_DEFINED__
@@ -8202,7 +8198,6 @@ D3D12_RESOURCE_ALLOCATION_INFO AllocatorPimpl::GetResourceAllocationInfoNative(c
 {
     D3D12MA_ASSERT(m_Device8 != NULL);
     D3D12_RESOURCE_ALLOCATION_INFO1 info1Unused;
-/* GODOT start */
 #if defined(_MSC_VER) || !defined(_WIN32)
     return m_Device8->GetResourceAllocationInfo2(0, 1, &resourceDesc, &info1Unused);
 #else
@@ -8210,7 +8205,6 @@ D3D12_RESOURCE_ALLOCATION_INFO AllocatorPimpl::GetResourceAllocationInfoNative(c
     m_Device8->GetResourceAllocationInfo2(&ret, 0, 1, &resourceDesc, &info1Unused);
     return ret;
 #endif
-/* GODOT end */
 }
 #endif // #ifdef __ID3D12Device8_INTERFACE_DEFINED__
 

+ 45 - 0
thirdparty/d3d12ma/patches/0001-mingw-support.patch

@@ -0,0 +1,45 @@
+diff --git a/thirdparty/d3d12ma/D3D12MemAlloc.cpp b/thirdparty/d3d12ma/D3D12MemAlloc.cpp
+index 8e2488091a..80d910e694 100644
+--- a/thirdparty/d3d12ma/D3D12MemAlloc.cpp
++++ b/thirdparty/d3d12ma/D3D12MemAlloc.cpp
+@@ -33,6 +33,12 @@
+     #include <shared_mutex>
+ #endif
+ 
++#if !defined(_MSC_VER)
++#include <guiddef.h>
++
++#include <dxguids.h>
++#endif
++
+ ////////////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////
+ //
+@@ -8178,7 +8184,13 @@ HRESULT AllocatorPimpl::UpdateD3D12Budget()
+ 
+ D3D12_RESOURCE_ALLOCATION_INFO AllocatorPimpl::GetResourceAllocationInfoNative(const D3D12_RESOURCE_DESC& resourceDesc) const
+ {
++#if defined(_MSC_VER) || !defined(_WIN32)
+     return m_Device->GetResourceAllocationInfo(0, 1, &resourceDesc);
++#else
++    D3D12_RESOURCE_ALLOCATION_INFO ret;
++    m_Device->GetResourceAllocationInfo(&ret, 0, 1, &resourceDesc);
++    return ret;
++#endif
+ }
+ 
+ #ifdef __ID3D12Device8_INTERFACE_DEFINED__
+@@ -8186,7 +8198,13 @@ D3D12_RESOURCE_ALLOCATION_INFO AllocatorPimpl::GetResourceAllocationInfoNative(c
+ {
+     D3D12MA_ASSERT(m_Device8 != NULL);
+     D3D12_RESOURCE_ALLOCATION_INFO1 info1Unused;
++#if defined(_MSC_VER) || !defined(_WIN32)
+     return m_Device8->GetResourceAllocationInfo2(0, 1, &resourceDesc, &info1Unused);
++#else
++    D3D12_RESOURCE_ALLOCATION_INFO ret;
++    m_Device8->GetResourceAllocationInfo2(&ret, 0, 1, &resourceDesc, &info1Unused);
++    return ret;
++#endif
+ }
+ #endif // #ifdef __ID3D12Device8_INTERFACE_DEFINED__
+ 

+ 0 - 2627
thirdparty/directx_headers/include/directx/D3D12TokenizedProgramFormat.hpp

@@ -1,2627 +0,0 @@
-#pragma once
-//*********************************************************
-//
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License (MIT).
-//
-//*********************************************************
-//
-// High Level Goals
-//
-// - Serve as the runtime/DDI representation for all D3D11 tokenized code,
-//   for all classes of programs, including pixel program, vertex program,
-//   geometry program, etc.
-//
-// - Any information that HLSL needs to give to drivers is encoded in
-//   this token format in some form.
-//
-// - Enable common tools and source code for managing all tokenizable
-//   program formats.
-//
-// - Support extensible token definitions, allowing full customizations for
-//   specific program classes, while maintaining general conventions for all
-//   program models.
-//
-// - Binary backwards compatible with D3D10.  Any token name that was originally
-//   defined with "D3D10" in it is unchanged; D3D11 only adds new tokens.
-//
-// ----------------------------------------------------------------------------
-//
-// Low Level Feature Summary
-//
-// - DWORD based tokens always, for simplicity
-// - Opcode token is generally a single DWORD, though there is a bit indicating
-//   if extended information (extra DWORD(s)) are present
-// - Operand tokens are a completely self contained, extensible format,
-//   with scalar and 4-vector data types as first class citizens, but
-//   allowance for extension to n-component vectors.
-// - Initial operand token identifies register type, register file
-//   structure/dimensionality and mode of indexing for each dimension,
-//   and choice of component selection mechanism (i.e. mask vs. swizzle etc).
-// - Optional additional extended operand tokens can defined things like
-//   modifiers (which are not needed by default).
-// - Operand's immediate index value(s), if needed, appear as subsequent DWORD
-//   values, and if relative addressing is specified, an additional completely
-//   self contained operand definition appears nested in the token sequence.
-//
-// ----------------------------------------------------------------------------
-
-#include <winapifamily.h>
-
-#pragma region Application Family
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_GAMES)
-
-// ----------------------------------------------------------------------------
-// Version Token (VerTok)
-//
-// [07:00] minor version number (0-255)
-// [15:08] major version number (0-255)
-// [31:16] D3D10_SB_TOKENIZED_PROGRAM_TYPE
-//
-// ----------------------------------------------------------------------------
-
-typedef enum D3D10_SB_TOKENIZED_PROGRAM_TYPE
-{
-    D3D10_SB_PIXEL_SHADER       = 0,
-    D3D10_SB_VERTEX_SHADER      = 1,
-    D3D10_SB_GEOMETRY_SHADER    = 2,
-    
-    // D3D11 Shaders
-    D3D11_SB_HULL_SHADER        = 3,
-    D3D11_SB_DOMAIN_SHADER      = 4,
-    D3D11_SB_COMPUTE_SHADER     = 5,
-
-    // Subset of D3D12 Shaders where this field is referenced by runtime
-    // Entries from 6-12 are unique to state objects 
-    // (e.g. library, callable and raytracing shaders)
-    D3D12_SB_MESH_SHADER        = 13,
-    D3D12_SB_AMPLIFICATION_SHADER = 14,
-
-    D3D11_SB_RESERVED0          = 0xFFF0
-} D3D10_SB_TOKENIZED_PROGRAM_TYPE;
-
-#define D3D10_SB_TOKENIZED_PROGRAM_TYPE_MASK  0xffff0000
-#define D3D10_SB_TOKENIZED_PROGRAM_TYPE_SHIFT 16
-
-// DECODER MACRO: Retrieve program type from version token
-#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))
-
-#define D3D10_SB_TOKENIZED_PROGRAM_MAJOR_VERSION_MASK  0x000000f0
-#define D3D10_SB_TOKENIZED_PROGRAM_MAJOR_VERSION_SHIFT 4
-#define D3D10_SB_TOKENIZED_PROGRAM_MINOR_VERSION_MASK  0x0000000f
-
-// DECODER MACRO: Retrieve major version # from version token
-#define DECODE_D3D10_SB_TOKENIZED_PROGRAM_MAJOR_VERSION(VerTok) (((VerTok)&D3D10_SB_TOKENIZED_PROGRAM_MAJOR_VERSION_MASK)>>D3D10_SB_TOKENIZED_PROGRAM_MAJOR_VERSION_SHIFT)
-// DECODER MACRO: Retrieve minor version # from version token
-#define DECODE_D3D10_SB_TOKENIZED_PROGRAM_MINOR_VERSION(VerTok) ((VerTok)&D3D10_SB_TOKENIZED_PROGRAM_MINOR_VERSION_MASK)
-
-// ENCODER MACRO: Create complete VerTok
-#define ENCODE_D3D10_SB_TOKENIZED_PROGRAM_VERSION_TOKEN(ProgType,MajorVer,MinorVer) ((((ProgType)<<D3D10_SB_TOKENIZED_PROGRAM_TYPE_SHIFT)&D3D10_SB_TOKENIZED_PROGRAM_TYPE_MASK)|\
-                                                                               ((((MajorVer)<<D3D10_SB_TOKENIZED_PROGRAM_MAJOR_VERSION_SHIFT)&D3D10_SB_TOKENIZED_PROGRAM_MAJOR_VERSION_MASK))|\
-                                                                               ((MinorVer)&D3D10_SB_TOKENIZED_PROGRAM_MINOR_VERSION_MASK))
-
-// ----------------------------------------------------------------------------
-// Length Token (LenTok)
-//
-// Always follows VerTok
-//
-// [31:00] Unsigned integer count of number of
-//              DWORDs in program code, including version
-//              and length tokens.  So the minimum value
-//              is 0x00000002 (if an empty program is ever
-//              valid).
-//
-// ----------------------------------------------------------------------------
-
-// DECODER MACRO: Retrieve program length
-#define DECODE_D3D10_SB_TOKENIZED_PROGRAM_LENGTH(LenTok) (LenTok)
-// ENCODER MACRO: Create complete LenTok
-#define ENCODE_D3D10_SB_TOKENIZED_PROGRAM_LENGTH(Length) (Length)
-#define MAX_D3D10_SB_TOKENIZED_PROGRAM_LENGTH (0xffffffff)
-
-// ----------------------------------------------------------------------------
-// Opcode Format (OpcodeToken0)
-//
-// [10:00] D3D10_SB_OPCODE_TYPE
-// if( [10:00] == D3D10_SB_OPCODE_CUSTOMDATA )
-// {
-//    Token starts a custom-data block.  See "Custom-Data Block Format".
-// }
-// else // standard opcode token
-// {
-//    [23:11] Opcode-Specific Controls
-//    [30:24] Instruction length in DWORDs including the opcode token.
-//    [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//            contains extended opcode token.
-// }
-//
-// ----------------------------------------------------------------------------
-
-typedef enum D3D10_SB_OPCODE_TYPE {
-    D3D10_SB_OPCODE_ADD          ,
-    D3D10_SB_OPCODE_AND          ,
-    D3D10_SB_OPCODE_BREAK        ,
-    D3D10_SB_OPCODE_BREAKC       ,
-    D3D10_SB_OPCODE_CALL         ,
-    D3D10_SB_OPCODE_CALLC        ,
-    D3D10_SB_OPCODE_CASE         ,
-    D3D10_SB_OPCODE_CONTINUE     ,
-    D3D10_SB_OPCODE_CONTINUEC    ,
-    D3D10_SB_OPCODE_CUT          ,
-    D3D10_SB_OPCODE_DEFAULT      ,
-    D3D10_SB_OPCODE_DERIV_RTX    ,
-    D3D10_SB_OPCODE_DERIV_RTY    ,
-    D3D10_SB_OPCODE_DISCARD      ,
-    D3D10_SB_OPCODE_DIV          ,
-    D3D10_SB_OPCODE_DP2          ,
-    D3D10_SB_OPCODE_DP3          ,
-    D3D10_SB_OPCODE_DP4          ,
-    D3D10_SB_OPCODE_ELSE         ,
-    D3D10_SB_OPCODE_EMIT         ,
-    D3D10_SB_OPCODE_EMITTHENCUT  ,
-    D3D10_SB_OPCODE_ENDIF        ,
-    D3D10_SB_OPCODE_ENDLOOP      ,
-    D3D10_SB_OPCODE_ENDSWITCH    ,
-    D3D10_SB_OPCODE_EQ           ,
-    D3D10_SB_OPCODE_EXP          ,
-    D3D10_SB_OPCODE_FRC          ,
-    D3D10_SB_OPCODE_FTOI         ,
-    D3D10_SB_OPCODE_FTOU         ,
-    D3D10_SB_OPCODE_GE           ,
-    D3D10_SB_OPCODE_IADD         ,
-    D3D10_SB_OPCODE_IF           ,
-    D3D10_SB_OPCODE_IEQ          ,
-    D3D10_SB_OPCODE_IGE          ,
-    D3D10_SB_OPCODE_ILT          ,
-    D3D10_SB_OPCODE_IMAD         ,
-    D3D10_SB_OPCODE_IMAX         ,
-    D3D10_SB_OPCODE_IMIN         ,
-    D3D10_SB_OPCODE_IMUL         ,
-    D3D10_SB_OPCODE_INE          ,
-    D3D10_SB_OPCODE_INEG         ,
-    D3D10_SB_OPCODE_ISHL         ,
-    D3D10_SB_OPCODE_ISHR         ,
-    D3D10_SB_OPCODE_ITOF         ,
-    D3D10_SB_OPCODE_LABEL        ,
-    D3D10_SB_OPCODE_LD           ,
-    D3D10_SB_OPCODE_LD_MS        ,
-    D3D10_SB_OPCODE_LOG          ,
-    D3D10_SB_OPCODE_LOOP         ,
-    D3D10_SB_OPCODE_LT           ,
-    D3D10_SB_OPCODE_MAD          ,
-    D3D10_SB_OPCODE_MIN          ,
-    D3D10_SB_OPCODE_MAX          ,
-    D3D10_SB_OPCODE_CUSTOMDATA   ,
-    D3D10_SB_OPCODE_MOV          ,
-    D3D10_SB_OPCODE_MOVC         ,
-    D3D10_SB_OPCODE_MUL          ,
-    D3D10_SB_OPCODE_NE           ,
-    D3D10_SB_OPCODE_NOP          ,
-    D3D10_SB_OPCODE_NOT          ,
-    D3D10_SB_OPCODE_OR           ,
-    D3D10_SB_OPCODE_RESINFO      ,
-    D3D10_SB_OPCODE_RET          ,
-    D3D10_SB_OPCODE_RETC         ,
-    D3D10_SB_OPCODE_ROUND_NE     ,
-    D3D10_SB_OPCODE_ROUND_NI     ,
-    D3D10_SB_OPCODE_ROUND_PI     ,
-    D3D10_SB_OPCODE_ROUND_Z      ,
-    D3D10_SB_OPCODE_RSQ          ,
-    D3D10_SB_OPCODE_SAMPLE       ,
-    D3D10_SB_OPCODE_SAMPLE_C     ,
-    D3D10_SB_OPCODE_SAMPLE_C_LZ  ,
-    D3D10_SB_OPCODE_SAMPLE_L     ,
-    D3D10_SB_OPCODE_SAMPLE_D     ,
-    D3D10_SB_OPCODE_SAMPLE_B     ,
-    D3D10_SB_OPCODE_SQRT         ,
-    D3D10_SB_OPCODE_SWITCH       ,
-    D3D10_SB_OPCODE_SINCOS       ,
-    D3D10_SB_OPCODE_UDIV         ,
-    D3D10_SB_OPCODE_ULT          ,
-    D3D10_SB_OPCODE_UGE          ,
-    D3D10_SB_OPCODE_UMUL         ,
-    D3D10_SB_OPCODE_UMAD         ,
-    D3D10_SB_OPCODE_UMAX         ,
-    D3D10_SB_OPCODE_UMIN         ,
-    D3D10_SB_OPCODE_USHR         ,
-    D3D10_SB_OPCODE_UTOF         ,
-    D3D10_SB_OPCODE_XOR          ,
-    D3D10_SB_OPCODE_DCL_RESOURCE                     , // DCL* opcodes have
-    D3D10_SB_OPCODE_DCL_CONSTANT_BUFFER              , // custom operand formats.
-    D3D10_SB_OPCODE_DCL_SAMPLER                      ,
-    D3D10_SB_OPCODE_DCL_INDEX_RANGE                  ,
-    D3D10_SB_OPCODE_DCL_GS_OUTPUT_PRIMITIVE_TOPOLOGY ,
-    D3D10_SB_OPCODE_DCL_GS_INPUT_PRIMITIVE           ,
-    D3D10_SB_OPCODE_DCL_MAX_OUTPUT_VERTEX_COUNT      ,
-    D3D10_SB_OPCODE_DCL_INPUT                        ,
-    D3D10_SB_OPCODE_DCL_INPUT_SGV                    ,
-    D3D10_SB_OPCODE_DCL_INPUT_SIV                    ,
-    D3D10_SB_OPCODE_DCL_INPUT_PS                     ,
-    D3D10_SB_OPCODE_DCL_INPUT_PS_SGV                 ,
-    D3D10_SB_OPCODE_DCL_INPUT_PS_SIV                 ,
-    D3D10_SB_OPCODE_DCL_OUTPUT                       ,
-    D3D10_SB_OPCODE_DCL_OUTPUT_SGV                   ,
-    D3D10_SB_OPCODE_DCL_OUTPUT_SIV                   ,
-    D3D10_SB_OPCODE_DCL_TEMPS                        ,
-    D3D10_SB_OPCODE_DCL_INDEXABLE_TEMP               ,
-    D3D10_SB_OPCODE_DCL_GLOBAL_FLAGS                 ,
-
-// -----------------------------------------------
-
-    // This marks the end of D3D10.0 opcodes
-    D3D10_SB_OPCODE_RESERVED0,
-    
-// ---------- DX 10.1 op codes---------------------
-
-    D3D10_1_SB_OPCODE_LOD,
-    D3D10_1_SB_OPCODE_GATHER4,
-    D3D10_1_SB_OPCODE_SAMPLE_POS,
-    D3D10_1_SB_OPCODE_SAMPLE_INFO,
-
-// -----------------------------------------------
-
-    // This marks the end of D3D10.1 opcodes
-    D3D10_1_SB_OPCODE_RESERVED1,
-
-// ---------- DX 11 op codes---------------------
-    D3D11_SB_OPCODE_HS_DECLS                         , // token marks beginning of HS sub-shader
-    D3D11_SB_OPCODE_HS_CONTROL_POINT_PHASE           , // token marks beginning of HS sub-shader
-    D3D11_SB_OPCODE_HS_FORK_PHASE                    , // token marks beginning of HS sub-shader
-    D3D11_SB_OPCODE_HS_JOIN_PHASE                    , // token marks beginning of HS sub-shader
-
-    D3D11_SB_OPCODE_EMIT_STREAM                      ,
-    D3D11_SB_OPCODE_CUT_STREAM                       ,
-    D3D11_SB_OPCODE_EMITTHENCUT_STREAM               ,
-    D3D11_SB_OPCODE_INTERFACE_CALL                   ,
-
-    D3D11_SB_OPCODE_BUFINFO                          ,
-    D3D11_SB_OPCODE_DERIV_RTX_COARSE                 ,
-    D3D11_SB_OPCODE_DERIV_RTX_FINE                   ,
-    D3D11_SB_OPCODE_DERIV_RTY_COARSE                 ,
-    D3D11_SB_OPCODE_DERIV_RTY_FINE                   ,
-    D3D11_SB_OPCODE_GATHER4_C                        ,
-    D3D11_SB_OPCODE_GATHER4_PO                       ,
-    D3D11_SB_OPCODE_GATHER4_PO_C                     ,
-    D3D11_SB_OPCODE_RCP                              ,
-    D3D11_SB_OPCODE_F32TOF16                         ,
-    D3D11_SB_OPCODE_F16TOF32                         ,
-    D3D11_SB_OPCODE_UADDC                            ,
-    D3D11_SB_OPCODE_USUBB                            ,
-    D3D11_SB_OPCODE_COUNTBITS                        ,
-    D3D11_SB_OPCODE_FIRSTBIT_HI                      ,
-    D3D11_SB_OPCODE_FIRSTBIT_LO                      ,
-    D3D11_SB_OPCODE_FIRSTBIT_SHI                     ,
-    D3D11_SB_OPCODE_UBFE                             ,
-    D3D11_SB_OPCODE_IBFE                             ,
-    D3D11_SB_OPCODE_BFI                              ,
-    D3D11_SB_OPCODE_BFREV                            ,
-    D3D11_SB_OPCODE_SWAPC                            ,
-
-    D3D11_SB_OPCODE_DCL_STREAM                       ,
-    D3D11_SB_OPCODE_DCL_FUNCTION_BODY                ,
-    D3D11_SB_OPCODE_DCL_FUNCTION_TABLE               ,
-    D3D11_SB_OPCODE_DCL_INTERFACE                    ,
-    
-    D3D11_SB_OPCODE_DCL_INPUT_CONTROL_POINT_COUNT    ,
-    D3D11_SB_OPCODE_DCL_OUTPUT_CONTROL_POINT_COUNT   ,
-    D3D11_SB_OPCODE_DCL_TESS_DOMAIN                  ,
-    D3D11_SB_OPCODE_DCL_TESS_PARTITIONING            ,
-    D3D11_SB_OPCODE_DCL_TESS_OUTPUT_PRIMITIVE        ,
-    D3D11_SB_OPCODE_DCL_HS_MAX_TESSFACTOR            ,
-    D3D11_SB_OPCODE_DCL_HS_FORK_PHASE_INSTANCE_COUNT ,
-    D3D11_SB_OPCODE_DCL_HS_JOIN_PHASE_INSTANCE_COUNT ,
-
-    D3D11_SB_OPCODE_DCL_THREAD_GROUP                 ,
-    D3D11_SB_OPCODE_DCL_UNORDERED_ACCESS_VIEW_TYPED  ,
-    D3D11_SB_OPCODE_DCL_UNORDERED_ACCESS_VIEW_RAW    ,
-    D3D11_SB_OPCODE_DCL_UNORDERED_ACCESS_VIEW_STRUCTURED,
-    D3D11_SB_OPCODE_DCL_THREAD_GROUP_SHARED_MEMORY_RAW,
-    D3D11_SB_OPCODE_DCL_THREAD_GROUP_SHARED_MEMORY_STRUCTURED,
-    D3D11_SB_OPCODE_DCL_RESOURCE_RAW                 ,
-    D3D11_SB_OPCODE_DCL_RESOURCE_STRUCTURED          ,
-    D3D11_SB_OPCODE_LD_UAV_TYPED                     ,
-    D3D11_SB_OPCODE_STORE_UAV_TYPED                  ,
-    D3D11_SB_OPCODE_LD_RAW                           ,
-    D3D11_SB_OPCODE_STORE_RAW                        ,
-    D3D11_SB_OPCODE_LD_STRUCTURED                    ,
-    D3D11_SB_OPCODE_STORE_STRUCTURED                 ,
-    D3D11_SB_OPCODE_ATOMIC_AND                       ,
-    D3D11_SB_OPCODE_ATOMIC_OR                        ,
-    D3D11_SB_OPCODE_ATOMIC_XOR                       ,
-    D3D11_SB_OPCODE_ATOMIC_CMP_STORE                 ,
-    D3D11_SB_OPCODE_ATOMIC_IADD                      ,
-    D3D11_SB_OPCODE_ATOMIC_IMAX                      ,
-    D3D11_SB_OPCODE_ATOMIC_IMIN                      ,
-    D3D11_SB_OPCODE_ATOMIC_UMAX                      ,
-    D3D11_SB_OPCODE_ATOMIC_UMIN                      ,
-    D3D11_SB_OPCODE_IMM_ATOMIC_ALLOC                 ,
-    D3D11_SB_OPCODE_IMM_ATOMIC_CONSUME               ,
-    D3D11_SB_OPCODE_IMM_ATOMIC_IADD                  ,
-    D3D11_SB_OPCODE_IMM_ATOMIC_AND                   ,
-    D3D11_SB_OPCODE_IMM_ATOMIC_OR                    ,
-    D3D11_SB_OPCODE_IMM_ATOMIC_XOR                   ,
-    D3D11_SB_OPCODE_IMM_ATOMIC_EXCH                  ,
-    D3D11_SB_OPCODE_IMM_ATOMIC_CMP_EXCH              ,
-    D3D11_SB_OPCODE_IMM_ATOMIC_IMAX                  ,
-    D3D11_SB_OPCODE_IMM_ATOMIC_IMIN                  ,
-    D3D11_SB_OPCODE_IMM_ATOMIC_UMAX                  ,
-    D3D11_SB_OPCODE_IMM_ATOMIC_UMIN                  ,   
-    D3D11_SB_OPCODE_SYNC                             ,
-    
-    D3D11_SB_OPCODE_DADD                             ,
-    D3D11_SB_OPCODE_DMAX                             ,
-    D3D11_SB_OPCODE_DMIN                             ,
-    D3D11_SB_OPCODE_DMUL                             ,
-    D3D11_SB_OPCODE_DEQ                              ,
-    D3D11_SB_OPCODE_DGE                              ,
-    D3D11_SB_OPCODE_DLT                              ,
-    D3D11_SB_OPCODE_DNE                              ,
-    D3D11_SB_OPCODE_DMOV                             ,
-    D3D11_SB_OPCODE_DMOVC                            ,
-    D3D11_SB_OPCODE_DTOF                             ,
-    D3D11_SB_OPCODE_FTOD                             ,
-
-    D3D11_SB_OPCODE_EVAL_SNAPPED                     ,
-    D3D11_SB_OPCODE_EVAL_SAMPLE_INDEX                ,
-    D3D11_SB_OPCODE_EVAL_CENTROID                    ,
-    
-    D3D11_SB_OPCODE_DCL_GS_INSTANCE_COUNT            ,
-
-    D3D11_SB_OPCODE_ABORT                            ,
-    D3D11_SB_OPCODE_DEBUG_BREAK                      ,
-
-// -----------------------------------------------
-
-    // This marks the end of D3D11.0 opcodes
-    D3D11_SB_OPCODE_RESERVED0,
-
-    D3D11_1_SB_OPCODE_DDIV,
-    D3D11_1_SB_OPCODE_DFMA,
-    D3D11_1_SB_OPCODE_DRCP,
-
-    D3D11_1_SB_OPCODE_MSAD,
-
-    D3D11_1_SB_OPCODE_DTOI,
-    D3D11_1_SB_OPCODE_DTOU,
-    D3D11_1_SB_OPCODE_ITOD,
-    D3D11_1_SB_OPCODE_UTOD,
-
-// -----------------------------------------------
-
-    // This marks the end of D3D11.1 opcodes
-    D3D11_1_SB_OPCODE_RESERVED0,
-
-    D3DWDDM1_3_SB_OPCODE_GATHER4_FEEDBACK,
-    D3DWDDM1_3_SB_OPCODE_GATHER4_C_FEEDBACK,
-    D3DWDDM1_3_SB_OPCODE_GATHER4_PO_FEEDBACK,
-    D3DWDDM1_3_SB_OPCODE_GATHER4_PO_C_FEEDBACK,
-    D3DWDDM1_3_SB_OPCODE_LD_FEEDBACK,
-    D3DWDDM1_3_SB_OPCODE_LD_MS_FEEDBACK,
-    D3DWDDM1_3_SB_OPCODE_LD_UAV_TYPED_FEEDBACK,
-    D3DWDDM1_3_SB_OPCODE_LD_RAW_FEEDBACK,
-    D3DWDDM1_3_SB_OPCODE_LD_STRUCTURED_FEEDBACK,
-    D3DWDDM1_3_SB_OPCODE_SAMPLE_L_FEEDBACK,
-    D3DWDDM1_3_SB_OPCODE_SAMPLE_C_LZ_FEEDBACK,
-
-    D3DWDDM1_3_SB_OPCODE_SAMPLE_CLAMP_FEEDBACK,
-    D3DWDDM1_3_SB_OPCODE_SAMPLE_B_CLAMP_FEEDBACK,
-    D3DWDDM1_3_SB_OPCODE_SAMPLE_D_CLAMP_FEEDBACK,
-    D3DWDDM1_3_SB_OPCODE_SAMPLE_C_CLAMP_FEEDBACK,
-
-    D3DWDDM1_3_SB_OPCODE_CHECK_ACCESS_FULLY_MAPPED,
-
-// -----------------------------------------------
-
-    // This marks the end of WDDM 1.3 opcodes
-    D3DWDDM1_3_SB_OPCODE_RESERVED0,
-
-    D3D10_SB_NUM_OPCODES                                     // Should be the last entry
-} D3D10_SB_OPCODE_TYPE;
-
-#define D3D10_SB_OPCODE_TYPE_MASK 0x00007ff
-// DECODER MACRO: Retrieve program opcode
-#define DECODE_D3D10_SB_OPCODE_TYPE(OpcodeToken0) ((D3D10_SB_OPCODE_TYPE)((OpcodeToken0)&D3D10_SB_OPCODE_TYPE_MASK))
-// ENCODER MACRO: Create the opcode-type portion of OpcodeToken0
-#define ENCODE_D3D10_SB_OPCODE_TYPE(OpcodeName) ((OpcodeName)&D3D10_SB_OPCODE_TYPE_MASK)
-
-#define D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH_MASK 0x7f000000
-#define D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH_SHIFT 24
-// DECODER MACRO: Retrieve instruction length
-// in # of DWORDs including the opcode token(s).
-// The range is 1-127.
-#define DECODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(OpcodeToken0) (((OpcodeToken0)&D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH_MASK)>> D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH_SHIFT)
-
-// ENCODER MACRO: Store instruction length
-// portion of OpcodeToken0, in # of DWORDs
-// including the opcode token(s).
-// Valid range is 1-127.
-#define ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(Length) (((Length)<<D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH_SHIFT)&D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH_MASK)
-#define MAX_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH 127
-
-#define D3D10_SB_INSTRUCTION_SATURATE_MASK 0x00002000
-// DECODER MACRO: Check OpcodeToken0 to see if an instruction
-// is to saturate the result [0..1]
-// This flag is indicated by one of the bits in the
-// opcode specific control range.
-#define DECODE_IS_D3D10_SB_INSTRUCTION_SATURATE_ENABLED(OpcodeToken0) ((OpcodeToken0)&D3D10_SB_INSTRUCTION_SATURATE_MASK)
-// ENCODER MACRO: Encode in OpcodeToken0 if instruction is to saturate the result.
-#define ENCODE_D3D10_SB_INSTRUCTION_SATURATE(bSat) (((bSat)!=0)?D3D10_SB_INSTRUCTION_SATURATE_MASK:0)
-
-// Boolean test for conditional instructions such as if (if_z or if_nz)
-// This is part of the opcode specific control range.
-typedef enum D3D10_SB_INSTRUCTION_TEST_BOOLEAN
-{
-    D3D10_SB_INSTRUCTION_TEST_ZERO       = 0,
-    D3D10_SB_INSTRUCTION_TEST_NONZERO    = 1
-} D3D10_SB_INSTRUCTION_TEST_BOOLEAN;
-#define D3D10_SB_INSTRUCTION_TEST_BOOLEAN_MASK  0x00040000
-#define D3D10_SB_INSTRUCTION_TEST_BOOLEAN_SHIFT 18
-
-// DECODER MACRO: For an OpcodeToken0 for requires either a
-// zero or non-zero test, determine which test was chosen.
-#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))
-// ENCODER MACRO: Store "zero" or "nonzero" in the opcode
-// specific control range of OpcodeToken0
-#define ENCODE_D3D10_SB_INSTRUCTION_TEST_BOOLEAN(Boolean) (((Boolean)<<D3D10_SB_INSTRUCTION_TEST_BOOLEAN_SHIFT)&D3D10_SB_INSTRUCTION_TEST_BOOLEAN_MASK)
-
-// Precise value mask (bits 19-22)
-// This is part of the opcode specific control range.
-// It's 1 bit per-channel of the output, for instructions with multiple
-// output operands, it applies to that component in each operand. This
-// uses the components defined in D3D10_SB_COMPONENT_NAME.
-#define D3D11_SB_INSTRUCTION_PRECISE_VALUES_MASK  0x00780000
-#define D3D11_SB_INSTRUCTION_PRECISE_VALUES_SHIFT 19
-
-// DECODER MACRO: this macro extracts from OpcodeToken0 the 4 component
-// (xyzw) mask, as a field of D3D10_SB_4_COMPONENT_[X|Y|Z|W] flags.
-#define DECODE_D3D11_SB_INSTRUCTION_PRECISE_VALUES(OpcodeToken0) ((((OpcodeToken0)&D3D11_SB_INSTRUCTION_PRECISE_VALUES_MASK)>>D3D11_SB_INSTRUCTION_PRECISE_VALUES_SHIFT))
-// ENCODER MACRO: Given a set of
-// D3D10_SB_OPERAND_4_COMPONENT_[X|Y|Z|W] values
-// or'd together, encode them in OpcodeToken0.
-#define ENCODE_D3D11_SB_INSTRUCTION_PRECISE_VALUES(ComponentMask) (((ComponentMask)<<D3D11_SB_INSTRUCTION_PRECISE_VALUES_SHIFT)&D3D11_SB_INSTRUCTION_PRECISE_VALUES_MASK)
-
-// resinfo instruction return type
-typedef enum D3D10_SB_RESINFO_INSTRUCTION_RETURN_TYPE
-{
-    D3D10_SB_RESINFO_INSTRUCTION_RETURN_FLOAT      = 0,
-    D3D10_SB_RESINFO_INSTRUCTION_RETURN_RCPFLOAT   = 1,
-    D3D10_SB_RESINFO_INSTRUCTION_RETURN_UINT       = 2
-} D3D10_SB_RESINFO_INSTRUCTION_RETURN_TYPE;
-
-#define D3D10_SB_RESINFO_INSTRUCTION_RETURN_TYPE_MASK  0x00001800
-#define D3D10_SB_RESINFO_INSTRUCTION_RETURN_TYPE_SHIFT 11
-
-// DECODER MACRO: For an OpcodeToken0 for the resinfo instruction, 
-// determine the return type.
-#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))
-// ENCODER MACRO: Encode the return type for the resinfo instruction
-// in the opcode specific control range of OpcodeToken0
-#define ENCODE_D3D10_SB_RESINFO_INSTRUCTION_RETURN_TYPE(ReturnType) (((ReturnType)<<D3D10_SB_RESINFO_INSTRUCTION_RETURN_TYPE_SHIFT)&D3D10_SB_RESINFO_INSTRUCTION_RETURN_TYPE_MASK)
-
-// sync instruction flags
-#define D3D11_SB_SYNC_THREADS_IN_GROUP              0x00000800
-#define D3D11_SB_SYNC_THREAD_GROUP_SHARED_MEMORY    0x00001000
-#define D3D11_SB_SYNC_UNORDERED_ACCESS_VIEW_MEMORY_GROUP  0x00002000
-#define D3D11_SB_SYNC_UNORDERED_ACCESS_VIEW_MEMORY_GLOBAL  0x00004000
-#define D3D11_SB_SYNC_FLAGS_MASK                    0x00007800
-
-// DECODER MACRO: Retrieve flags for sync instruction from OpcodeToken0.
-#define DECODE_D3D11_SB_SYNC_FLAGS(OperandToken0) ((OperandToken0)&D3D11_SB_SYNC_FLAGS_MASK)
-
-// ENCODER MACRO: Given a set of sync instruciton flags, encode them in OpcodeToken0.
-#define ENCODE_D3D11_SB_SYNC_FLAGS(Flags) ((Flags)&D3D11_SB_SYNC_FLAGS_MASK)
-
-#define D3D10_SB_OPCODE_EXTENDED_MASK 0x80000000
-#define D3D10_SB_OPCODE_EXTENDED_SHIFT 31
-// DECODER MACRO: Determine if the opcode is extended
-// by an additional opcode token.  Currently there are no
-// extended opcodes.
-#define DECODE_IS_D3D10_SB_OPCODE_EXTENDED(OpcodeToken0) (((OpcodeToken0)&D3D10_SB_OPCODE_EXTENDED_MASK)>> D3D10_SB_OPCODE_EXTENDED_SHIFT)
-// ENCODER MACRO: Store in OpcodeToken0 whether the opcode is extended
-// by an additional opcode token.  
-#define ENCODE_D3D10_SB_OPCODE_EXTENDED(bExtended) (((bExtended)!=0)?D3D10_SB_OPCODE_EXTENDED_MASK:0)
-
-// ----------------------------------------------------------------------------
-// Extended Opcode Format (OpcodeToken1)
-//
-// If bit31 of an opcode token is set, the
-// opcode has an additional extended opcode token DWORD
-// directly following OpcodeToken0.  Other tokens
-// expected for the opcode, such as the operand
-// token(s) always follow
-// OpcodeToken0 AND OpcodeToken1..n (extended
-// opcode tokens, if present).
-//
-// [05:00] D3D10_SB_EXTENDED_OPCODE_TYPE
-// [30:06] if([05:00] == D3D10_SB_EXTENDED_OPCODE_SAMPLE_CONTROLS)
-//         {
-//              This custom opcode contains controls for SAMPLE.
-//              [08:06] Ignored, 0.
-//              [12:09] U texel immediate offset (4 bit 2's comp) (0 default)
-//              [16:13] V texel immediate offset (4 bit 2's comp) (0 default)
-//              [20:17] W texel immediate offset (4 bit 2's comp) (0 default)
-//              [30:14] Ignored, 0.
-//         }
-//         else if( [05:00] == D3D11_SB_EXTENDED_OPCODE_RESOURCE_DIM )
-//         {
-//              [10:06] D3D10_SB_RESOURCE_DIMENSION
-//              [22:11] When dimension is D3D11_SB_RESOURCE_DIMENSION_STRUCTURED_BUFFER this holds the buffer stride, otherwise 0
-//              [30:23] Ignored, 0.
-//         }
-//         else if( [05:00] == D3D11_SB_EXTENDED_OPCODE_RESOURCE_RETURN_TYPE )
-//         {
-//              [09:06] D3D10_SB_RESOURCE_RETURN_TYPE for component X
-//              [13:10] D3D10_SB_RESOURCE_RETURN_TYPE for component Y
-//              [17:14] D3D10_SB_RESOURCE_RETURN_TYPE for component Z
-//              [21:18] D3D10_SB_RESOURCE_RETURN_TYPE for component W
-//              [30:22] Ignored, 0.
-//         }
-//         else
-//         {
-//              [30:04] Ignored, 0.
-//         }
-// [31]    0 normally. 1 there is another extended opcode.  Any number
-//         of extended opcode tokens can be chained.  It is possible that some extended
-//         opcode tokens could include multiple DWORDS - that is defined
-//         on a case by case basis.
-//
-// ----------------------------------------------------------------------------
-typedef enum D3D10_SB_EXTENDED_OPCODE_TYPE
-{
-    D3D10_SB_EXTENDED_OPCODE_EMPTY           = 0,
-    D3D10_SB_EXTENDED_OPCODE_SAMPLE_CONTROLS = 1,
-    D3D11_SB_EXTENDED_OPCODE_RESOURCE_DIM = 2,
-    D3D11_SB_EXTENDED_OPCODE_RESOURCE_RETURN_TYPE = 3,
-} D3D10_SB_EXTENDED_OPCODE_TYPE;
-#define D3D11_SB_MAX_SIMULTANEOUS_EXTENDED_OPCODES 3
-
-#define D3D10_SB_EXTENDED_OPCODE_TYPE_MASK 0x0000003f
-
-// DECODER MACRO: Given an extended opcode
-// token (OpcodeToken1), figure out what type
-// of token it is (from D3D10_SB_EXTENDED_OPCODE_TYPE enum)
-// to be able to interpret the rest of the token's contents.
-#define DECODE_D3D10_SB_EXTENDED_OPCODE_TYPE(OpcodeToken1) ((D3D10_SB_EXTENDED_OPCODE_TYPE)((OpcodeToken1)&D3D10_SB_EXTENDED_OPCODE_TYPE_MASK))
-
-// ENCODER MACRO: Store extended opcode token
-// type in OpcodeToken1.
-#define ENCODE_D3D10_SB_EXTENDED_OPCODE_TYPE(ExtOpcodeType) ((ExtOpcodeType)&D3D10_SB_EXTENDED_OPCODE_TYPE_MASK)
-
-typedef enum D3D10_SB_IMMEDIATE_ADDRESS_OFFSET_COORD
-{
-    D3D10_SB_IMMEDIATE_ADDRESS_OFFSET_U        = 0,
-    D3D10_SB_IMMEDIATE_ADDRESS_OFFSET_V        = 1,
-    D3D10_SB_IMMEDIATE_ADDRESS_OFFSET_W        = 2,
-} D3D10_SB_IMMEDIATE_ADDRESS_OFFSET_COORD;
-#define D3D10_SB_IMMEDIATE_ADDRESS_OFFSET_COORD_MASK (3)
-#define D3D10_SB_IMMEDIATE_ADDRESS_OFFSET_SHIFT(Coord) (9+4*((Coord)&D3D10_SB_IMMEDIATE_ADDRESS_OFFSET_COORD_MASK))
-#define D3D10_SB_IMMEDIATE_ADDRESS_OFFSET_MASK(Coord) (0x0000000f<<D3D10_SB_IMMEDIATE_ADDRESS_OFFSET_SHIFT(Coord))
-
-// DECODER MACRO: Given an extended opcode token
-// (OpcodeToken1), and extended token type ==
-// D3D10_SB_EXTENDED_OPCODE_SAMPLE_CONTROLS, determine the immediate
-// texel address offset for u/v/w (D3D10_SB_ADDRESS_OFFSET_COORD)
-// This macro returns a (signed) integer, by sign extending the
-// decoded 4 bit 2's complement immediate value.
-#define DECODE_IMMEDIATE_D3D10_SB_ADDRESS_OFFSET(Coord,OpcodeToken1) ((((OpcodeToken1)&D3D10_SB_IMMEDIATE_ADDRESS_OFFSET_MASK(Coord))>>(D3D10_SB_IMMEDIATE_ADDRESS_OFFSET_SHIFT(Coord))))
-
-// ENCODER MACRO: Store the immediate texel address offset
-// for U or V or W Coord (D3D10_SB_ADDRESS_OFFSET_COORD) in an extended
-// opcode token (OpcodeToken1) that has extended opcode
-// type == D3D10_SB_EXTENDED_OPCODE_SAMPLE_CONTROLS (opcode type encoded separately)
-// A 2's complement number is expected as input, from which the LSB 4 bits are extracted.
-#define ENCODE_IMMEDIATE_D3D10_SB_ADDRESS_OFFSET(Coord,ImmediateOffset) (((ImmediateOffset)<<D3D10_SB_IMMEDIATE_ADDRESS_OFFSET_SHIFT(Coord))&D3D10_SB_IMMEDIATE_ADDRESS_OFFSET_MASK(Coord))
-
-#define D3D11_SB_EXTENDED_RESOURCE_DIMENSION_MASK  0x000007C0
-#define D3D11_SB_EXTENDED_RESOURCE_DIMENSION_SHIFT 6
-
-// DECODER MACRO: Given an extended resource declaration token,
-// (D3D11_SB_EXTENDED_OPCODE_RESOURCE_DIM), determine the resource dimension
-// (D3D10_SB_RESOURCE_DIMENSION enum)
-#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))
-
-// ENCODER MACRO: Store resource dimension
-// (D3D10_SB_RESOURCE_DIMENSION enum) into a
-// an extended resource declaration token (D3D11_SB_EXTENDED_OPCODE_RESOURCE_DIM)
-#define ENCODE_D3D11_SB_EXTENDED_RESOURCE_DIMENSION(ResourceDim) (((ResourceDim)<<D3D11_SB_EXTENDED_RESOURCE_DIMENSION_SHIFT)&D3D11_SB_EXTENDED_RESOURCE_DIMENSION_MASK)
-
-#define D3D11_SB_EXTENDED_RESOURCE_DIMENSION_STRUCTURE_STRIDE_MASK  0x007FF800
-#define D3D11_SB_EXTENDED_RESOURCE_DIMENSION_STRUCTURE_STRIDE_SHIFT 11
-
-// DECODER MACRO: Given an extended resource declaration token for a structured buffer,
-// (D3D11_SB_EXTENDED_OPCODE_RESOURCE_DIM), determine the structure stride
-// (12-bit unsigned integer)
-#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)
-
-// ENCODER MACRO: Store resource dimension structure stride
-// (12-bit unsigned integer) into a
-// an extended resource declaration token (D3D11_SB_EXTENDED_OPCODE_RESOURCE_DIM)
-#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)
-
-#define D3D10_SB_RESOURCE_RETURN_TYPE_MASK    0x0000000f
-#define D3D10_SB_RESOURCE_RETURN_TYPE_NUMBITS 0x00000004
-#define D3D11_SB_EXTENDED_RESOURCE_RETURN_TYPE_SHIFT 6
-
-// DECODER MACRO: Get the resource return type for component (0-3) from
-// an extended resource declaration token (D3D11_SB_EXTENDED_OPCODE_RESOURCE_RETURN_TYPE)
-#define DECODE_D3D11_SB_EXTENDED_RESOURCE_RETURN_TYPE(OpcodeTokenN, Component) \
-    ((D3D10_SB_RESOURCE_RETURN_TYPE)(((OpcodeTokenN) >> \
-    (Component * D3D10_SB_RESOURCE_RETURN_TYPE_NUMBITS + D3D11_SB_EXTENDED_RESOURCE_RETURN_TYPE_SHIFT))&D3D10_SB_RESOURCE_RETURN_TYPE_MASK))
-
-// ENCODER MACRO: Generate a resource return type for a component in an extended
-// resource delcaration token (D3D11_SB_EXTENDED_OPCODE_RESOURCE_RETURN_TYPE)
-#define ENCODE_D3D11_SB_EXTENDED_RESOURCE_RETURN_TYPE(ReturnType, Component) \
-    (((ReturnType)&D3D10_SB_RESOURCE_RETURN_TYPE_MASK) << (Component * D3D10_SB_RESOURCE_RETURN_TYPE_NUMBITS + D3D11_SB_EXTENDED_RESOURCE_RETURN_TYPE_SHIFT))
-
-// ----------------------------------------------------------------------------
-// Custom-Data Block Format
-//
-// DWORD 0 (CustomDataDescTok):
-// [10:00] == D3D10_SB_OPCODE_CUSTOMDATA
-// [31:11] == D3D10_SB_CUSTOMDATA_CLASS
-//
-// DWORD 1: 
-//          32-bit unsigned integer count of number
-//          of DWORDs in custom-data block,
-//          including DWORD 0 and DWORD 1.
-//          So the minimum value is 0x00000002,
-//          meaning empty custom-data.
-//
-// Layout of custom-data contents, for the various meta-data classes,
-// not defined in this file.
-//
-// ----------------------------------------------------------------------------
-
-typedef enum D3D10_SB_CUSTOMDATA_CLASS
-{
-    D3D10_SB_CUSTOMDATA_COMMENT = 0,
-    D3D10_SB_CUSTOMDATA_DEBUGINFO,
-    D3D10_SB_CUSTOMDATA_OPAQUE,
-    D3D10_SB_CUSTOMDATA_DCL_IMMEDIATE_CONSTANT_BUFFER,
-    D3D11_SB_CUSTOMDATA_SHADER_MESSAGE,
-    D3D11_SB_CUSTOMDATA_SHADER_CLIP_PLANE_CONSTANT_MAPPINGS_FOR_DX9,
-} D3D10_SB_CUSTOMDATA_CLASS;
-
-#define D3D10_SB_CUSTOMDATA_CLASS_MASK 0xfffff800
-#define D3D10_SB_CUSTOMDATA_CLASS_SHIFT 11
-// DECODER MACRO: Find out what class of custom-data is present.
-// The contents of the custom-data block are defined
-// for each class of custom-data.
-#define DECODE_D3D10_SB_CUSTOMDATA_CLASS(CustomDataDescTok) ((D3D10_SB_CUSTOMDATA_CLASS)(((CustomDataDescTok)&D3D10_SB_CUSTOMDATA_CLASS_MASK)>>D3D10_SB_CUSTOMDATA_CLASS_SHIFT))
-// ENCODER MACRO: Create complete CustomDataDescTok
-#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))
-
-// ----------------------------------------------------------------------------
-// Instruction Operand Format (OperandToken0)
-//
-// [01:00] D3D10_SB_OPERAND_NUM_COMPONENTS
-// [11:02] Component Selection
-//         if([01:00] == D3D10_SB_OPERAND_0_COMPONENT)
-//              [11:02] = Ignored, 0
-//         else if([01:00] == D3D10_SB_OPERAND_1_COMPONENT
-//              [11:02] = Ignored, 0
-//         else if([01:00] == D3D10_SB_OPERAND_4_COMPONENT
-//         {
-//              [03:02] = D3D10_SB_OPERAND_4_COMPONENT_SELECTION_MODE
-//              if([03:02] == D3D10_SB_OPERAND_4_COMPONENT_MASK_MODE)
-//              {
-//                  [07:04] = D3D10_SB_OPERAND_4_COMPONENT_MASK
-//                  [11:08] = Ignored, 0
-//              }
-//              else if([03:02] == D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE_MODE)
-//              {
-//                  [11:04] = D3D10_SB_4_COMPONENT_SWIZZLE
-//              }
-//              else if([03:02] == D3D10_SB_OPERAND_4_COMPONENT_SELECT_1_MODE)
-//              {
-//                  [05:04] = D3D10_SB_4_COMPONENT_NAME
-//                  [11:06] = Ignored, 0
-//              }
-//         }
-//         else if([01:00] == D3D10_SB_OPERAND_N_COMPONENT)
-//         {
-//              Currently not defined.
-//         }
-// [19:12] D3D10_SB_OPERAND_TYPE
-// [21:20] D3D10_SB_OPERAND_INDEX_DIMENSION:
-//            Number of dimensions in the register
-//            file (NOT the # of dimensions in the
-//            individual register or memory
-//            resource being referenced).
-// [24:22] if( [21:20] >= D3D10_SB_OPERAND_INDEX_1D )
-//             D3D10_SB_OPERAND_INDEX_REPRESENTATION for first operand index
-//         else
-//             Ignored, 0
-// [27:25] if( [21:20] >= D3D10_SB_OPERAND_INDEX_2D )
-//             D3D10_SB_OPERAND_INDEX_REPRESENTATION for second operand index
-//         else
-//             Ignored, 0
-// [30:28] if( [21:20] == D3D10_SB_OPERAND_INDEX_3D )
-//             D3D10_SB_OPERAND_INDEX_REPRESENTATION for third operand index
-//         else
-//             Ignored, 0
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.
-//
-// ----------------------------------------------------------------------------
-
-// Number of components in data vector referred to by operand.
-typedef enum D3D10_SB_OPERAND_NUM_COMPONENTS
-{
-    D3D10_SB_OPERAND_0_COMPONENT = 0,
-    D3D10_SB_OPERAND_1_COMPONENT = 1,
-    D3D10_SB_OPERAND_4_COMPONENT = 2,
-    D3D10_SB_OPERAND_N_COMPONENT = 3 // unused for now
-} D3D10_SB_OPERAND_NUM_COMPONENTS;
-#define D3D10_SB_OPERAND_NUM_COMPONENTS_MASK 0x00000003
-
-// DECODER MACRO: Extract from OperandToken0 how many components
-// the data vector referred to by the operand contains.
-// (D3D10_SB_OPERAND_NUM_COMPONENTS enum)
-#define DECODE_D3D10_SB_OPERAND_NUM_COMPONENTS(OperandToken0) ((D3D10_SB_OPERAND_NUM_COMPONENTS)((OperandToken0)&D3D10_SB_OPERAND_NUM_COMPONENTS_MASK))
-
-// ENCODER MACRO: Define in OperandToken0 how many components
-// the data vector referred to by the operand contains.
-// (D3D10_SB_OPERAND_NUM_COMPONENTS enum).
-#define ENCODE_D3D10_SB_OPERAND_NUM_COMPONENTS(NumComp) ((NumComp)&D3D10_SB_OPERAND_NUM_COMPONENTS_MASK)
-
-typedef enum D3D10_SB_OPERAND_4_COMPONENT_SELECTION_MODE
-{
-    D3D10_SB_OPERAND_4_COMPONENT_MASK_MODE    = 0,  // mask 4 components
-    D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE_MODE = 1,  // swizzle 4 components
-    D3D10_SB_OPERAND_4_COMPONENT_SELECT_1_MODE = 2, // select 1 of 4 components
-} D3D10_SB_OPERAND_4_COMPONENT_SELECTION_MODE;
-
-#define D3D10_SB_OPERAND_4_COMPONENT_SELECTION_MODE_MASK  0x0000000c
-#define D3D10_SB_OPERAND_4_COMPONENT_SELECTION_MODE_SHIFT 2
-
-// DECODER MACRO: For an operand representing 4component data,
-// extract from OperandToken0 the method for selecting data from
-// the 4 components (D3D10_SB_OPERAND_4_COMPONENT_SELECTION_MODE).
-#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))
-
-// ENCODER MACRO: For an operand representing 4component data,
-// encode in OperandToken0 a value from D3D10_SB_OPERAND_4_COMPONENT_SELECTION_MODE
-#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)
-
-typedef enum D3D10_SB_4_COMPONENT_NAME
-{
-    D3D10_SB_4_COMPONENT_X = 0,
-    D3D10_SB_4_COMPONENT_Y = 1,
-    D3D10_SB_4_COMPONENT_Z = 2,
-    D3D10_SB_4_COMPONENT_W = 3,
-    D3D10_SB_4_COMPONENT_R = 0,
-    D3D10_SB_4_COMPONENT_G = 1,
-    D3D10_SB_4_COMPONENT_B = 2,
-    D3D10_SB_4_COMPONENT_A = 3
-} D3D10_SB_4_COMPONENT_NAME;
-#define D3D10_SB_4_COMPONENT_NAME_MASK 3
-
-// MACROS FOR USE IN D3D10_SB_OPERAND_4_COMPONENT_MASK_MODE:
-
-#define D3D10_SB_OPERAND_4_COMPONENT_MASK_MASK   0x000000f0
-#define D3D10_SB_OPERAND_4_COMPONENT_MASK_SHIFT  4
-#define D3D10_SB_OPERAND_4_COMPONENT_MASK_X      0x00000010
-#define D3D10_SB_OPERAND_4_COMPONENT_MASK_Y      0x00000020
-#define D3D10_SB_OPERAND_4_COMPONENT_MASK_Z      0x00000040
-#define D3D10_SB_OPERAND_4_COMPONENT_MASK_W      0x00000080
-#define D3D10_SB_OPERAND_4_COMPONENT_MASK_R      D3D10_SB_OPERAND_4_COMPONENT_MASK_X
-#define D3D10_SB_OPERAND_4_COMPONENT_MASK_G      D3D10_SB_OPERAND_4_COMPONENT_MASK_Y
-#define D3D10_SB_OPERAND_4_COMPONENT_MASK_B      D3D10_SB_OPERAND_4_COMPONENT_MASK_Z
-#define D3D10_SB_OPERAND_4_COMPONENT_MASK_A      D3D10_SB_OPERAND_4_COMPONENT_MASK_W
-#define D3D10_SB_OPERAND_4_COMPONENT_MASK_ALL    D3D10_SB_OPERAND_4_COMPONENT_MASK_MASK
-
-// DECODER MACRO: When 4 component selection mode is
-// D3D10_SB_OPERAND_4_COMPONENT_MASK_MODE, this macro
-// extracts from OperandToken0 the 4 component (xyzw) mask,
-// as a field of D3D10_SB_OPERAND_4_COMPONENT_MASK_[X|Y|Z|W] flags.
-// Alternatively, the D3D10_SB_OPERAND_4_COMPONENT_MASK_[X|Y|Z|W] masks
-// can be tested on OperandToken0 directly, without this macro.
-#define DECODE_D3D10_SB_OPERAND_4_COMPONENT_MASK(OperandToken0) ((OperandToken0)&D3D10_SB_OPERAND_4_COMPONENT_MASK_MASK)
-
-// ENCODER MACRO: Given a set of
-// D3D10_SB_OPERAND_4_COMPONENT_MASK_[X|Y|Z|W] values
-// or'd together, encode them in OperandToken0.
-#define ENCODE_D3D10_SB_OPERAND_4_COMPONENT_MASK(ComponentMask) ((ComponentMask)&D3D10_SB_OPERAND_4_COMPONENT_MASK_MASK)
-
-// ENCODER/DECODER MACRO: Given a D3D10_SB_4_COMPONENT_NAME,
-// generate the 4-component mask for it.
-// This can be used in loops that build masks or read masks.
-// Alternatively, the D3D10_SB_OPERAND_4_COMPONENT_MASK_[X|Y|Z|W] masks
-// can be used directly, without this macro.
-#define D3D10_SB_OPERAND_4_COMPONENT_MASK(ComponentName) ((1<<(D3D10_SB_OPERAND_4_COMPONENT_MASK_SHIFT+ComponentName))&D3D10_SB_OPERAND_4_COMPONENT_MASK_MASK)
-
-// MACROS FOR USE IN D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE_MODE:
-
-#define D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE_MASK 0x00000ff0
-#define D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE_SHIFT 4
-
-// DECODER MACRO: When 4 component selection mode is
-// D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE_MODE, this macro
-// extracts from OperandToken0 the 4 component swizzle,
-// as a field of D3D10_SB_OPERAND_4_COMPONENT_MASK_[X|Y|Z|W] flags.
-#define DECODE_D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE(OperandToken0) ((OperandToken0)&D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE_MASK)
-
-// DECODER MACRO: Pass a D3D10_SB_4_COMPONENT_NAME as "DestComp" in following
-// macro to extract, from OperandToken0 or from a decoded swizzle,
-// the swizzle source component (D3D10_SB_4_COMPONENT_NAME enum):
-#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))
-
-// ENCODER MACRO: Generate a 4 component swizzle given
-// 4 D3D10_SB_4_COMPONENT_NAME source values for dest
-// components x, y, z, w respectively.
-#define ENCODE_D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE(XSrc,YSrc,ZSrc,WSrc) ((((XSrc)&D3D10_SB_4_COMPONENT_NAME_MASK)|     \
-                                                                     (((YSrc)&D3D10_SB_4_COMPONENT_NAME_MASK)<<2)| \
-                                                                     (((ZSrc)&D3D10_SB_4_COMPONENT_NAME_MASK)<<4)| \
-                                                                     (((WSrc)&D3D10_SB_4_COMPONENT_NAME_MASK)<<6)  \
-                                                                      )<<D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE_SHIFT)
-
-// ENCODER/DECODER MACROS: Various common swizzle patterns
-// (noswizzle and replicate of each channels)
-#define D3D10_SB_OPERAND_4_COMPONENT_NOSWIZZLE   ENCODE_D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE(D3D10_SB_4_COMPONENT_X,\
-                                                                                   D3D10_SB_4_COMPONENT_Y,\
-                                                                                   D3D10_SB_4_COMPONENT_Z,\
-                                                                                   D3D10_SB_4_COMPONENT_W)
-
-#define D3D10_SB_OPERAND_4_COMPONENT_REPLICATEX  ENCODE_D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE(D3D10_SB_4_COMPONENT_X,\
-                                                                                   D3D10_SB_4_COMPONENT_X,\
-                                                                                   D3D10_SB_4_COMPONENT_X,\
-                                                                                   D3D10_SB_4_COMPONENT_X)
-
-#define D3D10_SB_OPERAND_4_COMPONENT_REPLICATEY  ENCODE_D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE(D3D10_SB_4_COMPONENT_Y,\
-                                                                                   D3D10_SB_4_COMPONENT_Y,\
-                                                                                   D3D10_SB_4_COMPONENT_Y,\
-                                                                                   D3D10_SB_4_COMPONENT_Y)
-
-#define D3D10_SB_OPERAND_4_COMPONENT_REPLICATEZ  ENCODE_D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE(D3D10_SB_4_COMPONENT_Z,\
-                                                                                   D3D10_SB_4_COMPONENT_Z,\
-                                                                                   D3D10_SB_4_COMPONENT_Z,\
-                                                                                   D3D10_SB_4_COMPONENT_Z)
-
-#define D3D10_SB_OPERAND_4_COMPONENT_REPLICATEW  ENCODE_D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE(D3D10_SB_4_COMPONENT_W,\
-                                                                                   D3D10_SB_4_COMPONENT_W,\
-                                                                                   D3D10_SB_4_COMPONENT_W,\
-                                                                                   D3D10_SB_4_COMPONENT_W)
-
-#define D3D10_SB_OPERAND_4_COMPONENT_REPLICATERED    D3D10_SB_OPERAND_4_COMPONENT_REPLICATEX
-#define D3D10_SB_OPERAND_4_COMPONENT_REPLICATEGREEN  D3D10_SB_OPERAND_4_COMPONENT_REPLICATEY
-#define D3D10_SB_OPERAND_4_COMPONENT_REPLICATEBLUE   D3D10_SB_OPERAND_4_COMPONENT_REPLICATEZ
-#define D3D10_SB_OPERAND_4_COMPONENT_REPLICATEALPHA  D3D10_SB_OPERAND_4_COMPONENT_REPLICATEW
-
-// MACROS FOR USE IN D3D10_SB_OPERAND_4_COMPONENT_SELECT_1_MODE:
-#define D3D10_SB_OPERAND_4_COMPONENT_SELECT_1_MASK   0x00000030
-#define D3D10_SB_OPERAND_4_COMPONENT_SELECT_1_SHIFT  4
-
-// DECODER MACRO: When 4 component selection mode is
-// D3D10_SB_OPERAND_4_COMPONENT_SELECT_1_MODE, this macro
-// extracts from OperandToken0 a D3D10_SB_4_COMPONENT_NAME
-// which picks one of the 4 components.
-#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))
-
-// ENCODER MACRO: Given a D3D10_SB_4_COMPONENT_NAME selecting
-// a single component for D3D10_SB_OPERAND_4_COMPONENT_SELECT_1_MODE,
-// encode it into OperandToken0
-#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)
-
-// MACROS FOR DETERMINING OPERAND TYPE:
-
-typedef enum D3D10_SB_OPERAND_TYPE
-{
-    D3D10_SB_OPERAND_TYPE_TEMP           = 0,  // Temporary Register File
-    D3D10_SB_OPERAND_TYPE_INPUT          = 1,  // General Input Register File
-    D3D10_SB_OPERAND_TYPE_OUTPUT         = 2,  // General Output Register File
-    D3D10_SB_OPERAND_TYPE_INDEXABLE_TEMP = 3,  // Temporary Register File (indexable)
-    D3D10_SB_OPERAND_TYPE_IMMEDIATE32    = 4,  // 32bit/component immediate value(s)
-                                          // If for example, operand token bits
-                                          // [01:00]==D3D10_SB_OPERAND_4_COMPONENT,
-                                          // this means that the operand type:
-                                          // D3D10_SB_OPERAND_TYPE_IMMEDIATE32
-                                          // results in 4 additional 32bit
-                                          // DWORDS present for the operand.
-    D3D10_SB_OPERAND_TYPE_IMMEDIATE64    = 5,  // 64bit/comp.imm.val(s)HI:LO
-    D3D10_SB_OPERAND_TYPE_SAMPLER        = 6,  // Reference to sampler state
-    D3D10_SB_OPERAND_TYPE_RESOURCE       = 7,  // Reference to memory resource (e.g. texture)
-    D3D10_SB_OPERAND_TYPE_CONSTANT_BUFFER= 8,  // Reference to constant buffer
-    D3D10_SB_OPERAND_TYPE_IMMEDIATE_CONSTANT_BUFFER= 9,  // Reference to immediate constant buffer
-    D3D10_SB_OPERAND_TYPE_LABEL          = 10, // Label
-    D3D10_SB_OPERAND_TYPE_INPUT_PRIMITIVEID = 11, // Input primitive ID
-    D3D10_SB_OPERAND_TYPE_OUTPUT_DEPTH   = 12, // Output Depth
-    D3D10_SB_OPERAND_TYPE_NULL           = 13, // Null register, used to discard results of operations
-                                               // Below Are operands new in DX 10.1
-    D3D10_SB_OPERAND_TYPE_RASTERIZER     = 14, // DX10.1 Rasterizer register, used to denote the depth/stencil and render target resources
-    D3D10_SB_OPERAND_TYPE_OUTPUT_COVERAGE_MASK = 15, // DX10.1 PS output MSAA coverage mask (scalar)
-                                               // Below Are operands new in DX 11
-    D3D11_SB_OPERAND_TYPE_STREAM         = 16, // Reference to GS stream output resource
-    D3D11_SB_OPERAND_TYPE_FUNCTION_BODY  = 17, // Reference to a function definition
-    D3D11_SB_OPERAND_TYPE_FUNCTION_TABLE = 18, // Reference to a set of functions used by a class
-    D3D11_SB_OPERAND_TYPE_INTERFACE      = 19, // Reference to an interface
-    D3D11_SB_OPERAND_TYPE_FUNCTION_INPUT = 20, // Reference to an input parameter to a function
-    D3D11_SB_OPERAND_TYPE_FUNCTION_OUTPUT = 21, // Reference to an output parameter to a function
-    D3D11_SB_OPERAND_TYPE_OUTPUT_CONTROL_POINT_ID = 22, // HS Control Point phase input saying which output control point ID this is
-    D3D11_SB_OPERAND_TYPE_INPUT_FORK_INSTANCE_ID = 23, // HS Fork Phase input instance ID
-    D3D11_SB_OPERAND_TYPE_INPUT_JOIN_INSTANCE_ID = 24, // HS Join Phase input instance ID
-    D3D11_SB_OPERAND_TYPE_INPUT_CONTROL_POINT = 25, // HS Fork+Join, DS phase input control points (array of them)
-    D3D11_SB_OPERAND_TYPE_OUTPUT_CONTROL_POINT = 26, // HS Fork+Join phase output control points (array of them)
-    D3D11_SB_OPERAND_TYPE_INPUT_PATCH_CONSTANT = 27, // DS+HSJoin Input Patch Constants (array of them)
-    D3D11_SB_OPERAND_TYPE_INPUT_DOMAIN_POINT = 28, // DS Input Domain point
-    D3D11_SB_OPERAND_TYPE_THIS_POINTER       = 29, // Reference to an interface this pointer
-    D3D11_SB_OPERAND_TYPE_UNORDERED_ACCESS_VIEW = 30, // Reference to UAV u#
-    D3D11_SB_OPERAND_TYPE_THREAD_GROUP_SHARED_MEMORY = 31, // Reference to Thread Group Shared Memory g#
-    D3D11_SB_OPERAND_TYPE_INPUT_THREAD_ID = 32, // Compute Shader Thread ID
-    D3D11_SB_OPERAND_TYPE_INPUT_THREAD_GROUP_ID = 33, // Compute Shader Thread Group ID
-    D3D11_SB_OPERAND_TYPE_INPUT_THREAD_ID_IN_GROUP = 34, // Compute Shader Thread ID In Thread Group
-    D3D11_SB_OPERAND_TYPE_INPUT_COVERAGE_MASK = 35, // Pixel shader coverage mask input
-    D3D11_SB_OPERAND_TYPE_INPUT_THREAD_ID_IN_GROUP_FLATTENED = 36, // Compute Shader Thread ID In Group Flattened to a 1D value.
-    D3D11_SB_OPERAND_TYPE_INPUT_GS_INSTANCE_ID = 37, // Input GS instance ID
-    D3D11_SB_OPERAND_TYPE_OUTPUT_DEPTH_GREATER_EQUAL = 38, // Output Depth, forced to be greater than or equal than current depth
-    D3D11_SB_OPERAND_TYPE_OUTPUT_DEPTH_LESS_EQUAL    = 39, // Output Depth, forced to be less than or equal to current depth
-    D3D11_SB_OPERAND_TYPE_CYCLE_COUNTER = 40, // Cycle counter
-    D3D11_SB_OPERAND_TYPE_OUTPUT_STENCIL_REF = 41, // DX11 PS output stencil reference (scalar)
-    D3D11_SB_OPERAND_TYPE_INNER_COVERAGE = 42, // DX11 PS input inner coverage (scalar)
-} D3D10_SB_OPERAND_TYPE;
-
-#define D3D10_SB_OPERAND_TYPE_MASK   0x000ff000
-#define D3D10_SB_OPERAND_TYPE_SHIFT  12
-
-// DECODER MACRO: Determine operand type from OperandToken0.
-#define DECODE_D3D10_SB_OPERAND_TYPE(OperandToken0) ((D3D10_SB_OPERAND_TYPE)(((OperandToken0)&D3D10_SB_OPERAND_TYPE_MASK)>>D3D10_SB_OPERAND_TYPE_SHIFT))
-
-// ENCODER MACRO: Store operand type in OperandToken0.
-#define ENCODE_D3D10_SB_OPERAND_TYPE(OperandType) (((OperandType)<<D3D10_SB_OPERAND_TYPE_SHIFT)&D3D10_SB_OPERAND_TYPE_MASK)
-
-typedef enum D3D10_SB_OPERAND_INDEX_DIMENSION
-{
-    D3D10_SB_OPERAND_INDEX_0D = 0, // e.g. Position
-    D3D10_SB_OPERAND_INDEX_1D = 1, // Most common.  e.g. Temp registers.
-    D3D10_SB_OPERAND_INDEX_2D = 2, // e.g. Geometry Program Input registers.
-    D3D10_SB_OPERAND_INDEX_3D = 3, // 3D rarely if ever used.
-} D3D10_SB_OPERAND_INDEX_DIMENSION;
-#define D3D10_SB_OPERAND_INDEX_DIMENSION_MASK  0x00300000
-#define D3D10_SB_OPERAND_INDEX_DIMENSION_SHIFT 20
-
-// DECODER MACRO: Determine operand index dimension from OperandToken0.
-#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))
-
-// ENCODER MACRO: Store operand index dimension
-// (D3D10_SB_OPERAND_INDEX_DIMENSION enum) in OperandToken0.
-#define ENCODE_D3D10_SB_OPERAND_INDEX_DIMENSION(OperandIndexDim) (((OperandIndexDim)<<D3D10_SB_OPERAND_INDEX_DIMENSION_SHIFT)&D3D10_SB_OPERAND_INDEX_DIMENSION_MASK)
-
-typedef enum D3D10_SB_OPERAND_INDEX_REPRESENTATION
-{
-    D3D10_SB_OPERAND_INDEX_IMMEDIATE32               = 0, // Extra DWORD
-    D3D10_SB_OPERAND_INDEX_IMMEDIATE64               = 1, // 2 Extra DWORDs
-                                                     //   (HI32:LO32)
-    D3D10_SB_OPERAND_INDEX_RELATIVE                  = 2, // Extra operand
-    D3D10_SB_OPERAND_INDEX_IMMEDIATE32_PLUS_RELATIVE = 3, // Extra DWORD followed by
-                                                     //   extra operand
-    D3D10_SB_OPERAND_INDEX_IMMEDIATE64_PLUS_RELATIVE = 4, // 2 Extra DWORDS
-                                                     //   (HI32:LO32) followed
-                                                     //   by extra operand
-} D3D10_SB_OPERAND_INDEX_REPRESENTATION;
-#define D3D10_SB_OPERAND_INDEX_REPRESENTATION_SHIFT(Dim) (22+3*((Dim)&3))
-#define D3D10_SB_OPERAND_INDEX_REPRESENTATION_MASK(Dim) (0x3<<D3D10_SB_OPERAND_INDEX_REPRESENTATION_SHIFT(Dim))
-
-// DECODER MACRO: Determine from OperandToken0 what representation
-// an operand index is provided as (D3D10_SB_OPERAND_INDEX_REPRESENTATION enum),
-// for index dimension [0], [1] or [2], depending on D3D10_SB_OPERAND_INDEX_DIMENSION.
-#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)))
-
-// ENCODER MACRO: Store in OperandToken0 what representation
-// an operand index is provided as (D3D10_SB_OPERAND_INDEX_REPRESENTATION enum),
-// for index dimension [0], [1] or [2], depending on D3D10_SB_OPERAND_INDEX_DIMENSION.
-#define ENCODE_D3D10_SB_OPERAND_INDEX_REPRESENTATION(Dim,IndexRepresentation) (((IndexRepresentation)<<D3D10_SB_OPERAND_INDEX_REPRESENTATION_SHIFT(Dim))&D3D10_SB_OPERAND_INDEX_REPRESENTATION_MASK(Dim))
-
-#define D3D10_SB_OPERAND_EXTENDED_MASK  0x80000000
-#define D3D10_SB_OPERAND_EXTENDED_SHIFT 31
-
-// DECODER MACRO: Determine if the operand is extended
-// by an additional opcode token.
-#define DECODE_IS_D3D10_SB_OPERAND_EXTENDED(OperandToken0) (((OperandToken0)&D3D10_SB_OPERAND_EXTENDED_MASK)>>D3D10_SB_OPERAND_EXTENDED_SHIFT)
-
-// ENCODER MACRO: Store in OperandToken0 whether the operand is extended
-// by an additional operand token.
-#define ENCODE_D3D10_SB_OPERAND_EXTENDED(bExtended) (((bExtended)!=0)?D3D10_SB_OPERAND_EXTENDED_MASK:0)
-
-// ----------------------------------------------------------------------------
-// Extended Instruction Operand Format (OperandToken1)
-//
-// If bit31 of an operand token is set, the
-// operand has additional data in a second DWORD
-// directly following OperandToken0.  Other tokens
-// expected for the operand, such as immmediate
-// values or relative address operands (full
-// operands in themselves) always follow
-// OperandToken0 AND OperandToken1..n (extended
-// operand tokens, if present).
-//
-// [05:00] D3D10_SB_EXTENDED_OPERAND_TYPE
-// [16:06] if([05:00] == D3D10_SB_EXTENDED_OPERAND_MODIFIER)
-//         {
-//              [13:06] D3D10_SB_OPERAND_MODIFIER
-//              [16:14] Min Precision: D3D11_SB_OPERAND_MIN_PRECISION
-//              [17:17] Non-uniform: D3D12_SB_OPERAND_NON_UNIFORM
-//         }
-//         else
-//         {
-//              [17:06] Ignored, 0.
-//         }
-// [30:18] Ignored, 0.
-// [31]    0 normally. 1 if second order extended operand definition,
-//         meaning next DWORD contains yet ANOTHER extended operand
-//         description. Currently no second order extensions defined.
-//         This would be useful if a particular extended operand does
-//         not have enough space to store the required information in
-//         a single token and so is extended further.
-//
-// ----------------------------------------------------------------------------
-
-typedef enum D3D10_SB_EXTENDED_OPERAND_TYPE
-{
-    D3D10_SB_EXTENDED_OPERAND_EMPTY            = 0, // Might be used if this
-                                               // enum is full and
-                                               // further extended opcode
-                                               // is needed.
-    D3D10_SB_EXTENDED_OPERAND_MODIFIER         = 1,
-} D3D10_SB_EXTENDED_OPERAND_TYPE;
-#define D3D10_SB_EXTENDED_OPERAND_TYPE_MASK 0x0000003f
-
-// DECODER MACRO: Given an extended operand
-// token (OperandToken1), figure out what type
-// of token it is (from D3D10_SB_EXTENDED_OPERAND_TYPE enum)
-// to be able to interpret the rest of the token's contents.
-#define DECODE_D3D10_SB_EXTENDED_OPERAND_TYPE(OperandToken1) ((D3D10_SB_EXTENDED_OPERAND_TYPE)((OperandToken1)&D3D10_SB_EXTENDED_OPERAND_TYPE_MASK))
-
-// ENCODER MACRO: Store extended operand token
-// type in OperandToken1.
-#define ENCODE_D3D10_SB_EXTENDED_OPERAND_TYPE(ExtOperandType) ((ExtOperandType)&D3D10_SB_EXTENDED_OPERAND_TYPE_MASK)
-
-typedef enum D3D10_SB_OPERAND_MODIFIER
-{
-    D3D10_SB_OPERAND_MODIFIER_NONE     = 0, // Nop.  This is the implied
-                                             // default if the extended
-                                             // operand is not present for
-                                             // an operand for which source
-                                             // modifiers are meaningful
-    D3D10_SB_OPERAND_MODIFIER_NEG      = 1, // Negate
-    D3D10_SB_OPERAND_MODIFIER_ABS      = 2, // Absolute value, abs()
-    D3D10_SB_OPERAND_MODIFIER_ABSNEG   = 3, // -abs()
-} D3D10_SB_OPERAND_MODIFIER;
-#define D3D10_SB_OPERAND_MODIFIER_MASK  0x00003fc0
-#define D3D10_SB_OPERAND_MODIFIER_SHIFT 6
-
-// DECODER MACRO: Given a D3D10_SB_EXTENDED_OPERAND_MODIFIER
-// extended token (OperandToken1), determine the source modifier
-// (D3D10_SB_OPERAND_MODIFIER enum)
-#define DECODE_D3D10_SB_OPERAND_MODIFIER(OperandToken1) ((D3D10_SB_OPERAND_MODIFIER)(((OperandToken1)&D3D10_SB_OPERAND_MODIFIER_MASK)>>D3D10_SB_OPERAND_MODIFIER_SHIFT))
-
-// ENCODER MACRO: Generate a complete source modifier extended token
-// (OperandToken1), given D3D10_SB_OPERAND_MODIFIER enum (the
-// ext. operand type is also set to D3D10_SB_EXTENDED_OPERAND_MODIFIER).
-#define ENCODE_D3D10_SB_EXTENDED_OPERAND_MODIFIER(SourceMod)  ((((SourceMod)<<D3D10_SB_OPERAND_MODIFIER_SHIFT)&D3D10_SB_OPERAND_MODIFIER_MASK)| \
-                                                                ENCODE_D3D10_SB_EXTENDED_OPERAND_TYPE(D3D10_SB_EXTENDED_OPERAND_MODIFIER) | \
-                                                                ENCODE_D3D10_SB_OPERAND_DOUBLE_EXTENDED(0))
-
-// Min precision specifier for source/dest operands.  This 
-// fits in the extended operand token field. Implementations are free to 
-// execute at higher precision than the min - details spec'ed elsewhere.
-// This is part of the opcode specific control range.
-typedef enum D3D11_SB_OPERAND_MIN_PRECISION
-{
-    D3D11_SB_OPERAND_MIN_PRECISION_DEFAULT    = 0, // Default precision 
-                                                       // for the shader model
-    D3D11_SB_OPERAND_MIN_PRECISION_FLOAT_16   = 1, // Min 16 bit/component float
-    D3D11_SB_OPERAND_MIN_PRECISION_FLOAT_2_8  = 2, // Min 10(2.8)bit/comp. float
-    D3D11_SB_OPERAND_MIN_PRECISION_SINT_16    = 4, // Min 16 bit/comp. signed integer
-    D3D11_SB_OPERAND_MIN_PRECISION_UINT_16    = 5, // Min 16 bit/comp. unsigned integer
-} D3D11_SB_OPERAND_MIN_PRECISION;
-#define D3D11_SB_OPERAND_MIN_PRECISION_MASK  0x0001C000
-#define D3D11_SB_OPERAND_MIN_PRECISION_SHIFT 14
-
-// DECODER MACRO: For an OperandToken1 that can specify
-// a minimum precision for execution, find out what it is.
-#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))
-
-// ENCODER MACRO: Encode minimum precision for execution
-// into the extended operand token, OperandToken1
-#define ENCODE_D3D11_SB_OPERAND_MIN_PRECISION(MinPrecision) (((MinPrecision)<< D3D11_SB_OPERAND_MIN_PRECISION_SHIFT)& D3D11_SB_OPERAND_MIN_PRECISION_MASK)
-
-
-// Non-uniform extended operand modifier.
-#define D3D12_SB_OPERAND_NON_UNIFORM_MASK  0x00020000
-#define D3D12_SB_OPERAND_NON_UNIFORM_SHIFT 17
-
-// DECODER MACRO: For an OperandToken1 that can specify a non-uniform operand
-#define DECODE_D3D12_SB_OPERAND_NON_UNIFORM(OperandToken1) (((OperandToken1)& D3D12_SB_OPERAND_NON_UNIFORM_MASK)>> D3D12_SB_OPERAND_NON_UNIFORM_SHIFT)
-
-// ENCODER MACRO: Encode non-uniform state into the extended operand token, OperandToken1
-#define ENCODE_D3D12_SB_OPERAND_NON_UNIFORM(NonUniform) (((NonUniform)<< D3D12_SB_OPERAND_NON_UNIFORM_SHIFT)& D3D12_SB_OPERAND_NON_UNIFORM_MASK)
-
-
-#define D3D10_SB_OPERAND_DOUBLE_EXTENDED_MASK  0x80000000
-#define D3D10_SB_OPERAND_DOUBLE_EXTENDED_SHIFT 31
-// DECODER MACRO: Determine if an extended operand token
-// (OperandToken1) is further extended by yet another token
-// (OperandToken2).  Currently there are no secondary
-// extended operand tokens.
-#define DECODE_IS_D3D10_SB_OPERAND_DOUBLE_EXTENDED(OperandToken1) (((OperandToken1)&D3D10_SB_OPERAND_DOUBLE_EXTENDED_MASK)>>D3D10_SB_OPERAND_DOUBLE_EXTENDED_SHIFT)
-
-// ENCODER MACRO: Store in OperandToken1 whether the operand is extended
-// by an additional operand token.  Currently there are no secondary
-// extended operand tokens.
-#define ENCODE_D3D10_SB_OPERAND_DOUBLE_EXTENDED(bExtended) (((bExtended)!=0)?D3D10_SB_OPERAND_DOUBLE_EXTENDED_MASK:0)
-
-// ----------------------------------------------------------------------------
-// Name Token (NameToken) (used in declaration statements)
-//
-// [15:00] D3D10_SB_NAME enumeration
-// [31:16] Reserved, 0
-//
-// ----------------------------------------------------------------------------
-#define D3D10_SB_NAME_MASK  0x0000ffff
-
-// DECODER MACRO: Get the name from NameToken
-#define DECODE_D3D10_SB_NAME(NameToken) ((D3D10_SB_NAME)((NameToken)&D3D10_SB_NAME_MASK))
-
-// ENCODER MACRO: Generate a complete NameToken given a D3D10_SB_NAME
-#define ENCODE_D3D10_SB_NAME(Name) ((Name)&D3D10_SB_NAME_MASK)
-
-//---------------------------------------------------------------------
-// Declaration Statements
-//
-// Declarations start with a standard opcode token,
-// having opcode type being D3D10_SB_OPCODE_DCL*.
-// Each particular declaration type has custom
-// operand token(s), described below.
-//---------------------------------------------------------------------
-
-// ----------------------------------------------------------------------------
-// Global Flags Declaration
-//
-// OpcodeToken0:
-//
-// [10:00] D3D10_SB_OPCODE_DCL_GLOBAL_FLAGS
-// [11:11] Refactoring allowed if bit set.
-// [12:12] Enable double precision float ops.
-// [13:13] Force early depth-stencil test.
-// [14:14] Enable RAW and structured buffers in non-CS 4.x shaders.
-// [15:15] Skip optimizations of shader IL when translating to native code
-// [16:16] Enable minimum-precision data types
-// [17:17] Enable 11.1 double-precision floating-point instruction extensions
-// [18:18] Enable 11.1 non-double instruction extensions
-// [23:19] Reserved for future flags.
-// [30:24] Instruction length in DWORDs including the opcode token. == 1
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// OpcodeToken0 is followed by no operands.
-//
-// ----------------------------------------------------------------------------
-#define D3D10_SB_GLOBAL_FLAG_REFACTORING_ALLOWED               (1<<11)
-#define D3D11_SB_GLOBAL_FLAG_ENABLE_DOUBLE_PRECISION_FLOAT_OPS (1<<12)
-#define D3D11_SB_GLOBAL_FLAG_FORCE_EARLY_DEPTH_STENCIL         (1<<13)
-#define D3D11_SB_GLOBAL_FLAG_ENABLE_RAW_AND_STRUCTURED_BUFFERS (1<<14)
-#define D3D11_1_SB_GLOBAL_FLAG_SKIP_OPTIMIZATION               (1<<15)
-#define D3D11_1_SB_GLOBAL_FLAG_ENABLE_MINIMUM_PRECISION        (1<<16)
-#define D3D11_1_SB_GLOBAL_FLAG_ENABLE_DOUBLE_EXTENSIONS        (1<<17)
-#define D3D11_1_SB_GLOBAL_FLAG_ENABLE_SHADER_EXTENSIONS        (1<<18)
-#define D3D12_SB_GLOBAL_FLAG_ALL_RESOURCES_BOUND               (1<<19)
-
-#define D3D10_SB_GLOBAL_FLAGS_MASK  0x00fff800
-
-// DECODER MACRO: Get global flags
-#define DECODE_D3D10_SB_GLOBAL_FLAGS(OpcodeToken0) ((OpcodeToken0)&D3D10_SB_GLOBAL_FLAGS_MASK)
-
-// ENCODER MACRO: Encode global flags
-#define ENCODE_D3D10_SB_GLOBAL_FLAGS(Flags) ((Flags)&D3D10_SB_GLOBAL_FLAGS_MASK)
-
-// ----------------------------------------------------------------------------
-// Resource Declaration (non multisampled)
-//
-// OpcodeToken0:
-//
-// [10:00] D3D10_SB_OPCODE_DCL_RESOURCE
-// [15:11] D3D10_SB_RESOURCE_DIMENSION
-// [23:16] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// OpcodeToken0 is followed by 2 operands on Shader Models 4.0 through 5.0:
-// (1) an operand, starting with OperandToken0, defining which
-//     t# register (D3D10_SB_OPERAND_TYPE_RESOURCE) is being declared.
-// (2) a Resource Return Type token (ResourceReturnTypeToken)
-//
-// OpcodeToken0 is followed by 3 operands on Shader Model 5.1 and later:
-// (1) an operand, starting with OperandToken0, defining which
-//     t# register (D3D10_SB_OPERAND_TYPE_RESOURCE) is being declared.
-//     The indexing dimension for the register must be D3D10_SB_OPERAND_INDEX_DIMENSION_3D, 
-//     and the meaning of the index dimensions are as follows: (t<id>[<lbound>:<ubound>])
-//       1 <id>:     variable ID being declared
-//       2 <lbound>: the lower bound of the range of resources in the space
-//       3 <ubound>: the upper bound (inclusive) of this range
-//     As opposed to when the t# is used in shader instructions, where the register
-//     must be D3D10_SB_OPERAND_INDEX_DIMENSION_2D, and the meaning of the index 
-//     dimensions are as follows: (t<id>[<idx>]):
-//       1 <id>:  variable ID being used (matches dcl)
-//       2 <idx>: absolute index of resource within space (may be dynamically indexed)
-// (2) a Resource Return Type token (ResourceReturnTypeToken)
-// (3) a DWORD indicating the space index.
-//
-// ----------------------------------------------------------------------------
-#define D3D10_SB_RESOURCE_DIMENSION_MASK  0x0000F800
-#define D3D10_SB_RESOURCE_DIMENSION_SHIFT 11
-
-// DECODER MACRO: Given a resource declaration token,
-// (OpcodeToken0), determine the resource dimension
-// (D3D10_SB_RESOURCE_DIMENSION enum)
-#define DECODE_D3D10_SB_RESOURCE_DIMENSION(OpcodeToken0) ((D3D10_SB_RESOURCE_DIMENSION)(((OpcodeToken0)&D3D10_SB_RESOURCE_DIMENSION_MASK)>>D3D10_SB_RESOURCE_DIMENSION_SHIFT))
-
-// ENCODER MACRO: Store resource dimension
-// (D3D10_SB_RESOURCE_DIMENSION enum) into a
-// a resource declaration token (OpcodeToken0)
-#define ENCODE_D3D10_SB_RESOURCE_DIMENSION(ResourceDim) (((ResourceDim)<<D3D10_SB_RESOURCE_DIMENSION_SHIFT)&D3D10_SB_RESOURCE_DIMENSION_MASK)
-
-// ----------------------------------------------------------------------------
-// Resource Declaration (multisampled)
-//
-// OpcodeToken0:
-//
-// [10:00] D3D10_SB_OPCODE_DCL_RESOURCE (same opcode as non-multisampled case)
-// [15:11] D3D10_SB_RESOURCE_DIMENSION (must be TEXTURE2DMS or TEXTURE2DMSARRAY)
-// [22:16] Sample count 1...127.  0 is currently disallowed, though
-//         in future versions 0 could mean "configurable" sample count
-// [23:23] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// OpcodeToken0 is followed by 2 operands on Shader Models 4.0 through 5.0:
-// (1) an operand, starting with OperandToken0, defining which
-//     t# register (D3D10_SB_OPERAND_TYPE_RESOURCE) is being declared.
-// (2) a Resource Return Type token (ResourceReturnTypeToken)
-//
-// OpcodeToken0 is followed by 3 operands on Shader Model 5.1 and later:
-// (1) an operand, starting with OperandToken0, defining which
-//     t# register (D3D10_SB_OPERAND_TYPE_RESOURCE) is being declared.
-//     The indexing dimension for the register must be D3D10_SB_OPERAND_INDEX_DIMENSION_3D, 
-//     and the meaning of the index dimensions are as follows: (t<id>[<lbound>:<ubound>])
-//       1 <id>:     variable ID being declared
-//       2 <lbound>: the lower bound of the range of resources in the space
-//       3 <ubound>: the upper bound (inclusive) of this range
-//     As opposed to when the t# is used in shader instructions, where the register
-//     must be D3D10_SB_OPERAND_INDEX_DIMENSION_2D, and the meaning of the index 
-//     dimensions are as follows: (t<id>[<idx>]):
-//       1 <id>:  variable ID being used (matches dcl)
-//       2 <idx>: absolute index of resource within space (may be dynamically indexed)
-// (2) a Resource Return Type token (ResourceReturnTypeToken)
-// (3) a DWORD indicating the space index.
-//
-// ----------------------------------------------------------------------------
-
-// use same macro for encoding/decoding resource dimension aas the non-msaa declaration
-
-#define D3D10_SB_RESOURCE_SAMPLE_COUNT_MASK  0x07F0000
-#define D3D10_SB_RESOURCE_SAMPLE_COUNT_SHIFT 16
-
-// DECODER MACRO: Given a resource declaration token,
-// (OpcodeToken0), determine the resource sample count (1..127)
-#define DECODE_D3D10_SB_RESOURCE_SAMPLE_COUNT(OpcodeToken0) ((UINT)(((OpcodeToken0)&D3D10_SB_RESOURCE_SAMPLE_COUNT_MASK)>>D3D10_SB_RESOURCE_SAMPLE_COUNT_SHIFT))
-
-// ENCODER MACRO: Store resource sample count up to 127 into a
-// a resource declaration token (OpcodeToken0)
-#define ENCODE_D3D10_SB_RESOURCE_SAMPLE_COUNT(SampleCount) (((SampleCount > 127 ? 127 : SampleCount)<<D3D10_SB_RESOURCE_SAMPLE_COUNT_SHIFT)&D3D10_SB_RESOURCE_SAMPLE_COUNT_MASK)
-
-// ----------------------------------------------------------------------------
-// Resource Return Type Token (ResourceReturnTypeToken) (used in resource
-// declaration statements)
-//
-// [03:00] D3D10_SB_RESOURCE_RETURN_TYPE for component X
-// [07:04] D3D10_SB_RESOURCE_RETURN_TYPE for component Y
-// [11:08] D3D10_SB_RESOURCE_RETURN_TYPE for component Z
-// [15:12] D3D10_SB_RESOURCE_RETURN_TYPE for component W
-// [31:16] Reserved, 0
-//
-// ----------------------------------------------------------------------------
-// DECODER MACRO: Get the resource return type for component (0-3) from
-// ResourceReturnTypeToken
-#define DECODE_D3D10_SB_RESOURCE_RETURN_TYPE(ResourceReturnTypeToken, Component) \
-    ((D3D10_SB_RESOURCE_RETURN_TYPE)(((ResourceReturnTypeToken) >> \
-    (Component * D3D10_SB_RESOURCE_RETURN_TYPE_NUMBITS))&D3D10_SB_RESOURCE_RETURN_TYPE_MASK))
-
-// ENCODER MACRO: Generate a resource return type for a component
-#define ENCODE_D3D10_SB_RESOURCE_RETURN_TYPE(ReturnType, Component) \
-    (((ReturnType)&D3D10_SB_RESOURCE_RETURN_TYPE_MASK) << (Component * D3D10_SB_RESOURCE_RETURN_TYPE_NUMBITS))
-
-// ----------------------------------------------------------------------------
-// Sampler Declaration
-//
-// OpcodeToken0:
-//
-// [10:00] D3D10_SB_OPCODE_DCL_SAMPLER
-// [14:11] D3D10_SB_SAMPLER_MODE
-// [23:15] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// OpcodeToken0 is followed by 1 operand on Shader Models 4.0 through 5.0:
-// (1) Operand starting with OperandToken0, defining which sampler
-//     (D3D10_SB_OPERAND_TYPE_SAMPLER) register # is being declared.
-//
-// OpcodeToken0 is followed by 2 operands on Shader Model 5.1 and later:
-// (1) an operand, starting with OperandToken0, defining which
-//     s# register (D3D10_SB_OPERAND_TYPE_SAMPLER) is being declared.
-//     The indexing dimension for the register must be D3D10_SB_OPERAND_INDEX_DIMENSION_3D, 
-//     and the meaning of the index dimensions are as follows: (s<id>[<lbound>:<ubound>])
-//       1 <id>:     variable ID being declared
-//       2 <lbound>: the lower bound of the range of samplers in the space
-//       3 <ubound>: the upper bound (inclusive) of this range
-//     As opposed to when the s# is used in shader instructions, where the register
-//     must be D3D10_SB_OPERAND_INDEX_DIMENSION_2D, and the meaning of the index 
-//     dimensions are as follows: (s<id>[<idx>]):
-//       1 <id>:  variable ID being used (matches dcl)
-//       2 <idx>: absolute index of sampler within space (may be dynamically indexed)
-// (2) a DWORD indicating the space index.
-//
-// ----------------------------------------------------------------------------
-typedef enum D3D10_SB_SAMPLER_MODE
-{
-    D3D10_SB_SAMPLER_MODE_DEFAULT      = 0,
-    D3D10_SB_SAMPLER_MODE_COMPARISON   = 1,
-    D3D10_SB_SAMPLER_MODE_MONO         = 2,
-} D3D10_SB_SAMPLER_MODE;
-
-#define D3D10_SB_SAMPLER_MODE_MASK  0x00007800
-#define D3D10_SB_SAMPLER_MODE_SHIFT 11
-
-// DECODER MACRO: Find out if a Constant Buffer is going to be indexed or not
-#define DECODE_D3D10_SB_SAMPLER_MODE(OpcodeToken0) ((D3D10_SB_SAMPLER_MODE)(((OpcodeToken0)&D3D10_SB_SAMPLER_MODE_MASK)>>D3D10_SB_SAMPLER_MODE_SHIFT))
-
-// ENCODER MACRO: Generate a resource return type for a component
-#define ENCODE_D3D10_SB_SAMPLER_MODE(SamplerMode) (((SamplerMode)<<D3D10_SB_SAMPLER_MODE_SHIFT)&D3D10_SB_SAMPLER_MODE_MASK)
-
-// ----------------------------------------------------------------------------
-// Input Register Declaration (see separate declarations for Pixel Shaders)
-//
-// OpcodeToken0:
-//
-// [10:00] D3D10_SB_OPCODE_DCL_INPUT
-// [23:11] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// OpcodeToken0 is followed by 1 operand:
-// (1) Operand, starting with OperandToken0, defining which input
-//     v# register (D3D10_SB_OPERAND_TYPE_INPUT) is being declared, 
-//     including writemask.
-//
-// ----------------------------------------------------------------------------
-
-// ----------------------------------------------------------------------------
-// Input Register Declaration w/System Interpreted Value
-// (see separate declarations for Pixel Shaders)
-//
-// OpcodeToken0:
-//
-// [10:00] D3D10_SB_OPCODE_DCL_INPUT_SIV
-// [23:11] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// OpcodeToken0 is followed by 2 operands:
-// (1) Operand, starting with OperandToken0, defining which input
-//     v# register (D3D10_SB_OPERAND_TYPE_INPUT) is being declared,
-//     including writemask.  For Geometry Shaders, the input is 
-//     v[vertex][attribute], and this declaration is only for which register 
-//     on the attribute axis is being declared.  The vertex axis value must 
-//     be equal to the # of vertices in the current input primitive for the GS
-//     (i.e. 6 for triangle + adjacency).
-// (2) a System Interpreted Value Name (NameToken)
-//
-// ----------------------------------------------------------------------------
-
-// ----------------------------------------------------------------------------
-// Input Register Declaration w/System Generated Value
-// (available for all shaders incl. Pixel Shader, no interpolation mode needed)
-//
-// OpcodeToken0:
-//
-// [10:00] D3D10_SB_OPCODE_DCL_INPUT_SGV
-// [23:11] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// OpcodeToken0 is followed by 2 operands:
-// (1) Operand, starting with OperandToken0, defining which input
-//     v# register (D3D10_SB_OPERAND_TYPE_INPUT) is being declared,
-//     including writemask.
-// (2) a System Generated Value Name (NameToken)
-//
-// ----------------------------------------------------------------------------
-
-// ----------------------------------------------------------------------------
-// Pixel Shader Input Register Declaration
-//
-// OpcodeToken0:
-//
-// [10:00] D3D10_SB_OPCODE_DCL_INPUT_PS
-// [14:11] D3D10_SB_INTERPOLATION_MODE
-// [23:15] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// OpcodeToken0 is followed by 1 operand:
-// (1) Operand, starting with OperandToken0, defining which input
-//     v# register (D3D10_SB_OPERAND_TYPE_INPUT) is being declared,
-//     including writemask.
-//
-// ----------------------------------------------------------------------------
-#define D3D10_SB_INPUT_INTERPOLATION_MODE_MASK  0x00007800
-#define D3D10_SB_INPUT_INTERPOLATION_MODE_SHIFT 11
-
-// DECODER MACRO: Find out interpolation mode for the input register
-#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))
-
-// ENCODER MACRO: Encode interpolation mode for a register.
-#define ENCODE_D3D10_SB_INPUT_INTERPOLATION_MODE(InterpolationMode) (((InterpolationMode)<<D3D10_SB_INPUT_INTERPOLATION_MODE_SHIFT)&D3D10_SB_INPUT_INTERPOLATION_MODE_MASK)
-
-// ----------------------------------------------------------------------------
-// Pixel Shader Input Register Declaration w/System Interpreted Value
-//
-// OpcodeToken0:
-//
-// [10:00] D3D10_SB_OPCODE_DCL_INPUT_PS_SIV
-// [14:11] D3D10_SB_INTERPOLATION_MODE
-// [23:15] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// OpcodeToken0 is followed by 2 operands:
-// (1) Operand, starting with OperandToken0, defining which input
-//     v# register (D3D10_SB_OPERAND_TYPE_INPUT) is being declared.
-// (2) a System Interpreted Value Name (NameToken)
-//
-// ----------------------------------------------------------------------------
-
-// ----------------------------------------------------------------------------
-// Pixel Shader Input Register Declaration w/System Generated Value
-//
-// OpcodeToken0:
-//
-// [10:00] D3D10_SB_OPCODE_DCL_INPUT_PS_SGV
-// [23:11] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// OpcodeToken0 is followed by 2 operands:
-// (1) Operand, starting with OperandToken0, defining which input
-//     v# register (D3D10_SB_OPERAND_TYPE_INPUT) is being declared.
-// (2) a System Generated Value Name (NameToken)
-//
-// ----------------------------------------------------------------------------
-
-// ----------------------------------------------------------------------------
-// Output Register Declaration
-//
-// OpcodeToken0:
-//
-// [10:00] D3D10_SB_OPCODE_DCL_OUTPUT
-// [23:11] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// OpcodeToken0 is followed by 1 operand:
-// (1) Operand, starting with OperandToken0, defining which
-//     o# register (D3D10_SB_OPERAND_TYPE_OUTPUT) is being declared,
-//     including writemask.
-//     (in Pixel Shader, output can also be one of 
-//     D3D10_SB_OPERAND_TYPE_OUTPUT_DEPTH,
-//     D3D11_SB_OPERAND_TYPE_OUTPUT_DEPTH_GREATER_EQUAL, or
-//     D3D11_SB_OPERAND_TYPE_OUTPUT_DEPTH_LESS_EQUAL )
-//
-// ----------------------------------------------------------------------------
-
-// ----------------------------------------------------------------------------
-// Output Register Declaration w/System Interpreted Value
-//
-// OpcodeToken0:
-//
-// [10:00] D3D10_SB_OPCODE_DCL_OUTPUT_SIV
-// [23:11] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// OpcodeToken0 is followed by 2 operands:
-// (1) an operand, starting with OperandToken0, defining which
-//     o# register (D3D10_SB_OPERAND_TYPE_OUTPUT) is being declared,
-//     including writemask.
-// (2) a System Interpreted Name token (NameToken)
-//
-// ----------------------------------------------------------------------------
-
-// ----------------------------------------------------------------------------
-// Output Register Declaration w/System Generated Value
-//
-// OpcodeToken0:
-//
-// [10:00] D3D10_SB_OPCODE_DCL_OUTPUT_SGV
-// [23:11] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// OpcodeToken0 is followed by 2 operands:
-// (1) an operand, starting with OperandToken0, defining which
-//     o# register (D3D10_SB_OPERAND_TYPE_OUTPUT) is being declared,
-//     including writemask.
-// (2) a System Generated Name token (NameToken)
-//
-// ----------------------------------------------------------------------------
-
-
-// ----------------------------------------------------------------------------
-// Input or Output Register Indexing Range Declaration
-//
-// OpcodeToken0:
-//
-// [10:00] D3D10_SB_OPCODE_DCL_INDEX_RANGE
-// [23:11] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// OpcodeToken0 is followed by 2 operands:
-// (1) an operand, starting with OperandToken0, defining which
-//     input (v#) or output (o#) register is having its array indexing range
-//     declared, including writemask.  For Geometry Shader inputs, 
-//     it is assumed that the vertex axis is always fully indexable,
-//     and 0 must be specified as the vertex# in this declaration, so that 
-//     only the a range of attributes are having their index range defined.
-//     
-// (2) a DWORD representing the count of registers starting from the one
-//     indicated in (1).
-//
-// ----------------------------------------------------------------------------
-
-// ----------------------------------------------------------------------------
-// Temp Register Declaration r0...r(n-1) 
-//
-// OpcodeToken0:
-//
-// [10:00] D3D10_SB_OPCODE_DCL_TEMPS
-// [23:11] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// OpcodeToken0 is followed by 1 operand:
-// (1) DWORD (unsigned int) indicating how many temps are being declared.  
-//     i.e. 5 means r0...r4 are declared.
-//
-// ----------------------------------------------------------------------------
-
-// ----------------------------------------------------------------------------
-// Indexable Temp Register (x#[size]) Declaration
-//
-// OpcodeToken0:
-//
-// [10:00] D3D10_SB_OPCODE_DCL_INDEXABLE_TEMP
-// [23:11] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// OpcodeToken0 is followed by 3 DWORDs:
-// (1) Register index (defines which x# register is declared)
-// (2) Number of registers in this register bank
-// (3) Number of components in the array (1-4). 1 means .x, 2 means .xy etc.
-//
-// ----------------------------------------------------------------------------
-
-// ----------------------------------------------------------------------------
-// Constant Buffer Declaration
-//
-// OpcodeToken0:
-//
-// [10:00] D3D10_SB_OPCODE_DCL_CONSTANT_BUFFER
-// [11]    D3D10_SB_CONSTANT_BUFFER_ACCESS_PATTERN
-// [23:12] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// OpcodeToken0 is followed by 1 operand on Shader Model 4.0 through 5.0:
-// (1) Operand, starting with OperandToken0, defining which CB slot (cb#[size])
-//     is being declared. (operand type: D3D10_SB_OPERAND_TYPE_CONSTANT_BUFFER)
-//     The indexing dimension for the register must be 
-//     D3D10_SB_OPERAND_INDEX_DIMENSION_2D, where the first index specifies
-//     which cb#[] is being declared, and the second (array) index specifies the size 
-//     of the buffer, as a count of 32-bit*4 elements.  (As opposed to when the 
-//     cb#[] is used in shader instructions, and the array index represents which 
-//     location in the constant buffer is being referenced.)
-//     If the size is specified as 0, the CB size is not known (any size CB
-//     can be bound to the slot).
-//
-// The order of constant buffer declarations in a shader indicates their
-// relative priority from highest to lowest (hint to driver).
-// 
-// OpcodeToken0 is followed by 3 operands on Shader Model 5.1 and later:
-// (1) Operand, starting with OperandToken0, defining which CB range (ID and bounds)
-//     is being declared. (operand type: D3D10_SB_OPERAND_TYPE_CONSTANT_BUFFER)
-//     The indexing dimension for the register must be D3D10_SB_OPERAND_INDEX_DIMENSION_3D, 
-//     and the meaning of the index dimensions are as follows: (cb<id>[<lbound>:<ubound>])
-//       1 <id>:     variable ID being declared
-//       2 <lbound>: the lower bound of the range of constant buffers in the space
-//       3 <ubound>: the upper bound (inclusive) of this range
-//     As opposed to when the cb#[] is used in shader instructions: (cb<id>[<idx>][<loc>])
-//       1 <id>:  variable ID being used (matches dcl)
-//       2 <idx>: absolute index of constant buffer within space (may be dynamically indexed)
-//       3 <loc>: location of vector within constant buffer being referenced,
-//          which may also be dynamically indexed, with no access pattern flag required.
-// (2) a DWORD indicating the size of the constant buffer as a count of 16-byte vectors.
-//     Each vector is 32-bit*4 elements == 128-bits == 16 bytes.
-//     If the size is specified as 0, the CB size is not known (any size CB
-//     can be bound to the slot).
-// (3) a DWORD indicating the space index.
-//
-// ----------------------------------------------------------------------------
-
-typedef enum D3D10_SB_CONSTANT_BUFFER_ACCESS_PATTERN
-{
-    D3D10_SB_CONSTANT_BUFFER_IMMEDIATE_INDEXED  = 0,
-    D3D10_SB_CONSTANT_BUFFER_DYNAMIC_INDEXED    = 1
-} D3D10_SB_CONSTANT_BUFFER_ACCESS_PATTERN;
-
-#define D3D10_SB_CONSTANT_BUFFER_ACCESS_PATTERN_MASK  0x00000800
-#define D3D10_SB_CONSTANT_BUFFER_ACCESS_PATTERN_SHIFT 11
-
-// DECODER MACRO: Find out if a Constant Buffer is going to be indexed or not
-#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))
-
-// ENCODER MACRO: Encode the access pattern for the Constant Buffer
-#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)
-
-// ----------------------------------------------------------------------------
-// Immediate Constant Buffer Declaration
-//
-// OpcodeToken0:
-//
-// [10:00] D3D10_SB_OPCODE_CUSTOMDATA
-// [31:11] == D3D10_SB_CUSTOMDATA_DCL_IMMEDIATE_CONSTANT_BUFFER
-//
-// OpcodeToken0 is followed by:
-// (1) DWORD indicating length of declaration, including OpcodeToken0.
-//     This length must = 2(for OpcodeToken0 and 1) + a multiple of 4 
-//                                                    (# of immediate constants)
-// (2) Sequence of 4-tuples of DWORDs defining the Immediate Constant Buffer.
-//     The number of 4-tuples is (length above - 1) / 4
-// ----------------------------------------------------------------------------
-
-// ----------------------------------------------------------------------------
-// Shader Message Declaration
-//
-// OpcodeToken0:
-//
-// [10:00] D3D10_SB_OPCODE_CUSTOMDATA
-// [31:11] == D3D11_SB_CUSTOMDATA_SHADER_MESSAGE
-//
-// OpcodeToken0 is followed by:
-// (1) DWORD indicating length of declaration, including OpcodeToken0.
-// (2) DWORD (D3D11_SB_SHADER_MESSAGE_ID) indicating shader message or error.
-// (3) D3D11_SB_SHADER_MESSAGE_FORMAT indicating the convention for formatting the message.
-// (4) DWORD indicating the number of characters in the string without the terminator.
-// (5) DWORD indicating the number of operands.
-// (6) DWORD indicating length of operands.
-// (7) Encoded operands.
-// (8) String with trailing zero, padded to a multiple of DWORDs.
-//     The string is in the given format and the operands given should
-//     be used for argument substitutions when formatting.
-// ----------------------------------------------------------------------------
-
-typedef enum D3D11_SB_SHADER_MESSAGE_ID
-{
-    D3D11_SB_SHADER_MESSAGE_ID_MESSAGE = 0x00200102,
-    D3D11_SB_SHADER_MESSAGE_ID_ERROR = 0x00200103
-} D3D11_SB_SHADER_MESSAGE_ID;
-
-typedef enum D3D11_SB_SHADER_MESSAGE_FORMAT
-{
-    // No formatting, just a text string.  Operands are ignored.
-    D3D11_SB_SHADER_MESSAGE_FORMAT_ANSI_TEXT,
-    // Format string follows C/C++ printf conventions.
-    D3D11_SB_SHADER_MESSAGE_FORMAT_ANSI_PRINTF,
-} D3D11_SB_SHADER_MESSAGE_FORMAT;
-
-// ----------------------------------------------------------------------------
-// Shader Clip Plane Constant Mappings for DX9 hardware
-//
-// OpcodeToken0:
-//
-// [10:00] D3D10_SB_OPCODE_CUSTOMDATA
-// [31:11] == D3D11_SB_CUSTOMDATA_SHADER_CLIP_PLANE_CONSTANT_MAPPINGS_FOR_DX9
-//
-// OpcodeToken0 is followed by:
-// (1) DWORD indicating length of declaration, including OpcodeToken0.
-// (2) DWORD indicating number of constant mappings (up to 6 mappings).
-// (3+) Constant mapping tables in following format.
-//
-// struct _Clip_Plane_Constant_Mapping
-// {
-//     WORD ConstantBufferIndex;  // cb[n]
-//     WORD StartConstantElement; // starting index of cb[n][m]
-//     WORD ConstantElemntCount;  // number of elements cb[n][m] ~ cb[n][m+l]
-//     WORD Reserved;             //
-// };
-// ----------------------------------------------------------------------------
-
-// ----------------------------------------------------------------------------
-// Geometry Shader Input Primitive Declaration
-//
-// OpcodeToken0:
-//
-// [10:00] D3D10_SB_OPCODE_DCL_GS_INPUT_PRIMITIVE
-// [16:11] D3D10_SB_PRIMITIVE [not D3D10_SB_PRIMITIVE_TOPOLOGY]
-// [23:17] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token. == 1
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// ----------------------------------------------------------------------------
-
-#define D3D10_SB_GS_INPUT_PRIMITIVE_MASK  0x0001f800
-#define D3D10_SB_GS_INPUT_PRIMITIVE_SHIFT 11
-
-// DECODER MACRO: Given a primitive topology declaration,
-// (OpcodeToken0), determine the primitive topology
-// (D3D10_SB_PRIMITIVE enum)
-#define DECODE_D3D10_SB_GS_INPUT_PRIMITIVE(OpcodeToken0) ((D3D10_SB_PRIMITIVE)(((OpcodeToken0)&D3D10_SB_GS_INPUT_PRIMITIVE_MASK)>>D3D10_SB_GS_INPUT_PRIMITIVE_SHIFT))
-
-// ENCODER MACRO: Store primitive topology
-// (D3D10_SB_PRIMITIVE enum) into a
-// a primitive topology declaration token (OpcodeToken0)
-#define ENCODE_D3D10_SB_GS_INPUT_PRIMITIVE(Prim) (((Prim)<<D3D10_SB_GS_INPUT_PRIMITIVE_SHIFT)&D3D10_SB_GS_INPUT_PRIMITIVE_MASK)
-
-// ----------------------------------------------------------------------------
-// Geometry Shader Output Topology Declaration
-//
-// OpcodeToken0:
-//
-// [10:00] D3D10_SB_OPCODE_DCL_GS_OUTPUT_PRIMITIVE_TOPOLOGY
-// [17:11] D3D10_SB_PRIMITIVE_TOPOLOGY
-// [23:18] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token. == 1
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// ----------------------------------------------------------------------------
-
-#define D3D10_SB_GS_OUTPUT_PRIMITIVE_TOPOLOGY_MASK  0x0001f800
-#define D3D10_SB_GS_OUTPUT_PRIMITIVE_TOPOLOGY_SHIFT 11
-
-// DECODER MACRO: Given a primitive topology declaration,
-// (OpcodeToken0), determine the primitive topology
-// (D3D10_SB_PRIMITIVE_TOPOLOGY enum)
-#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))
-
-// ENCODER MACRO: Store primitive topology
-// (D3D10_SB_PRIMITIVE_TOPOLOGY enum) into a
-// a primitive topology declaration token (OpcodeToken0)
-#define ENCODE_D3D10_SB_GS_OUTPUT_PRIMITIVE_TOPOLOGY(PrimTopology) (((PrimTopology)<<D3D10_SB_GS_OUTPUT_PRIMITIVE_TOPOLOGY_SHIFT)&D3D10_SB_GS_OUTPUT_PRIMITIVE_TOPOLOGY_MASK)
-
-// ----------------------------------------------------------------------------
-// Geometry Shader Maximum Output Vertex Count Declaration
-//
-// OpcodeToken0:
-//
-// [10:00] D3D10_SB_OPCODE_DCL_MAX_OUTPUT_VERTEX_COUNT
-// [23:11] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// OpcodeToken0 is followed by a DWORD representing the
-// maximum number of primitives that could be output
-// by the Geometry Shader.
-//
-// ----------------------------------------------------------------------------
-
-// ----------------------------------------------------------------------------
-// Geometry Shader Instance Count Declaration
-//
-// OpcodeToken0:
-//
-// [10:00] D3D11_SB_OPCODE_DCL_GS_INSTANCE_COUNT
-// [23:11] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// OpcodeToken0 is followed by a UINT32 representing the
-// number of instances of the geometry shader program to execute.
-//
-// ----------------------------------------------------------------------------
-
-// ----------------------------------------------------------------------------
-// Hull Shader Declaration Phase: HS/DS Input Control Point Count
-//
-// OpcodeToken0:
-//
-// [10:00] D3D11_SB_OPCODE_DCL_INPUT_CONTROL_POINT_COUNT
-// [16:11] Control point count 
-// [23:17] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token. == 1
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// ----------------------------------------------------------------------------
-#define D3D11_SB_INPUT_CONTROL_POINT_COUNT_MASK  0x0001f800
-#define D3D11_SB_INPUT_CONTROL_POINT_COUNT_SHIFT 11
-
-// DECODER MACRO: Given an input control point count declaration token,
-// (OpcodeToken0), determine the control point count
-#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))
-
-// ENCODER MACRO: Store input control point count into a declaration token
-#define ENCODE_D3D11_SB_INPUT_CONTROL_POINT_COUNT(Count) (((Count)<<D3D11_SB_INPUT_CONTROL_POINT_COUNT_SHIFT)&D3D11_SB_INPUT_CONTROL_POINT_COUNT_MASK)
-
-// ----------------------------------------------------------------------------
-// Hull Shader Declaration Phase: HS Output Control Point Count
-//
-// OpcodeToken0:
-//
-// [10:00] D3D11_SB_OPCODE_DCL_OUTPUT_CONTROL_POINT_COUNT
-// [16:11] Control point count 
-// [23:17] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token. == 1
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// ----------------------------------------------------------------------------
-#define D3D11_SB_OUTPUT_CONTROL_POINT_COUNT_MASK  0x0001f800
-#define D3D11_SB_OUTPUT_CONTROL_POINT_COUNT_SHIFT 11
-
-// DECODER MACRO: Given an output control point count declaration token,
-// (OpcodeToken0), determine the control point count
-#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))
-
-// ENCODER MACRO: Store output control point count into a declaration token
-#define ENCODE_D3D11_SB_OUTPUT_CONTROL_POINT_COUNT(Count) (((Count)<<D3D11_SB_OUTPUT_CONTROL_POINT_COUNT_SHIFT)&D3D11_SB_OUTPUT_CONTROL_POINT_COUNT_MASK)
-
-// ----------------------------------------------------------------------------
-// Hull Shader Declaration Phase: Tessellator Domain
-//
-// OpcodeToken0:
-//
-// [10:00] D3D11_SB_OPCODE_DCL_TESS_DOMAIN
-// [12:11] Domain
-// [23:13] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token. == 1
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// ----------------------------------------------------------------------------
-typedef enum D3D11_SB_TESSELLATOR_DOMAIN
-{
-    D3D11_SB_TESSELLATOR_DOMAIN_UNDEFINED = 0,
-    D3D11_SB_TESSELLATOR_DOMAIN_ISOLINE   = 1,
-    D3D11_SB_TESSELLATOR_DOMAIN_TRI       = 2,
-    D3D11_SB_TESSELLATOR_DOMAIN_QUAD      = 3
-} D3D11_SB_TESSELLATOR_DOMAIN;
-
-#define D3D11_SB_TESS_DOMAIN_MASK  0x00001800
-#define D3D11_SB_TESS_DOMAIN_SHIFT 11
-
-// DECODER MACRO: Given a tessellator domain declaration,
-// (OpcodeToken0), determine the domain
-// (D3D11_SB_TESSELLATOR_DOMAIN enum)
-#define DECODE_D3D11_SB_TESS_DOMAIN(OpcodeToken0) ((D3D11_SB_TESSELLATOR_DOMAIN)(((OpcodeToken0)&D3D11_SB_TESS_DOMAIN_MASK)>>D3D11_SB_TESS_DOMAIN_SHIFT))
-
-// ENCODER MACRO: Store tessellator domain
-// (D3D11_SB_TESSELLATOR_DOMAIN enum) into a
-// a tessellator domain declaration token (OpcodeToken0)
-#define ENCODE_D3D11_SB_TESS_DOMAIN(Domain) (((Domain)<<D3D11_SB_TESS_DOMAIN_SHIFT)&D3D11_SB_TESS_DOMAIN_MASK)
-
-// ----------------------------------------------------------------------------
-// Hull Shader Declaration Phase: Tessellator Partitioning
-//
-// OpcodeToken0:
-//
-// [10:00] D3D11_SB_OPCODE_DCL_TESS_PARTITIONING
-// [13:11] Partitioning
-// [23:14] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token. == 1
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// ----------------------------------------------------------------------------
-typedef enum D3D11_SB_TESSELLATOR_PARTITIONING
-{
-    D3D11_SB_TESSELLATOR_PARTITIONING_UNDEFINED       = 0,
-    D3D11_SB_TESSELLATOR_PARTITIONING_INTEGER         = 1,
-    D3D11_SB_TESSELLATOR_PARTITIONING_POW2            = 2,
-    D3D11_SB_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD  = 3,
-    D3D11_SB_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN = 4
-} D3D11_SB_TESSELLATOR_PARTITIONING;
-
-#define D3D11_SB_TESS_PARTITIONING_MASK  0x00003800
-#define D3D11_SB_TESS_PARTITIONING_SHIFT 11
-
-// DECODER MACRO: Given a tessellator partitioning declaration,
-// (OpcodeToken0), determine the domain
-// (D3D11_SB_TESSELLATOR_PARTITIONING enum)
-#define DECODE_D3D11_SB_TESS_PARTITIONING(OpcodeToken0) ((D3D11_SB_TESSELLATOR_PARTITIONING)(((OpcodeToken0)&D3D11_SB_TESS_PARTITIONING_MASK)>>D3D11_SB_TESS_PARTITIONING_SHIFT))
-
-// ENCODER MACRO: Store tessellator partitioning
-// (D3D11_SB_TESSELLATOR_PARTITIONING enum) into a
-// a tessellator partitioning declaration token (OpcodeToken0)
-#define ENCODE_D3D11_SB_TESS_PARTITIONING(Partitioning) (((Partitioning)<<D3D11_SB_TESS_PARTITIONING_SHIFT)&D3D11_SB_TESS_PARTITIONING_MASK)
-
-// ----------------------------------------------------------------------------
-// Hull Shader Declaration Phase: Tessellator Output Primitive
-//
-// OpcodeToken0:
-//
-// [10:00] D3D11_SB_OPCODE_DCL_TESS_OUTPUT_PRIMITIVE
-// [13:11] Output Primitive
-// [23:14] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token. == 1
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// ----------------------------------------------------------------------------
-typedef enum D3D11_SB_TESSELLATOR_OUTPUT_PRIMITIVE
-{
-    D3D11_SB_TESSELLATOR_OUTPUT_UNDEFINED     = 0,
-    D3D11_SB_TESSELLATOR_OUTPUT_POINT         = 1,
-    D3D11_SB_TESSELLATOR_OUTPUT_LINE          = 2,
-    D3D11_SB_TESSELLATOR_OUTPUT_TRIANGLE_CW   = 3,
-    D3D11_SB_TESSELLATOR_OUTPUT_TRIANGLE_CCW  = 4
-} D3D11_SB_TESSELLATOR_OUTPUT_PRIMITIVE;
-
-#define D3D11_SB_TESS_OUTPUT_PRIMITIVE_MASK  0x00003800
-#define D3D11_SB_TESS_OUTPUT_PRIMITIVE_SHIFT 11
-
-// DECODER MACRO: Given a tessellator output primitive declaration,
-// (OpcodeToken0), determine the domain
-// (D3D11_SB_TESSELLATOR_OUTPUT_PRIMITIVE enum)
-#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))
-
-// ENCODER MACRO: Store tessellator output primitive
-// (D3D11_SB_TESSELLATOR_OUTPUT_PRIMITIVE enum) into a
-// a tessellator output primitive declaration token (OpcodeToken0)
-#define ENCODE_D3D11_SB_TESS_OUTPUT_PRIMITIVE(OutputPrimitive) (((OutputPrimitive)<<D3D11_SB_TESS_OUTPUT_PRIMITIVE_SHIFT)&D3D11_SB_TESS_OUTPUT_PRIMITIVE_MASK)
-
-
-// ----------------------------------------------------------------------------
-// Hull Shader Declaration Phase: Hull Shader Max Tessfactor
-//
-// OpcodeToken0:
-//
-// [10:00] D3D11_SB_OPCODE_DCL_HS_MAX_TESSFACTOR
-// [23:11] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// OpcodeToken0 is followed by a float32 representing the
-// maximum TessFactor.
-//
-// ----------------------------------------------------------------------------
-
-// ----------------------------------------------------------------------------
-// Hull Shader Declaration Phase: Hull Shader Fork Phase Instance Count
-//
-// OpcodeToken0:
-//
-// [10:00] D3D11_SB_OPCODE_DCL_HS_FORK_PHASE_INSTANCE_COUNT
-// [23:11] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// OpcodeToken0 is followed by a UINT32 representing the
-// number of instances of the current fork phase program to execute.
-//
-// ----------------------------------------------------------------------------
-
-typedef enum D3D10_SB_INTERPOLATION_MODE
-{
-    D3D10_SB_INTERPOLATION_UNDEFINED = 0,
-    D3D10_SB_INTERPOLATION_CONSTANT = 1,
-    D3D10_SB_INTERPOLATION_LINEAR = 2,
-    D3D10_SB_INTERPOLATION_LINEAR_CENTROID = 3,
-    D3D10_SB_INTERPOLATION_LINEAR_NOPERSPECTIVE = 4,
-    D3D10_SB_INTERPOLATION_LINEAR_NOPERSPECTIVE_CENTROID = 5,
-    D3D10_SB_INTERPOLATION_LINEAR_SAMPLE = 6, // DX10.1
-    D3D10_SB_INTERPOLATION_LINEAR_NOPERSPECTIVE_SAMPLE = 7, // DX10.1
-} D3D10_SB_INTERPOLATION_MODE;
-
-// Keep PRIMITIVE_TOPOLOGY values in sync with earlier DX versions (HW consumes values directly).
-typedef enum D3D10_SB_PRIMITIVE_TOPOLOGY
-{
-    D3D10_SB_PRIMITIVE_TOPOLOGY_UNDEFINED = 0,
-    D3D10_SB_PRIMITIVE_TOPOLOGY_POINTLIST = 1,
-    D3D10_SB_PRIMITIVE_TOPOLOGY_LINELIST = 2,
-    D3D10_SB_PRIMITIVE_TOPOLOGY_LINESTRIP = 3,
-    D3D10_SB_PRIMITIVE_TOPOLOGY_TRIANGLELIST = 4,
-    D3D10_SB_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = 5,
-    // 6 is reserved for legacy triangle fans
-    // Adjacency values should be equal to (0x8 & non-adjacency):
-    D3D10_SB_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = 10,
-    D3D10_SB_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = 11,
-    D3D10_SB_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = 12,
-    D3D10_SB_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = 13,
-} D3D10_SB_PRIMITIVE_TOPOLOGY;
-
-typedef enum D3D10_SB_PRIMITIVE
-{
-    D3D10_SB_PRIMITIVE_UNDEFINED = 0,
-    D3D10_SB_PRIMITIVE_POINT = 1,
-    D3D10_SB_PRIMITIVE_LINE = 2,
-    D3D10_SB_PRIMITIVE_TRIANGLE = 3,
-    // Adjacency values should be equal to (0x4 & non-adjacency):
-    D3D10_SB_PRIMITIVE_LINE_ADJ = 6,
-    D3D10_SB_PRIMITIVE_TRIANGLE_ADJ = 7,
-    D3D11_SB_PRIMITIVE_1_CONTROL_POINT_PATCH = 8,
-    D3D11_SB_PRIMITIVE_2_CONTROL_POINT_PATCH = 9,
-    D3D11_SB_PRIMITIVE_3_CONTROL_POINT_PATCH = 10,
-    D3D11_SB_PRIMITIVE_4_CONTROL_POINT_PATCH = 11,
-    D3D11_SB_PRIMITIVE_5_CONTROL_POINT_PATCH = 12,
-    D3D11_SB_PRIMITIVE_6_CONTROL_POINT_PATCH = 13,
-    D3D11_SB_PRIMITIVE_7_CONTROL_POINT_PATCH = 14,
-    D3D11_SB_PRIMITIVE_8_CONTROL_POINT_PATCH = 15,
-    D3D11_SB_PRIMITIVE_9_CONTROL_POINT_PATCH = 16,
-    D3D11_SB_PRIMITIVE_10_CONTROL_POINT_PATCH = 17,
-    D3D11_SB_PRIMITIVE_11_CONTROL_POINT_PATCH = 18,
-    D3D11_SB_PRIMITIVE_12_CONTROL_POINT_PATCH = 19,
-    D3D11_SB_PRIMITIVE_13_CONTROL_POINT_PATCH = 20,
-    D3D11_SB_PRIMITIVE_14_CONTROL_POINT_PATCH = 21,
-    D3D11_SB_PRIMITIVE_15_CONTROL_POINT_PATCH = 22,
-    D3D11_SB_PRIMITIVE_16_CONTROL_POINT_PATCH = 23,
-    D3D11_SB_PRIMITIVE_17_CONTROL_POINT_PATCH = 24,
-    D3D11_SB_PRIMITIVE_18_CONTROL_POINT_PATCH = 25,
-    D3D11_SB_PRIMITIVE_19_CONTROL_POINT_PATCH = 26,
-    D3D11_SB_PRIMITIVE_20_CONTROL_POINT_PATCH = 27,
-    D3D11_SB_PRIMITIVE_21_CONTROL_POINT_PATCH = 28,
-    D3D11_SB_PRIMITIVE_22_CONTROL_POINT_PATCH = 29,
-    D3D11_SB_PRIMITIVE_23_CONTROL_POINT_PATCH = 30,
-    D3D11_SB_PRIMITIVE_24_CONTROL_POINT_PATCH = 31,
-    D3D11_SB_PRIMITIVE_25_CONTROL_POINT_PATCH = 32,
-    D3D11_SB_PRIMITIVE_26_CONTROL_POINT_PATCH = 33,
-    D3D11_SB_PRIMITIVE_27_CONTROL_POINT_PATCH = 34,
-    D3D11_SB_PRIMITIVE_28_CONTROL_POINT_PATCH = 35,
-    D3D11_SB_PRIMITIVE_29_CONTROL_POINT_PATCH = 36,
-    D3D11_SB_PRIMITIVE_30_CONTROL_POINT_PATCH = 37,
-    D3D11_SB_PRIMITIVE_31_CONTROL_POINT_PATCH = 38,
-    D3D11_SB_PRIMITIVE_32_CONTROL_POINT_PATCH = 39,
-} D3D10_SB_PRIMITIVE;
-
-typedef enum D3D10_SB_COMPONENT_MASK
-{
-    D3D10_SB_COMPONENT_MASK_X = 1,
-    D3D10_SB_COMPONENT_MASK_Y = 2,
-    D3D10_SB_COMPONENT_MASK_Z = 4,
-    D3D10_SB_COMPONENT_MASK_W = 8,
-    D3D10_SB_COMPONENT_MASK_R = 1,
-    D3D10_SB_COMPONENT_MASK_G = 2,
-    D3D10_SB_COMPONENT_MASK_B = 4,
-    D3D10_SB_COMPONENT_MASK_A = 8,
-    D3D10_SB_COMPONENT_MASK_ALL = 15,
-} D3D10_SB_COMPONENT_MASK;
-
-typedef enum D3D10_SB_NAME
-{
-    D3D10_SB_NAME_UNDEFINED = 0,
-    D3D10_SB_NAME_POSITION = 1,
-    D3D10_SB_NAME_CLIP_DISTANCE = 2,
-    D3D10_SB_NAME_CULL_DISTANCE = 3,
-    D3D10_SB_NAME_RENDER_TARGET_ARRAY_INDEX = 4,
-    D3D10_SB_NAME_VIEWPORT_ARRAY_INDEX = 5,
-    D3D10_SB_NAME_VERTEX_ID = 6,
-    D3D10_SB_NAME_PRIMITIVE_ID = 7,
-    D3D10_SB_NAME_INSTANCE_ID = 8,
-    D3D10_SB_NAME_IS_FRONT_FACE = 9,
-    D3D10_SB_NAME_SAMPLE_INDEX = 10,
-    // The following are added for D3D11
-    D3D11_SB_NAME_FINAL_QUAD_U_EQ_0_EDGE_TESSFACTOR = 11, 
-    D3D11_SB_NAME_FINAL_QUAD_V_EQ_0_EDGE_TESSFACTOR = 12, 
-    D3D11_SB_NAME_FINAL_QUAD_U_EQ_1_EDGE_TESSFACTOR = 13, 
-    D3D11_SB_NAME_FINAL_QUAD_V_EQ_1_EDGE_TESSFACTOR = 14, 
-    D3D11_SB_NAME_FINAL_QUAD_U_INSIDE_TESSFACTOR = 15, 
-    D3D11_SB_NAME_FINAL_QUAD_V_INSIDE_TESSFACTOR = 16, 
-    D3D11_SB_NAME_FINAL_TRI_U_EQ_0_EDGE_TESSFACTOR = 17, 
-    D3D11_SB_NAME_FINAL_TRI_V_EQ_0_EDGE_TESSFACTOR = 18, 
-    D3D11_SB_NAME_FINAL_TRI_W_EQ_0_EDGE_TESSFACTOR = 19, 
-    D3D11_SB_NAME_FINAL_TRI_INSIDE_TESSFACTOR = 20, 
-    D3D11_SB_NAME_FINAL_LINE_DETAIL_TESSFACTOR = 21,
-    D3D11_SB_NAME_FINAL_LINE_DENSITY_TESSFACTOR = 22,
-    // The following are added for D3D12
-    D3D12_SB_NAME_BARYCENTRICS = 23,
-    D3D12_SB_NAME_SHADINGRATE = 24,
-    D3D12_SB_NAME_CULLPRIMITIVE = 25,
-} D3D10_SB_NAME;
-
-typedef enum D3D10_SB_RESOURCE_DIMENSION
-{
-    D3D10_SB_RESOURCE_DIMENSION_UNKNOWN = 0,
-    D3D10_SB_RESOURCE_DIMENSION_BUFFER = 1,
-    D3D10_SB_RESOURCE_DIMENSION_TEXTURE1D = 2,
-    D3D10_SB_RESOURCE_DIMENSION_TEXTURE2D = 3,
-    D3D10_SB_RESOURCE_DIMENSION_TEXTURE2DMS = 4,
-    D3D10_SB_RESOURCE_DIMENSION_TEXTURE3D = 5,
-    D3D10_SB_RESOURCE_DIMENSION_TEXTURECUBE = 6,
-    D3D10_SB_RESOURCE_DIMENSION_TEXTURE1DARRAY = 7,
-    D3D10_SB_RESOURCE_DIMENSION_TEXTURE2DARRAY = 8,
-    D3D10_SB_RESOURCE_DIMENSION_TEXTURE2DMSARRAY = 9,
-    D3D10_SB_RESOURCE_DIMENSION_TEXTURECUBEARRAY = 10,
-    D3D11_SB_RESOURCE_DIMENSION_RAW_BUFFER = 11,
-    D3D11_SB_RESOURCE_DIMENSION_STRUCTURED_BUFFER = 12,
-} D3D10_SB_RESOURCE_DIMENSION;
-
-typedef enum D3D10_SB_RESOURCE_RETURN_TYPE
-{
-    D3D10_SB_RETURN_TYPE_UNORM = 1,
-    D3D10_SB_RETURN_TYPE_SNORM = 2,
-    D3D10_SB_RETURN_TYPE_SINT = 3,
-    D3D10_SB_RETURN_TYPE_UINT = 4,
-    D3D10_SB_RETURN_TYPE_FLOAT = 5,
-    D3D10_SB_RETURN_TYPE_MIXED = 6,
-    D3D11_SB_RETURN_TYPE_DOUBLE = 7,
-    D3D11_SB_RETURN_TYPE_CONTINUED = 8,
-    D3D11_SB_RETURN_TYPE_UNUSED = 9,
-} D3D10_SB_RESOURCE_RETURN_TYPE;
-
-typedef enum D3D10_SB_REGISTER_COMPONENT_TYPE
-{
-    D3D10_SB_REGISTER_COMPONENT_UNKNOWN = 0,
-    D3D10_SB_REGISTER_COMPONENT_UINT32 = 1,
-    D3D10_SB_REGISTER_COMPONENT_SINT32 = 2,
-    D3D10_SB_REGISTER_COMPONENT_FLOAT32 = 3
-} D3D10_SB_REGISTER_COMPONENT_TYPE;
-
-typedef enum D3D10_SB_INSTRUCTION_RETURN_TYPE
-{
-    D3D10_SB_INSTRUCTION_RETURN_FLOAT      = 0,
-    D3D10_SB_INSTRUCTION_RETURN_UINT       = 1
-} D3D10_SB_INSTRUCTION_RETURN_TYPE;
-
-#define D3D10_SB_INSTRUCTION_RETURN_TYPE_MASK  0x00001800
-#define D3D10_SB_INSTRUCTION_RETURN_TYPE_SHIFT 11
-
-// DECODER MACRO: For an OpcodeToken0 with the return type 
-// determine the return type.
-#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))
-// ENCODER MACRO: Encode the return type for instructions
-// in the opcode specific control range of OpcodeToken0
-#define ENCODE_D3D10_SB_INSTRUCTION_RETURN_TYPE(ReturnType) (((ReturnType)<<D3D10_SB_INSTRUCTION_RETURN_TYPE_SHIFT)&D3D10_SB_INSTRUCTION_RETURN_TYPE_MASK)
-
-// ----------------------------------------------------------------------------
-// Interface function body Declaration
-//
-// OpcodeToken0:
-//
-// [10:00] D3D10_SB_OPCODE_DCL_FUNCTION_BODY
-// [23:11] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  If it is extended, then
-//         it contains the actual instruction length in DWORDs, since
-//         it may not fit into 7 bits if enough operands are defined.
-//
-// OpcodeToken0 is followed by a DWORD that represents the function body
-// identifier.
-//
-// ----------------------------------------------------------------------------
-
-// ----------------------------------------------------------------------------
-// Interface function table Declaration
-//
-// OpcodeToken0:
-//
-// [10:00] D3D10_SB_OPCODE_DCL_FUNCTION_TABLE
-// [23:11] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  If it is extended, then
-//         it contains the actual instruction length in DWORDs, since
-//         it may not fit into 7 bits if enough functions are defined.
-//
-// OpcodeToken0 is followed by a DWORD that represents the function table
-// identifier and another DWORD (TableLength) that gives the number of
-// functions in the table.
-//
-// This is followed by TableLength DWORDs which are function body indices.
-//
-// ----------------------------------------------------------------------------
-
-// ----------------------------------------------------------------------------
-// Interface Declaration
-//
-// OpcodeToken0:
-//
-// [10:00] D3D10_SB_OPCODE_DCL_INTERFACE
-// [11]    1 if the interface is indexed dynamically, 0 otherwise.
-// [23:12] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  If it is extended, then
-//         it contains the actual instruction length in DWORDs, since
-//         it may not fit into 7 bits if enough types are used.
-//
-// OpcodeToken0 is followed by a DWORD that represents the interface
-// identifier. Next is a DWORD that gives the expected function table
-// length. Then another DWORD (OpcodeToken3) with the following layout:
-//
-// [15:00] TableLength, the number of types that implement this interface
-// [31:16] ArrayLength, the number of interfaces that are defined in this array.
-//
-// This is followed by TableLength DWORDs which are function table
-// identifiers, representing possible tables for a given interface.
-//
-// ----------------------------------------------------------------------------
-
-#define D3D11_SB_INTERFACE_INDEXED_BIT_MASK  0x00000800
-#define D3D11_SB_INTERFACE_INDEXED_BIT_SHIFT 11
-
-#define D3D11_SB_INTERFACE_TABLE_LENGTH_MASK  0x0000ffff
-#define D3D11_SB_INTERFACE_TABLE_LENGTH_SHIFT 0
-
-#define D3D11_SB_INTERFACE_ARRAY_LENGTH_MASK  0xffff0000
-#define D3D11_SB_INTERFACE_ARRAY_LENGTH_SHIFT 16
-
-// get/set the indexed bit for an interface definition
-#define DECODE_D3D11_SB_INTERFACE_INDEXED_BIT(OpcodeToken0) ((((OpcodeToken0)&D3D11_SB_INTERFACE_INDEXED_BIT_MASK)>>D3D11_SB_INTERFACE_INDEXED_BIT_SHIFT) ? true : false)
-#define ENCODE_D3D11_SB_INTERFACE_INDEXED_BIT(IndexedBit) (((IndexedBit)<<D3D11_SB_INTERFACE_INDEXED_BIT_SHIFT)&D3D11_SB_INTERFACE_INDEXED_BIT_MASK)
-
-// get/set the table length for an interface definition
-#define DECODE_D3D11_SB_INTERFACE_TABLE_LENGTH(OpcodeToken0) ((UINT)(((OpcodeToken0)&D3D11_SB_INTERFACE_TABLE_LENGTH_MASK)>>D3D11_SB_INTERFACE_TABLE_LENGTH_SHIFT))
-#define ENCODE_D3D11_SB_INTERFACE_TABLE_LENGTH(TableLength) (((TableLength)<<D3D11_SB_INTERFACE_TABLE_LENGTH_SHIFT)&D3D11_SB_INTERFACE_TABLE_LENGTH_MASK)
-
-// get/set the array length for an interface definition
-#define DECODE_D3D11_SB_INTERFACE_ARRAY_LENGTH(OpcodeToken0) ((UINT)(((OpcodeToken0)&D3D11_SB_INTERFACE_ARRAY_LENGTH_MASK)>>D3D11_SB_INTERFACE_ARRAY_LENGTH_SHIFT))
-#define ENCODE_D3D11_SB_INTERFACE_ARRAY_LENGTH(ArrayLength) (((ArrayLength)<<D3D11_SB_INTERFACE_ARRAY_LENGTH_SHIFT)&D3D11_SB_INTERFACE_ARRAY_LENGTH_MASK)
-
-// ----------------------------------------------------------------------------
-// Interface call
-//
-// OpcodeToken0:
-//
-// [10:00] D3D10_SB_OPCODE_INTERFACE_CALL
-// [23:11] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  If it is extended, then
-//         it contains the actual instruction length in DWORDs, since
-//         it may not fit into 7 bits if enough types are used.
-//
-// OpcodeToken0 is followed by a DWORD that gives the function index to
-// call in the function table specified for the given interface. 
-// Next is the interface operand.
-//
-// ----------------------------------------------------------------------------
-
-// ----------------------------------------------------------------------------
-// Thread Group Declaration (Compute Shader)
-//
-// OpcodeToken0:
-//
-// [10:00] D3D11_SB_OPCODE_DCL_THREAD_GROUP
-// [23:11] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  If it is extended, then
-//         it contains the actual instruction length in DWORDs, since
-//         it may not fit into 7 bits if enough types are used.
-//
-// OpcodeToken0 is followed by 3 DWORDs, the Thread Group dimensions as UINT32:
-// x, y, z
-//
-// ----------------------------------------------------------------------------
-
-// ----------------------------------------------------------------------------
-// Typed Unordered Access View Declaration
-//
-// OpcodeToken0:
-//
-// [10:00] D3D11_SB_OPCODE_DCL_UNORDERED_ACCESS_VIEW_TYPED
-// [15:11] D3D10_SB_RESOURCE_DIMENSION
-// [16:16] D3D11_SB_GLOBALLY_COHERENT_ACCESS or 0 (LOCALLY_COHERENT)
-// [17:17] D3D11_SB_RASTERIZER_ORDERED_ACCESS or 0
-// [23:18] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// OpcodeToken0 is followed by 2 operands on Shader Models 4.0 through 5.0:
-// (1) an operand, starting with OperandToken0, defining which
-//     u# register (D3D11_SB_OPERAND_TYPE_UNORDERED_ACCESS_VIEW) is being declared.
-// (2) a Resource Return Type token (ResourceReturnTypeToken)
-//
-// OpcodeToken0 is followed by 3 operands on Shader Model 5.1 and later:
-// (1) an operand, starting with OperandToken0, defining which
-//     u# register (D3D11_SB_OPERAND_TYPE_UNORDERED_ACCESS_VIEW) is being declared.
-//     The indexing dimension for the register must be D3D10_SB_OPERAND_INDEX_DIMENSION_3D, 
-//     and the meaning of the index dimensions are as follows: (u<id>[<lbound>:<ubound>])
-//       1 <id>:     variable ID being declared
-//       2 <lbound>: the lower bound of the range of UAV's in the space
-//       3 <ubound>: the upper bound (inclusive) of this range
-//     As opposed to when the u# is used in shader instructions, where the register
-//     must be D3D10_SB_OPERAND_INDEX_DIMENSION_2D, and the meaning of the index 
-//     dimensions are as follows: (u<id>[<idx>]):
-//       1 <id>:  variable ID being used (matches dcl)
-//       2 <idx>: absolute index of uav within space (may be dynamically indexed)
-// (2) a Resource Return Type token (ResourceReturnTypeToken)
-// (3) a DWORD indicating the space index.
-//
-// ----------------------------------------------------------------------------
-// UAV access scope flags
-#define D3D11_SB_GLOBALLY_COHERENT_ACCESS 0x00010000
-#define D3D11_SB_ACCESS_COHERENCY_MASK    0x00010000
-
-// DECODER MACRO: Retrieve flags for sync instruction from OpcodeToken0.
-#define DECODE_D3D11_SB_ACCESS_COHERENCY_FLAGS(OperandToken0) ((OperandToken0)&D3D11_SB_ACCESS_COHERENCY_MASK)
-
-// ENCODER MACRO: Given a set of sync instruciton flags, encode them in OpcodeToken0.
-#define ENCODE_D3D11_SB_ACCESS_COHERENCY_FLAGS(Flags) ((Flags)&D3D11_SB_ACCESS_COHERENCY_MASK)
-
-// Additional UAV access flags
-#define D3D11_SB_RASTERIZER_ORDERED_ACCESS 0x00020000
-
-// Resource flags mask.  Use to retrieve all resource flags, including the order preserving counter.
-#define D3D11_SB_RESOURCE_FLAGS_MASK    (D3D11_SB_GLOBALLY_COHERENT_ACCESS|D3D11_SB_RASTERIZER_ORDERED_ACCESS|D3D11_SB_UAV_HAS_ORDER_PRESERVING_COUNTER)
-
-// DECODER MACRO: Retrieve UAV access flags for from OpcodeToken0.
-#define DECODE_D3D11_SB_RESOURCE_FLAGS(OperandToken0) ((OperandToken0)&D3D11_SB_RESOURCE_FLAGS_MASK)
-
-// ENCODER MACRO: Given UAV access flags, encode them in OpcodeToken0.
-#define ENCODE_D3D11_SB_RESOURCE_FLAGS(Flags) ((Flags)&D3D11_SB_RESOURCE_FLAGS_MASK)
-
-// ----------------------------------------------------------------------------
-// Raw Unordered Access View Declaration
-//
-// OpcodeToken0:
-//
-// [10:00] D3D11_SB_OPCODE_DCL_UNORDERED_ACCESS_VIEW_RAW
-// [15:11] Ignored, 0
-// [16:16] D3D11_SB_GLOBALLY_COHERENT_ACCESS or 0 (LOCALLY_COHERENT)
-// [17:17] D3D11_SB_RASTERIZER_ORDERED_ACCESS or 0
-// [23:18] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// OpcodeToken0 is followed by 1 operand on Shader Models 4.0 through 5.0:
-// (1) an operand, starting with OperandToken0, defining which
-//     u# register (D3D11_SB_OPERAND_TYPE_UNORDERED_ACCESS_VIEW) is being declared.
-//
-// OpcodeToken0 is followed by 2 operands on Shader Model 5.1 and later:
-// (1) an operand, starting with OperandToken0, defining which
-//     u# register (D3D11_SB_OPERAND_TYPE_UNORDERED_ACCESS_VIEW) is being declared.
-//     The indexing dimension for the register must be D3D10_SB_OPERAND_INDEX_DIMENSION_3D, 
-//     and the meaning of the index dimensions are as follows: (u<id>[<lbound>:<ubound>])
-//       1 <id>:     variable ID being declared
-//       2 <lbound>: the lower bound of the range of UAV's in the space
-//       3 <ubound>: the upper bound (inclusive) of this range
-//     As opposed to when the u# is used in shader instructions, where the register
-//     must be D3D10_SB_OPERAND_INDEX_DIMENSION_2D, and the meaning of the index 
-//     dimensions are as follows: (u<id>[<idx>]):
-//       1 <id>:  variable ID being used (matches dcl)
-//       2 <idx>: absolute index of uav within space (may be dynamically indexed)
-// (2) a DWORD indicating the space index.
-//
-// ----------------------------------------------------------------------------
-
-// ----------------------------------------------------------------------------
-// Structured Unordered Access View Declaration
-//
-// OpcodeToken0:
-//
-// [10:00] D3D11_SB_OPCODE_DCL_UNORDERED_ACCESS_VIEW_STRUCTURED
-// [15:11] Ignored, 0
-// [16:16] D3D11_SB_GLOBALLY_COHERENT_ACCESS or 0 (LOCALLY_COHERENT)
-// [17:17] D3D11_SB_RASTERIZER_ORDERED_ACCESS or 0
-// [22:18] Ignored, 0
-// [23:23] D3D11_SB_UAV_HAS_ORDER_PRESERVING_COUNTER or 0
-//
-//            The presence of this flag means that if a UAV is bound to the
-//            corresponding slot, it must have been created with 
-//            D3D11_BUFFER_UAV_FLAG_COUNTER at the API.  Also, the shader
-//            can contain either imm_atomic_alloc or _consume instructions
-//            operating on the given UAV.
-// 
-//            If this flag is not present, the shader can still contain
-//            either imm_atomic_alloc or imm_atomic_consume instructions for
-//            this UAV.  But if such instructions are present in this case,
-//            and a UAV is bound corresponding slot, it must have been created 
-//            with the D3D11_BUFFER_UAV_FLAG_APPEND flag at the API.
-//            Append buffers have a counter as well, but values returned 
-//            to the shader are only valid for the lifetime of the shader 
-//            invocation.
-//
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// OpcodeToken0 is followed by 2 operands:
-// (1) an operand, starting with OperandToken0, defining which
-//     u# register (D3D11_SB_OPERAND_TYPE_UNORDERED_ACCESS_VIEW) is 
-//     being declared.
-// (2) a DWORD indicating UINT32 byte stride
-//
-// OpcodeToken0 is followed by 3 operands on Shader Model 5.1 and later:
-// (1) an operand, starting with OperandToken0, defining which
-//     u# register (D3D11_SB_OPERAND_TYPE_UNORDERED_ACCESS_VIEW) is being declared.
-//     The indexing dimension for the register must be D3D10_SB_OPERAND_INDEX_DIMENSION_3D, 
-//     and the meaning of the index dimensions are as follows: (u<id>[<lbound>:<ubound>])
-//       1 <id>:     variable ID being declared
-//       2 <lbound>: the lower bound of the range of UAV's in the space
-//       3 <ubound>: the upper bound (inclusive) of this range
-//     As opposed to when the u# is used in shader instructions, where the register
-//     must be D3D10_SB_OPERAND_INDEX_DIMENSION_2D, and the meaning of the index 
-//     dimensions are as follows: (u<id>[<idx>]):
-//       1 <id>:  variable ID being used (matches dcl)
-//       2 <idx>: absolute index of uav within space (may be dynamically indexed)
-// (2) a DWORD indicating UINT32 byte stride
-// (3) a DWORD indicating the space index.
-//
-// ----------------------------------------------------------------------------
-// UAV flags
-#define D3D11_SB_UAV_HAS_ORDER_PRESERVING_COUNTER 0x00800000
-#define D3D11_SB_UAV_FLAGS_MASK                   0x00800000
-
-// DECODER MACRO: Retrieve flags about UAV from OpcodeToken0.
-#define DECODE_D3D11_SB_UAV_FLAGS(OperandToken0) ((OperandToken0)&D3D11_SB_UAV_FLAGS_MASK)
-
-// ENCODER MACRO: Given a set of UAV flags, encode them in OpcodeToken0.
-#define ENCODE_D3D11_SB_UAV_FLAGS(Flags) ((Flags)&D3D11_SB_UAV_FLAGS_MASK)
-
-// ----------------------------------------------------------------------------
-// Raw Thread Group Shared Memory Declaration
-//
-// OpcodeToken0:
-//
-// [10:00] D3D11_SB_OPCODE_DCL_THREAD_GROUP_SHARED_MEMORY_RAW
-// [23:11] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// OpcodeToken0 is followed by 2 operands:
-// (1) an operand, starting with OperandToken0, defining which
-//     g# register (D3D11_SB_OPERAND_TYPE_THREAD_GROUP_SHARED_MEMORY) is being declared.
-// (2) a DWORD indicating the byte count, which must be a multiple of 4.
-//
-// ----------------------------------------------------------------------------
-
-// ----------------------------------------------------------------------------
-// Structured Thread Group Shared Memory Declaration
-//
-// OpcodeToken0:
-//
-// [10:00] D3D11_SB_OPCODE_DCL_THREAD_GROUP_SHARED_MEMORY_STRUCTURED
-// [23:11] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// OpcodeToken0 is followed by 3 operands:
-// (1) an operand, starting with OperandToken0, defining which
-//     g# register (D3D11_SB_OPERAND_TYPE_THREAD_GROUP_SHARED_MEMORY) is 
-//     being declared.
-// (2) a DWORD indicating UINT32 struct byte stride
-// (3) a DWORD indicating UINT32 struct count
-//
-// ----------------------------------------------------------------------------
-
-// ----------------------------------------------------------------------------
-// Raw Shader Resource View Declaration
-//
-// OpcodeToken0:
-//
-// [10:00] D3D11_SB_OPCODE_DCL_RESOURCE_RAW
-// [23:11] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// OpcodeToken0 is followed by 1 operand:
-// (1) an operand, starting with OperandToken0, defining which
-//     t# register (D3D10_SB_OPERAND_TYPE_RESOURCE) is being declared.
-//
-// OpcodeToken0 is followed by 2 operands on Shader Model 5.1 and later:
-// (1) an operand, starting with OperandToken0, defining which
-//     t# register (D3D10_SB_OPERAND_TYPE_RESOURCE) is being declared.
-//     The indexing dimension for the register must be D3D10_SB_OPERAND_INDEX_DIMENSION_3D, 
-//     and the meaning of the index dimensions are as follows: (t<id>[<lbound>:<ubound>])
-//       1 <id>:     variable ID being declared
-//       2 <lbound>: the lower bound of the range of resources in the space
-//       3 <ubound>: the upper bound (inclusive) of this range
-//     As opposed to when the t# is used in shader instructions, where the register
-//     must be D3D10_SB_OPERAND_INDEX_DIMENSION_2D, and the meaning of the index 
-//     dimensions are as follows: (t<id>[<idx>]):
-//       1 <id>:  variable ID being used (matches dcl)
-//       2 <idx>: absolute index of resource within space (may be dynamically indexed)
-// (2) a DWORD indicating the space index.
-//
-// ----------------------------------------------------------------------------
-
-// ----------------------------------------------------------------------------
-// Structured Shader Resource View Declaration
-//
-// OpcodeToken0:
-//
-// [10:00] D3D11_SB_OPCODE_DCL_RESOURCE_STRUCTURED
-// [23:11] Ignored, 0
-// [30:24] Instruction length in DWORDs including the opcode token.
-// [31]    0 normally. 1 if extended operand definition, meaning next DWORD
-//         contains extended operand description.  This dcl is currently not
-//         extended.
-//
-// OpcodeToken0 is followed by 2 operands:
-// (1) an operand, starting with OperandToken0, defining which
-//     g# register (D3D10_SB_OPERAND_TYPE_RESOURCE) is 
-//     being declared.
-// (2) a DWORD indicating UINT32 struct byte stride
-//
-// OpcodeToken0 is followed by 3 operands on Shader Model 5.1 and later:
-// (1) an operand, starting with OperandToken0, defining which
-//     t# register (D3D10_SB_OPERAND_TYPE_RESOURCE) is being declared.
-//     The indexing dimension for the register must be D3D10_SB_OPERAND_INDEX_DIMENSION_3D, 
-//     and the meaning of the index dimensions are as follows: (t<id>[<lbound>:<ubound>])
-//       1 <id>:     variable ID being declared
-//       2 <lbound>: the lower bound of the range of resources in the space
-//       3 <ubound>: the upper bound (inclusive) of this range
-//     As opposed to when the t# is used in shader instructions, where the register
-//     must be D3D10_SB_OPERAND_INDEX_DIMENSION_2D, and the meaning of the index 
-//     dimensions are as follows: (t<id>[<idx>]):
-//       1 <id>:  variable ID being used (matches dcl)
-//       2 <idx>: absolute index of resource within space (may be dynamically indexed)
-// (2) a DWORD indicating UINT32 struct byte stride
-// (3) a DWORD indicating the space index.
-//
-// ----------------------------------------------------------------------------
-
-#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_GAMES) */
-#pragma endregion

+ 1 - 1
thirdparty/directx_headers/include/directx/d3dx12_check_feature_support.h

@@ -1,4 +1,4 @@
-//*********************************************************
+//*********************************************************
 //
 // Copyright (c) Microsoft Corporation.
 // Licensed under the MIT License (MIT).

+ 0 - 4
thirdparty/directx_headers/include/directx/d3dx12_pipeline_state_stream.h

@@ -25,12 +25,10 @@
 struct DefaultSampleMask { operator UINT() noexcept { return UINT_MAX; } };
 struct DefaultSampleDesc { operator DXGI_SAMPLE_DESC() noexcept { return DXGI_SAMPLE_DESC{1, 0}; } };
 
-/* GODOT start */
 #if defined(_MSC_VER)
 #pragma warning(push)
 #pragma warning(disable : 4324)
 #endif
-/* GODOT start */
 template <typename InnerStructType, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE Type, typename DefaultArg = InnerStructType>
 class alignas(void*) CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT
 {
@@ -46,11 +44,9 @@ public:
     InnerStructType* operator&() noexcept { return &pssInner; }
     InnerStructType const* operator&() const noexcept { return &pssInner; }
 };
-/* GODOT start */
 #if defined(_MSC_VER)
 #pragma warning(pop)
 #endif
-/* GODOT end */
 typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_PIPELINE_STATE_FLAGS,         D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_FLAGS>                             CD3DX12_PIPELINE_STATE_STREAM_FLAGS;
 typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< UINT,                               D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_NODE_MASK>                         CD3DX12_PIPELINE_STATE_STREAM_NODE_MASK;
 typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< ID3D12RootSignature*,               D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE>                    CD3DX12_PIPELINE_STATE_STREAM_ROOT_SIGNATURE;

+ 1 - 15
thirdparty/directx_headers/include/directx/d3dx12_root_signature.h

@@ -996,9 +996,7 @@ struct CD3DX12_GPU_DESCRIPTOR_HANDLE : public D3D12_GPU_DESCRIPTOR_HANDLE
 // two code paths for building root signatures, this helper method reconstructs a 1.0 signature when
 // 1.1 is not supported.
 inline HRESULT D3DX12SerializeVersionedRootSignature(
-/* GODOT start */
     _In_ HMODULE pLibD3D12,
-/* GODOT end */
     _In_ const D3D12_VERSIONED_ROOT_SIGNATURE_DESC* pRootSignatureDesc,
     D3D_ROOT_SIGNATURE_VERSION MaxVersion,
     _Outptr_ ID3DBlob** ppBlob,
@@ -1009,22 +1007,18 @@ inline HRESULT D3DX12SerializeVersionedRootSignature(
         *ppErrorBlob = nullptr;
     }
 
-    /* GODOT start */
-	PFN_D3D12_SERIALIZE_ROOT_SIGNATURE d3d_D3D12SerializeRootSignature = (PFN_D3D12_SERIALIZE_ROOT_SIGNATURE)(void *)GetProcAddress(pLibD3D12, "D3D12SerializeRootSignature");
+    PFN_D3D12_SERIALIZE_ROOT_SIGNATURE d3d_D3D12SerializeRootSignature = (PFN_D3D12_SERIALIZE_ROOT_SIGNATURE)(void *)GetProcAddress(pLibD3D12, "D3D12SerializeRootSignature");
     if (d3d_D3D12SerializeRootSignature == nullptr) {
         return E_INVALIDARG;
     }
     PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE d3d_D3D12SerializeVersionedRootSignature = (PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE)(void *)GetProcAddress(pLibD3D12, "D3D12SerializeVersionedRootSignature");
-    /* GODOT end */
     switch (MaxVersion)
     {
         case D3D_ROOT_SIGNATURE_VERSION_1_0:
             switch (pRootSignatureDesc->Version)
             {
                 case D3D_ROOT_SIGNATURE_VERSION_1_0:
-/* GODOT start */
                     return d3d_D3D12SerializeRootSignature(&pRootSignatureDesc->Desc_1_0, D3D_ROOT_SIGNATURE_VERSION_1, ppBlob, ppErrorBlob);
-/* GODOT end */
 
                 case D3D_ROOT_SIGNATURE_VERSION_1_1:
 #if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 609)
@@ -1126,9 +1120,7 @@ inline HRESULT D3DX12SerializeVersionedRootSignature(
                     if (SUCCEEDED(hr))
                     {
                         const CD3DX12_ROOT_SIGNATURE_DESC desc_1_0(desc_1_1.NumParameters, pParameters_1_0, desc_1_1.NumStaticSamplers, pStaticSamplers == nullptr ? desc_1_1.pStaticSamplers : pStaticSamplers, desc_1_1.Flags);
-/* GODOT start */
                         hr = d3d_D3D12SerializeRootSignature(&desc_1_0, D3D_ROOT_SIGNATURE_VERSION_1, ppBlob, ppErrorBlob);
-/* GODOT end */
                     }
 
                     if (pParameters)
@@ -1159,9 +1151,7 @@ inline HRESULT D3DX12SerializeVersionedRootSignature(
             {
             case D3D_ROOT_SIGNATURE_VERSION_1_0:
             case D3D_ROOT_SIGNATURE_VERSION_1_1:
-/* GODOT start */
                 return d3d_D3D12SerializeVersionedRootSignature(pRootSignatureDesc, ppBlob, ppErrorBlob);
-/* GODOT end */
 
 #if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 609)
             case D3D_ROOT_SIGNATURE_VERSION_1_2:
@@ -1197,9 +1187,7 @@ inline HRESULT D3DX12SerializeVersionedRootSignature(
                 if (SUCCEEDED(hr))
                 {
                     const CD3DX12_VERSIONED_ROOT_SIGNATURE_DESC desc(desc_1_1.NumParameters, desc_1_1.pParameters, desc_1_1.NumStaticSamplers, pStaticSamplers == nullptr ? desc_1_1.pStaticSamplers : pStaticSamplers, desc_1_1.Flags);
-/* GODOT start */
                     hr = d3d_D3D12SerializeVersionedRootSignature(&desc, ppBlob, ppErrorBlob);
-/* GODOT end */
                 }
 
                 if (pStaticSamplers)
@@ -1215,9 +1203,7 @@ inline HRESULT D3DX12SerializeVersionedRootSignature(
 #if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 609)
         case D3D_ROOT_SIGNATURE_VERSION_1_2:
 #endif
-/* GODOT start */
             return d3d_D3D12SerializeVersionedRootSignature(pRootSignatureDesc, ppBlob, ppErrorBlob);
-/* GODOT end */
     }
 
     return E_INVALIDARG;

+ 25 - 0
thirdparty/directx_headers/patches/0001-mingw-pragma.patch

@@ -0,0 +1,25 @@
+diff --git a/thirdparty/directx_headers/include/directx/d3dx12_pipeline_state_stream.h b/thirdparty/directx_headers/include/directx/d3dx12_pipeline_state_stream.h
+index f061e79596..27c7f20448 100644
+--- a/thirdparty/directx_headers/include/directx/d3dx12_pipeline_state_stream.h
++++ b/thirdparty/directx_headers/include/directx/d3dx12_pipeline_state_stream.h
+@@ -25,8 +25,10 @@
+ struct DefaultSampleMask { operator UINT() noexcept { return UINT_MAX; } };
+ struct DefaultSampleDesc { operator DXGI_SAMPLE_DESC() noexcept { return DXGI_SAMPLE_DESC{1, 0}; } };
+ 
++#if defined(_MSC_VER)
+ #pragma warning(push)
+ #pragma warning(disable : 4324)
++#endif
+ template <typename InnerStructType, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE Type, typename DefaultArg = InnerStructType>
+ class alignas(void*) CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT
+ {
+@@ -42,7 +44,9 @@ public:
+     InnerStructType* operator&() noexcept { return &pssInner; }
+     InnerStructType const* operator&() const noexcept { return &pssInner; }
+ };
++#if defined(_MSC_VER)
+ #pragma warning(pop)
++#endif
+ typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_PIPELINE_STATE_FLAGS,         D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_FLAGS>                             CD3DX12_PIPELINE_STATE_STREAM_FLAGS;
+ typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< UINT,                               D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_NODE_MASK>                         CD3DX12_PIPELINE_STATE_STREAM_NODE_MASK;
+ typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< ID3D12RootSignature*,               D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE>                    CD3DX12_PIPELINE_STATE_STREAM_ROOT_SIGNATURE;

+ 8 - 22
thirdparty/directx_headers/patches/patch_d3d12_dynamic_load.diff → thirdparty/directx_headers/patches/0002-win7-8-dynamic-load.patch

@@ -1,28 +1,24 @@
 diff --git a/thirdparty/directx_headers/include/directx/d3dx12_root_signature.h b/thirdparty/directx_headers/include/directx/d3dx12_root_signature.h
-index 572efed852..18efa7a0cb 100644
+index 572efed852..2da79d10f1 100644
 --- a/thirdparty/directx_headers/include/directx/d3dx12_root_signature.h
 +++ b/thirdparty/directx_headers/include/directx/d3dx12_root_signature.h
-@@ -996,6 +996,9 @@ struct CD3DX12_GPU_DESCRIPTOR_HANDLE : public D3D12_GPU_DESCRIPTOR_HANDLE
+@@ -996,6 +996,7 @@ struct CD3DX12_GPU_DESCRIPTOR_HANDLE : public D3D12_GPU_DESCRIPTOR_HANDLE
  // two code paths for building root signatures, this helper method reconstructs a 1.0 signature when
  // 1.1 is not supported.
  inline HRESULT D3DX12SerializeVersionedRootSignature(
-+/* GODOT start */
 +    _In_ HMODULE pLibD3D12,
-+/* GODOT end */
      _In_ const D3D12_VERSIONED_ROOT_SIGNATURE_DESC* pRootSignatureDesc,
      D3D_ROOT_SIGNATURE_VERSION MaxVersion,
      _Outptr_ ID3DBlob** ppBlob,
-@@ -1006,13 +1009,22 @@ inline HRESULT D3DX12SerializeVersionedRootSignature(
+@@ -1006,13 +1007,18 @@ inline HRESULT D3DX12SerializeVersionedRootSignature(
          *ppErrorBlob = nullptr;
      }
  
-+    /* GODOT start */
-+	PFN_D3D12_SERIALIZE_ROOT_SIGNATURE d3d_D3D12SerializeRootSignature = (PFN_D3D12_SERIALIZE_ROOT_SIGNATURE)(void *)GetProcAddress(pLibD3D12, "D3D12SerializeRootSignature");
++    PFN_D3D12_SERIALIZE_ROOT_SIGNATURE d3d_D3D12SerializeRootSignature = (PFN_D3D12_SERIALIZE_ROOT_SIGNATURE)(void *)GetProcAddress(pLibD3D12, "D3D12SerializeRootSignature");
 +    if (d3d_D3D12SerializeRootSignature == nullptr) {
 +        return E_INVALIDARG;
 +    }
 +    PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE d3d_D3D12SerializeVersionedRootSignature = (PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE)(void *)GetProcAddress(pLibD3D12, "D3D12SerializeVersionedRootSignature");
-+    /* GODOT end */
      switch (MaxVersion)
      {
          case D3D_ROOT_SIGNATURE_VERSION_1_0:
@@ -30,53 +26,43 @@ index 572efed852..18efa7a0cb 100644
              {
                  case D3D_ROOT_SIGNATURE_VERSION_1_0:
 -                    return D3D12SerializeRootSignature(&pRootSignatureDesc->Desc_1_0, D3D_ROOT_SIGNATURE_VERSION_1, ppBlob, ppErrorBlob);
-+/* GODOT start */
 +                    return d3d_D3D12SerializeRootSignature(&pRootSignatureDesc->Desc_1_0, D3D_ROOT_SIGNATURE_VERSION_1, ppBlob, ppErrorBlob);
-+/* GODOT end */
  
                  case D3D_ROOT_SIGNATURE_VERSION_1_1:
  #if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 609)
-@@ -1114,7 +1126,9 @@ inline HRESULT D3DX12SerializeVersionedRootSignature(
+@@ -1114,7 +1120,7 @@ inline HRESULT D3DX12SerializeVersionedRootSignature(
                      if (SUCCEEDED(hr))
                      {
                          const CD3DX12_ROOT_SIGNATURE_DESC desc_1_0(desc_1_1.NumParameters, pParameters_1_0, desc_1_1.NumStaticSamplers, pStaticSamplers == nullptr ? desc_1_1.pStaticSamplers : pStaticSamplers, desc_1_1.Flags);
 -                        hr = D3D12SerializeRootSignature(&desc_1_0, D3D_ROOT_SIGNATURE_VERSION_1, ppBlob, ppErrorBlob);
-+/* GODOT start */
 +                        hr = d3d_D3D12SerializeRootSignature(&desc_1_0, D3D_ROOT_SIGNATURE_VERSION_1, ppBlob, ppErrorBlob);
-+/* GODOT end */
                      }
  
                      if (pParameters)
-@@ -1145,7 +1159,9 @@ inline HRESULT D3DX12SerializeVersionedRootSignature(
+@@ -1145,7 +1151,7 @@ inline HRESULT D3DX12SerializeVersionedRootSignature(
              {
              case D3D_ROOT_SIGNATURE_VERSION_1_0:
              case D3D_ROOT_SIGNATURE_VERSION_1_1:
 -                return D3D12SerializeVersionedRootSignature(pRootSignatureDesc, ppBlob, ppErrorBlob);
-+/* GODOT start */
 +                return d3d_D3D12SerializeVersionedRootSignature(pRootSignatureDesc, ppBlob, ppErrorBlob);
-+/* GODOT end */
  
  #if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 609)
              case D3D_ROOT_SIGNATURE_VERSION_1_2:
-@@ -1181,7 +1197,9 @@ inline HRESULT D3DX12SerializeVersionedRootSignature(
+@@ -1181,7 +1187,7 @@ inline HRESULT D3DX12SerializeVersionedRootSignature(
                  if (SUCCEEDED(hr))
                  {
                      const CD3DX12_VERSIONED_ROOT_SIGNATURE_DESC desc(desc_1_1.NumParameters, desc_1_1.pParameters, desc_1_1.NumStaticSamplers, pStaticSamplers == nullptr ? desc_1_1.pStaticSamplers : pStaticSamplers, desc_1_1.Flags);
 -                    hr = D3D12SerializeVersionedRootSignature(&desc, ppBlob, ppErrorBlob);
-+/* GODOT start */
 +                    hr = d3d_D3D12SerializeVersionedRootSignature(&desc, ppBlob, ppErrorBlob);
-+/* GODOT end */
                  }
  
                  if (pStaticSamplers)
-@@ -1197,7 +1215,9 @@ inline HRESULT D3DX12SerializeVersionedRootSignature(
+@@ -1197,7 +1203,7 @@ inline HRESULT D3DX12SerializeVersionedRootSignature(
  #if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 609)
          case D3D_ROOT_SIGNATURE_VERSION_1_2:
  #endif
 -            return D3D12SerializeVersionedRootSignature(pRootSignatureDesc, ppBlob, ppErrorBlob);
-+/* GODOT start */
 +            return d3d_D3D12SerializeVersionedRootSignature(pRootSignatureDesc, ppBlob, ppErrorBlob);
-+/* GODOT end */
      }
  
      return E_INVALIDARG;

+ 4 - 8
thirdparty/embree/common/algorithms/parallel_reduce.h

@@ -58,19 +58,15 @@ namespace embree
     const Value v = tbb::parallel_reduce(tbb::blocked_range<Index>(first,last,minStepSize),identity,
       [&](const tbb::blocked_range<Index>& r, const Value& start) { return reduction(start,func(range<Index>(r.begin(),r.end()))); },
       reduction,context);
-    // -- GODOT start --
-    // if (context.is_group_execution_cancelled())
-    //   throw std::runtime_error("task cancelled");
-    // -- GODOT end --
+    //if (context.is_group_execution_cancelled())
+    //  throw std::runtime_error("task cancelled");
     return v;
   #else
     const Value v = tbb::parallel_reduce(tbb::blocked_range<Index>(first,last,minStepSize),identity,
       [&](const tbb::blocked_range<Index>& r, const Value& start) { return reduction(start,func(range<Index>(r.begin(),r.end()))); },
       reduction);
-    // -- GODOT start --
-    // if (tbb::task::self().is_cancelled())
-    //   throw std::runtime_error("task cancelled");
-    // -- GODOT end --
+    //if (tbb::task::self().is_cancelled())
+    //  throw std::runtime_error("task cancelled");
     return v;
   #endif
 #else // TASKING_PPL

+ 1 - 3
thirdparty/embree/common/lexers/stringstream.cpp

@@ -39,12 +39,10 @@ namespace embree
     std::vector<char> str; str.reserve(64);
     while (cin->peek() != EOF && !isSeparator(cin->peek())) {
       int c = cin->get();
-      // -- GODOT start --
-      // if (!isValidChar(c)) throw std::runtime_error("invalid character "+std::string(1,c)+" in input");
+      //if (!isValidChar(c)) throw std::runtime_error("invalid character "+std::string(1,c)+" in input");
       if (!isValidChar(c)) {
         abort();
       }
-      // -- GODOT end --
       str.push_back((char)c);
     }
     str.push_back(0);

+ 0 - 6
thirdparty/embree/common/simd/arm/sse2neon.h

@@ -102,9 +102,7 @@
 #include <stdint.h>
 #include <stdlib.h>
 
-// -- GODOT start --
 #if defined(_WIN32) && !defined(__MINGW32__)
-// -- GODOT end --
 /* Definitions for _mm_{malloc,free} are provided by <malloc.h>
  * from both MinGW-w64 and MSVC.
  */
@@ -1890,13 +1888,11 @@ FORCE_INLINE __m128 _mm_div_ss(__m128 a, __m128 b)
 #if !defined(SSE2NEON_ALLOC_DEFINED)
 FORCE_INLINE void _mm_free(void *addr)
 {
-// -- GODOT start --
 #if defined(_WIN32)
     _aligned_free(addr);
 #else
     free(addr);
 #endif
-// -- GODOT end --
 }
 #endif
 
@@ -2088,7 +2084,6 @@ FORCE_INLINE void *_mm_malloc(size_t size, size_t align)
         return malloc(size);
     if (align == 2 || (sizeof(void *) == 8 && align == 4))
         align = sizeof(void *);
-// -- GODOT start --
 #if defined(_WIN32)
     ptr = _aligned_malloc(size, align);
     if (ptr)
@@ -2097,7 +2092,6 @@ FORCE_INLINE void *_mm_malloc(size_t size, size_t align)
     if (!posix_memalign(&ptr, align, size))
         return ptr;
 #endif
-// -- GODOT end --
     return NULL;
 }
 #endif

+ 20 - 42
thirdparty/embree/common/sys/alloc.cpp

@@ -24,32 +24,28 @@ namespace embree
   
   void enableUSMAllocEmbree(sycl::context* context, sycl::device* device)
   {
-    // -- GODOT start --
-    // if (tls_context_embree != nullptr) throw std::runtime_error("USM allocation already enabled");
-    // if (tls_device_embree != nullptr) throw std::runtime_error("USM allocation already enabled");
+    //if (tls_context_embree != nullptr) throw std::runtime_error("USM allocation already enabled");
+    //if (tls_device_embree != nullptr) throw std::runtime_error("USM allocation already enabled");
     if (tls_context_embree != nullptr) {
       abort();
     }
     if (tls_device_embree != nullptr) {
       abort();
     }
-    // -- GODOT end --
     tls_context_embree = context;
     tls_device_embree = device;
   }
 
   void disableUSMAllocEmbree()
   {
-    // -- GODOT start --
-    // if (tls_context_embree  == nullptr) throw std::runtime_error("USM allocation not enabled");
-    // if (tls_device_embree  == nullptr) throw std::runtime_error("USM allocation not enabled");
+    //if (tls_context_embree  == nullptr) throw std::runtime_error("USM allocation not enabled");
+    //if (tls_device_embree  == nullptr) throw std::runtime_error("USM allocation not enabled");
     if (tls_context_embree  == nullptr) {
       abort();
     }
     if (tls_device_embree  == nullptr) {
       abort();
     }
-    // -- GODOT end --
     tls_context_embree = nullptr;
     tls_device_embree = nullptr;
   }
@@ -64,16 +60,14 @@ namespace embree
 
   void disableUSMAllocTutorial()
   {
-    // -- GODOT start --
-    // if (tls_context_tutorial  == nullptr) throw std::runtime_error("USM allocation not enabled");
-    // if (tls_device_tutorial  == nullptr) throw std::runtime_error("USM allocation not enabled");
+    //if (tls_context_tutorial  == nullptr) throw std::runtime_error("USM allocation not enabled");
+    //if (tls_device_tutorial  == nullptr) throw std::runtime_error("USM allocation not enabled");
     if (tls_context_tutorial  == nullptr) {
       abort();
     }
     if (tls_device_tutorial  == nullptr) {
       abort();
     }
-    // -- GODOT end --
     
     tls_context_tutorial = nullptr;
     tls_device_tutorial = nullptr;
@@ -88,13 +82,11 @@ namespace embree
 
     assert((align & (align-1)) == 0);
     void* ptr = _mm_malloc(size,align);
-    // -- GODOT start --
-    // if (size != 0 && ptr == nullptr)
-    //   throw std::bad_alloc();
+    //if (size != 0 && ptr == nullptr)
+    //  throw std::bad_alloc();
     if (size != 0 && ptr == nullptr) {
       abort();
     }
-    // -- GODOT end --
     return ptr;
   }
 
@@ -123,13 +115,11 @@ namespace embree
     else
       ptr = sycl::aligned_alloc_shared(align,size,*device,*context);
       
-    // -- GODOT start --
-    // if (size != 0 && ptr == nullptr)
-    //   throw std::bad_alloc();
+    //if (size != 0 && ptr == nullptr)
+    //  throw std::bad_alloc();
     if (size != 0 && ptr == nullptr) {
       abort();
     }
-    // -- GODOT end --
 
     return ptr;
   }
@@ -275,12 +265,10 @@ namespace embree
     /* fall back to 4k pages */
     int flags = MEM_COMMIT | MEM_RESERVE;
     char* ptr = (char*) VirtualAlloc(nullptr,bytes,flags,PAGE_READWRITE);
-    // -- GODOT start --
-    // if (ptr == nullptr) throw std::bad_alloc();
+    //if (ptr == nullptr) throw std::bad_alloc();
     if (ptr == nullptr) {
       abort();
     }
-    // -- GODOT end --
     hugepages = false;
     return ptr;
   }
@@ -296,13 +284,11 @@ namespace embree
     if (bytesNew >= bytesOld)
       return bytesOld;
 
-    // -- GODOT start --
-    // if (!VirtualFree((char*)ptr+bytesNew,bytesOld-bytesNew,MEM_DECOMMIT))
-    //   throw std::bad_alloc();
+    //if (!VirtualFree((char*)ptr+bytesNew,bytesOld-bytesNew,MEM_DECOMMIT))
+    //  throw std::bad_alloc();
     if (!VirtualFree((char*)ptr+bytesNew,bytesOld-bytesNew,MEM_DECOMMIT)) {
       abort();
     }
-    // -- GODOT end --
 
     return bytesNew;
   }
@@ -312,13 +298,11 @@ namespace embree
     if (bytes == 0) 
       return;
 
-    // -- GODOT start --
-    // if (!VirtualFree(ptr,0,MEM_RELEASE))
-    //   throw std::bad_alloc();
+    //if (!VirtualFree(ptr,0,MEM_RELEASE))
+    //  throw std::bad_alloc();
     if (!VirtualFree(ptr,0,MEM_RELEASE)) {
       abort();
     }
-    // -- GODOT end --
   }
 
   void os_advise(void *ptr, size_t bytes)
@@ -422,12 +406,10 @@ namespace embree
 
     /* fallback to 4k pages */
     void* ptr = (char*) mmap(0, bytes, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
-    // -- GODOT start --
-    // if (ptr == MAP_FAILED) throw std::bad_alloc();
+    //if (ptr == MAP_FAILED) throw std::bad_alloc();
     if (ptr == MAP_FAILED) {
       abort();
     }
-    // -- GODOT end --
     hugepages = false;
 
     /* advise huge page hint for THP */
@@ -443,13 +425,11 @@ namespace embree
     if (bytesNew >= bytesOld)
       return bytesOld;
 
-    // -- GODOT start --
-    // if (munmap((char*)ptr+bytesNew,bytesOld-bytesNew) == -1)
-    //   throw std::bad_alloc();
+    //if (munmap((char*)ptr+bytesNew,bytesOld-bytesNew) == -1)
+    //  throw std::bad_alloc();
     if (munmap((char*)ptr+bytesNew,bytesOld-bytesNew) == -1) {
       abort();
     }
-    // -- GODOT end --
 
     return bytesNew;
   }
@@ -462,13 +442,11 @@ namespace embree
     /* for hugepages we need to also align the size */
     const size_t pageSize = hugepages ? PAGE_SIZE_2M : PAGE_SIZE_4K;
     bytes = (bytes+pageSize-1) & ~(pageSize-1);
-    // -- GODOT start --
-    // if (munmap(ptr,bytes) == -1)
-    //   throw std::bad_alloc();
+    //if (munmap(ptr,bytes) == -1)
+    //  throw std::bad_alloc();
     if (munmap(ptr,bytes) == -1) {
       abort();
     }
-    // -- GODOT end --
   }
 
   /* hint for transparent huge pages (THP) */

+ 1 - 3
thirdparty/embree/common/sys/alloc.h

@@ -160,10 +160,8 @@ namespace embree
       typedef std::ptrdiff_t difference_type;
 
       __forceinline pointer allocate( size_type n ) {
-        // -- GODOT start --
-        // throw std::runtime_error("no allocation supported");
+        //throw std::runtime_error("no allocation supported");
         abort();
-        // -- GODOT end --
       }
 
       __forceinline void deallocate( pointer p, size_type n ) {

+ 4 - 8
thirdparty/embree/common/sys/platform.h

@@ -213,19 +213,15 @@
 #define UPRINT4(x,y,z,w) embree_cout_uniform << STRING(x) << " = " << (x) << ", " << STRING(y) << " = " << (y) << ", " << STRING(z) << " = " << (z) << ", " << STRING(w) << " = " << (w) << embree_endl
 
 #if defined(DEBUG) // only report file and line in debug mode
-  // -- GODOT start --
-  // #define THROW_RUNTIME_ERROR(str) \
-  //   throw std::runtime_error(std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str));
+  //#define THROW_RUNTIME_ERROR(str) \
+  //  throw std::runtime_error(std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str));
   #define THROW_RUNTIME_ERROR(str) \
     printf("%s (%d): %s", __FILE__, __LINE__, std::string(str).c_str()), abort();
-  // -- GODOT end --
 #else
-  // -- GODOT start --
-  // #define THROW_RUNTIME_ERROR(str) \
-  //   throw std::runtime_error(str);
+  //#define THROW_RUNTIME_ERROR(str) \
+  //  throw std::runtime_error(str);
   #define THROW_RUNTIME_ERROR(str) \
     abort();
-  // -- GODOT end --
 #endif
 
 #define FATAL(x)   THROW_RUNTIME_ERROR(x)

+ 17 - 4
thirdparty/embree/common/sys/sysinfo.cpp

@@ -647,11 +647,9 @@ namespace embree
 #if defined(__EMSCRIPTEN__)
 #include <emscripten.h>
 
-// -- GODOT start --
 extern "C" {
 extern int godot_js_os_hw_concurrency_get();
 }
-// -- GODOT end --
 #endif
 
 namespace embree
@@ -665,9 +663,24 @@ namespace embree
     nThreads = sysconf(_SC_NPROCESSORS_ONLN); // does not work in Linux LXC container
     assert(nThreads);
 #elif defined(__EMSCRIPTEN__)
-    // -- GODOT start --
     nThreads = godot_js_os_hw_concurrency_get();
-    // -- GODOT end --
+#if 0
+    // WebAssembly supports pthreads, but not pthread_getaffinity_np. Get the number of logical
+    // threads from the browser or Node.js using JavaScript.
+    nThreads = MAIN_THREAD_EM_ASM_INT({
+        const isBrowser = typeof window !== 'undefined';
+        const isNode = typeof process !== 'undefined' && process.versions != null &&
+            process.versions.node != null;
+        if (isBrowser) {
+            // Return 1 if the browser does not expose hardwareConcurrency.
+            return window.navigator.hardwareConcurrency || 1;
+        } else if (isNode) {
+            return require('os').cpus().length;
+        } else {
+            return 1;
+        }
+    });
+#endif
 #else
     cpu_set_t set;
     if (pthread_getaffinity_np(pthread_self(), sizeof(set), &set) == 0)

+ 6 - 8
thirdparty/embree/common/tasking/taskschedulerinternal.cpp

@@ -48,15 +48,13 @@ namespace embree
     {
       Task* prevTask = thread.task;
       thread.task = this;
-      // -- GODOT start --
-      // try {
-      //   if (context->cancellingException == nullptr)
+      //try {
+      //  if (context->cancellingException == nullptr)
           closure->execute();
-      // } catch (...) {
-      //   if (context->cancellingException == nullptr)
-      //     context->cancellingException = std::current_exception();
-      // }
-      // -- GODOT end --
+      //} catch (...) {
+      //  if (context->cancellingException == nullptr)
+      //    context->cancellingException = std::current_exception();
+      //}
       thread.task = prevTask;
       add_dependencies(-1);
     }

+ 4 - 8
thirdparty/embree/common/tasking/taskschedulerinternal.h

@@ -130,13 +130,11 @@ namespace embree
       __forceinline void* alloc(size_t bytes, size_t align = 64)
       {
         size_t ofs = bytes + ((align - stackPtr) & (align-1));
-        // -- GODOT start --
-        // if (stackPtr + ofs > CLOSURE_STACK_SIZE)
-        //   throw std::runtime_error("closure stack overflow");
+        //if (stackPtr + ofs > CLOSURE_STACK_SIZE)
+        //  throw std::runtime_error("closure stack overflow");
         if (stackPtr + ofs > CLOSURE_STACK_SIZE) {
           abort();
         }
-        // -- GODOT end --
         stackPtr += ofs;
         return &stack[stackPtr-bytes];
       }
@@ -144,13 +142,11 @@ namespace embree
       template<typename Closure>
       __forceinline void push_right(Thread& thread, const size_t size, const Closure& closure, TaskGroupContext* context)
       {
-        // -- GODOT start --
-        // if (right >= TASK_STACK_SIZE)
-        //   throw std::runtime_error("task stack overflow");
+        //if (right >= TASK_STACK_SIZE)
+        //  throw std::runtime_error("task stack overflow");
         if (right >= TASK_STACK_SIZE) {
           abort();
         }
-        // -- GODOT end --
 
 	/* allocate new task on right side of stack */
         size_t oldStackPtr = stackPtr;

+ 1 - 3
thirdparty/embree/kernels/bvh/bvh_statistics.cpp

@@ -150,10 +150,8 @@ namespace embree
       }
     }
     else {
-      // -- GODOT start --
-      // throw std::runtime_error("not supported node type in bvh_statistics");
+      //throw std::runtime_error("not supported node type in bvh_statistics");
       abort();
-      // -- GODOT end --
     }
     return s;
   } 

+ 4 - 8
thirdparty/embree/kernels/common/alloc.h

@@ -189,13 +189,11 @@ namespace embree
       , atype(osAllocation ? EMBREE_OS_MALLOC : ALIGNED_MALLOC)
       , primrefarray(device,0)
     {
-      // -- GODOT start --
-      // if (osAllocation && useUSM)
-      //   throw std::runtime_error("USM allocation cannot be combined with OS allocation.");
+      //if (osAllocation && useUSM)
+      //  throw std::runtime_error("USM allocation cannot be combined with OS allocation.");
       if (osAllocation && useUSM) {
         abort();
       }
-      // -- GODOT end --
 
       for (size_t i=0; i<MAX_THREAD_USED_BLOCK_SLOTS; i++)
       {
@@ -507,13 +505,11 @@ namespace embree
         Block* myUsedBlocks = threadUsedBlocks[slot];
         if (myUsedBlocks) {
           void* ptr = myUsedBlocks->malloc(device,bytes,align,partial);
-          // -- GODOT start --
-          // if (ptr == nullptr && !blockAllocation)
-          //   throw std::bad_alloc();
+          //if (ptr == nullptr && !blockAllocation)
+          //  throw std::bad_alloc();
           if (ptr == nullptr && !blockAllocation) {
             abort();
           }
-          // -- GODOT end --
           if (ptr) return ptr;
         }
 

+ 9 - 13
thirdparty/embree/kernels/common/rtcore.cpp

@@ -257,17 +257,15 @@ RTC_NAMESPACE_BEGIN;
     RTC_TRACE(rtcSetSceneBuildQuality);
     RTC_VERIFY_HANDLE(hscene);
     RTC_ENTER_DEVICE(hscene);
-    // -- GODOT start --
-    // if (quality != RTC_BUILD_QUALITY_LOW &&
-    //     quality != RTC_BUILD_QUALITY_MEDIUM &&
-    //     quality != RTC_BUILD_QUALITY_HIGH)
-    //   throw std::runtime_error("invalid build quality");
+    //if (quality != RTC_BUILD_QUALITY_LOW &&
+    //    quality != RTC_BUILD_QUALITY_MEDIUM &&
+    //    quality != RTC_BUILD_QUALITY_HIGH)
+    //  throw std::runtime_error("invalid build quality");
     if (quality != RTC_BUILD_QUALITY_LOW &&
         quality != RTC_BUILD_QUALITY_MEDIUM &&
         quality != RTC_BUILD_QUALITY_HIGH) {
       abort();
     }
-    // -- GODOT end --
     scene->setBuildQuality(quality);
     RTC_CATCH_END2(scene);
   }
@@ -1570,19 +1568,17 @@ RTC_API void rtcSetGeometryTransform(RTCGeometry hgeometry, unsigned int timeSte
     RTC_TRACE(rtcSetGeometryBuildQuality);
     RTC_VERIFY_HANDLE(hgeometry);
     RTC_ENTER_DEVICE(hgeometry);
-    // -- GODOT start --
-    // if (quality != RTC_BUILD_QUALITY_LOW &&
-    //     quality != RTC_BUILD_QUALITY_MEDIUM &&
-    //     quality != RTC_BUILD_QUALITY_HIGH &&
-    //     quality != RTC_BUILD_QUALITY_REFIT)
-    //   throw std::runtime_error("invalid build quality");
+    //if (quality != RTC_BUILD_QUALITY_LOW &&
+    //    quality != RTC_BUILD_QUALITY_MEDIUM &&
+    //    quality != RTC_BUILD_QUALITY_HIGH &&
+    //    quality != RTC_BUILD_QUALITY_REFIT)
+    //  throw std::runtime_error("invalid build quality");
     if (quality != RTC_BUILD_QUALITY_LOW &&
         quality != RTC_BUILD_QUALITY_MEDIUM &&
         quality != RTC_BUILD_QUALITY_HIGH &&
         quality != RTC_BUILD_QUALITY_REFIT) {
       abort();
     }
-    // -- GODOT end --
     geometry->setBuildQuality(quality);
     RTC_CATCH_END2(geometry);
   }

+ 9 - 11
thirdparty/embree/kernels/common/rtcore.h

@@ -13,13 +13,13 @@ namespace embree
   __forceinline bool isIncoherent(RTCRayQueryFlags flags) { return (flags & RTC_RAY_QUERY_FLAG_COHERENT) == RTC_RAY_QUERY_FLAG_INCOHERENT; }
 
 /*! Macros used in the rtcore API implementation */
-// -- GODOT start --
-#define RTC_CATCH_BEGIN
-#define RTC_CATCH_END(device)
-#define RTC_CATCH_END2(scene)
-#define RTC_CATCH_END2_FALSE(scene) return false;
-#if 0
-// -- GODOT end --
+#if 1
+#  define RTC_CATCH_BEGIN
+#  define RTC_CATCH_END(device)
+#  define RTC_CATCH_END2(scene)
+#  define RTC_CATCH_END2_FALSE(scene) return false;
+#else
+  
 #define RTC_CATCH_BEGIN try {
   
 #define RTC_CATCH_END(device)                                                \
@@ -94,7 +94,6 @@ namespace embree
 #define RTC_TRACE(x) 
 #endif
 
-// -- GODOT start --
 #if 0
   /*! used to throw embree API errors */
   struct rtcore_error : public std::exception
@@ -116,13 +115,12 @@ namespace embree
 #if defined(DEBUG) // only report file and line in debug mode
   #define throw_RTCError(error,str) \
     printf("%s (%d): %s", __FILE__, __LINE__, std::string(str).c_str()), abort();
-    // throw rtcore_error(error,std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str));
+    //throw rtcore_error(error,std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str));
 #else
   #define throw_RTCError(error,str) \
     abort();
-    // throw rtcore_error(error,str);
+    //throw rtcore_error(error,str);
 #endif
-// -- GODOT end --
 
 #define RTC_BUILD_ARGUMENTS_HAS(settings,member) \
   (settings.byteSize > (offsetof(RTCBuildArguments,member)+sizeof(settings.member)))

+ 8 - 10
thirdparty/embree/kernels/common/scene.cpp

@@ -894,18 +894,16 @@ namespace embree
     }
 
     /* initiate build */
-    // -- GODOT start --
-    // try {
+    //try {
       TaskScheduler::TaskGroupContext context;
       scheduler->spawn_root([&]() { commit_task(); Lock<MutexSys> lock(taskGroup->schedulerMutex); taskGroup->scheduler = nullptr; }, &context, 1, !join);
-    // }
-    // catch (...) {
-    //   accels_clear();
-    //   Lock<MutexSys> lock(taskGroup->schedulerMutex);
-    //   taskGroup->scheduler = nullptr;
-    //   throw;
-    // }
-    // -- GODOT end --
+    //}
+    //catch (...) {
+    //  accels_clear();
+    //  Lock<MutexSys> lock(taskGroup->schedulerMutex);
+    //  taskGroup->scheduler = nullptr;
+    //  throw;
+    //}
   }
 
 #endif

+ 6 - 8
thirdparty/embree/kernels/common/state.cpp

@@ -194,15 +194,13 @@ namespace embree
   bool State::parseFile(const FileName& fileName)
   { 
     Ref<Stream<int> > file;
-    // -- GODOT start --
-    // try {
+    //try {
       file = new FileStream(fileName);
-    // }
-    // catch (std::runtime_error& e) {
-    //   (void) e;
-    //   return false;
-    // }
-    // -- GODOT end --
+    //}
+    //catch (std::runtime_error& e) {
+    //  (void) e;
+    //  return false;
+    //}
     
     std::vector<std::string> syms;
     for (size_t i=0; i<sizeof(symbols)/sizeof(void*); i++) 

+ 115 - 183
thirdparty/embree/patches/godot-changes-noexcept.patch → thirdparty/embree/patches/0001-disable-exceptions.patch

@@ -1,17 +1,15 @@
 diff --git a/thirdparty/embree/common/algorithms/parallel_reduce.h b/thirdparty/embree/common/algorithms/parallel_reduce.h
-index b52b1e2e13..51ec0a6405 100644
+index b52b1e2e13..fbff38f660 100644
 --- a/thirdparty/embree/common/algorithms/parallel_reduce.h
 +++ b/thirdparty/embree/common/algorithms/parallel_reduce.h
-@@ -58,15 +58,19 @@ namespace embree
+@@ -58,15 +58,15 @@ namespace embree
      const Value v = tbb::parallel_reduce(tbb::blocked_range<Index>(first,last,minStepSize),identity,
        [&](const tbb::blocked_range<Index>& r, const Value& start) { return reduction(start,func(range<Index>(r.begin(),r.end()))); },
        reduction,context);
 -    if (context.is_group_execution_cancelled())
 -      throw std::runtime_error("task cancelled");
-+    // -- GODOT start --
-+    // if (context.is_group_execution_cancelled())
-+    //   throw std::runtime_error("task cancelled");
-+    // -- GODOT end --
++    //if (context.is_group_execution_cancelled())
++    //  throw std::runtime_error("task cancelled");
      return v;
    #else
      const Value v = tbb::parallel_reduce(tbb::blocked_range<Index>(first,last,minStepSize),identity,
@@ -19,51 +17,45 @@ index b52b1e2e13..51ec0a6405 100644
        reduction);
 -    if (tbb::task::self().is_cancelled())
 -      throw std::runtime_error("task cancelled");
-+    // -- GODOT start --
-+    // if (tbb::task::self().is_cancelled())
-+    //   throw std::runtime_error("task cancelled");
-+    // -- GODOT end --
++    //if (tbb::task::self().is_cancelled())
++    //  throw std::runtime_error("task cancelled");
      return v;
    #endif
  #else // TASKING_PPL
 diff --git a/thirdparty/embree/common/lexers/stringstream.cpp b/thirdparty/embree/common/lexers/stringstream.cpp
-index 42ffb10176..c93da0b420 100644
+index 42ffb10176..fa4266d0b9 100644
 --- a/thirdparty/embree/common/lexers/stringstream.cpp
 +++ b/thirdparty/embree/common/lexers/stringstream.cpp
-@@ -39,7 +39,12 @@ namespace embree
+@@ -39,7 +39,10 @@ namespace embree
      std::vector<char> str; str.reserve(64);
      while (cin->peek() != EOF && !isSeparator(cin->peek())) {
        int c = cin->get();
 -      if (!isValidChar(c)) throw std::runtime_error("invalid character "+std::string(1,c)+" in input");
-+      // -- GODOT start --
-+      // if (!isValidChar(c)) throw std::runtime_error("invalid character "+std::string(1,c)+" in input");
++      //if (!isValidChar(c)) throw std::runtime_error("invalid character "+std::string(1,c)+" in input");
 +      if (!isValidChar(c)) {
 +        abort();
 +      }
-+      // -- GODOT end --
        str.push_back((char)c);
      }
      str.push_back(0);
 diff --git a/thirdparty/embree/common/sys/alloc.cpp b/thirdparty/embree/common/sys/alloc.cpp
-index de225fafc6..71616a3982 100644
+index de225fafc6..8e83646031 100644
 --- a/thirdparty/embree/common/sys/alloc.cpp
 +++ b/thirdparty/embree/common/sys/alloc.cpp
-@@ -24,16 +24,32 @@ namespace embree
+@@ -24,16 +24,28 @@ namespace embree
    
    void enableUSMAllocEmbree(sycl::context* context, sycl::device* device)
    {
 -    if (tls_context_embree != nullptr) throw std::runtime_error("USM allocation already enabled");
 -    if (tls_device_embree != nullptr) throw std::runtime_error("USM allocation already enabled");
-+    // -- GODOT start --
-+    // if (tls_context_embree != nullptr) throw std::runtime_error("USM allocation already enabled");
-+    // if (tls_device_embree != nullptr) throw std::runtime_error("USM allocation already enabled");
++    //if (tls_context_embree != nullptr) throw std::runtime_error("USM allocation already enabled");
++    //if (tls_device_embree != nullptr) throw std::runtime_error("USM allocation already enabled");
 +    if (tls_context_embree != nullptr) {
 +      abort();
 +    }
 +    if (tls_device_embree != nullptr) {
 +      abort();
 +    }
-+    // -- GODOT end --
      tls_context_embree = context;
      tls_device_embree = device;
    }
@@ -72,331 +64,292 @@ index de225fafc6..71616a3982 100644
    {
 -    if (tls_context_embree  == nullptr) throw std::runtime_error("USM allocation not enabled");
 -    if (tls_device_embree  == nullptr) throw std::runtime_error("USM allocation not enabled");
-+    // -- GODOT start --
-+    // if (tls_context_embree  == nullptr) throw std::runtime_error("USM allocation not enabled");
-+    // if (tls_device_embree  == nullptr) throw std::runtime_error("USM allocation not enabled");
++    //if (tls_context_embree  == nullptr) throw std::runtime_error("USM allocation not enabled");
++    //if (tls_device_embree  == nullptr) throw std::runtime_error("USM allocation not enabled");
 +    if (tls_context_embree  == nullptr) {
 +      abort();
 +    }
 +    if (tls_device_embree  == nullptr) {
 +      abort();
 +    }
-+    // -- GODOT end --
      tls_context_embree = nullptr;
      tls_device_embree = nullptr;
    }
-@@ -48,8 +64,16 @@ namespace embree
+@@ -48,8 +60,14 @@ namespace embree
  
    void disableUSMAllocTutorial()
    {
 -    if (tls_context_tutorial  == nullptr) throw std::runtime_error("USM allocation not enabled");
 -    if (tls_device_tutorial  == nullptr) throw std::runtime_error("USM allocation not enabled");
-+    // -- GODOT start --
-+    // if (tls_context_tutorial  == nullptr) throw std::runtime_error("USM allocation not enabled");
-+    // if (tls_device_tutorial  == nullptr) throw std::runtime_error("USM allocation not enabled");
++    //if (tls_context_tutorial  == nullptr) throw std::runtime_error("USM allocation not enabled");
++    //if (tls_device_tutorial  == nullptr) throw std::runtime_error("USM allocation not enabled");
 +    if (tls_context_tutorial  == nullptr) {
 +      abort();
 +    }
 +    if (tls_device_tutorial  == nullptr) {
 +      abort();
 +    }
-+    // -- GODOT end --
      
      tls_context_tutorial = nullptr;
      tls_device_tutorial = nullptr;
-@@ -64,8 +88,13 @@ namespace embree
+@@ -64,8 +82,11 @@ namespace embree
  
      assert((align & (align-1)) == 0);
      void* ptr = _mm_malloc(size,align);
 -    if (size != 0 && ptr == nullptr)
 -      throw std::bad_alloc();
-+    // -- GODOT start --
-+    // if (size != 0 && ptr == nullptr)
-+    //   throw std::bad_alloc();
++    //if (size != 0 && ptr == nullptr)
++    //  throw std::bad_alloc();
 +    if (size != 0 && ptr == nullptr) {
 +      abort();
 +    }
-+    // -- GODOT end --
      return ptr;
    }
  
-@@ -94,8 +123,13 @@ namespace embree
+@@ -94,8 +115,11 @@ namespace embree
      else
        ptr = sycl::aligned_alloc_shared(align,size,*device,*context);
        
 -    if (size != 0 && ptr == nullptr)
 -      throw std::bad_alloc();
-+    // -- GODOT start --
-+    // if (size != 0 && ptr == nullptr)
-+    //   throw std::bad_alloc();
++    //if (size != 0 && ptr == nullptr)
++    //  throw std::bad_alloc();
 +    if (size != 0 && ptr == nullptr) {
 +      abort();
 +    }
-+    // -- GODOT end --
  
      return ptr;
    }
-@@ -241,7 +275,12 @@ namespace embree
+@@ -241,7 +265,10 @@ namespace embree
      /* fall back to 4k pages */
      int flags = MEM_COMMIT | MEM_RESERVE;
      char* ptr = (char*) VirtualAlloc(nullptr,bytes,flags,PAGE_READWRITE);
 -    if (ptr == nullptr) throw std::bad_alloc();
-+    // -- GODOT start --
-+    // if (ptr == nullptr) throw std::bad_alloc();
++    //if (ptr == nullptr) throw std::bad_alloc();
 +    if (ptr == nullptr) {
 +      abort();
 +    }
-+    // -- GODOT end --
      hugepages = false;
      return ptr;
    }
-@@ -257,8 +296,13 @@ namespace embree
+@@ -257,8 +284,11 @@ namespace embree
      if (bytesNew >= bytesOld)
        return bytesOld;
  
 -    if (!VirtualFree((char*)ptr+bytesNew,bytesOld-bytesNew,MEM_DECOMMIT))
 -      throw std::bad_alloc();
-+    // -- GODOT start --
-+    // if (!VirtualFree((char*)ptr+bytesNew,bytesOld-bytesNew,MEM_DECOMMIT))
-+    //   throw std::bad_alloc();
++    //if (!VirtualFree((char*)ptr+bytesNew,bytesOld-bytesNew,MEM_DECOMMIT))
++    //  throw std::bad_alloc();
 +    if (!VirtualFree((char*)ptr+bytesNew,bytesOld-bytesNew,MEM_DECOMMIT)) {
 +      abort();
 +    }
-+    // -- GODOT end --
  
      return bytesNew;
    }
-@@ -268,8 +312,13 @@ namespace embree
+@@ -268,8 +298,11 @@ namespace embree
      if (bytes == 0) 
        return;
  
 -    if (!VirtualFree(ptr,0,MEM_RELEASE))
 -      throw std::bad_alloc();
-+    // -- GODOT start --
-+    // if (!VirtualFree(ptr,0,MEM_RELEASE))
-+    //   throw std::bad_alloc();
++    //if (!VirtualFree(ptr,0,MEM_RELEASE))
++    //  throw std::bad_alloc();
 +    if (!VirtualFree(ptr,0,MEM_RELEASE)) {
 +      abort();
 +    }
-+    // -- GODOT end --
    }
  
    void os_advise(void *ptr, size_t bytes)
-@@ -373,7 +422,12 @@ namespace embree
+@@ -373,7 +406,10 @@ namespace embree
  
      /* fallback to 4k pages */
      void* ptr = (char*) mmap(0, bytes, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
 -    if (ptr == MAP_FAILED) throw std::bad_alloc();
-+    // -- GODOT start --
-+    // if (ptr == MAP_FAILED) throw std::bad_alloc();
++    //if (ptr == MAP_FAILED) throw std::bad_alloc();
 +    if (ptr == MAP_FAILED) {
 +      abort();
 +    }
-+    // -- GODOT end --
      hugepages = false;
  
      /* advise huge page hint for THP */
-@@ -389,8 +443,13 @@ namespace embree
+@@ -389,8 +425,11 @@ namespace embree
      if (bytesNew >= bytesOld)
        return bytesOld;
  
 -    if (munmap((char*)ptr+bytesNew,bytesOld-bytesNew) == -1)
 -      throw std::bad_alloc();
-+    // -- GODOT start --
-+    // if (munmap((char*)ptr+bytesNew,bytesOld-bytesNew) == -1)
-+    //   throw std::bad_alloc();
++    //if (munmap((char*)ptr+bytesNew,bytesOld-bytesNew) == -1)
++    //  throw std::bad_alloc();
 +    if (munmap((char*)ptr+bytesNew,bytesOld-bytesNew) == -1) {
 +      abort();
 +    }
-+    // -- GODOT end --
  
      return bytesNew;
    }
-@@ -403,8 +462,13 @@ namespace embree
+@@ -403,8 +442,11 @@ namespace embree
      /* for hugepages we need to also align the size */
      const size_t pageSize = hugepages ? PAGE_SIZE_2M : PAGE_SIZE_4K;
      bytes = (bytes+pageSize-1) & ~(pageSize-1);
 -    if (munmap(ptr,bytes) == -1)
 -      throw std::bad_alloc();
-+    // -- GODOT start --
-+    // if (munmap(ptr,bytes) == -1)
-+    //   throw std::bad_alloc();
++    //if (munmap(ptr,bytes) == -1)
++    //  throw std::bad_alloc();
 +    if (munmap(ptr,bytes) == -1) {
 +      abort();
 +    }
-+    // -- GODOT end --
    }
  
    /* hint for transparent huge pages (THP) */
 diff --git a/thirdparty/embree/common/sys/alloc.h b/thirdparty/embree/common/sys/alloc.h
-index e19c2c221a..28b17f988d 100644
+index e19c2c221a..e2c942049a 100644
 --- a/thirdparty/embree/common/sys/alloc.h
 +++ b/thirdparty/embree/common/sys/alloc.h
-@@ -160,7 +160,10 @@ namespace embree
+@@ -160,7 +160,8 @@ namespace embree
        typedef std::ptrdiff_t difference_type;
  
        __forceinline pointer allocate( size_type n ) {
 -        throw std::runtime_error("no allocation supported");
-+        // -- GODOT start --
-+        // throw std::runtime_error("no allocation supported");
++        //throw std::runtime_error("no allocation supported");
 +        abort();
-+        // -- GODOT end --
        }
  
        __forceinline void deallocate( pointer p, size_type n ) {
 diff --git a/thirdparty/embree/common/sys/platform.h b/thirdparty/embree/common/sys/platform.h
-index 6dc0cf3318..d4a9b9e119 100644
+index 6dc0cf3318..9f08cd1516 100644
 --- a/thirdparty/embree/common/sys/platform.h
 +++ b/thirdparty/embree/common/sys/platform.h
-@@ -213,11 +213,19 @@
+@@ -213,11 +213,15 @@
  #define UPRINT4(x,y,z,w) embree_cout_uniform << STRING(x) << " = " << (x) << ", " << STRING(y) << " = " << (y) << ", " << STRING(z) << " = " << (z) << ", " << STRING(w) << " = " << (w) << embree_endl
  
  #if defined(DEBUG) // only report file and line in debug mode
-+  // -- GODOT start --
-+  // #define THROW_RUNTIME_ERROR(str) \
-+  //   throw std::runtime_error(std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str));
++  //#define THROW_RUNTIME_ERROR(str) \
++  //  throw std::runtime_error(std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str));
    #define THROW_RUNTIME_ERROR(str) \
 -    throw std::runtime_error(std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str));
 +    printf("%s (%d): %s", __FILE__, __LINE__, std::string(str).c_str()), abort();
-+  // -- GODOT end --
  #else
-+  // -- GODOT start --
-+  // #define THROW_RUNTIME_ERROR(str) \
-+  //   throw std::runtime_error(str);
++  //#define THROW_RUNTIME_ERROR(str) \
++  //  throw std::runtime_error(str);
    #define THROW_RUNTIME_ERROR(str) \
 -    throw std::runtime_error(str);
 +    abort();
-+  // -- GODOT end --
  #endif
  
  #define FATAL(x)   THROW_RUNTIME_ERROR(x)
 diff --git a/thirdparty/embree/common/tasking/taskschedulerinternal.cpp b/thirdparty/embree/common/tasking/taskschedulerinternal.cpp
-index 83ead95122..88b88a30ec 100644
+index 83ead95122..e89ae04f8b 100644
 --- a/thirdparty/embree/common/tasking/taskschedulerinternal.cpp
 +++ b/thirdparty/embree/common/tasking/taskschedulerinternal.cpp
-@@ -48,13 +48,15 @@ namespace embree
+@@ -48,13 +48,13 @@ namespace embree
      {
        Task* prevTask = thread.task;
        thread.task = this;
 -      try {
 -        if (context->cancellingException == nullptr)
-+      // -- GODOT start --
-+      // try {
-+      //   if (context->cancellingException == nullptr)
++      //try {
++      //  if (context->cancellingException == nullptr)
            closure->execute();
 -      } catch (...) {
 -        if (context->cancellingException == nullptr)
 -          context->cancellingException = std::current_exception();
 -      }
-+      // } catch (...) {
-+      //   if (context->cancellingException == nullptr)
-+      //     context->cancellingException = std::current_exception();
-+      // }
-+      // -- GODOT end --
++      //} catch (...) {
++      //  if (context->cancellingException == nullptr)
++      //    context->cancellingException = std::current_exception();
++      //}
        thread.task = prevTask;
        add_dependencies(-1);
      }
 diff --git a/thirdparty/embree/common/tasking/taskschedulerinternal.h b/thirdparty/embree/common/tasking/taskschedulerinternal.h
-index 355648b3f8..e72d3b72ba 100644
+index b01bebf7c3..4a04323b80 100644
 --- a/thirdparty/embree/common/tasking/taskschedulerinternal.h
 +++ b/thirdparty/embree/common/tasking/taskschedulerinternal.h
-@@ -130,8 +130,13 @@ namespace embree
+@@ -130,8 +130,11 @@ namespace embree
        __forceinline void* alloc(size_t bytes, size_t align = 64)
        {
          size_t ofs = bytes + ((align - stackPtr) & (align-1));
 -        if (stackPtr + ofs > CLOSURE_STACK_SIZE)
 -          throw std::runtime_error("closure stack overflow");
-+        // -- GODOT start --
-+        // if (stackPtr + ofs > CLOSURE_STACK_SIZE)
-+        //   throw std::runtime_error("closure stack overflow");
++        //if (stackPtr + ofs > CLOSURE_STACK_SIZE)
++        //  throw std::runtime_error("closure stack overflow");
 +        if (stackPtr + ofs > CLOSURE_STACK_SIZE) {
 +          abort();
 +        }
-+        // -- GODOT end --
          stackPtr += ofs;
          return &stack[stackPtr-bytes];
        }
-@@ -139,8 +144,13 @@ namespace embree
+@@ -139,8 +142,11 @@ namespace embree
        template<typename Closure>
        __forceinline void push_right(Thread& thread, const size_t size, const Closure& closure, TaskGroupContext* context)
        {
 -        if (right >= TASK_STACK_SIZE)
 -          throw std::runtime_error("task stack overflow");
-+        // -- GODOT start --
-+        // if (right >= TASK_STACK_SIZE)
-+        //   throw std::runtime_error("task stack overflow");
++        //if (right >= TASK_STACK_SIZE)
++        //  throw std::runtime_error("task stack overflow");
 +        if (right >= TASK_STACK_SIZE) {
 +          abort();
 +        }
-+        // -- GODOT end --
  
  	/* allocate new task on right side of stack */
          size_t oldStackPtr = stackPtr;
 diff --git a/thirdparty/embree/kernels/bvh/bvh_statistics.cpp b/thirdparty/embree/kernels/bvh/bvh_statistics.cpp
-index 40f9043736..57f75bfd7e 100644
+index 40f9043736..7ea9736c5c 100644
 --- a/thirdparty/embree/kernels/bvh/bvh_statistics.cpp
 +++ b/thirdparty/embree/kernels/bvh/bvh_statistics.cpp
-@@ -150,7 +150,10 @@ namespace embree
+@@ -150,7 +150,8 @@ namespace embree
        }
      }
      else {
 -      throw std::runtime_error("not supported node type in bvh_statistics");
-+      // -- GODOT start --
-+      // throw std::runtime_error("not supported node type in bvh_statistics");
++      //throw std::runtime_error("not supported node type in bvh_statistics");
 +      abort();
-+      // -- GODOT end --
      }
      return s;
    } 
 diff --git a/thirdparty/embree/kernels/common/alloc.h b/thirdparty/embree/kernels/common/alloc.h
-index 2bd292de4d..840d48c327 100644
+index 2bd292de4d..8ac22e53ec 100644
 --- a/thirdparty/embree/kernels/common/alloc.h
 +++ b/thirdparty/embree/kernels/common/alloc.h
-@@ -189,8 +189,13 @@ namespace embree
+@@ -189,8 +189,11 @@ namespace embree
        , atype(osAllocation ? EMBREE_OS_MALLOC : ALIGNED_MALLOC)
        , primrefarray(device,0)
      {
 -      if (osAllocation && useUSM)
 -        throw std::runtime_error("USM allocation cannot be combined with OS allocation.");
-+      // -- GODOT start --
-+      // if (osAllocation && useUSM)
-+      //   throw std::runtime_error("USM allocation cannot be combined with OS allocation.");
++      //if (osAllocation && useUSM)
++      //  throw std::runtime_error("USM allocation cannot be combined with OS allocation.");
 +      if (osAllocation && useUSM) {
 +        abort();
 +      }
-+      // -- GODOT end --
  
        for (size_t i=0; i<MAX_THREAD_USED_BLOCK_SLOTS; i++)
        {
-@@ -502,8 +507,13 @@ namespace embree
+@@ -502,8 +505,11 @@ namespace embree
          Block* myUsedBlocks = threadUsedBlocks[slot];
          if (myUsedBlocks) {
            void* ptr = myUsedBlocks->malloc(device,bytes,align,partial);
 -          if (ptr == nullptr && !blockAllocation)
 -            throw std::bad_alloc();
-+          // -- GODOT start --
-+          // if (ptr == nullptr && !blockAllocation)
-+          //   throw std::bad_alloc();
++          //if (ptr == nullptr && !blockAllocation)
++          //  throw std::bad_alloc();
 +          if (ptr == nullptr && !blockAllocation) {
 +            abort();
 +          }
-+          // -- GODOT end --
            if (ptr) return ptr;
          }
  
 diff --git a/thirdparty/embree/kernels/common/rtcore.cpp b/thirdparty/embree/kernels/common/rtcore.cpp
-index 8dc5d7045b..eb8d2c0a58 100644
+index 8dc5d7045b..e19c243bf6 100644
 --- a/thirdparty/embree/kernels/common/rtcore.cpp
 +++ b/thirdparty/embree/kernels/common/rtcore.cpp
-@@ -257,10 +257,17 @@ RTC_NAMESPACE_BEGIN;
+@@ -257,10 +257,15 @@ RTC_NAMESPACE_BEGIN;
      RTC_TRACE(rtcSetSceneBuildQuality);
      RTC_VERIFY_HANDLE(hscene);
      RTC_ENTER_DEVICE(hscene);
-+    // -- GODOT start --
-+    // if (quality != RTC_BUILD_QUALITY_LOW &&
-+    //     quality != RTC_BUILD_QUALITY_MEDIUM &&
-+    //     quality != RTC_BUILD_QUALITY_HIGH)
-+    //   throw std::runtime_error("invalid build quality");
++    //if (quality != RTC_BUILD_QUALITY_LOW &&
++    //    quality != RTC_BUILD_QUALITY_MEDIUM &&
++    //    quality != RTC_BUILD_QUALITY_HIGH)
++    //  throw std::runtime_error("invalid build quality");
      if (quality != RTC_BUILD_QUALITY_LOW &&
          quality != RTC_BUILD_QUALITY_MEDIUM &&
 -        quality != RTC_BUILD_QUALITY_HIGH)
@@ -404,20 +357,18 @@ index 8dc5d7045b..eb8d2c0a58 100644
 +        quality != RTC_BUILD_QUALITY_HIGH) {
 +      abort();
 +    }
-+    // -- GODOT end --
      scene->setBuildQuality(quality);
      RTC_CATCH_END2(scene);
    }
-@@ -1563,11 +1570,19 @@ RTC_API void rtcSetGeometryTransform(RTCGeometry hgeometry, unsigned int timeSte
+@@ -1563,11 +1568,17 @@ RTC_API void rtcSetGeometryTransform(RTCGeometry hgeometry, unsigned int timeSte
      RTC_TRACE(rtcSetGeometryBuildQuality);
      RTC_VERIFY_HANDLE(hgeometry);
      RTC_ENTER_DEVICE(hgeometry);
-+    // -- GODOT start --
-+    // if (quality != RTC_BUILD_QUALITY_LOW &&
-+    //     quality != RTC_BUILD_QUALITY_MEDIUM &&
-+    //     quality != RTC_BUILD_QUALITY_HIGH &&
-+    //     quality != RTC_BUILD_QUALITY_REFIT)
-+    //   throw std::runtime_error("invalid build quality");
++    //if (quality != RTC_BUILD_QUALITY_LOW &&
++    //    quality != RTC_BUILD_QUALITY_MEDIUM &&
++    //    quality != RTC_BUILD_QUALITY_HIGH &&
++    //    quality != RTC_BUILD_QUALITY_REFIT)
++    //  throw std::runtime_error("invalid build quality");
      if (quality != RTC_BUILD_QUALITY_LOW &&
          quality != RTC_BUILD_QUALITY_MEDIUM &&
          quality != RTC_BUILD_QUALITY_HIGH &&
@@ -426,44 +377,31 @@ index 8dc5d7045b..eb8d2c0a58 100644
 +        quality != RTC_BUILD_QUALITY_REFIT) {
 +      abort();
 +    }
-+    // -- GODOT end --
      geometry->setBuildQuality(quality);
      RTC_CATCH_END2(geometry);
    }
 diff --git a/thirdparty/embree/kernels/common/rtcore.h b/thirdparty/embree/kernels/common/rtcore.h
-index 73a061de11..47526482c1 100644
+index 73a061de11..cd7a6f4395 100644
 --- a/thirdparty/embree/kernels/common/rtcore.h
 +++ b/thirdparty/embree/kernels/common/rtcore.h
-@@ -13,13 +13,13 @@ namespace embree
+@@ -13,7 +13,7 @@ namespace embree
    __forceinline bool isIncoherent(RTCRayQueryFlags flags) { return (flags & RTC_RAY_QUERY_FLAG_COHERENT) == RTC_RAY_QUERY_FLAG_INCOHERENT; }
  
  /*! Macros used in the rtcore API implementation */
-+// -- GODOT start --
-+#define RTC_CATCH_BEGIN
-+#define RTC_CATCH_END(device)
-+#define RTC_CATCH_END2(scene)
-+#define RTC_CATCH_END2_FALSE(scene) return false;
- #if 0
--#  define RTC_CATCH_BEGIN
--#  define RTC_CATCH_END(device)
--#  define RTC_CATCH_END2(scene)
--#  define RTC_CATCH_END2_FALSE(scene) return false;
--#else
--  
-+// -- GODOT end --
- #define RTC_CATCH_BEGIN try {
-   
- #define RTC_CATCH_END(device)                                                \
-@@ -94,6 +94,8 @@ namespace embree
+-#if 0
++#if 1
+ #  define RTC_CATCH_BEGIN
+ #  define RTC_CATCH_END(device)
+ #  define RTC_CATCH_END2(scene)
+@@ -94,6 +94,7 @@ namespace embree
  #define RTC_TRACE(x) 
  #endif
  
-+// -- GODOT start --
 +#if 0
    /*! used to throw embree API errors */
    struct rtcore_error : public std::exception
    {
-@@ -109,14 +111,18 @@ namespace embree
+@@ -109,13 +110,16 @@ namespace embree
      RTCError error;
      std::string str;
    };
@@ -473,28 +411,25 @@ index 73a061de11..47526482c1 100644
    #define throw_RTCError(error,str) \
 -    throw rtcore_error(error,std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str));
 +    printf("%s (%d): %s", __FILE__, __LINE__, std::string(str).c_str()), abort();
-+    // throw rtcore_error(error,std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str));
++    //throw rtcore_error(error,std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str));
  #else
    #define throw_RTCError(error,str) \
 -    throw rtcore_error(error,str);
 +    abort();
-+    // throw rtcore_error(error,str);
++    //throw rtcore_error(error,str);
  #endif
-+// -- GODOT end --
  
  #define RTC_BUILD_ARGUMENTS_HAS(settings,member) \
-   (settings.byteSize > (offsetof(RTCBuildArguments,member)+sizeof(settings.member)))
 diff --git a/thirdparty/embree/kernels/common/scene.cpp b/thirdparty/embree/kernels/common/scene.cpp
-index fda8dd938a..10cb3c4bec 100644
+index fda8dd938a..706cc512df 100644
 --- a/thirdparty/embree/kernels/common/scene.cpp
 +++ b/thirdparty/embree/kernels/common/scene.cpp
-@@ -894,16 +894,18 @@ namespace embree
+@@ -894,16 +894,16 @@ namespace embree
      }
  
      /* initiate build */
 -    try {
-+    // -- GODOT start --
-+    // try {
++    //try {
        TaskScheduler::TaskGroupContext context;
        scheduler->spawn_root([&]() { commit_task(); Lock<MutexSys> lock(taskGroup->schedulerMutex); taskGroup->scheduler = nullptr; }, &context, 1, !join);
 -    }
@@ -504,40 +439,37 @@ index fda8dd938a..10cb3c4bec 100644
 -      taskGroup->scheduler = nullptr;
 -      throw;
 -    }
-+    // }
-+    // catch (...) {
-+    //   accels_clear();
-+    //   Lock<MutexSys> lock(taskGroup->schedulerMutex);
-+    //   taskGroup->scheduler = nullptr;
-+    //   throw;
-+    // }
-+    // -- GODOT end --
++    //}
++    //catch (...) {
++    //  accels_clear();
++    //  Lock<MutexSys> lock(taskGroup->schedulerMutex);
++    //  taskGroup->scheduler = nullptr;
++    //  throw;
++    //}
    }
  
  #endif
 diff --git a/thirdparty/embree/kernels/common/state.cpp b/thirdparty/embree/kernels/common/state.cpp
-index 4e3ab6ddfb..1d73ae9629 100644
+index 4e3ab6ddfb..8e83c95bd7 100644
 --- a/thirdparty/embree/kernels/common/state.cpp
 +++ b/thirdparty/embree/kernels/common/state.cpp
-@@ -194,13 +194,15 @@ namespace embree
+@@ -194,13 +194,13 @@ namespace embree
    bool State::parseFile(const FileName& fileName)
    { 
      Ref<Stream<int> > file;
 -    try {
-+    // -- GODOT start --
-+    // try {
++    //try {
        file = new FileStream(fileName);
 -    }
 -    catch (std::runtime_error& e) {
 -      (void) e;
 -      return false;
 -    }
-+    // }
-+    // catch (std::runtime_error& e) {
-+    //   (void) e;
-+    //   return false;
-+    // }
-+    // -- GODOT end --
++    //}
++    //catch (std::runtime_error& e) {
++    //  (void) e;
++    //  return false;
++    //}
      
      std::vector<std::string> syms;
      for (size_t i=0; i<sizeof(symbols)/sizeof(void*); i++) 

+ 0 - 0
thirdparty/embree/patches/godot-config-changes.patch → thirdparty/embree/patches/0002-godot-config.patch


+ 32 - 0
thirdparty/embree/patches/0003-emscripten-nthreads.patch

@@ -0,0 +1,32 @@
+diff --git a/thirdparty/embree/common/sys/sysinfo.cpp b/thirdparty/embree/common/sys/sysinfo.cpp
+index 61256b34f2..4583e49b1c 100644
+--- a/thirdparty/embree/common/sys/sysinfo.cpp
++++ b/thirdparty/embree/common/sys/sysinfo.cpp
+@@ -646,6 +646,10 @@ namespace embree
+ 
+ #if defined(__EMSCRIPTEN__)
+ #include <emscripten.h>
++
++extern "C" {
++extern int godot_js_os_hw_concurrency_get();
++}
+ #endif
+ 
+ namespace embree
+@@ -659,6 +663,8 @@ namespace embree
+     nThreads = sysconf(_SC_NPROCESSORS_ONLN); // does not work in Linux LXC container
+     assert(nThreads);
+ #elif defined(__EMSCRIPTEN__)
++    nThreads = godot_js_os_hw_concurrency_get();
++#if 0
+     // WebAssembly supports pthreads, but not pthread_getaffinity_np. Get the number of logical
+     // threads from the browser or Node.js using JavaScript.
+     nThreads = MAIN_THREAD_EM_ASM_INT({
+@@ -674,6 +680,7 @@ namespace embree
+             return 1;
+         }
+     });
++#endif
+ #else
+     cpu_set_t set;
+     if (pthread_getaffinity_np(pthread_self(), sizeof(set), &set) == 0)

+ 1 - 1
thirdparty/embree/patches/mingw-no-cpuidex.patch → thirdparty/embree/patches/0004-mingw-no-cpuidex.patch

@@ -1,5 +1,5 @@
 diff --git a/thirdparty/embree/common/sys/sysinfo.cpp b/thirdparty/embree/common/sys/sysinfo.cpp
-index d01eab3c9d..4ecab05265 100644
+index d5b653fe5a..4583e49b1c 100644
 --- a/thirdparty/embree/common/sys/sysinfo.cpp
 +++ b/thirdparty/embree/common/sys/sysinfo.cpp
 @@ -295,7 +295,7 @@ namespace embree

+ 18 - 24
thirdparty/embree/patches/mingw-llvm-arm64.diff → thirdparty/embree/patches/0005-mingw-llvm-arm64.patch

@@ -1,46 +1,40 @@
 diff --git a/thirdparty/embree/common/simd/arm/sse2neon.h b/thirdparty/embree/common/simd/arm/sse2neon.h
-index b18d41e783..c54d0b7951 100644
+index b18d41e783..5a75ccff20 100644
 --- a/thirdparty/embree/common/simd/arm/sse2neon.h
 +++ b/thirdparty/embree/common/simd/arm/sse2neon.h
-@@ -102,7 +102,9 @@
+@@ -102,7 +102,7 @@
  #include <stdint.h>
  #include <stdlib.h>
  
 -#if defined(_WIN32)
-+// -- GODOT start --
 +#if defined(_WIN32) && !defined(__MINGW32__)
-+// -- GODOT end --
  /* Definitions for _mm_{malloc,free} are provided by <malloc.h>
   * from both MinGW-w64 and MSVC.
   */
-@@ -2080,8 +2082,16 @@ FORCE_INLINE void *_mm_malloc(size_t size, size_t align)
+@@ -1888,7 +1888,11 @@ FORCE_INLINE __m128 _mm_div_ss(__m128 a, __m128 b)
+ #if !defined(SSE2NEON_ALLOC_DEFINED)
+ FORCE_INLINE void _mm_free(void *addr)
+ {
++#if defined(_WIN32)
++    _aligned_free(addr);
++#else
+     free(addr);
++#endif
+ }
+ #endif
+ 
+@@ -2080,8 +2084,14 @@ FORCE_INLINE void *_mm_malloc(size_t size, size_t align)
          return malloc(size);
      if (align == 2 || (sizeof(void *) == 8 && align == 4))
          align = sizeof(void *);
--    if (!posix_memalign(&ptr, align, size))
-+// -- GODOT start --
 +#if defined(_WIN32)
 +    ptr = _aligned_malloc(size, align);
 +    if (ptr)
-         return ptr;
-+#else
-+    if (!posix_memalign(&ptr, align, size))
 +        return ptr;
-+#endif
-+// -- GODOT end --
-     return NULL;
- }
- #endif
-@@ -1890,7 +1890,13 @@ FORCE_INLINE __m128 _mm_div_ss(__m128 a, __m128 b)
- #if !defined(SSE2NEON_ALLOC_DEFINED)
- FORCE_INLINE void _mm_free(void *addr)
- {
-+// -- GODOT start --
-+#if defined(_WIN32)
-+    _aligned_free(addr);
 +#else
-     free(addr);
+     if (!posix_memalign(&ptr, align, size))
+         return ptr;
 +#endif
-+// -- GODOT end --
+     return NULL;
  }
  #endif

+ 0 - 0
thirdparty/embree/patches/include-order-dllexport-fix.patch → thirdparty/embree/patches/0006-include-order-dllexport.patch


+ 0 - 42
thirdparty/embree/patches/emscripten-nthreads.patch

@@ -1,42 +0,0 @@
-diff --git a/thirdparty/embree/common/sys/sysinfo.cpp b/thirdparty/embree/common/sys/sysinfo.cpp
-index c98f61fa53..7f7a009a1e 100644
---- a/thirdparty/embree/common/sys/sysinfo.cpp
-+++ b/thirdparty/embree/common/sys/sysinfo.cpp
-@@ -640,6 +640,12 @@ namespace embree
- 
- #if defined(__EMSCRIPTEN__)
- #include <emscripten.h>
-+
-+// -- GODOT start --
-+extern "C" {
-+extern int godot_js_os_hw_concurrency_get();
-+}
-+// -- GODOT end --
- #endif
- 
- namespace embree
-@@ -653,21 +659,9 @@ namespace embree
-     nThreads = sysconf(_SC_NPROCESSORS_ONLN); // does not work in Linux LXC container
-     assert(nThreads);
- #elif defined(__EMSCRIPTEN__)
--    // WebAssembly supports pthreads, but not pthread_getaffinity_np. Get the number of logical
--    // threads from the browser or Node.js using JavaScript.
--    nThreads = MAIN_THREAD_EM_ASM_INT({
--        const isBrowser = typeof window !== 'undefined';
--        const isNode = typeof process !== 'undefined' && process.versions != null &&
--            process.versions.node != null;
--        if (isBrowser) {
--            // Return 1 if the browser does not expose hardwareConcurrency.
--            return window.navigator.hardwareConcurrency || 1;
--        } else if (isNode) {
--            return require('os').cpus().length;
--        } else {
--            return 1;
--        }
--    });
-+    // -- GODOT start --
-+    nThreads = godot_js_os_hw_concurrency_get();
-+    // -- GODOT end --
- #else
-     cpu_set_t set;
-     if (pthread_getaffinity_np(pthread_self(), sizeof(set), &set) == 0)

+ 2 - 8
thirdparty/enet/enet/enet.h

@@ -13,7 +13,6 @@ extern "C"
 #include <stdint.h>
 #include <stdlib.h>
 
-// -- Godot start --
 #if 0
 #ifdef _WIN32
 #include "enet/win32.h"
@@ -21,8 +20,7 @@ extern "C"
 #include "enet/unix.h"
 #endif
 #endif
-#include "enet/godot.h"
-// -- Godot end --
+#include "enet/enet_godot.h"
 
 #include "enet/types.h"
 #include "enet/protocol.h"
@@ -93,7 +91,6 @@ typedef enum _ENetSocketShutdown
  * but not for enet_host_create.  Once a server responds to a broadcast, the
  * address is updated from ENET_HOST_BROADCAST to the server's actual IP address.
  */
-// -- Godot start --
 #if 0
 typedef struct _ENetAddress
 {
@@ -101,7 +98,6 @@ typedef struct _ENetAddress
    enet_uint16 port;
 } ENetAddress;
 #endif
-// -- Godot end --
 
 /**
  * Packet flag bit constants.
@@ -618,9 +614,7 @@ ENET_API size_t enet_range_coder_decompress (void *, const enet_uint8 *, size_t,
    
 extern size_t enet_protocol_command_size (enet_uint8);
 
-// -- Godot start --
-#include "enet/godot_ext.h"
-// -- Godot end --
+#include "enet/enet_godot_ext.h"
 
 #ifdef __cplusplus
 }

+ 2 - 2
thirdparty/enet/enet/godot.h → thirdparty/enet/enet/enet_godot.h

@@ -1,5 +1,5 @@
 /**************************************************************************/
-/*  godot.h                                                               */
+/*  enet_godot.h                                                          */
 /**************************************************************************/
 /*                         This file is part of:                          */
 /*                             GODOT ENGINE                               */
@@ -29,7 +29,7 @@
 /**************************************************************************/
 
 /**
- @file  godot.h
+ @file  enet_godot.h
  @brief ENet Godot header
 */
 

+ 53 - 0
thirdparty/enet/enet/enet_godot_ext.h

@@ -0,0 +1,53 @@
+/**************************************************************************/
+/*  enet_godot_ext.h                                                      */
+/**************************************************************************/
+/*                         This file is part of:                          */
+/*                             GODOT ENGINE                               */
+/*                        https://godotengine.org                         */
+/**************************************************************************/
+/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */
+/*                                                                        */
+/* Permission is hereby granted, free of charge, to any person obtaining  */
+/* a copy of this software and associated documentation files (the        */
+/* "Software"), to deal in the Software without restriction, including    */
+/* without limitation the rights to use, copy, modify, merge, publish,    */
+/* distribute, sublicense, and/or sell copies of the Software, and to     */
+/* permit persons to whom the Software is furnished to do so, subject to  */
+/* the following conditions:                                              */
+/*                                                                        */
+/* The above copyright notice and this permission notice shall be         */
+/* included in all copies or substantial portions of the Software.        */
+/*                                                                        */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */
+/**************************************************************************/
+
+/**
+ @ *file  enet_godot_ext.h
+ @brief ENet Godot extensions header
+ */
+
+#ifndef __ENET_GODOT_EXT_H__
+#define __ENET_GODOT_EXT_H__
+
+/** Sets the host field in the address parameter from ip struct.
+    @param address destination to store resolved address
+    @param ip the ip struct to read from
+    @param size the size of the ip struct.
+    @retval 0 on success
+    @retval != 0 on failure
+    @returns the address of the given ip in address on success.
+*/
+ENET_API void enet_address_set_ip(ENetAddress * address, const uint8_t * ip, size_t size);
+
+ENET_API int enet_host_dtls_server_setup (ENetHost *, void *);
+ENET_API int enet_host_dtls_client_setup (ENetHost *, const char *, void *);
+ENET_API void enet_host_refuse_new_connections (ENetHost *, int);
+
+#endif // __ENET_GODOT_EXT_H__

+ 0 - 18
thirdparty/enet/enet/godot_ext.h

@@ -1,18 +0,0 @@
-#ifndef __ENET_GODOT_EXT_H__
-#define __ENET_GODOT_EXT_H__
-
-/** Sets the host field in the address parameter from ip struct.
-    @param address destination to store resolved address
-    @param ip the ip struct to read from
-    @param size the size of the ip struct.
-    @retval 0 on success
-    @retval != 0 on failure
-    @returns the address of the given ip in address on success.
-*/
-ENET_API void enet_address_set_ip(ENetAddress * address, const uint8_t * ip, size_t size);
-
-ENET_API int enet_host_dtls_server_setup (ENetHost *, void *);
-ENET_API int enet_host_dtls_client_setup (ENetHost *, const char *, void *);
-ENET_API void enet_host_refuse_new_connections (ENetHost *, int);
-
-#endif // __ENET_GODOT_EXT_H__

+ 2 - 2
thirdparty/enet/godot.cpp → thirdparty/enet/enet_godot.cpp

@@ -1,5 +1,5 @@
 /**************************************************************************/
-/*  godot.cpp                                                             */
+/*  enet_godot.cpp                                                        */
 /**************************************************************************/
 /*                         This file is part of:                          */
 /*                             GODOT ENGINE                               */
@@ -29,7 +29,7 @@
 /**************************************************************************/
 
 /**
- @file  godot.cpp
+ @file  enet_godot.cpp
  @brief ENet Godot specific functions
 */
 

+ 6 - 12
thirdparty/enet/patches/godot_socket.patch → thirdparty/enet/patches/0001-godot-socket.patch

@@ -1,15 +1,14 @@
 diff --git a/thirdparty/enet/enet/enet.h b/thirdparty/enet/enet/enet.h
-index 4a207041b3..5232f8a869 100644
+index 3001018763..ccd8382c23 100644
 --- a/thirdparty/enet/enet/enet.h
 +++ b/thirdparty/enet/enet/enet.h
-@@ -10,13 +10,19 @@ extern "C"
+@@ -10,13 +10,17 @@ extern "C"
  {
  #endif
  
 +#include <stdint.h>
  #include <stdlib.h>
  
-+// -- Godot start --
 +#if 0
  #ifdef _WIN32
  #include "enet/win32.h"
@@ -17,16 +16,14 @@ index 4a207041b3..5232f8a869 100644
  #include "enet/unix.h"
  #endif
 +#endif
-+#include "enet/godot.h"
-+// -- Godot end --
++#include "enet/enet_godot.h"
  
  #include "enet/types.h"
  #include "enet/protocol.h"
-@@ -87,11 +93,15 @@ typedef enum _ENetSocketShutdown
+@@ -87,11 +91,13 @@ typedef enum _ENetSocketShutdown
   * but not for enet_host_create.  Once a server responds to a broadcast, the
   * address is updated from ENET_HOST_BROADCAST to the server's actual IP address.
   */
-+// -- Godot start --
 +#if 0
  typedef struct _ENetAddress
  {
@@ -34,17 +31,14 @@ index 4a207041b3..5232f8a869 100644
     enet_uint16 port;
  } ENetAddress;
 +#endif
-+// -- Godot end --
  
  /**
   * Packet flag bit constants.
-@@ -608,6 +618,10 @@ ENET_API size_t enet_range_coder_decompress (void *, const enet_uint8 *, size_t,
+@@ -608,6 +614,8 @@ ENET_API size_t enet_range_coder_decompress (void *, const enet_uint8 *, size_t,
     
  extern size_t enet_protocol_command_size (enet_uint8);
  
-+// -- Godot start --
-+#include "enet/godot_ext.h"
-+// -- Godot end --
++#include "enet/enet_godot_ext.h"
 +
  #ifdef __cplusplus
  }

+ 0 - 0
thirdparty/etcpak/patches/bc7e_remove.patch → thirdparty/etcpak/patches/0001-remove-bc7enc.patch


+ 2 - 2
thirdparty/glad/patches/patch_enable_both_gl_and_gles.diff → thirdparty/glad/patches/0001-enable-both-gl-and-gles.patch

@@ -1,5 +1,5 @@
 diff --git a/thirdparty/glad/gl.c b/thirdparty/glad/gl.c
-index a0b59dbbfb..9f10f6544a 100644
+index e8cc5ff1d9..ee0cc188fc 100644
 --- a/thirdparty/glad/gl.c
 +++ b/thirdparty/glad/gl.c
 @@ -2475,7 +2475,7 @@ static GLADapiproc glad_gl_get_proc(void *vuserptr, const char *name) {
@@ -49,7 +49,7 @@ index a0b59dbbfb..9f10f6544a 100644
  }
  
 diff --git a/thirdparty/glad/glad/gl.h b/thirdparty/glad/glad/gl.h
-index 905c16aeed..f3cb7d8cb5 100644
+index 7f77d6a13f..307ea4dbb8 100644
 --- a/thirdparty/glad/glad/gl.h
 +++ b/thirdparty/glad/glad/gl.h
 @@ -67,6 +67,7 @@

+ 1 - 1
thirdparty/glslang/patches/disable-absolute-paths-for-apple-compat.patch → thirdparty/glslang/patches/0001-apple-disable-absolute-paths.patch

@@ -1,5 +1,5 @@
 diff --git a/thirdparty/glslang/glslang/Include/InfoSink.h b/thirdparty/glslang/glslang/Include/InfoSink.h
-index 23f495dc..137ede85 100644
+index 23f495dcb7..137ede8510 100644
 --- a/thirdparty/glslang/glslang/Include/InfoSink.h
 +++ b/thirdparty/glslang/glslang/Include/InfoSink.h
 @@ -36,7 +36,7 @@

+ 0 - 0
thirdparty/glslang/patches/fix-build-gcc15.patch → thirdparty/glslang/patches/0002-gcc15-include-fix.patch


+ 0 - 0
thirdparty/jpeg-compressor/patches/clang-fortify-fix.patch → thirdparty/jpeg-compressor/patches/0001-clang-fortify-fix.patch


+ 5 - 12
thirdparty/libbacktrace/patches/patch_big_files.diff → thirdparty/libbacktrace/patches/0001-big-files-support.patch

@@ -1,8 +1,8 @@
 diff --git a/thirdparty/libbacktrace/read.c b/thirdparty/libbacktrace/read.c
-index 1811c8d2e0..fda8e222d4 100644
+index 7af66602fd..a7e937667c 100644
 --- a/thirdparty/libbacktrace/read.c
 +++ b/thirdparty/libbacktrace/read.c
-@@ -52,14 +52,9 @@ backtrace_get_view (struct backtrace_state *state, int descriptor,
+@@ -52,14 +52,7 @@ backtrace_get_view (struct backtrace_state *state, int descriptor,
  {
    uint64_t got;
    ssize_t r;
@@ -14,34 +14,27 @@ index 1811c8d2e0..fda8e222d4 100644
 -    }
 -
 -  if (lseek (descriptor, offset, SEEK_SET) < 0)
-+/* GODOT start */
 +  if (_lseeki64 (descriptor, offset, SEEK_SET) < 0)
-+/* GODOT end */
      {
        error_callback (data, "lseek", errno);
        return 0;
-@@ -74,7 +69,13 @@ backtrace_get_view (struct backtrace_state *state, int descriptor,
+@@ -74,7 +67,10 @@ backtrace_get_view (struct backtrace_state *state, int descriptor,
    got = 0;
    while (got < size)
      {
 -      r = read (descriptor, view->base, size - got);
-+/* GODOT start */
 +      uint64_t sz = size - got;
-+      if (sz > INT_MAX) {
++      if (sz > INT_MAX)
 +        sz = INT_MAX;
-+      }
 +      r = _read (descriptor, view->base, sz);
-+/* GODOT end */
        if (r < 0)
  	{
  	  error_callback (data, "read", errno);
-@@ -84,6 +85,9 @@ backtrace_get_view (struct backtrace_state *state, int descriptor,
+@@ -84,6 +80,7 @@ backtrace_get_view (struct backtrace_state *state, int descriptor,
        if (r == 0)
  	break;
        got += (uint64_t) r;
-+/* GODOT start */
 +      view->base += r;
-+/* GODOT end */
      }
  
    if (got < size)

+ 1 - 8
thirdparty/libbacktrace/read.c

@@ -52,9 +52,7 @@ backtrace_get_view (struct backtrace_state *state, int descriptor,
 {
   uint64_t got;
   ssize_t r;
-/* GODOT start */
   if (_lseeki64 (descriptor, offset, SEEK_SET) < 0)
-/* GODOT end */
     {
       error_callback (data, "lseek", errno);
       return 0;
@@ -69,13 +67,10 @@ backtrace_get_view (struct backtrace_state *state, int descriptor,
   got = 0;
   while (got < size)
     {
-/* GODOT start */
       uint64_t sz = size - got;
-      if (sz > INT_MAX) {
+      if (sz > INT_MAX)
         sz = INT_MAX;
-      }
       r = _read (descriptor, view->base, sz);
-/* GODOT end */
       if (r < 0)
 	{
 	  error_callback (data, "read", errno);
@@ -85,9 +80,7 @@ backtrace_get_view (struct backtrace_state *state, int descriptor,
       if (r == 0)
 	break;
       got += (uint64_t) r;
-/* GODOT start */
       view->base += r;
-/* GODOT end */
     }
 
   if (got < size)

+ 30 - 0
thirdparty/libktx/patches/0001-external-basisu.patch

@@ -0,0 +1,30 @@
+diff --git a/thirdparty/libktx/lib/basis_transcode.cpp b/thirdparty/libktx/lib/basis_transcode.cpp
+index ca68545e4a..d7ecb7a0fd 100644
+--- a/thirdparty/libktx/lib/basis_transcode.cpp
++++ b/thirdparty/libktx/lib/basis_transcode.cpp
+@@ -29,9 +29,9 @@
+ #include "vkformat_enum.h"
+ #include "vk_format.h"
+ #include "basis_sgd.h"
+-#include "basisu/transcoder/basisu_file_headers.h"
+-#include "basisu/transcoder/basisu_transcoder.h"
+-#include "basisu/transcoder/basisu_transcoder_internal.h"
++#include "transcoder/basisu_file_headers.h"
++#include "transcoder/basisu_transcoder.h"
++#include "transcoder/basisu_transcoder_internal.h"
+ 
+ #undef DECLARE_PRIVATE
+ #undef DECLARE_PROTECTED
+diff --git a/thirdparty/libktx/lib/miniz_wrapper.cpp b/thirdparty/libktx/lib/miniz_wrapper.cpp
+index 07920c4809..cbd7da540a 100644
+--- a/thirdparty/libktx/lib/miniz_wrapper.cpp
++++ b/thirdparty/libktx/lib/miniz_wrapper.cpp
+@@ -30,7 +30,7 @@
+ #pragma GCC diagnostic ignored "-Wextra"
+ #pragma GCC diagnostic ignored "-Wmisleading-indentation"
+ #endif
+-#include "basisu/encoder/basisu_miniz.h"
++#include "encoder/basisu_miniz.h"
+ #ifdef __GNUC__
+ #pragma GCC diagnostic pop
+ #endif

+ 0 - 30
thirdparty/libktx/patches/godot.patch → thirdparty/libktx/patches/0002-disable-astc-block-ext.patch

@@ -1,20 +1,3 @@
-diff --git a/thirdparty/libktx/lib/basis_transcode.cpp b/thirdparty/libktx/lib/basis_transcode.cpp
-index ca68545e4a..d7ecb7a0fd 100644
---- a/thirdparty/libktx/lib/basis_transcode.cpp
-+++ b/thirdparty/libktx/lib/basis_transcode.cpp
-@@ -29,9 +29,9 @@
- #include "vkformat_enum.h"
- #include "vk_format.h"
- #include "basis_sgd.h"
--#include "basisu/transcoder/basisu_file_headers.h"
--#include "basisu/transcoder/basisu_transcoder.h"
--#include "basisu/transcoder/basisu_transcoder_internal.h"
-+#include "transcoder/basisu_file_headers.h"
-+#include "transcoder/basisu_transcoder.h"
-+#include "transcoder/basisu_transcoder_internal.h"
- 
- #undef DECLARE_PRIVATE
- #undef DECLARE_PROTECTED
 diff --git a/thirdparty/libktx/lib/dfdutils/vk2dfd.inl b/thirdparty/libktx/lib/dfdutils/vk2dfd.inl
 index 5104c8fcb4..3398441e8c 100644
 --- a/thirdparty/libktx/lib/dfdutils/vk2dfd.inl
@@ -35,16 +18,3 @@ index 5104c8fcb4..3398441e8c 100644
  case VK_FORMAT_R16G16_S10_5_NV: return createDFDUnpacked(0, 2, 2, 0, s_S10_5);
  case VK_FORMAT_A1B5G5R5_UNORM_PACK16_KHR: {
      int channels[] = {0,1,2,3}; int bits[] = {5,5,5,1};
-diff --git a/thirdparty/libktx/lib/miniz_wrapper.cpp b/thirdparty/libktx/lib/miniz_wrapper.cpp
-index 07920c4809..cbd7da540a 100644
---- a/thirdparty/libktx/lib/miniz_wrapper.cpp
-+++ b/thirdparty/libktx/lib/miniz_wrapper.cpp
-@@ -30,7 +30,7 @@
- #pragma GCC diagnostic ignored "-Wextra"
- #pragma GCC diagnostic ignored "-Wmisleading-indentation"
- #endif
--#include "basisu/encoder/basisu_miniz.h"
-+#include "encoder/basisu_miniz.h"
- #ifdef __GNUC__
- #pragma GCC diagnostic pop
- #endif

+ 4 - 6
thirdparty/libwebp/patches/godot-node-debug-fix.patch → thirdparty/libwebp/patches/0001-msvc-node-debug-rename.patch

@@ -1,15 +1,13 @@
 diff --git a/thirdparty/libwebp/src/enc/quant_enc.c b/thirdparty/libwebp/src/enc/quant_enc.c
-index 6d8202d277..8f9a3c8668 100644
---- a/src/enc/quant_enc.c
-+++ b/src/enc/quant_enc.c
-@@ -556,6 +556,11 @@ static void AddScore(VP8ModeScore* WEBP_RESTRICT const dst,
+index 6d8202d277..302e8047f2 100644
+--- a/thirdparty/libwebp/src/enc/quant_enc.c
++++ b/thirdparty/libwebp/src/enc/quant_enc.c
+@@ -556,6 +556,9 @@ static void AddScore(VP8ModeScore* WEBP_RESTRICT const dst,
  //------------------------------------------------------------------------------
  // Performs trellis-optimized quantization.
  
-+// -- GODOT start --
 +// Prevents Visual Studio debugger from using this Node struct in place of the Godot Node class.
 +#define Node Node_libwebp_quant
-+// -- GODOT end --
 +
  // Trellis node
  typedef struct {

+ 2 - 4
thirdparty/libwebp/patches/godot-msvc-arm64-fpstrict-fix.patch → thirdparty/libwebp/patches/0002-msvc-arm64-fpstrict.patch

@@ -1,18 +1,16 @@
 diff --git a/thirdparty/libwebp/sharpyuv/sharpyuv_gamma.c b/thirdparty/libwebp/sharpyuv/sharpyuv_gamma.c
-index 09028428ac..3184e2b80f 100644
+index 09028428ac..6f1a88bf1a 100644
 --- a/thirdparty/libwebp/sharpyuv/sharpyuv_gamma.c
 +++ b/thirdparty/libwebp/sharpyuv/sharpyuv_gamma.c
-@@ -26,7 +26,13 @@ static uint32_t kGammaToLinearTabS[GAMMA_TO_LINEAR_TAB_SIZE + 2];
+@@ -26,7 +26,11 @@ static uint32_t kGammaToLinearTabS[GAMMA_TO_LINEAR_TAB_SIZE + 2];
  #define LINEAR_TO_GAMMA_TAB_SIZE (1 << LINEAR_TO_GAMMA_TAB_BITS)
  static uint32_t kLinearToGammaTabS[LINEAR_TO_GAMMA_TAB_SIZE + 2];
  
-+// -- GODOT start --
 +#if defined(_MSC_VER)
 +static const double kGammaF = 2.222222222222222;
 +#else
  static const double kGammaF = 1. / 0.45;
 +#endif
-+// -- GODOT end --
  #define GAMMA_TO_LINEAR_BITS 16
  
  static volatile int kGammaTablesSOk = 0;

+ 0 - 0
thirdparty/libwebp/patches/godot-clang-cl-fix.patch → thirdparty/libwebp/patches/0003-clang-cl-sse2-sse41.patch


+ 0 - 2
thirdparty/libwebp/sharpyuv/sharpyuv_gamma.c

@@ -26,13 +26,11 @@ static uint32_t kGammaToLinearTabS[GAMMA_TO_LINEAR_TAB_SIZE + 2];
 #define LINEAR_TO_GAMMA_TAB_SIZE (1 << LINEAR_TO_GAMMA_TAB_BITS)
 static uint32_t kLinearToGammaTabS[LINEAR_TO_GAMMA_TAB_SIZE + 2];
 
-// -- GODOT start --
 #if defined(_MSC_VER)
 static const double kGammaF = 2.222222222222222;
 #else
 static const double kGammaF = 1. / 0.45;
 #endif
-// -- GODOT end --
 #define GAMMA_TO_LINEAR_BITS 16
 
 static volatile int kGammaTablesSOk = 0;

+ 0 - 2
thirdparty/libwebp/src/enc/quant_enc.c

@@ -556,10 +556,8 @@ static void AddScore(VP8ModeScore* WEBP_RESTRICT const dst,
 //------------------------------------------------------------------------------
 // Performs trellis-optimized quantization.
 
-// -- GODOT start --
 // Prevents Visual Studio debugger from using this Node struct in place of the Godot Node class.
 #define Node Node_libwebp_quant
-// -- GODOT end --
 
 // Trellis node
 typedef struct {

+ 4 - 1
thirdparty/linuxbsd_headers/README.md

@@ -11,7 +11,10 @@ readability.
 - Version: 1.1.3-5
 - License: LGPL-2.1+
 
-Patches in the `patches` directory should be re-applied after updates.
+Patches:
+
+- `0001-musl-standard-poll.patch` (GH-71934)
+- `0002-freebsd-sys-endian.patch` (GH-100047)
 
 
 ## dbus

+ 13 - 0
thirdparty/linuxbsd_headers/alsa/patches/0001-musl-standard-poll.patch

@@ -0,0 +1,13 @@
+diff --git a/thirdparty/linuxbsd_headers/alsa/asoundlib.h b/thirdparty/linuxbsd_headers/alsa/asoundlib.h
+index 3c2766e325..a546194382 100644
+--- a/thirdparty/linuxbsd_headers/alsa/asoundlib.h
++++ b/thirdparty/linuxbsd_headers/alsa/asoundlib.h
+@@ -35,7 +35,7 @@
+ #include <string.h>
+ #include <fcntl.h>
+ #include <assert.h>
+-#include <sys/poll.h>
++#include <poll.h>
+ #include <errno.h>
+ #include <stdarg.h>
+ #include <endian.h>

+ 0 - 0
thirdparty/linuxbsd_headers/alsa/patches/freebsd_endian.diff → thirdparty/linuxbsd_headers/alsa/patches/0002-freebsd-sys-endian.patch


+ 0 - 11
thirdparty/linuxbsd_headers/alsa/patches/use-standard-poll-h.diff

@@ -1,11 +0,0 @@
---- a/asoundlib.h
-+++ b/asoundlib.h
-@@ -35,7 +35,7 @@
- #include <string.h>
- #include <fcntl.h>
- #include <assert.h>
--#include <sys/poll.h>
-+#include <poll.h>
- #include <errno.h>
- #include <stdarg.h>
- #include <endian.h>

+ 0 - 0
thirdparty/mbedtls/patches/msvc-redeclaration-bug.diff → thirdparty/mbedtls/patches/0001-msvc-2019-psa-redeclaration.patch


+ 0 - 0
thirdparty/meshoptimizer/patches/distance-only-metric.patch → thirdparty/meshoptimizer/patches/0001-simplifier-distance-only-error.patch


+ 4 - 53
thirdparty/mingw-std-threads/godot.patch → thirdparty/mingw-std-threads/patches/0001-disable-exceptions.patch

@@ -1,16 +1,7 @@
 diff --git a/thirdparty/mingw-std-threads/mingw.condition_variable.h b/thirdparty/mingw-std-threads/mingw.condition_variable.h
-index 50c5ebd6df..d099fad2ec 100644
+index 05086ac429..d099fad2ec 100644
 --- a/thirdparty/mingw-std-threads/mingw.condition_variable.h
 +++ b/thirdparty/mingw-std-threads/mingw.condition_variable.h
-@@ -58,7 +58,7 @@
- 
- namespace mingw_stdthread
- {
--#if defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS)
-+#if defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS) && !defined(__clang__)
- enum class cv_status { no_timeout, timeout };
- #else
- using std::cv_status;
 @@ -87,12 +87,12 @@ public:
          :   mSemaphore(CreateSemaphoreA(NULL, 0, 0xFFFF, NULL))
      {
@@ -35,17 +26,8 @@ index 50c5ebd6df..d099fad2ec 100644
          }
      }
  public:
-@@ -547,7 +547,7 @@ namespace std
- //  was none. Direct specification (std::), however, would be unaffected.
- //    Take the safe option, and include only in the presence of MinGW's win32
- //  implementation.
--#if defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS)
-+#if defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS) && !defined(__clang__)
- using mingw_stdthread::cv_status;
- using mingw_stdthread::condition_variable;
- using mingw_stdthread::condition_variable_any;
 diff --git a/thirdparty/mingw-std-threads/mingw.mutex.h b/thirdparty/mingw-std-threads/mingw.mutex.h
-index 03efa13f8b..1e881e6c7d 100644
+index 3bf9bd02a7..1e881e6c7d 100644
 --- a/thirdparty/mingw-std-threads/mingw.mutex.h
 +++ b/thirdparty/mingw-std-threads/mingw.mutex.h
 @@ -132,7 +132,7 @@ struct _OwnerThread
@@ -73,17 +55,8 @@ index 03efa13f8b..1e881e6c7d 100644
      }
      bool try_lock()
      {
-@@ -480,7 +480,7 @@ namespace std
- //  was none. Direct specification (std::), however, would be unaffected.
- //    Take the safe option, and include only in the presence of MinGW's win32
- //  implementation.
--#if defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS)
-+#if defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS) && !defined(__clang__)
- using mingw_stdthread::recursive_mutex;
- using mingw_stdthread::mutex;
- using mingw_stdthread::recursive_timed_mutex;
 diff --git a/thirdparty/mingw-std-threads/mingw.shared_mutex.h b/thirdparty/mingw-std-threads/mingw.shared_mutex.h
-index ff1ac65135..ddc46bb826 100644
+index de89b57966..ddc46bb826 100644
 --- a/thirdparty/mingw-std-threads/mingw.shared_mutex.h
 +++ b/thirdparty/mingw-std-threads/mingw.shared_mutex.h
 @@ -134,7 +134,7 @@ public:
@@ -125,21 +98,8 @@ index ff1ac65135..ddc46bb826 100644
          mMutex->unlock_shared();
          mOwns = false;
      }
-@@ -484,10 +484,10 @@ namespace std
- //  was none. Direct specification (std::), however, would be unaffected.
- //    Take the safe option, and include only in the presence of MinGW's win32
- //  implementation.
--#if (__cplusplus < 201703L) || (defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS))
-+#if (__cplusplus < 201703L) || (defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS) && !defined(__clang__))
- using mingw_stdthread::shared_mutex;
- #endif
--#if (__cplusplus < 201402L) || (defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS))
-+#if (__cplusplus < 201402L) || (defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS) && !defined(__clang__))
- using mingw_stdthread::shared_timed_mutex;
- using mingw_stdthread::shared_lock;
- #elif !defined(MINGW_STDTHREAD_REDUNDANCY_WARNING)  //  Skip repetition
 diff --git a/thirdparty/mingw-std-threads/mingw.thread.h b/thirdparty/mingw-std-threads/mingw.thread.h
-index bcdd1a36a8..60d2200db2 100644
+index 011c2d8c56..60d2200db2 100644
 --- a/thirdparty/mingw-std-threads/mingw.thread.h
 +++ b/thirdparty/mingw-std-threads/mingw.thread.h
 @@ -193,10 +193,9 @@ public:
@@ -178,12 +138,3 @@ index bcdd1a36a8..60d2200db2 100644
          }
          if (mHandle != kInvalidHandle)
          {
-@@ -326,7 +325,7 @@ namespace std
- //  was none. Direct specification (std::), however, would be unaffected.
- //    Take the safe option, and include only in the presence of MinGW's win32
- //  implementation.
--#if defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS)
-+#if defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS) && !defined(__clang__)
- using mingw_stdthread::thread;
- //    Remove ambiguity immediately, to avoid problems arising from the above.
- //using std::thread;

+ 65 - 0
thirdparty/mingw-std-threads/patches/0002-clang-std-replacements-leak.patch

@@ -0,0 +1,65 @@
+diff --git a/thirdparty/mingw-std-threads/mingw.condition_variable.h b/thirdparty/mingw-std-threads/mingw.condition_variable.h
+index f9e248c154..d099fad2ec 100644
+--- a/thirdparty/mingw-std-threads/mingw.condition_variable.h
++++ b/thirdparty/mingw-std-threads/mingw.condition_variable.h
+@@ -58,7 +58,7 @@
+ 
+ namespace mingw_stdthread
+ {
+-#if defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS)
++#if defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS) && !defined(__clang__)
+ enum class cv_status { no_timeout, timeout };
+ #else
+ using std::cv_status;
+@@ -547,7 +547,7 @@ namespace std
+ //  was none. Direct specification (std::), however, would be unaffected.
+ //    Take the safe option, and include only in the presence of MinGW's win32
+ //  implementation.
+-#if defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS)
++#if defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS) && !defined(__clang__)
+ using mingw_stdthread::cv_status;
+ using mingw_stdthread::condition_variable;
+ using mingw_stdthread::condition_variable_any;
+diff --git a/thirdparty/mingw-std-threads/mingw.mutex.h b/thirdparty/mingw-std-threads/mingw.mutex.h
+index 73698d13cb..1e881e6c7d 100644
+--- a/thirdparty/mingw-std-threads/mingw.mutex.h
++++ b/thirdparty/mingw-std-threads/mingw.mutex.h
+@@ -480,7 +480,7 @@ namespace std
+ //  was none. Direct specification (std::), however, would be unaffected.
+ //    Take the safe option, and include only in the presence of MinGW's win32
+ //  implementation.
+-#if defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS)
++#if defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS) && !defined(__clang__)
+ using mingw_stdthread::recursive_mutex;
+ using mingw_stdthread::mutex;
+ using mingw_stdthread::recursive_timed_mutex;
+diff --git a/thirdparty/mingw-std-threads/mingw.shared_mutex.h b/thirdparty/mingw-std-threads/mingw.shared_mutex.h
+index 5375b0fbd1..ddc46bb826 100644
+--- a/thirdparty/mingw-std-threads/mingw.shared_mutex.h
++++ b/thirdparty/mingw-std-threads/mingw.shared_mutex.h
+@@ -484,10 +484,10 @@ namespace std
+ //  was none. Direct specification (std::), however, would be unaffected.
+ //    Take the safe option, and include only in the presence of MinGW's win32
+ //  implementation.
+-#if (__cplusplus < 201703L) || (defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS))
++#if (__cplusplus < 201703L) || (defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS) && !defined(__clang__))
+ using mingw_stdthread::shared_mutex;
+ #endif
+-#if (__cplusplus < 201402L) || (defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS))
++#if (__cplusplus < 201402L) || (defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS) && !defined(__clang__))
+ using mingw_stdthread::shared_timed_mutex;
+ using mingw_stdthread::shared_lock;
+ #elif !defined(MINGW_STDTHREAD_REDUNDANCY_WARNING)  //  Skip repetition
+diff --git a/thirdparty/mingw-std-threads/mingw.thread.h b/thirdparty/mingw-std-threads/mingw.thread.h
+index 4bcc63e1b1..60d2200db2 100644
+--- a/thirdparty/mingw-std-threads/mingw.thread.h
++++ b/thirdparty/mingw-std-threads/mingw.thread.h
+@@ -325,7 +325,7 @@ namespace std
+ //  was none. Direct specification (std::), however, would be unaffected.
+ //    Take the safe option, and include only in the presence of MinGW's win32
+ //  implementation.
+-#if defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS)
++#if defined(__MINGW32__ ) && !defined(_GLIBCXX_HAS_GTHREADS) && !defined(__clang__)
+ using mingw_stdthread::thread;
+ //    Remove ambiguity immediately, to avoid problems arising from the above.
+ //using std::thread;

+ 5 - 9
thirdparty/minimp3/minimp3.h

@@ -1566,7 +1566,6 @@ static void mp3d_synth(float *xl, mp3d_sample_t *dstl, int nch, float *lins)
 
 #else /* MINIMP3_FLOAT_OUTPUT */
 
-// -- GODOT start --
 #if defined(_MSC_VER) && (defined(_M_ARM64) || defined(_M_ARM64EC) || defined(_M_ARM))
             static f4 g_scale;
             g_scale = vsetq_lane_f32(1.0f/32768.0f, g_scale, 0);
@@ -1576,7 +1575,6 @@ static void mp3d_synth(float *xl, mp3d_sample_t *dstl, int nch, float *lins)
 #else
             static const f4 g_scale = { 1.0f/32768.0f, 1.0f/32768.0f, 1.0f/32768.0f, 1.0f/32768.0f };
 #endif
-// -- GODOT end --
 
             a = VMUL(a, g_scale);
             b = VMUL(b, g_scale);
@@ -1825,17 +1823,15 @@ void mp3dec_f32_to_s16(const float *in, int16_t *out, int num_samples)
     for(; i < aligned_count; i += 8)
     {
 
-// -- GODOT start --
 #if defined(_MSC_VER) && (defined(_M_ARM64) || defined(_M_ARM64EC) || defined(_M_ARM))
-            static f4 g_scale;
-            g_scale = vsetq_lane_f32(32768.0f, g_scale, 0);
-            g_scale = vsetq_lane_f32(32768.0f, g_scale, 1);
-            g_scale = vsetq_lane_f32(32768.0f, g_scale, 2);
-            g_scale = vsetq_lane_f32(32768.0f, g_scale, 3);
+        static f4 g_scale;
+        g_scale = vsetq_lane_f32(32768.0f, g_scale, 0);
+        g_scale = vsetq_lane_f32(32768.0f, g_scale, 1);
+        g_scale = vsetq_lane_f32(32768.0f, g_scale, 2);
+        g_scale = vsetq_lane_f32(32768.0f, g_scale, 3);
 #else
         static const f4 g_scale = { 32768.0f, 32768.0f, 32768.0f, 32768.0f };
 #endif
-// -- GODOT end --
 
         f4 a = VMUL(VLD(&in[i  ]), g_scale);
         f4 b = VMUL(VLD(&in[i+4]), g_scale);

+ 8 - 12
thirdparty/minimp3/patches/msvc-arm-fix.patch → thirdparty/minimp3/patches/0001-msvc-arm.patch

@@ -1,12 +1,11 @@
 diff --git a/thirdparty/minimp3/minimp3.h b/thirdparty/minimp3/minimp3.h
-index 3220ae1a85..2a9975cc86 100644
+index 3220ae1a85..49708b9846 100644
 --- a/thirdparty/minimp3/minimp3.h
 +++ b/thirdparty/minimp3/minimp3.h
-@@ -1566,7 +1566,18 @@ static void mp3d_synth(float *xl, mp3d_sample_t *dstl, int nch, float *lins)
+@@ -1566,7 +1566,16 @@ static void mp3d_synth(float *xl, mp3d_sample_t *dstl, int nch, float *lins)
  
  #else /* MINIMP3_FLOAT_OUTPUT */
  
-+// -- GODOT start --
 +#if defined(_MSC_VER) && (defined(_M_ARM64) || defined(_M_ARM64EC) || defined(_M_ARM))
 +            static f4 g_scale;
 +            g_scale = vsetq_lane_f32(1.0f/32768.0f, g_scale, 0);
@@ -16,27 +15,24 @@ index 3220ae1a85..2a9975cc86 100644
 +#else
              static const f4 g_scale = { 1.0f/32768.0f, 1.0f/32768.0f, 1.0f/32768.0f, 1.0f/32768.0f };
 +#endif
-+// -- GODOT end --
 +
              a = VMUL(a, g_scale);
              b = VMUL(b, g_scale);
  #if HAVE_SSE
-@@ -1813,7 +1824,19 @@ void mp3dec_f32_to_s16(const float *in, int16_t *out, int num_samples)
+@@ -1813,7 +1822,17 @@ void mp3dec_f32_to_s16(const float *in, int16_t *out, int num_samples)
      int aligned_count = num_samples & ~7;
      for(; i < aligned_count; i += 8)
      {
 +
-+// -- GODOT start --
 +#if defined(_MSC_VER) && (defined(_M_ARM64) || defined(_M_ARM64EC) || defined(_M_ARM))
-+            static f4 g_scale;
-+            g_scale = vsetq_lane_f32(32768.0f, g_scale, 0);
-+            g_scale = vsetq_lane_f32(32768.0f, g_scale, 1);
-+            g_scale = vsetq_lane_f32(32768.0f, g_scale, 2);
-+            g_scale = vsetq_lane_f32(32768.0f, g_scale, 3);
++        static f4 g_scale;
++        g_scale = vsetq_lane_f32(32768.0f, g_scale, 0);
++        g_scale = vsetq_lane_f32(32768.0f, g_scale, 1);
++        g_scale = vsetq_lane_f32(32768.0f, g_scale, 2);
++        g_scale = vsetq_lane_f32(32768.0f, g_scale, 3);
 +#else
          static const f4 g_scale = { 32768.0f, 32768.0f, 32768.0f, 32768.0f };
 +#endif
-+// -- GODOT end --
 +
          f4 a = VMUL(VLD(&in[i  ]), g_scale);
          f4 b = VMUL(VLD(&in[i+4]), g_scale);

+ 0 - 0
thirdparty/minimp3/patches/msvc-warnings-fixes.patch → thirdparty/minimp3/patches/0002-msvc-warnings.patch


+ 3 - 8
thirdparty/minizip/ioapi.c

@@ -75,16 +75,12 @@ void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filef
     p_filefunc64_32->zfile_func64.opaque = p_filefunc32->opaque;
     p_filefunc64_32->zseek32_file = p_filefunc32->zseek_file;
     p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file;
-    /* GODOT start */
     p_filefunc64_32->zfile_func64.alloc_mem = p_filefunc32->alloc_mem;
     p_filefunc64_32->zfile_func64.free_mem = p_filefunc32->free_mem;
-    /* GODOT end */
 }
 
-/* GODOT start */
-/*
-// GODOT end
 
+#if 0
 
 static voidpf ZCALLBACK fopen_file_func(voidpf opaque, const char* filename, int mode) {
     FILE* file = NULL;
@@ -236,6 +232,5 @@ void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def) {
     pzlib_filefunc_def->zerror_file = ferror_file_func;
     pzlib_filefunc_def->opaque = NULL;
 }
-// GODOT start
-*/
-/* GODOT end */
+
+#endif

+ 0 - 4
thirdparty/minizip/ioapi.h

@@ -155,10 +155,8 @@ typedef struct zlib_filefunc_def_s
     close_file_func     zclose_file;
     testerror_file_func zerror_file;
     voidpf              opaque;
-    /* GODOT start */
     alloc_func          alloc_mem;
     free_func           free_mem;
-    /* GODOT end */
 } zlib_filefunc_def;
 
 typedef ZPOS64_T (ZCALLBACK *tell64_file_func)    (voidpf opaque, voidpf stream);
@@ -175,10 +173,8 @@ typedef struct zlib_filefunc64_def_s
     close_file_func     zclose_file;
     testerror_file_func zerror_file;
     voidpf              opaque;
-    /* GODOT start */
     alloc_func          alloc_mem;
     free_func           free_mem;
-    /* GODOT end */
 } zlib_filefunc64_def;
 
 void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def);

+ 34 - 63
thirdparty/minizip/patches/godot-seek.patch → thirdparty/minizip/patches/0001-godot-seek.patch

@@ -1,108 +1,97 @@
 diff --git a/thirdparty/minizip/ioapi.c b/thirdparty/minizip/ioapi.c
-index 782d32469a..2e89f5f41a 100644
+index 782d32469a..2e393aca2d 100644
 --- a/thirdparty/minizip/ioapi.c
 +++ b/thirdparty/minizip/ioapi.c
-@@ -75,8 +75,15 @@ void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filef
+@@ -75,9 +75,12 @@ void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filef
      p_filefunc64_32->zfile_func64.opaque = p_filefunc32->opaque;
      p_filefunc64_32->zseek32_file = p_filefunc32->zseek_file;
      p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file;
-+    /* GODOT start */
 +    p_filefunc64_32->zfile_func64.alloc_mem = p_filefunc32->alloc_mem;
 +    p_filefunc64_32->zfile_func64.free_mem = p_filefunc32->free_mem;
-+    /* GODOT end */
  }
  
-+/* GODOT start */
-+/*
-+// GODOT end
  
++#if 0
  
  static voidpf ZCALLBACK fopen_file_func(voidpf opaque, const char* filename, int mode) {
-@@ -229,3 +236,6 @@ void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def) {
+     FILE* file = NULL;
+@@ -229,3 +232,5 @@ void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def) {
      pzlib_filefunc_def->zerror_file = ferror_file_func;
      pzlib_filefunc_def->opaque = NULL;
  }
-+// GODOT start
-+*/
-+/* GODOT end */
++
++#endif
 diff --git a/thirdparty/minizip/ioapi.h b/thirdparty/minizip/ioapi.h
-index a2d2e6e60d..509b52da8a 100644
+index a2d2e6e60d..556dd8ad18 100644
 --- a/thirdparty/minizip/ioapi.h
 +++ b/thirdparty/minizip/ioapi.h
-@@ -155,6 +155,10 @@ typedef struct zlib_filefunc_def_s
+@@ -155,6 +155,8 @@ typedef struct zlib_filefunc_def_s
      close_file_func     zclose_file;
      testerror_file_func zerror_file;
      voidpf              opaque;
-+    /* GODOT start */
 +    alloc_func          alloc_mem;
 +    free_func           free_mem;
-+    /* GODOT end */
  } zlib_filefunc_def;
  
  typedef ZPOS64_T (ZCALLBACK *tell64_file_func)    (voidpf opaque, voidpf stream);
-@@ -171,6 +175,10 @@ typedef struct zlib_filefunc64_def_s
+@@ -171,6 +173,8 @@ typedef struct zlib_filefunc64_def_s
      close_file_func     zclose_file;
      testerror_file_func zerror_file;
      voidpf              opaque;
-+    /* GODOT start */
 +    alloc_func          alloc_mem;
 +    free_func           free_mem;
-+    /* GODOT end */
  } zlib_filefunc64_def;
  
  void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def);
 diff --git a/thirdparty/minizip/unzip.c b/thirdparty/minizip/unzip.c
-index ea05b7d62a..981ba3c0cb 100644
+index ea05b7d62a..7e8a6ac2d3 100644
 --- a/thirdparty/minizip/unzip.c
 +++ b/thirdparty/minizip/unzip.c
-@@ -152,6 +152,9 @@ typedef struct
+@@ -152,6 +152,7 @@ typedef struct
      uLong compression_method;   /* compression method (0==store) */
      ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
      int   raw;
-+    /* GODOT start */
 +    int extra_size;
-+    /* GODOT end */
  } file_in_zip64_read_info_s;
  
  
-@@ -513,9 +516,10 @@ local unzFile unzOpenInternal(const void *path,
+@@ -513,9 +514,9 @@ local unzFile unzOpenInternal(const void *path,
      us.z_filefunc.zseek32_file = NULL;
      us.z_filefunc.ztell32_file = NULL;
      if (pzlib_filefunc64_32_def==NULL)
 -        fill_fopen64_filefunc(&us.z_filefunc.zfile_func64);
 -    else
 -        us.z_filefunc = *pzlib_filefunc64_32_def;
-+        /* GODOT start */
++        //fill_fopen64_filefunc(&us.z_filefunc.zfile_func64);
 +        return NULL; // standard i/o not supported
 +    us.z_filefunc = *pzlib_filefunc64_32_def;
-+    /* GODOT end */
      us.is64bitOpenFunction = is64bitOpenFunction;
  
  
-@@ -703,6 +707,18 @@ extern unzFile ZEXPORT unzOpen64(const void *path) {
+@@ -703,6 +704,15 @@ extern unzFile ZEXPORT unzOpen64(const void *path) {
      return unzOpenInternal(path, NULL, 1);
  }
  
-+/* GODOT start */
 +extern void* unzGetOpaque(unzFile file) {
-+
 +    unz64_s* s;
 +    if (file==NULL)
 +        return NULL;
 +    s=(unz64_s*)file;
 +
 +    return s->z_filefunc.zfile_func64.opaque;
-+};
-+/* GODOT end */
++}
 +
  /*
    Close a ZipFile opened with unzOpen.
    If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
-@@ -905,10 +921,23 @@ local int unz64local_GetCurrentFileInfoInternal(unzFile file,
+@@ -905,10 +915,19 @@ local int unz64local_GetCurrentFileInfoInternal(unzFile file,
  
          if (lSeek!=0)
          {
-+            /* GODOT start */
+-            if (ZSEEK64(s->z_filefunc, s->filestream,(ZPOS64_T)lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
+-                lSeek=0;
+-            else
+-                err=UNZ_ERRNO;
 +            if (lSeek<0) {
 +                // WORKAROUND for backwards seeking
 +                ZPOS64_T pos = ZTELL64(s->z_filefunc, s->filestream);
@@ -111,47 +100,38 @@ index ea05b7d62a..981ba3c0cb 100644
 +                else
 +                    err=UNZ_ERRNO;
 +            } else {
-+            /* GODOT end */
-             if (ZSEEK64(s->z_filefunc, s->filestream,(ZPOS64_T)lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
-                 lSeek=0;
-             else
-                 err=UNZ_ERRNO;
-+            /* GODOT start */
++                if (ZSEEK64(s->z_filefunc, s->filestream,(ZPOS64_T)lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
++                    lSeek=0;
++                else
++                    err=UNZ_ERRNO;
 +            }
-+            /* GODOT end */
          }
  
          while(acc < file_info.size_file_extra)
-@@ -1446,8 +1475,10 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
+@@ -1446,8 +1465,8 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
      }
      else if ((s->cur_file_info.compression_method==Z_DEFLATED) && (!raw))
      {
 -      pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
 -      pfile_in_zip_read_info->stream.zfree = (free_func)0;
-+      /* GODOT start */
 +      pfile_in_zip_read_info->stream.zalloc = s->z_filefunc.zfile_func64.alloc_mem;
 +      pfile_in_zip_read_info->stream.zfree = s->z_filefunc.zfile_func64.free_mem;
-+      /* GODOT end */
        pfile_in_zip_read_info->stream.opaque = (voidpf)0;
        pfile_in_zip_read_info->stream.next_in = 0;
        pfile_in_zip_read_info->stream.avail_in = 0;
-@@ -1480,6 +1511,9 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
+@@ -1480,6 +1499,7 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
                iSizeVar;
  
      pfile_in_zip_read_info->stream.avail_in = (uInt)0;
-+    /* GODOT start */
 +    pfile_in_zip_read_info->extra_size = iSizeVar;
-+    /* GODOT end */
  
      s->pfile_in_zip_read = pfile_in_zip_read_info;
                  s->encrypted = 0;
-@@ -1510,6 +1544,85 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
+@@ -1510,6 +1530,82 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
      return UNZ_OK;
  }
  
-+/* GODOT start */
 +extern int ZEXPORT unzSeekCurrentFile(unzFile file, int pos) {
-+
 +    unz64_s* s;
 +    file_in_zip64_read_info_s* pfile_in_zip_read_info;
 +    if (file==NULL)
@@ -226,69 +206,60 @@ index ea05b7d62a..981ba3c0cb 100644
 +
 +    return pos;
 +}
-+/* GODOT end */
 +
  extern int ZEXPORT unzOpenCurrentFile(unzFile file) {
      return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL);
  }
 diff --git a/thirdparty/minizip/unzip.h b/thirdparty/minizip/unzip.h
-index 5cfc9c6274..0639674574 100644
+index 5cfc9c6274..37ff29b22a 100644
 --- a/thirdparty/minizip/unzip.h
 +++ b/thirdparty/minizip/unzip.h
-@@ -202,6 +202,10 @@ extern int ZEXPORT unzClose(unzFile file);
+@@ -202,6 +202,8 @@ extern int ZEXPORT unzClose(unzFile file);
      these files MUST be closed with unzCloseCurrentFile before call unzClose.
    return UNZ_OK if there is no problem. */
  
-+/* GODOT start */
 +extern void* unzGetOpaque(unzFile file);
-+/* GODOT end */
 +
  extern int ZEXPORT unzGetGlobalInfo(unzFile file,
                                      unz_global_info *pglobal_info);
  
-@@ -390,6 +394,13 @@ extern int ZEXPORT unzReadCurrentFile(unzFile file,
+@@ -390,6 +392,11 @@ extern int ZEXPORT unzReadCurrentFile(unzFile file,
      (UNZ_ERRNO for IO error, or zLib error for uncompress error)
  */
  
-+/* GODOT start */
 +extern int ZEXPORT unzSeekCurrentFile(unzFile file, int pos);
 +/*
 +  Seek to position in uncompressed data
 +*/
-+/* GODOT end */
 +
  extern z_off_t ZEXPORT unztell(unzFile file);
  
  extern ZPOS64_T ZEXPORT unztell64(unzFile file);
 diff --git a/thirdparty/minizip/zip.c b/thirdparty/minizip/zip.c
-index 60bdffac34..1d2d918e72 100644
+index 60bdffac34..078a0a82ec 100644
 --- a/thirdparty/minizip/zip.c
 +++ b/thirdparty/minizip/zip.c
-@@ -820,9 +820,11 @@ extern zipFile ZEXPORT zipOpen3(const void *pathname, int append, zipcharpc* glo
+@@ -820,9 +820,9 @@ extern zipFile ZEXPORT zipOpen3(const void *pathname, int append, zipcharpc* glo
  
      ziinit.z_filefunc.zseek32_file = NULL;
      ziinit.z_filefunc.ztell32_file = NULL;
 -    if (pzlib_filefunc64_32_def==NULL)
 -        fill_fopen64_filefunc(&ziinit.z_filefunc.zfile_func64);
 -    else
-+    /* GODOT start */
 +    if (pzlib_filefunc64_32_def==NULL) {
 +        //fill_fopen64_filefunc(&ziinit.z_filefunc.zfile_func64);
 +    } else
-+    /* GODOT end */
          ziinit.z_filefunc = *pzlib_filefunc64_32_def;
  
      ziinit.filestream = ZOPEN64(ziinit.z_filefunc,
-@@ -1182,8 +1184,10 @@ extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char* filename, c
+@@ -1182,8 +1182,8 @@ extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char* filename, c
      {
          if(zi->ci.method == Z_DEFLATED)
          {
 -          zi->ci.stream.zalloc = (alloc_func)0;
 -          zi->ci.stream.zfree = (free_func)0;
-+          /* GODOT start */
 +          zi->ci.stream.zalloc = zi->z_filefunc.zfile_func64.alloc_mem;
 +          zi->ci.stream.zfree = zi->z_filefunc.zfile_func64.free_mem;
-+          /* GODOT end */
            zi->ci.stream.opaque = (voidpf)0;
  
            if (windowBits>0)

+ 6 - 23
thirdparty/minizip/unzip.c

@@ -152,9 +152,7 @@ typedef struct
     uLong compression_method;   /* compression method (0==store) */
     ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
     int   raw;
-    /* GODOT start */
     int extra_size;
-    /* GODOT end */
 } file_in_zip64_read_info_s;
 
 
@@ -516,10 +514,9 @@ local unzFile unzOpenInternal(const void *path,
     us.z_filefunc.zseek32_file = NULL;
     us.z_filefunc.ztell32_file = NULL;
     if (pzlib_filefunc64_32_def==NULL)
-        /* GODOT start */
+        //fill_fopen64_filefunc(&us.z_filefunc.zfile_func64);
         return NULL; // standard i/o not supported
     us.z_filefunc = *pzlib_filefunc64_32_def;
-    /* GODOT end */
     us.is64bitOpenFunction = is64bitOpenFunction;
 
 
@@ -707,17 +704,14 @@ extern unzFile ZEXPORT unzOpen64(const void *path) {
     return unzOpenInternal(path, NULL, 1);
 }
 
-/* GODOT start */
 extern void* unzGetOpaque(unzFile file) {
-
     unz64_s* s;
     if (file==NULL)
         return NULL;
     s=(unz64_s*)file;
 
     return s->z_filefunc.zfile_func64.opaque;
-};
-/* GODOT end */
+}
 
 /*
   Close a ZipFile opened with unzOpen.
@@ -921,7 +915,6 @@ local int unz64local_GetCurrentFileInfoInternal(unzFile file,
 
         if (lSeek!=0)
         {
-            /* GODOT start */
             if (lSeek<0) {
                 // WORKAROUND for backwards seeking
                 ZPOS64_T pos = ZTELL64(s->z_filefunc, s->filestream);
@@ -930,14 +923,11 @@ local int unz64local_GetCurrentFileInfoInternal(unzFile file,
                 else
                     err=UNZ_ERRNO;
             } else {
-            /* GODOT end */
-            if (ZSEEK64(s->z_filefunc, s->filestream,(ZPOS64_T)lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
-                lSeek=0;
-            else
-                err=UNZ_ERRNO;
-            /* GODOT start */
+                if (ZSEEK64(s->z_filefunc, s->filestream,(ZPOS64_T)lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
+                    lSeek=0;
+                else
+                    err=UNZ_ERRNO;
             }
-            /* GODOT end */
         }
 
         while(acc < file_info.size_file_extra)
@@ -1475,10 +1465,8 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
     }
     else if ((s->cur_file_info.compression_method==Z_DEFLATED) && (!raw))
     {
-      /* GODOT start */
       pfile_in_zip_read_info->stream.zalloc = s->z_filefunc.zfile_func64.alloc_mem;
       pfile_in_zip_read_info->stream.zfree = s->z_filefunc.zfile_func64.free_mem;
-      /* GODOT end */
       pfile_in_zip_read_info->stream.opaque = (voidpf)0;
       pfile_in_zip_read_info->stream.next_in = 0;
       pfile_in_zip_read_info->stream.avail_in = 0;
@@ -1511,9 +1499,7 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
               iSizeVar;
 
     pfile_in_zip_read_info->stream.avail_in = (uInt)0;
-    /* GODOT start */
     pfile_in_zip_read_info->extra_size = iSizeVar;
-    /* GODOT end */
 
     s->pfile_in_zip_read = pfile_in_zip_read_info;
                 s->encrypted = 0;
@@ -1544,9 +1530,7 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
     return UNZ_OK;
 }
 
-/* GODOT start */
 extern int ZEXPORT unzSeekCurrentFile(unzFile file, int pos) {
-
     unz64_s* s;
     file_in_zip64_read_info_s* pfile_in_zip_read_info;
     if (file==NULL)
@@ -1621,7 +1605,6 @@ extern int ZEXPORT unzSeekCurrentFile(unzFile file, int pos) {
 
     return pos;
 }
-/* GODOT end */
 
 extern int ZEXPORT unzOpenCurrentFile(unzFile file) {
     return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL);

+ 0 - 4
thirdparty/minizip/unzip.h

@@ -202,9 +202,7 @@ extern int ZEXPORT unzClose(unzFile file);
     these files MUST be closed with unzCloseCurrentFile before call unzClose.
   return UNZ_OK if there is no problem. */
 
-/* GODOT start */
 extern void* unzGetOpaque(unzFile file);
-/* GODOT end */
 
 extern int ZEXPORT unzGetGlobalInfo(unzFile file,
                                     unz_global_info *pglobal_info);
@@ -394,12 +392,10 @@ extern int ZEXPORT unzReadCurrentFile(unzFile file,
     (UNZ_ERRNO for IO error, or zLib error for uncompress error)
 */
 
-/* GODOT start */
 extern int ZEXPORT unzSeekCurrentFile(unzFile file, int pos);
 /*
   Seek to position in uncompressed data
 */
-/* GODOT end */
 
 extern z_off_t ZEXPORT unztell(unzFile file);
 

+ 0 - 4
thirdparty/minizip/zip.c

@@ -820,11 +820,9 @@ extern zipFile ZEXPORT zipOpen3(const void *pathname, int append, zipcharpc* glo
 
     ziinit.z_filefunc.zseek32_file = NULL;
     ziinit.z_filefunc.ztell32_file = NULL;
-    /* GODOT start */
     if (pzlib_filefunc64_32_def==NULL) {
         //fill_fopen64_filefunc(&ziinit.z_filefunc.zfile_func64);
     } else
-    /* GODOT end */
         ziinit.z_filefunc = *pzlib_filefunc64_32_def;
 
     ziinit.filestream = ZOPEN64(ziinit.z_filefunc,
@@ -1184,10 +1182,8 @@ extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char* filename, c
     {
         if(zi->ci.method == Z_DEFLATED)
         {
-          /* GODOT start */
           zi->ci.stream.zalloc = zi->z_filefunc.zfile_func64.alloc_mem;
           zi->ci.stream.zfree = zi->z_filefunc.zfile_func64.free_mem;
-          /* GODOT end */
           zi->ci.stream.opaque = (voidpf)0;
 
           if (windowBits>0)

+ 0 - 0
thirdparty/noise/FastNoiseLite.h → thirdparty/misc/FastNoiseLite.h


部分文件因文件數量過多而無法顯示