Thirdparty: Harmonize patches to document downstream changes

This commit is contained in:
Rémi Verschelde 2025-01-31 10:58:38 +01:00
parent 0d14ae58b0
commit 91907a89f7
141 changed files with 1274 additions and 3849 deletions

View File

@ -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.

View File

@ -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

View File

@ -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",

View File

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

View File

@ -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>

274
thirdparty/README.md vendored
View File

@ -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,10 +935,27 @@ 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)
## thorvg
- Upstream: https://github.com/thorvg/thorvg
- Version: 0.15.8 (bd8c2fca7663a22fba7a339937cb60f2f6247a2e, 2025)
- License: MIT
Files extracted from upstream source:
- See `thorvg/update-thorvg.sh` for extraction instructions.
Set the version number and run the script.
Patches:
- `0001-revert-tvglines-bezier-precision.patch` (GH-96658)
- `0002-gcc15-include-fix.patch` (GH-102022)
## tinyexr
@ -916,22 +968,9 @@ Files extracted from upstream source:
- `tinyexr.{cc,h}`
The `tinyexr.cc` file was modified to include `zlib.h` which we provide,
instead of `miniz.h` as an external dependency.
Patches:
## thorvg
- Upstream: https://github.com/thorvg/thorvg
- Version: 0.15.8 (bd8c2fca7663a22fba7a339937cb60f2f6247a2e, 2025)
- License: MIT
Files extracted from upstream source:
See `thorvg/update-thorvg.sh` for extraction instructions. Set the version
number and run the script.
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

View File

@ -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;

View File

@ -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

View File

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

View File

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

View File

@ -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

View File

@ -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"

Binary file not shown.

View File

@ -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"

View File

@ -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

View File

@ -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();

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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;
}

View File

@ -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

View File

@ -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;

View File

@ -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 @@

View File

@ -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;
}

View File

@ -1,43 +0,0 @@
From b4a0fa23c13da413d94b99f307e401c3b83e0108 Mon Sep 17 00:00:00 2001
From: Ondrej Stava <ondrej.stava@gmail.com>
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 <rverschelde@gmail.com>
---
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

View File

@ -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>

View File

@ -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 @@

View File

@ -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>

View File

@ -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__

View File

@ -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__

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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) */

View File

@ -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 ) {

View File

@ -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)

View File

@ -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)

View File

@ -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);
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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)))

View File

@ -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

View File

@ -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++)

View File

@ -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++)

View File

@ -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)

View File

@ -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

View File

@ -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)
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)
@@ -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)
{
+// -- GODOT start --
+#if defined(_WIN32)
+ _aligned_free(addr);
+#else
free(addr);
+#endif
+// -- GODOT end --
}
#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 defined(_WIN32)
+ ptr = _aligned_malloc(size, align);
+ if (ptr)
+ return ptr;
+#else
if (!posix_memalign(&ptr, align, size))
return ptr;
+#endif
return NULL;
}
#endif

View File

@ -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)

View File

@ -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
}

View File

@ -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
thirdparty/enet/enet/enet_godot_ext.h vendored Normal file
View File

@ -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__

View File

@ -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__

View File

@ -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
*/

View File

@ -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
}

View File

@ -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 @@

View File

@ -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 @@

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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 {

View File

@ -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;

View File

@ -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;

View File

@ -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 {

View File

@ -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

View File

@ -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>

View File

@ -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>

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -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)

View File

@ -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);

View File

@ -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);

View File

@ -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)

Some files were not shown because too many files have changed in this diff Show More