summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--COPYRIGHT.txt8
-rw-r--r--SConstruct13
-rw-r--r--core/SCsub1
-rw-r--r--core/image.cpp44
-rw-r--r--core/image.h1
-rw-r--r--core/oa_hash_map.h45
-rw-r--r--doc/classes/Array.xml2
-rw-r--r--doc/classes/Dictionary.xml1
-rw-r--r--doc/classes/Image.xml7
-rw-r--r--doc/classes/Node.xml12
-rw-r--r--doc/classes/Object.xml2
-rw-r--r--doc/classes/PhysicalSkyMaterial.xml3
-rw-r--r--drivers/alsa/audio_driver_alsa.cpp4
-rw-r--r--drivers/coreaudio/audio_driver_coreaudio.cpp6
-rw-r--r--drivers/pulseaudio/audio_driver_pulseaudio.cpp4
-rw-r--r--drivers/wasapi/audio_driver_wasapi.cpp2
-rw-r--r--drivers/xaudio2/audio_driver_xaudio2.cpp4
-rw-r--r--editor/editor_export.cpp56
-rw-r--r--editor/editor_export.h5
-rw-r--r--editor/editor_node.cpp5
-rw-r--r--editor/icons/RootMotionView.svg1
-rw-r--r--editor/icons/ShaderGlobalsOverride.svg1
-rw-r--r--editor/project_export.cpp7
-rw-r--r--editor/project_export.h1
-rw-r--r--editor/scene_tree_dock.cpp3
-rw-r--r--gles_builders.py10
-rw-r--r--main/tests/test_oa_hash_map.cpp58
-rw-r--r--misc/scons/compilation_db.py (renamed from misc/scons/site_tools/compilation_db.py)0
-rw-r--r--modules/gdnative/gdnative/aabb.cpp2
-rw-r--r--modules/gdnative/gdnative/array.cpp2
-rw-r--r--modules/gdnative/gdnative/basis.cpp2
-rw-r--r--modules/gdnative/gdnative/color.cpp2
-rw-r--r--modules/gdnative/gdnative/dictionary.cpp2
-rw-r--r--modules/gdnative/gdnative/node_path.cpp2
-rw-r--r--modules/gdnative/gdnative/plane.cpp2
-rw-r--r--modules/gdnative/gdnative/pool_arrays.cpp8
-rw-r--r--modules/gdnative/gdnative/quat.cpp2
-rw-r--r--modules/gdnative/gdnative/rect2.cpp2
-rw-r--r--modules/gdnative/gdnative/rid.cpp2
-rw-r--r--modules/gdnative/gdnative/string.cpp4
-rw-r--r--modules/gdnative/gdnative/string_name.cpp2
-rw-r--r--modules/gdnative/gdnative/transform.cpp2
-rw-r--r--modules/gdnative/gdnative/transform2d.cpp2
-rw-r--r--modules/gdnative/gdnative/variant.cpp2
-rw-r--r--modules/gdnative/gdnative/vector2.cpp2
-rw-r--r--modules/gdnative/gdnative/vector3.cpp2
-rw-r--r--modules/gdnative/include/gdnative/pool_arrays.h14
-rw-r--r--modules/gdnative/include/gdnative/rid.h2
-rw-r--r--modules/gdnative/include/gdnative/variant.h2
-rw-r--r--modules/lightmapper_rd/lm_blendseams.glsl53
-rw-r--r--modules/lightmapper_rd/lm_common_inc.glsl7
-rw-r--r--modules/lightmapper_rd/lm_compute.glsl22
-rw-r--r--modules/lightmapper_rd/lm_raster.glsl22
-rw-r--r--modules/websocket/register_types.cpp9
-rw-r--r--platform/android/audio_driver_jandroid.cpp4
-rw-r--r--platform/android/export/export.cpp144
-rw-r--r--platform/android/java/app/AndroidManifest.xml4
-rw-r--r--platform/android/java/app/build.gradle29
-rw-r--r--platform/android/java/app/config.gradle81
-rw-r--r--platform/android/java/build.gradle3
-rw-r--r--platform/android/java/gradle.properties3
-rw-r--r--platform/android/java/lib/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java4
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/Godot.java9
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java6
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPluginRegistry.java15
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/plugin/SignalInfo.java3
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/utils/PermissionsUtil.java3
-rw-r--r--platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/GodotPayment.java3
-rw-r--r--platform/android/plugin/godot_plugin_config.h251
-rw-r--r--platform/haiku/audio_driver_media_kit.cpp4
-rw-r--r--platform/javascript/audio_driver_javascript.cpp49
-rw-r--r--platform/javascript/audio_driver_javascript.h1
-rw-r--r--platform/osx/display_server_osx.mm49
-rw-r--r--platform/windows/display_server_windows.cpp12
-rw-r--r--platform/windows/display_server_windows.h1
-rw-r--r--platform/windows/key_mapping_windows.cpp13
-rw-r--r--platform/windows/key_mapping_windows.h1
-rw-r--r--scene/gui/graph_edit.cpp13
-rw-r--r--scene/gui/graph_edit.h1
-rw-r--r--scene/gui/option_button.cpp3
-rw-r--r--scene/gui/popup_menu.cpp2
-rw-r--r--scene/gui/text_edit.cpp4
-rw-r--r--scene/main/node.cpp18
-rw-r--r--scene/main/node.h2
-rw-r--r--scene/main/window.cpp11
-rw-r--r--scene/resources/default_theme/default_theme.cpp33
-rw-r--r--scene/resources/sky_material.cpp17
-rw-r--r--scene/resources/sky_material.h4
-rw-r--r--servers/audio/audio_driver_dummy.cpp4
-rw-r--r--servers/audio_server.cpp3
-rw-r--r--servers/audio_server.h6
-rw-r--r--servers/rendering/rasterizer_rd/shaders/bokeh_dof.glsl5
-rw-r--r--servers/rendering/rasterizer_rd/shaders/canvas.glsl11
-rw-r--r--servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl9
-rw-r--r--servers/rendering/rasterizer_rd/shaders/canvas_uniforms_inc.glsl5
-rw-r--r--servers/rendering/rasterizer_rd/shaders/copy.glsl5
-rw-r--r--servers/rendering/rasterizer_rd/shaders/copy_to_fb.glsl16
-rw-r--r--servers/rendering/rasterizer_rd/shaders/cube_to_dp.glsl5
-rw-r--r--servers/rendering/rasterizer_rd/shaders/cubemap_downsampler.glsl5
-rw-r--r--servers/rendering/rasterizer_rd/shaders/cubemap_filter.glsl6
-rw-r--r--servers/rendering/rasterizer_rd/shaders/cubemap_roughness.glsl5
-rw-r--r--servers/rendering/rasterizer_rd/shaders/giprobe.glsl10
-rw-r--r--servers/rendering/rasterizer_rd/shaders/giprobe_debug.glsl10
-rw-r--r--servers/rendering/rasterizer_rd/shaders/giprobe_sdf.glsl15
-rw-r--r--servers/rendering/rasterizer_rd/shaders/giprobe_write.glsl14
-rw-r--r--servers/rendering/rasterizer_rd/shaders/luminance_reduce.glsl6
-rw-r--r--servers/rendering/rasterizer_rd/shaders/roughness_limiter.glsl9
-rw-r--r--servers/rendering/rasterizer_rd/shaders/scene_high_end.glsl10
-rw-r--r--servers/rendering/rasterizer_rd/shaders/scene_high_end_inc.glsl12
-rw-r--r--servers/rendering/rasterizer_rd/shaders/screen_space_reflection.glsl8
-rw-r--r--servers/rendering/rasterizer_rd/shaders/screen_space_reflection_filter.glsl8
-rw-r--r--servers/rendering/rasterizer_rd/shaders/screen_space_reflection_scale.glsl8
-rw-r--r--servers/rendering/rasterizer_rd/shaders/sky.glsl11
-rw-r--r--servers/rendering/rasterizer_rd/shaders/specular_merge.glsl8
-rw-r--r--servers/rendering/rasterizer_rd/shaders/ssao.glsl6
-rw-r--r--servers/rendering/rasterizer_rd/shaders/ssao_blur.glsl5
-rw-r--r--servers/rendering/rasterizer_rd/shaders/ssao_minify.glsl5
-rw-r--r--servers/rendering/rasterizer_rd/shaders/subsurface_scattering.glsl8
-rw-r--r--servers/rendering/rasterizer_rd/shaders/tonemap.glsl14
-rw-r--r--servers/rendering/rendering_device_binds.cpp28
-rw-r--r--thirdparty/README.md6
-rw-r--r--thirdparty/jpeg-compressor/patches/fix-msvc-sse2-detection.patch44
-rw-r--r--thirdparty/jpeg-compressor/patches/fix-msvc2017-build.patch31
-rw-r--r--thirdparty/misc/hq2x.cpp2636
-rw-r--r--thirdparty/misc/hq2x.h19
-rw-r--r--thirdparty/misc/r128.h14
127 files changed, 1018 insertions, 3296 deletions
diff --git a/.gitignore b/.gitignore
index 19490b9878..dfb1490aa9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -89,6 +89,9 @@ logs/
*.sln
*.vcxproj*
+# Custom SCons configuration override
+/custom.py
+
# Build results
[Dd]ebug/
[Dd]ebugPublic/
diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt
index 443e6fee97..7741573039 100644
--- a/COPYRIGHT.txt
+++ b/COPYRIGHT.txt
@@ -257,12 +257,6 @@ Comment: FastLZ
Copyright: 2005-2020, Ariya Hidayat
License: Expat
-Files: ./thirdparty/misc/hq2x.cpp
- ./thirdparty/misc/hq2x.h
-Comment: hq2x implementation
-Copyright: 2016, Bruno Ribeiro
-License: Apache-2.0
-
Files: ./thirdparty/misc/ifaddrs-android.cc
./thirdparty/misc/ifaddrs-android.h
Comment: libjingle
@@ -334,7 +328,7 @@ License: Zlib
Files: ./thirdparty/rvo2/
Comment: RVO2
-Copyright: 2016, University of North Carolina at Chapel Hill
+Copyright: 2016, University of North Carolina at Chapel Hill
License: Apache 2.0
Files: ./thirdparty/squish/
diff --git a/SConstruct b/SConstruct
index 86014b8160..f74940b059 100644
--- a/SConstruct
+++ b/SConstruct
@@ -272,14 +272,13 @@ if selected_platform in platform_list:
else:
env = env_base.Clone()
- # Custom tools are loaded automatically by SCons from site_scons/site_tools,
- # but we want to use a different folder, so we register it manually.
- from SCons.Script.Main import _load_site_scons_dir
+ # Compilation DB requires SCons 3.1.1+.
+ from SCons import __version__ as scons_raw_version
- _load_site_scons_dir(".", "misc/scons")
-
- env.Tool("compilation_db")
- env.Alias("compiledb", env.CompilationDatabase("compile_commands.json"))
+ scons_ver = env._get_major_minor_revision(scons_raw_version)
+ if scons_ver >= (3, 1, 1):
+ env.Tool("compilation_db", toolpath=["misc/scons"])
+ env.Alias("compiledb", env.CompilationDatabase("compile_commands.json"))
if env["dev"]:
env["verbose"] = True
diff --git a/core/SCsub b/core/SCsub
index d53988fae7..80a5f6b623 100644
--- a/core/SCsub
+++ b/core/SCsub
@@ -52,7 +52,6 @@ thirdparty_misc_sources = [
"r128.c",
"smaz.c",
# C++ sources
- "hq2x.cpp",
"pcg.cpp",
"triangulator.cpp",
"clipper.cpp",
diff --git a/core/image.cpp b/core/image.cpp
index f99e8a636f..51216c8c31 100644
--- a/core/image.cpp
+++ b/core/image.cpp
@@ -37,8 +37,6 @@
#include "core/os/copymem.h"
#include "core/print_string.h"
-#include "thirdparty/misc/hq2x.h"
-
#include <stdio.h>
const char *Image::format_names[Image::FORMAT_MAX] = {
@@ -1445,47 +1443,6 @@ static void _generate_po2_mipmap(const Component *p_src, Component *p_dst, uint3
}
}
-void Image::expand_x2_hq2x() {
- ERR_FAIL_COND(!_can_modify(format));
-
- bool used_mipmaps = has_mipmaps();
- if (used_mipmaps) {
- clear_mipmaps();
- }
-
- Format current = format;
-
- if (current != FORMAT_RGBA8) {
- convert(FORMAT_RGBA8);
- }
-
- Vector<uint8_t> dest;
- dest.resize(width * 2 * height * 2 * 4);
-
- {
- const uint8_t *r = data.ptr();
- uint8_t *w = dest.ptrw();
-
- ERR_FAIL_COND(!r);
-
- hq2x_resize((const uint32_t *)r, width, height, (uint32_t *)w);
- }
-
- width *= 2;
- height *= 2;
- data = dest;
-
- if (current != FORMAT_RGBA8) {
- convert(current);
- }
-
- // FIXME: This is likely meant to use "used_mipmaps" as defined above, but if we do,
- // we end up with a regression: GH-22747
- if (mipmaps) {
- generate_mipmaps();
- }
-}
-
void Image::shrink_x2() {
ERR_FAIL_COND(data.size() == 0);
@@ -3047,7 +3004,6 @@ void Image::_bind_methods() {
ClassDB::bind_method(D_METHOD("resize_to_po2", "square"), &Image::resize_to_po2, DEFVAL(false));
ClassDB::bind_method(D_METHOD("resize", "width", "height", "interpolation"), &Image::resize, DEFVAL(INTERPOLATE_BILINEAR));
ClassDB::bind_method(D_METHOD("shrink_x2"), &Image::shrink_x2);
- ClassDB::bind_method(D_METHOD("expand_x2_hq2x"), &Image::expand_x2_hq2x);
ClassDB::bind_method(D_METHOD("crop", "width", "height"), &Image::crop);
ClassDB::bind_method(D_METHOD("flip_x"), &Image::flip_x);
diff --git a/core/image.h b/core/image.h
index dbdfaa917b..53c203998e 100644
--- a/core/image.h
+++ b/core/image.h
@@ -235,7 +235,6 @@ public:
void resize_to_po2(bool p_square = false);
void resize(int p_width, int p_height, Interpolation p_interpolation = INTERPOLATE_BILINEAR);
void shrink_x2();
- void expand_x2_hq2x();
bool is_size_po2() const;
/**
* Crop the image to a specific size, if larger, then the image is filled by black
diff --git a/core/oa_hash_map.h b/core/oa_hash_map.h
index e411ced044..4e2ea034ea 100644
--- a/core/oa_hash_map.h
+++ b/core/oa_hash_map.h
@@ -45,6 +45,9 @@
*
* The entries are stored inplace, so huge keys or values might fill cache lines
* a lot faster.
+ *
+ * Only used keys and values are constructed. For free positions there's space
+ * in the arrays for each, but that memory is kept uninitialized.
*/
template <class TKey, class TValue,
class Hasher = HashMapHasherDefault,
@@ -146,9 +149,9 @@ private:
uint32_t *old_hashes = hashes;
num_elements = 0;
- keys = memnew_arr(TKey, capacity);
- values = memnew_arr(TValue, capacity);
- hashes = memnew_arr(uint32_t, capacity);
+ keys = static_cast<TKey *>(Memory::alloc_static(sizeof(TKey) * capacity));
+ values = static_cast<TValue *>(Memory::alloc_static(sizeof(TValue) * capacity));
+ hashes = static_cast<uint32_t *>(Memory::alloc_static(sizeof(uint32_t) * capacity));
for (uint32_t i = 0; i < capacity; i++) {
hashes[i] = 0;
@@ -160,11 +163,14 @@ private:
}
_insert_with_hash(old_hashes[i], old_keys[i], old_values[i]);
+
+ old_keys[i].~TKey();
+ old_values[i].~TValue();
}
- memdelete_arr(old_keys);
- memdelete_arr(old_values);
- memdelete_arr(old_hashes);
+ Memory::free_static(old_keys);
+ Memory::free_static(old_values);
+ Memory::free_static(old_hashes);
}
void _resize_and_rehash() {
@@ -208,8 +214,7 @@ public:
bool exists = _lookup_pos(p_key, pos);
if (exists) {
- values[pos].~TValue();
- memnew_placement(&values[pos], TValue(p_data));
+ values[pos] = p_data;
} else {
insert(p_key, p_data);
}
@@ -226,8 +231,7 @@ public:
bool exists = _lookup_pos(p_key, pos);
if (exists) {
- r_data.~TValue();
- memnew_placement(&r_data, TValue(values[pos]));
+ r_data = values[pos];
return true;
}
@@ -343,9 +347,9 @@ public:
OAHashMap(uint32_t p_initial_capacity = 64) {
capacity = p_initial_capacity;
- keys = memnew_arr(TKey, p_initial_capacity);
- values = memnew_arr(TValue, p_initial_capacity);
- hashes = memnew_arr(uint32_t, p_initial_capacity);
+ keys = static_cast<TKey *>(Memory::alloc_static(sizeof(TKey) * capacity));
+ values = static_cast<TValue *>(Memory::alloc_static(sizeof(TValue) * capacity));
+ hashes = static_cast<uint32_t *>(Memory::alloc_static(sizeof(uint32_t) * capacity));
for (uint32_t i = 0; i < p_initial_capacity; i++) {
hashes[i] = EMPTY_HASH;
@@ -353,9 +357,18 @@ public:
}
~OAHashMap() {
- memdelete_arr(keys);
- memdelete_arr(values);
- memdelete_arr(hashes);
+ for (uint32_t i = 0; i < capacity; i++) {
+ if (hashes[i] == EMPTY_HASH) {
+ continue;
+ }
+
+ values[i].~TValue();
+ keys[i].~TKey();
+ }
+
+ Memory::free_static(keys);
+ Memory::free_static(values);
+ Memory::free_static(hashes);
}
};
diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml
index 20296bbf45..7593f7dff4 100644
--- a/doc/classes/Array.xml
+++ b/doc/classes/Array.xml
@@ -20,7 +20,7 @@
var array2 = [3, "Four"]
print(array1 + array2) # ["One", 2, 3, "Four"]
[/codeblock]
- Arrays are always passed by reference.
+ [b]Note:[/b] Arrays are always passed by reference. To get a copy of an array which can be modified independently of the original array, use [method duplicate].
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/Dictionary.xml b/doc/classes/Dictionary.xml
index e982e00d6d..385f4b7e59 100644
--- a/doc/classes/Dictionary.xml
+++ b/doc/classes/Dictionary.xml
@@ -7,6 +7,7 @@
Dictionary type. Associative container which contains values referenced by unique keys. Dictionaries are composed of pairs of keys (which must be unique) and values. Dictionaries will preserve the insertion order when adding elements, even though this may not be reflected when printing the dictionary. In other programming languages, this data structure is sometimes referred to as an hash map or associative array.
You can define a dictionary by placing a comma-separated list of [code]key: value[/code] pairs in curly braces [code]{}[/code].
Erasing elements while iterating over them [b]is not supported[/b] and will result in undefined behavior.
+ [b]Note:[/b] Dictionaries are always passed by reference. To get a copy of a dictionary which can be modified independently of the original dictionary, use [method duplicate].
Creating a dictionary:
[codeblock]
var my_dir = {} # Creates an empty dictionary.
diff --git a/doc/classes/Image.xml b/doc/classes/Image.xml
index 99253e8840..55d2275194 100644
--- a/doc/classes/Image.xml
+++ b/doc/classes/Image.xml
@@ -190,13 +190,6 @@
<description>
</description>
</method>
- <method name="expand_x2_hq2x">
- <return type="void">
- </return>
- <description>
- Stretches the image and enlarges it by a factor of 2. No interpolation is done.
- </description>
- </method>
<method name="fill">
<return type="void">
</return>
diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml
index 0c0d16753a..04c8d2bf57 100644
--- a/doc/classes/Node.xml
+++ b/doc/classes/Node.xml
@@ -129,21 +129,19 @@
child_node.get_parent().remove_child(child_node)
add_child(child_node)
[/codeblock]
- If you need the child node to be added below a specific node in the list of children, use [method add_child_below_node] instead of this method.
+ If you need the child node to be added below a specific node in the list of children, use [method add_sibling] instead of this method.
[b]Note:[/b] If you want a child to be persisted to a [PackedScene], you must set [member owner] in addition to calling [method add_child]. This is typically relevant for [url=https://godot.readthedocs.io/en/latest/tutorials/misc/running_code_in_the_editor.html]tool scripts[/url] and [url=https://godot.readthedocs.io/en/latest/tutorials/plugins/editor/index.html]editor plugins[/url]. If [method add_child] is called without setting [member owner], the newly added [Node] will not be visible in the scene tree, though it will be visible in the 2D/3D view.
</description>
</method>
- <method name="add_child_below_node">
+ <method name="add_sibling">
<return type="void">
</return>
- <argument index="0" name="preceding_node" type="Node">
+ <argument index="0" name="sibling" type="Node">
</argument>
- <argument index="1" name="node" type="Node">
- </argument>
- <argument index="2" name="legible_unique_name" type="bool" default="false">
+ <argument index="1" name="legible_unique_name" type="bool" default="false">
</argument>
<description>
- Adds a child node below the [code]preceding_node[/code].
+ Adds a [code]sibling[/code] node to current's node parent, at the the same level as that node, right below it.
If [code]legible_unique_name[/code] is [code]true[/code], the child node will have an human-readable name based on the name of the node being instanced instead of its type.
Use [method add_child] instead of this method if you don't need the child node to be added below a specific node in the list of children.
</description>
diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml
index 35e87d1a2a..87bcab25db 100644
--- a/doc/classes/Object.xml
+++ b/doc/classes/Object.xml
@@ -192,7 +192,7 @@
<return type="void">
</return>
<description>
- Deletes the object from memory. Any pre-existing reference to the freed object will now return [code]null[/code].
+ Deletes the object from memory. Any pre-existing reference to the freed object will become invalid, e.g. [code]is_instance_valid(object)[/code] will return [code]false[/code].
</description>
</method>
<method name="get" qualifiers="const">
diff --git a/doc/classes/PhysicalSkyMaterial.xml b/doc/classes/PhysicalSkyMaterial.xml
index 89b43158dc..2e0f9c52f2 100644
--- a/doc/classes/PhysicalSkyMaterial.xml
+++ b/doc/classes/PhysicalSkyMaterial.xml
@@ -31,6 +31,9 @@
<member name="mie_eccentricity" type="float" setter="set_mie_eccentricity" getter="get_mie_eccentricity" default="0.8">
Controls the direction of the mie scattering. A value of [code]1[/code] means that when light hits a particle it passing through straight forward. A value of [code]-1[/code] means that all light is scatter backwards.
</member>
+ <member name="night_sky" type="Texture2D" setter="set_night_sky" getter="get_night_sky">
+ [Texture2D] for the night sky. This is added to the sky, so if it is bright enough, it may be visible during the day.
+ </member>
<member name="rayleigh_coefficient" type="float" setter="set_rayleigh_coefficient" getter="get_rayleigh_coefficient" default="2.0">
Controls the strength of the rayleigh scattering. Rayleigh scattering results from light colliding with small particles. It is responsible for the blue color of the sky.
</member>
diff --git a/drivers/alsa/audio_driver_alsa.cpp b/drivers/alsa/audio_driver_alsa.cpp
index 414b0c28e0..90c3d3af83 100644
--- a/drivers/alsa/audio_driver_alsa.cpp
+++ b/drivers/alsa/audio_driver_alsa.cpp
@@ -38,7 +38,7 @@
#include <errno.h>
Error AudioDriverALSA::init_device() {
- mix_rate = GLOBAL_DEF("audio/mix_rate", DEFAULT_MIX_RATE);
+ mix_rate = GLOBAL_GET("audio/mix_rate");
speaker_mode = SPEAKER_MODE_STEREO;
channels = 2;
@@ -104,7 +104,7 @@ Error AudioDriverALSA::init_device() {
// In ALSA the period size seems to be the one that will determine the actual latency
// Ref: https://www.alsa-project.org/main/index.php/FramesPeriods
unsigned int periods = 2;
- int latency = GLOBAL_DEF("audio/output_latency", DEFAULT_OUTPUT_LATENCY);
+ int latency = GLOBAL_GET("audio/output_latency");
buffer_frames = closest_power_of_2(latency * mix_rate / 1000);
buffer_size = buffer_frames * periods;
period_size = buffer_frames;
diff --git a/drivers/coreaudio/audio_driver_coreaudio.cpp b/drivers/coreaudio/audio_driver_coreaudio.cpp
index d71d8cdaba..48d0a29516 100644
--- a/drivers/coreaudio/audio_driver_coreaudio.cpp
+++ b/drivers/coreaudio/audio_driver_coreaudio.cpp
@@ -116,7 +116,7 @@ Error AudioDriverCoreAudio::init() {
break;
}
- mix_rate = GLOBAL_DEF_RST("audio/mix_rate", DEFAULT_MIX_RATE);
+ mix_rate = GLOBAL_GET("audio/mix_rate");
zeromem(&strdesc, sizeof(strdesc));
strdesc.mFormatID = kAudioFormatLinearPCM;
@@ -131,7 +131,7 @@ Error AudioDriverCoreAudio::init() {
result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, kOutputBus, &strdesc, sizeof(strdesc));
ERR_FAIL_COND_V(result != noErr, FAILED);
- int latency = GLOBAL_DEF_RST("audio/output_latency", DEFAULT_OUTPUT_LATENCY);
+ int latency = GLOBAL_GET("audio/output_latency");
// Sample rate is independent of channels (ref: https://stackoverflow.com/questions/11048825/audio-sample-frequency-rely-on-channels)
buffer_frames = closest_power_of_2(latency * mix_rate / 1000);
@@ -403,7 +403,7 @@ Error AudioDriverCoreAudio::capture_init() {
break;
}
- mix_rate = GLOBAL_DEF_RST("audio/mix_rate", DEFAULT_MIX_RATE);
+ mix_rate = GLOBAL_GET("audio/mix_rate");
zeromem(&strdesc, sizeof(strdesc));
strdesc.mFormatID = kAudioFormatLinearPCM;
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
index ce0b8ade95..a6bc4f3b2c 100644
--- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp
+++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
@@ -179,7 +179,7 @@ Error AudioDriverPulseAudio::init_device() {
break;
}
- int latency = GLOBAL_DEF_RST("audio/output_latency", DEFAULT_OUTPUT_LATENCY);
+ int latency = GLOBAL_GET("audio/output_latency");
buffer_frames = closest_power_of_2(latency * mix_rate / 1000);
pa_buffer_size = buffer_frames * pa_map.channels;
@@ -237,7 +237,7 @@ Error AudioDriverPulseAudio::init() {
thread_exited = false;
exit_thread = false;
- mix_rate = GLOBAL_DEF_RST("audio/mix_rate", DEFAULT_MIX_RATE);
+ mix_rate = GLOBAL_GET("audio/mix_rate");
pa_ml = pa_mainloop_new();
ERR_FAIL_COND_V(pa_ml == nullptr, ERR_CANT_OPEN);
diff --git a/drivers/wasapi/audio_driver_wasapi.cpp b/drivers/wasapi/audio_driver_wasapi.cpp
index 707e55cfcb..cd1c08b717 100644
--- a/drivers/wasapi/audio_driver_wasapi.cpp
+++ b/drivers/wasapi/audio_driver_wasapi.cpp
@@ -387,7 +387,7 @@ Error AudioDriverWASAPI::finish_capture_device() {
}
Error AudioDriverWASAPI::init() {
- mix_rate = GLOBAL_DEF_RST("audio/mix_rate", DEFAULT_MIX_RATE);
+ mix_rate = GLOBAL_GET("audio/mix_rate");
Error err = init_render_device();
if (err != OK) {
diff --git a/drivers/xaudio2/audio_driver_xaudio2.cpp b/drivers/xaudio2/audio_driver_xaudio2.cpp
index df7d2488fd..421cf6a8cf 100644
--- a/drivers/xaudio2/audio_driver_xaudio2.cpp
+++ b/drivers/xaudio2/audio_driver_xaudio2.cpp
@@ -44,12 +44,12 @@ Error AudioDriverXAudio2::init() {
pcm_open = false;
samples_in = nullptr;
- mix_rate = GLOBAL_DEF_RST("audio/mix_rate", DEFAULT_MIX_RATE);
+ mix_rate = GLOBAL_GET("audio/mix_rate");
// FIXME: speaker_mode seems unused in the Xaudio2 driver so far
speaker_mode = SPEAKER_MODE_STEREO;
channels = 2;
- int latency = GLOBAL_DEF_RST("audio/output_latency", DEFAULT_OUTPUT_LATENCY);
+ int latency = GLOBAL_GET("audio/output_latency");
buffer_size = closest_power_of_2(latency * mix_rate / 1000);
samples_in = memnew_arr(int32_t, buffer_size * channels);
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index 87ca499413..716ead9afc 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -1162,6 +1162,7 @@ void EditorExport::save_presets() {
}
void EditorExport::_bind_methods() {
+ ADD_SIGNAL(MethodInfo("export_presets_updated"));
}
void EditorExport::add_export_platform(const Ref<EditorExportPlatform> &p_platform) {
@@ -1229,8 +1230,13 @@ Vector<Ref<EditorExportPlugin>> EditorExport::get_export_plugins() {
}
void EditorExport::_notification(int p_what) {
- if (p_what == NOTIFICATION_ENTER_TREE) {
- load_config();
+ switch (p_what) {
+ case NOTIFICATION_ENTER_TREE: {
+ load_config();
+ } break;
+ case NOTIFICATION_PROCESS: {
+ update_export_presets();
+ } break;
}
}
@@ -1332,6 +1338,49 @@ void EditorExport::load_config() {
block_save = false;
}
+void EditorExport::update_export_presets() {
+ Map<StringName, List<EditorExportPlatform::ExportOption>> platform_options;
+
+ for (int i = 0; i < export_platforms.size(); i++) {
+ Ref<EditorExportPlatform> platform = export_platforms[i];
+
+ if (platform->should_update_export_options()) {
+ List<EditorExportPlatform::ExportOption> options;
+ platform->get_export_options(&options);
+
+ platform_options[platform->get_name()] = options;
+ }
+ }
+
+ bool export_presets_updated = false;
+ for (int i = 0; i < export_presets.size(); i++) {
+ Ref<EditorExportPreset> preset = export_presets[i];
+ if (platform_options.has(preset->get_platform()->get_name())) {
+ export_presets_updated = true;
+
+ List<EditorExportPlatform::ExportOption> options = platform_options[preset->get_platform()->get_name()];
+
+ // Copy the previous preset values
+ Map<StringName, Variant> previous_values = preset->values;
+
+ // Clear the preset properties and values prior to reloading
+ preset->properties.clear();
+ preset->values.clear();
+
+ for (List<EditorExportPlatform::ExportOption>::Element *E = options.front(); E; E = E->next()) {
+ preset->properties.push_back(E->get().option);
+
+ StringName option_name = E->get().option.name;
+ preset->values[option_name] = previous_values.has(option_name) ? previous_values[option_name] : E->get().default_value;
+ }
+ }
+ }
+
+ if (export_presets_updated) {
+ emit_signal(_export_presets_updated);
+ }
+}
+
bool EditorExport::poll_export_platforms() {
bool changed = false;
for (int i = 0; i < export_platforms.size(); i++) {
@@ -1351,7 +1400,10 @@ EditorExport::EditorExport() {
save_timer->connect("timeout", callable_mp(this, &EditorExport::_save));
block_save = false;
+ _export_presets_updated = "export_presets_updated";
+
singleton = this;
+ set_process(true);
}
EditorExport::~EditorExport() {
diff --git a/editor/editor_export.h b/editor/editor_export.h
index 797649855f..4978b39248 100644
--- a/editor/editor_export.h
+++ b/editor/editor_export.h
@@ -227,6 +227,7 @@ public:
virtual Ref<EditorExportPreset> create_preset();
virtual void get_export_options(List<ExportOption> *r_options) = 0;
+ virtual bool should_update_export_options() { return false; }
virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const { return true; }
virtual String get_os_name() const = 0;
@@ -350,6 +351,8 @@ class EditorExport : public Node {
Vector<Ref<EditorExportPreset>> export_presets;
Vector<Ref<EditorExportPlugin>> export_plugins;
+ StringName _export_presets_updated;
+
Timer *save_timer;
bool block_save;
@@ -381,7 +384,7 @@ public:
Vector<Ref<EditorExportPlugin>> get_export_plugins();
void load_config();
-
+ void update_export_presets();
bool poll_export_platforms();
EditorExport();
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index ca0e486259..8b7014fabe 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -6014,8 +6014,11 @@ EditorNode::EditorNode() {
left_menu_hb->add_child(settings_menu);
p = settings_menu->get_popup();
-
+#ifdef OSX_ENABLED
+ p->add_shortcut(ED_SHORTCUT("editor/editor_settings", TTR("Editor Settings..."), KEY_MASK_CMD + KEY_COMMA), SETTINGS_PREFERENCES);
+#else
p->add_shortcut(ED_SHORTCUT("editor/editor_settings", TTR("Editor Settings...")), SETTINGS_PREFERENCES);
+#endif
p->add_separator();
editor_layouts = memnew(PopupMenu);
diff --git a/editor/icons/RootMotionView.svg b/editor/icons/RootMotionView.svg
new file mode 100644
index 0000000000..4d33420383
--- /dev/null
+++ b/editor/icons/RootMotionView.svg
@@ -0,0 +1 @@
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><radialGradient id="a" cx="8" cy="8" gradientTransform="matrix(.85714281 -.00000007 .00000004 .85714284 1.142858 1.142858)" gradientUnits="userSpaceOnUse" r="7"><stop offset="0" stop-color="#fc9c9c"/><stop offset=".83333331" stop-color="#fc9c9c" stop-opacity=".701961"/><stop offset="1" stop-color="#fc9c9c" stop-opacity="0"/></radialGradient><path d="m5 2v3h-3v2h3v2h-3v2h3v3h2v-3h2v3h2v-3h3v-2h-3v-2h3v-2h-3v-3h-2v3h-2v-3zm2 5h2v2h-2z" fill="url(#a)"/></svg> \ No newline at end of file
diff --git a/editor/icons/ShaderGlobalsOverride.svg b/editor/icons/ShaderGlobalsOverride.svg
new file mode 100644
index 0000000000..2fe76ed777
--- /dev/null
+++ b/editor/icons/ShaderGlobalsOverride.svg
@@ -0,0 +1 @@
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m2 1c-.55226.0001-.99994.4477-1 1v12c.0000552.5523.44774.9999 1 1h12c.55226-.0001.99994-.4477 1-1v-8l-5-5zm1 2h6v3c0 .554.44599 1 1 1h3v6h-10zm1 1v1h3v-1zm0 2v1h2v-1zm3 0v1h1v-1zm-2 3 3 3 3-3z" fill="#e0e0e0"/></svg> \ No newline at end of file
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index 32a1cf2fa1..e5372a5d47 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -133,6 +133,12 @@ void ProjectExportDialog::_add_preset(int p_platform) {
_edit_preset(EditorExport::get_singleton()->get_export_preset_count() - 1);
}
+void ProjectExportDialog::_force_update_current_preset_parameters() {
+ // Force the parameters section to refresh its UI.
+ parameters->edit(nullptr);
+ _update_current_preset();
+}
+
void ProjectExportDialog::_update_current_preset() {
_edit_preset(presets->get_current());
}
@@ -1101,6 +1107,7 @@ ProjectExportDialog::ProjectExportDialog() {
parameters->set_name(TTR("Options"));
parameters->set_v_size_flags(Control::SIZE_EXPAND_FILL);
parameters->connect("property_edited", callable_mp(this, &ProjectExportDialog::_update_parameters));
+ EditorExport::get_singleton()->connect("export_presets_updated", callable_mp(this, &ProjectExportDialog::_force_update_current_preset_parameters));
// Resources export parameters.
diff --git a/editor/project_export.h b/editor/project_export.h
index 2e311eb3b3..cfa00773d8 100644
--- a/editor/project_export.h
+++ b/editor/project_export.h
@@ -123,6 +123,7 @@ private:
void _delete_preset_confirm();
void _update_export_all();
+ void _force_update_current_preset_parameters();
void _update_current_preset();
void _update_presets();
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index e73c52047b..514bb8dd03 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -579,7 +579,8 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
dup->set_name(parent->validate_child_name(dup));
- editor_data->get_undo_redo().add_do_method(parent, "add_child_below_node", add_below_node, dup);
+ editor_data->get_undo_redo().add_do_method(add_below_node, "add_sibling", dup);
+
for (List<Node *>::Element *F = owned.front(); F; F = F->next()) {
if (!duplimap.has(F->get())) {
continue;
diff --git a/gles_builders.py b/gles_builders.py
index 85a8d7aa15..85d0112c9a 100644
--- a/gles_builders.py
+++ b/gles_builders.py
@@ -36,14 +36,14 @@ def include_file_in_legacygl_header(filename, header_data, depth):
while line:
- if line.find("[vertex]") != -1:
+ if line.find("#[vertex]") != -1:
header_data.reading = "vertex"
line = fs.readline()
header_data.line_offset += 1
header_data.vertex_offset = header_data.line_offset
continue
- if line.find("[fragment]") != -1:
+ if line.find("#[fragment]") != -1:
header_data.reading = "fragment"
line = fs.readline()
header_data.line_offset += 1
@@ -612,21 +612,21 @@ def include_file_in_rd_header(filename, header_data, depth):
while line:
- if line.find("[vertex]") != -1:
+ if line.find("#[vertex]") != -1:
header_data.reading = "vertex"
line = fs.readline()
header_data.line_offset += 1
header_data.vertex_offset = header_data.line_offset
continue
- if line.find("[fragment]") != -1:
+ if line.find("#[fragment]") != -1:
header_data.reading = "fragment"
line = fs.readline()
header_data.line_offset += 1
header_data.fragment_offset = header_data.line_offset
continue
- if line.find("[compute]") != -1:
+ if line.find("#[compute]") != -1:
header_data.reading = "compute"
line = fs.readline()
header_data.line_offset += 1
diff --git a/main/tests/test_oa_hash_map.cpp b/main/tests/test_oa_hash_map.cpp
index cae143bb5d..719817baf4 100644
--- a/main/tests/test_oa_hash_map.cpp
+++ b/main/tests/test_oa_hash_map.cpp
@@ -35,6 +35,37 @@
namespace TestOAHashMap {
+struct CountedItem {
+ static int count;
+
+ int id = -1;
+ bool destroyed = false;
+
+ CountedItem() {
+ count++;
+ }
+
+ CountedItem(int p_id) :
+ id(p_id) {
+ count++;
+ }
+
+ CountedItem(const CountedItem &p_other) :
+ id(p_other.id) {
+ count++;
+ }
+
+ CountedItem &operator=(const CountedItem &p_other) = default;
+
+ ~CountedItem() {
+ CRASH_COND(destroyed);
+ count--;
+ destroyed = true;
+ }
+};
+
+int CountedItem::count;
+
MainLoop *test() {
OS::get_singleton()->print("\n\n\nHello from test\n");
@@ -152,6 +183,33 @@ MainLoop *test() {
map.set(5, 1);
}
+ // test memory management of items, should not crash or leak items
+ {
+ // Exercise different patterns of removal
+ for (int i = 0; i < 4; ++i) {
+ {
+ OAHashMap<String, CountedItem> map;
+ int id = 0;
+ for (int j = 0; j < 100; ++j) {
+ map.insert(itos(j), CountedItem(id));
+ }
+ if (i <= 1) {
+ for (int j = 0; j < 100; ++j) {
+ map.remove(itos(j));
+ }
+ }
+ if (i % 2 == 0) {
+ map.clear();
+ }
+ }
+
+ if (CountedItem::count != 0) {
+ OS::get_singleton()->print("%d != 0 (not performing the other test sub-cases, breaking...)\n", CountedItem::count);
+ break;
+ }
+ }
+ }
+
return nullptr;
}
diff --git a/misc/scons/site_tools/compilation_db.py b/misc/scons/compilation_db.py
index 87db32adc9..87db32adc9 100644
--- a/misc/scons/site_tools/compilation_db.py
+++ b/misc/scons/compilation_db.py
diff --git a/modules/gdnative/gdnative/aabb.cpp b/modules/gdnative/gdnative/aabb.cpp
index 246e5d4e8d..7f22c7dfe3 100644
--- a/modules/gdnative/gdnative/aabb.cpp
+++ b/modules/gdnative/gdnative/aabb.cpp
@@ -37,6 +37,8 @@
extern "C" {
#endif
+static_assert(sizeof(godot_aabb) == sizeof(AABB), "AABB size mismatch");
+
void GDAPI godot_aabb_new(godot_aabb *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size) {
const Vector3 *pos = (const Vector3 *)p_pos;
const Vector3 *size = (const Vector3 *)p_size;
diff --git a/modules/gdnative/gdnative/array.cpp b/modules/gdnative/gdnative/array.cpp
index 0c764ab8fd..fb23863dc9 100644
--- a/modules/gdnative/gdnative/array.cpp
+++ b/modules/gdnative/gdnative/array.cpp
@@ -41,6 +41,8 @@
extern "C" {
#endif
+static_assert(sizeof(godot_array) == sizeof(Array), "Array size mismatch");
+
void GDAPI godot_array_new(godot_array *r_dest) {
Array *dest = (Array *)r_dest;
memnew_placement(dest, Array);
diff --git a/modules/gdnative/gdnative/basis.cpp b/modules/gdnative/gdnative/basis.cpp
index 4f489287b9..990fd3795d 100644
--- a/modules/gdnative/gdnative/basis.cpp
+++ b/modules/gdnative/gdnative/basis.cpp
@@ -37,6 +37,8 @@
extern "C" {
#endif
+static_assert(sizeof(godot_basis) == sizeof(Basis), "Basis size mismatch");
+
void GDAPI godot_basis_new_with_rows(godot_basis *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis) {
const Vector3 *x_axis = (const Vector3 *)p_x_axis;
const Vector3 *y_axis = (const Vector3 *)p_y_axis;
diff --git a/modules/gdnative/gdnative/color.cpp b/modules/gdnative/gdnative/color.cpp
index d79170771a..c75e74daba 100644
--- a/modules/gdnative/gdnative/color.cpp
+++ b/modules/gdnative/gdnative/color.cpp
@@ -37,6 +37,8 @@
extern "C" {
#endif
+static_assert(sizeof(godot_color) == sizeof(Color), "Color size mismatch");
+
void GDAPI godot_color_new_rgba(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b, const godot_real p_a) {
Color *dest = (Color *)r_dest;
*dest = Color(p_r, p_g, p_b, p_a);
diff --git a/modules/gdnative/gdnative/dictionary.cpp b/modules/gdnative/gdnative/dictionary.cpp
index b145b88934..a126974815 100644
--- a/modules/gdnative/gdnative/dictionary.cpp
+++ b/modules/gdnative/gdnative/dictionary.cpp
@@ -39,6 +39,8 @@
extern "C" {
#endif
+static_assert(sizeof(godot_dictionary) == sizeof(Dictionary), "Dictionary size mismatch");
+
void GDAPI godot_dictionary_new(godot_dictionary *r_dest) {
Dictionary *dest = (Dictionary *)r_dest;
memnew_placement(dest, Dictionary);
diff --git a/modules/gdnative/gdnative/node_path.cpp b/modules/gdnative/gdnative/node_path.cpp
index 93f43835c8..88ed650ebe 100644
--- a/modules/gdnative/gdnative/node_path.cpp
+++ b/modules/gdnative/gdnative/node_path.cpp
@@ -37,6 +37,8 @@
extern "C" {
#endif
+static_assert(sizeof(godot_node_path) == sizeof(NodePath), "NodePath size mismatch");
+
void GDAPI godot_node_path_new(godot_node_path *r_dest, const godot_string *p_from) {
NodePath *dest = (NodePath *)r_dest;
const String *from = (const String *)p_from;
diff --git a/modules/gdnative/gdnative/plane.cpp b/modules/gdnative/gdnative/plane.cpp
index 923308dc34..663937f906 100644
--- a/modules/gdnative/gdnative/plane.cpp
+++ b/modules/gdnative/gdnative/plane.cpp
@@ -37,6 +37,8 @@
extern "C" {
#endif
+static_assert(sizeof(godot_plane) == sizeof(Plane), "Plane size mismatch");
+
void GDAPI godot_plane_new_with_reals(godot_plane *r_dest, const godot_real p_a, const godot_real p_b, const godot_real p_c, const godot_real p_d) {
Plane *dest = (Plane *)r_dest;
*dest = Plane(p_a, p_b, p_c, p_d);
diff --git a/modules/gdnative/gdnative/pool_arrays.cpp b/modules/gdnative/gdnative/pool_arrays.cpp
index 589b4d4dfe..652f59cd07 100644
--- a/modules/gdnative/gdnative/pool_arrays.cpp
+++ b/modules/gdnative/gdnative/pool_arrays.cpp
@@ -42,6 +42,14 @@
extern "C" {
#endif
+static_assert(sizeof(godot_packed_byte_array) == sizeof(Vector<uint8_t>), "Vector<uint8_t> size mismatch");
+static_assert(sizeof(godot_packed_int_array) == sizeof(Vector<godot_int>), "Vector<godot_int> size mismatch");
+static_assert(sizeof(godot_packed_real_array) == sizeof(Vector<godot_real>), "Vector<godot_real> size mismatch");
+static_assert(sizeof(godot_packed_string_array) == sizeof(Vector<String>), "Vector<String> size mismatch");
+static_assert(sizeof(godot_packed_vector2_array) == sizeof(Vector<Vector2>), "Vector<Vector2> size mismatch");
+static_assert(sizeof(godot_packed_vector3_array) == sizeof(Vector<Vector3>), "Vector<Vector3> size mismatch");
+static_assert(sizeof(godot_packed_color_array) == sizeof(Vector<Color>), "Vector<Color> size mismatch");
+
#define memnew_placement_custom(m_placement, m_class, m_constr) _post_initialize(new (m_placement, sizeof(m_class), "") m_constr)
// byte
diff --git a/modules/gdnative/gdnative/quat.cpp b/modules/gdnative/gdnative/quat.cpp
index 15c04f7191..de6308ad2a 100644
--- a/modules/gdnative/gdnative/quat.cpp
+++ b/modules/gdnative/gdnative/quat.cpp
@@ -37,6 +37,8 @@
extern "C" {
#endif
+static_assert(sizeof(godot_quat) == sizeof(Quat), "Quat size mismatch");
+
void GDAPI godot_quat_new(godot_quat *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z, const godot_real p_w) {
Quat *dest = (Quat *)r_dest;
*dest = Quat(p_x, p_y, p_z, p_w);
diff --git a/modules/gdnative/gdnative/rect2.cpp b/modules/gdnative/gdnative/rect2.cpp
index a2f735172f..63cbbaa3cf 100644
--- a/modules/gdnative/gdnative/rect2.cpp
+++ b/modules/gdnative/gdnative/rect2.cpp
@@ -37,6 +37,8 @@
extern "C" {
#endif
+static_assert(sizeof(godot_rect2) == sizeof(Rect2), "Rect2 size mismatch");
+
void GDAPI godot_rect2_new_with_position_and_size(godot_rect2 *r_dest, const godot_vector2 *p_pos, const godot_vector2 *p_size) {
const Vector2 *position = (const Vector2 *)p_pos;
const Vector2 *size = (const Vector2 *)p_size;
diff --git a/modules/gdnative/gdnative/rid.cpp b/modules/gdnative/gdnative/rid.cpp
index 7ea80123a3..d7a63f33a7 100644
--- a/modules/gdnative/gdnative/rid.cpp
+++ b/modules/gdnative/gdnative/rid.cpp
@@ -38,6 +38,8 @@
extern "C" {
#endif
+static_assert(sizeof(godot_rid) == sizeof(RID), "RID size mismatch");
+
void GDAPI godot_rid_new(godot_rid *r_dest) {
RID *dest = (RID *)r_dest;
memnew_placement(dest, RID);
diff --git a/modules/gdnative/gdnative/string.cpp b/modules/gdnative/gdnative/string.cpp
index a22af89edc..724a4b56cb 100644
--- a/modules/gdnative/gdnative/string.cpp
+++ b/modules/gdnative/gdnative/string.cpp
@@ -40,6 +40,10 @@
extern "C" {
#endif
+static_assert(sizeof(godot_char_string) == sizeof(CharString), "CharString size mismatch");
+static_assert(sizeof(godot_string) == sizeof(String), "String size mismatch");
+static_assert(sizeof(godot_char_type) == sizeof(CharType), "CharType size mismatch");
+
godot_int GDAPI godot_char_string_length(const godot_char_string *p_cs) {
const CharString *cs = (const CharString *)p_cs;
diff --git a/modules/gdnative/gdnative/string_name.cpp b/modules/gdnative/gdnative/string_name.cpp
index 1abb4486b1..7bbaaeeaa0 100644
--- a/modules/gdnative/gdnative/string_name.cpp
+++ b/modules/gdnative/gdnative/string_name.cpp
@@ -39,6 +39,8 @@
extern "C" {
#endif
+static_assert(sizeof(godot_string_name) == sizeof(StringName), "StringName size mismatch");
+
void GDAPI godot_string_name_new(godot_string_name *r_dest, const godot_string *p_name) {
StringName *dest = (StringName *)r_dest;
const String *name = (const String *)p_name;
diff --git a/modules/gdnative/gdnative/transform.cpp b/modules/gdnative/gdnative/transform.cpp
index c9b3e37fb2..d19de93e9b 100644
--- a/modules/gdnative/gdnative/transform.cpp
+++ b/modules/gdnative/gdnative/transform.cpp
@@ -37,6 +37,8 @@
extern "C" {
#endif
+static_assert(sizeof(godot_transform) == sizeof(Transform), "Transform size mismatch");
+
void GDAPI godot_transform_new_with_axis_origin(godot_transform *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis, const godot_vector3 *p_origin) {
const Vector3 *x_axis = (const Vector3 *)p_x_axis;
const Vector3 *y_axis = (const Vector3 *)p_y_axis;
diff --git a/modules/gdnative/gdnative/transform2d.cpp b/modules/gdnative/gdnative/transform2d.cpp
index 26a71333b1..c0f7878eb0 100644
--- a/modules/gdnative/gdnative/transform2d.cpp
+++ b/modules/gdnative/gdnative/transform2d.cpp
@@ -37,6 +37,8 @@
extern "C" {
#endif
+static_assert(sizeof(godot_transform2d) == sizeof(Transform2D), "Transform2D size mismatch");
+
void GDAPI godot_transform2d_new(godot_transform2d *r_dest, const godot_real p_rot, const godot_vector2 *p_pos) {
const Vector2 *pos = (const Vector2 *)p_pos;
Transform2D *dest = (Transform2D *)r_dest;
diff --git a/modules/gdnative/gdnative/variant.cpp b/modules/gdnative/gdnative/variant.cpp
index f0fc44ae8a..29d0f96b97 100644
--- a/modules/gdnative/gdnative/variant.cpp
+++ b/modules/gdnative/gdnative/variant.cpp
@@ -37,6 +37,8 @@
extern "C" {
#endif
+static_assert(sizeof(godot_variant) == sizeof(Variant), "Variant size mismatch");
+
// Workaround GCC ICE on armv7hl which was affected GCC 6.0 up to 8.0 (GH-16100).
// It was fixed upstream in 8.1, and a fix was backported to 7.4.
// This can be removed once no supported distro ships with versions older than 7.4.
diff --git a/modules/gdnative/gdnative/vector2.cpp b/modules/gdnative/gdnative/vector2.cpp
index b6c3569f42..72c3c0ec35 100644
--- a/modules/gdnative/gdnative/vector2.cpp
+++ b/modules/gdnative/gdnative/vector2.cpp
@@ -37,6 +37,8 @@
extern "C" {
#endif
+static_assert(sizeof(godot_vector2) == sizeof(Vector2), "Vector2 size mismatch");
+
void GDAPI godot_vector2_new(godot_vector2 *r_dest, const godot_real p_x, const godot_real p_y) {
Vector2 *dest = (Vector2 *)r_dest;
*dest = Vector2(p_x, p_y);
diff --git a/modules/gdnative/gdnative/vector3.cpp b/modules/gdnative/gdnative/vector3.cpp
index 3e272ae9df..16fbdf353a 100644
--- a/modules/gdnative/gdnative/vector3.cpp
+++ b/modules/gdnative/gdnative/vector3.cpp
@@ -37,6 +37,8 @@
extern "C" {
#endif
+static_assert(sizeof(godot_vector3) == sizeof(Vector3), "Vector3 size mismatch");
+
void GDAPI godot_vector3_new(godot_vector3 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z) {
Vector3 *dest = (Vector3 *)r_dest;
*dest = Vector3(p_x, p_y, p_z);
diff --git a/modules/gdnative/include/gdnative/pool_arrays.h b/modules/gdnative/include/gdnative/pool_arrays.h
index c610377f54..652bd6ae1c 100644
--- a/modules/gdnative/include/gdnative/pool_arrays.h
+++ b/modules/gdnative/include/gdnative/pool_arrays.h
@@ -39,7 +39,7 @@ extern "C" {
/////// PackedByteArray
-#define GODOT_PACKED_BYTE_ARRAY_SIZE sizeof(void *)
+#define GODOT_PACKED_BYTE_ARRAY_SIZE (2 * sizeof(void *))
#ifndef GODOT_CORE_API_GODOT_PACKED_BYTE_ARRAY_TYPE_DEFINED
#define GODOT_CORE_API_GODOT_PACKED_BYTE_ARRAY_TYPE_DEFINED
@@ -50,7 +50,7 @@ typedef struct {
/////// PackedInt32Array
-#define GODOT_PACKED_INT_ARRAY_SIZE sizeof(void *)
+#define GODOT_PACKED_INT_ARRAY_SIZE (2 * sizeof(void *))
#ifndef GODOT_CORE_API_GODOT_PACKED_INT_ARRAY_TYPE_DEFINED
#define GODOT_CORE_API_GODOT_PACKED_INT_ARRAY_TYPE_DEFINED
@@ -61,7 +61,7 @@ typedef struct {
/////// PackedFloat32Array
-#define GODOT_PACKED_REAL_ARRAY_SIZE sizeof(void *)
+#define GODOT_PACKED_REAL_ARRAY_SIZE (2 * sizeof(void *))
#ifndef GODOT_CORE_API_GODOT_PACKED_REAL_ARRAY_TYPE_DEFINED
#define GODOT_CORE_API_GODOT_PACKED_REAL_ARRAY_TYPE_DEFINED
@@ -72,7 +72,7 @@ typedef struct {
/////// PackedStringArray
-#define GODOT_PACKED_STRING_ARRAY_SIZE sizeof(void *)
+#define GODOT_PACKED_STRING_ARRAY_SIZE (2 * sizeof(void *))
#ifndef GODOT_CORE_API_GODOT_PACKED_STRING_ARRAY_TYPE_DEFINED
#define GODOT_CORE_API_GODOT_PACKED_STRING_ARRAY_TYPE_DEFINED
@@ -83,7 +83,7 @@ typedef struct {
/////// PackedVector2Array
-#define GODOT_PACKED_VECTOR2_ARRAY_SIZE sizeof(void *)
+#define GODOT_PACKED_VECTOR2_ARRAY_SIZE (2 * sizeof(void *))
#ifndef GODOT_CORE_API_GODOT_PACKED_VECTOR2_ARRAY_TYPE_DEFINED
#define GODOT_CORE_API_GODOT_PACKED_VECTOR2_ARRAY_TYPE_DEFINED
@@ -94,7 +94,7 @@ typedef struct {
/////// PackedVector3Array
-#define GODOT_PACKED_VECTOR3_ARRAY_SIZE sizeof(void *)
+#define GODOT_PACKED_VECTOR3_ARRAY_SIZE (2 * sizeof(void *))
#ifndef GODOT_CORE_API_GODOT_PACKED_VECTOR3_ARRAY_TYPE_DEFINED
#define GODOT_CORE_API_GODOT_PACKED_VECTOR3_ARRAY_TYPE_DEFINED
@@ -105,7 +105,7 @@ typedef struct {
/////// PackedColorArray
-#define GODOT_PACKED_COLOR_ARRAY_SIZE sizeof(void *)
+#define GODOT_PACKED_COLOR_ARRAY_SIZE (2 * sizeof(void *))
#ifndef GODOT_CORE_API_GODOT_PACKED_COLOR_ARRAY_TYPE_DEFINED
#define GODOT_CORE_API_GODOT_PACKED_COLOR_ARRAY_TYPE_DEFINED
diff --git a/modules/gdnative/include/gdnative/rid.h b/modules/gdnative/include/gdnative/rid.h
index 04661cedc8..73b601dc04 100644
--- a/modules/gdnative/include/gdnative/rid.h
+++ b/modules/gdnative/include/gdnative/rid.h
@@ -37,7 +37,7 @@ extern "C" {
#include <stdint.h>
-#define GODOT_RID_SIZE sizeof(void *)
+#define GODOT_RID_SIZE sizeof(uint64_t)
#ifndef GODOT_CORE_API_GODOT_RID_TYPE_DEFINED
#define GODOT_CORE_API_GODOT_RID_TYPE_DEFINED
diff --git a/modules/gdnative/include/gdnative/variant.h b/modules/gdnative/include/gdnative/variant.h
index 934e856fbf..682c3e3ba8 100644
--- a/modules/gdnative/include/gdnative/variant.h
+++ b/modules/gdnative/include/gdnative/variant.h
@@ -37,7 +37,7 @@ extern "C" {
#include <stdint.h>
-#define GODOT_VARIANT_SIZE (16 + sizeof(void *))
+#define GODOT_VARIANT_SIZE (16 + sizeof(int64_t))
#ifndef GODOT_CORE_API_GODOT_VARIANT_TYPE_DEFINED
#define GODOT_CORE_API_GODOT_VARIANT_TYPE_DEFINED
diff --git a/modules/lightmapper_rd/lm_blendseams.glsl b/modules/lightmapper_rd/lm_blendseams.glsl
index 8a9ea91311..e47e5fcc51 100644
--- a/modules/lightmapper_rd/lm_blendseams.glsl
+++ b/modules/lightmapper_rd/lm_blendseams.glsl
@@ -1,10 +1,9 @@
-/* clang-format off */
-[versions]
+#[versions]
-lines = "#define MODE_LINES"
-triangles = "#define MODE_TRIANGLES"
+lines = "#define MODE_LINES";
+triangles = "#define MODE_TRIANGLES";
-[vertex]
+#[vertex]
#version 450
@@ -12,22 +11,20 @@ VERSION_DEFINES
#include "lm_common_inc.glsl"
- /* clang-format on */
-
- layout(push_constant, binding = 0, std430) uniform Params {
- uint base_index;
- uint slice;
- vec2 uv_offset;
- bool debug;
- float blend;
- uint pad[2];
- } params;
+layout(push_constant, binding = 0, std430) uniform Params {
+ uint base_index;
+ uint slice;
+ vec2 uv_offset;
+ bool debug;
+ float blend;
+ uint pad[2];
+}
+params;
layout(location = 0) out vec3 uv_interp;
void main() {
#ifdef MODE_TRIANGLES
-
uint triangle_idx = params.base_index + gl_VertexIndex / 3;
uint triangle_subidx = gl_VertexIndex % 3;
@@ -42,7 +39,6 @@ void main() {
uv_interp = vec3(uv, float(params.slice));
gl_Position = vec4((uv + params.uv_offset) * 2.0 - 1.0, 0.0001, 1.0);
-
#endif
#ifdef MODE_LINES
@@ -71,12 +67,10 @@ void main() {
uv_interp = vec3(src_uv, float(params.slice));
gl_Position = vec4(dst_uv * 2.0 - 1.0, 0.0001, 1.0);
- ;
#endif
}
-/* clang-format off */
-[fragment]
+#[fragment]
#version 450
@@ -84,16 +78,15 @@ VERSION_DEFINES
#include "lm_common_inc.glsl"
- /* clang-format on */
-
- layout(push_constant, binding = 0, std430) uniform Params {
- uint base_index;
- uint slice;
- vec2 uv_offset;
- bool debug;
- float blend;
- uint pad[2];
- } params;
+layout(push_constant, binding = 0, std430) uniform Params {
+ uint base_index;
+ uint slice;
+ vec2 uv_offset;
+ bool debug;
+ float blend;
+ uint pad[2];
+}
+params;
layout(location = 0) in vec3 uv_interp;
diff --git a/modules/lightmapper_rd/lm_common_inc.glsl b/modules/lightmapper_rd/lm_common_inc.glsl
index 15946d5327..0ff455936e 100644
--- a/modules/lightmapper_rd/lm_common_inc.glsl
+++ b/modules/lightmapper_rd/lm_common_inc.glsl
@@ -11,7 +11,6 @@ struct Vertex {
layout(set = 0, binding = 1, std430) restrict readonly buffer Vertices {
Vertex data[];
}
-
vertices;
struct Triangle {
@@ -22,7 +21,6 @@ struct Triangle {
layout(set = 0, binding = 2, std430) restrict readonly buffer Triangles {
Triangle data[];
}
-
triangles;
struct Box {
@@ -35,13 +33,11 @@ struct Box {
layout(set = 0, binding = 3, std430) restrict readonly buffer Boxes {
Box data[];
}
-
boxes;
layout(set = 0, binding = 4, std430) restrict readonly buffer GridIndices {
uint data[];
}
-
grid_indices;
#define LIGHT_TYPE_DIRECTIONAL 0
@@ -70,7 +66,6 @@ struct Light {
layout(set = 0, binding = 5, std430) restrict readonly buffer Lights {
Light data[];
}
-
lights;
struct Seam {
@@ -81,13 +76,11 @@ struct Seam {
layout(set = 0, binding = 6, std430) restrict readonly buffer Seams {
Seam data[];
}
-
seams;
layout(set = 0, binding = 7, std430) restrict readonly buffer Probes {
vec4 data[];
}
-
probe_positions;
layout(set = 0, binding = 8) uniform utexture3D grid;
diff --git a/modules/lightmapper_rd/lm_compute.glsl b/modules/lightmapper_rd/lm_compute.glsl
index a442016969..56976bd623 100644
--- a/modules/lightmapper_rd/lm_compute.glsl
+++ b/modules/lightmapper_rd/lm_compute.glsl
@@ -1,13 +1,12 @@
-/* clang-format off */
-[versions]
+#[versions]
-primary = "#define MODE_DIRECT_LIGHT"
-secondary = "#define MODE_BOUNCE_LIGHT"
-dilate = "#define MODE_DILATE"
-unocclude = "#define MODE_UNOCCLUDE"
-light_probes = "#define MODE_LIGHT_PROBES"
+primary = "#define MODE_DIRECT_LIGHT";
+secondary = "#define MODE_BOUNCE_LIGHT";
+dilate = "#define MODE_DILATE";
+unocclude = "#define MODE_UNOCCLUDE";
+light_probes = "#define MODE_LIGHT_PROBES";
-[compute]
+#[compute]
#version 450
@@ -29,14 +28,11 @@ layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
#include "lm_common_inc.glsl"
-/* clang-format on */
-
#ifdef MODE_LIGHT_PROBES
layout(set = 1, binding = 0, std430) restrict buffer LightProbeData {
vec4 data[];
}
-
light_probes;
layout(set = 1, binding = 1) uniform texture2DArray source_light;
@@ -94,7 +90,6 @@ layout(push_constant, binding = 0, std430) uniform Params {
mat3x4 env_transform;
}
-
params;
//check it, but also return distance and barycentric coords (for uv lookup)
@@ -123,7 +118,6 @@ bool trace_ray(vec3 p_from, vec3 p_to
out float r_distance, out vec3 r_normal
#endif
) {
-
/* world coords */
vec3 rel = p_to - p_from;
@@ -149,7 +143,6 @@ bool trace_ray(vec3 p_from, vec3 p_to
while (all(greaterThanEqual(icell, ivec3(0))) && all(lessThan(icell, ivec3(params.grid_size))) && iters < 1000) {
uvec2 cell_data = texelFetch(usampler3D(grid, linear_sampler), icell, 0).xy;
if (cell_data.x > 0) { //triangles here
-
bool hit = false;
#if defined(MODE_UNOCCLUDE)
bool hit_backface = false;
@@ -211,7 +204,6 @@ bool trace_ray(vec3 p_from, vec3 p_to
r_triangle = tidx;
r_barycentric = barycentric;
}
-
#endif
}
}
diff --git a/modules/lightmapper_rd/lm_raster.glsl b/modules/lightmapper_rd/lm_raster.glsl
index 36b706bcd5..6c2904192b 100644
--- a/modules/lightmapper_rd/lm_raster.glsl
+++ b/modules/lightmapper_rd/lm_raster.glsl
@@ -1,5 +1,4 @@
-/* clang-format off */
-[vertex]
+#[vertex]
#version 450
@@ -7,9 +6,7 @@ VERSION_DEFINES
#include "lm_common_inc.glsl"
- /* clang-format on */
-
- layout(location = 0) out vec3 vertex_interp;
+layout(location = 0) out vec3 vertex_interp;
layout(location = 1) out vec3 normal_interp;
layout(location = 2) out vec2 uv_interp;
layout(location = 3) out vec3 barycentric;
@@ -26,11 +23,8 @@ layout(push_constant, binding = 0, std430) uniform Params {
ivec3 grid_size;
uint pad2;
}
-
params;
-/* clang-format on */
-
void main() {
uint triangle_idx = params.base_triangle + gl_VertexIndex / 3;
uint triangle_subidx = gl_VertexIndex % 3;
@@ -56,12 +50,9 @@ void main() {
face_normal = -normalize(cross((vertices.data[vertex_indices.x].position - vertices.data[vertex_indices.y].position), (vertices.data[vertex_indices.x].position - vertices.data[vertex_indices.z].position)));
gl_Position = vec4((uv_interp + params.uv_offset) * 2.0 - 1.0, 0.0001, 1.0);
- ;
}
-/* clang-format off */
-
-[fragment]
+#[fragment]
#version 450
@@ -69,7 +60,6 @@ VERSION_DEFINES
#include "lm_common_inc.glsl"
-
layout(push_constant, binding = 0, std430) uniform Params {
vec2 atlas_size;
vec2 uv_offset;
@@ -79,9 +69,8 @@ layout(push_constant, binding = 0, std430) uniform Params {
float bias;
ivec3 grid_size;
uint pad2;
-} params;
-
-/* clang-format on */
+}
+params;
layout(location = 0) in vec3 vertex_interp;
layout(location = 1) in vec3 normal_interp;
@@ -100,7 +89,6 @@ void main() {
{
// smooth out vertex position by interpolating its projection in the 3 normal planes (normal plane is created by vertex pos and normal)
// because we don't want to interpolate inwards, normals found pointing inwards are pushed out.
-
vec3 pos_a = vertices.data[vertex_indices.x].position;
vec3 pos_b = vertices.data[vertex_indices.y].position;
vec3 pos_c = vertices.data[vertex_indices.z].position;
diff --git a/modules/websocket/register_types.cpp b/modules/websocket/register_types.cpp
index 1ad249e1eb..bc50de414e 100644
--- a/modules/websocket/register_types.cpp
+++ b/modules/websocket/register_types.cpp
@@ -42,9 +42,16 @@
#endif
#ifdef TOOLS_ENABLED
#include "editor/debugger/editor_debugger_server.h"
+#include "editor/editor_node.h"
#include "editor_debugger_server_websocket.h"
#endif
+#ifdef TOOLS_ENABLED
+static void _editor_init_callback() {
+ EditorDebuggerServer::register_protocol_handler("ws://", EditorDebuggerServerWebSocket::create);
+}
+#endif
+
void register_websocket_types() {
#ifdef JAVASCRIPT_ENABLED
EMWSPeer::make_default();
@@ -62,7 +69,7 @@ void register_websocket_types() {
ClassDB::register_custom_instance_class<WebSocketPeer>();
#ifdef TOOLS_ENABLED
- EditorDebuggerServer::register_protocol_handler("ws://", EditorDebuggerServerWebSocket::create);
+ EditorNode::add_init_callback(&_editor_init_callback);
#endif
}
diff --git a/platform/android/audio_driver_jandroid.cpp b/platform/android/audio_driver_jandroid.cpp
index 0ace7d03a1..09c981b3fa 100644
--- a/platform/android/audio_driver_jandroid.cpp
+++ b/platform/android/audio_driver_jandroid.cpp
@@ -73,9 +73,9 @@ Error AudioDriverAndroid::init() {
// __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDL audio: opening device");
JNIEnv *env = ThreadAndroid::get_env();
- int mix_rate = GLOBAL_DEF_RST("audio/mix_rate", 44100);
+ int mix_rate = GLOBAL_GET("audio/mix_rate");
- int latency = GLOBAL_DEF_RST("audio/output_latency", 25);
+ int latency = GLOBAL_GET("audio/output_latency");
unsigned int buffer_size = next_power_of_2(latency * mix_rate / 1000);
print_verbose("Audio buffer size: " + itos(buffer_size));
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 0b6c6990f3..a53f97e492 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -44,6 +44,7 @@
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "platform/android/logo.gen.h"
+#include "platform/android/plugin/godot_plugin_config.h"
#include "platform/android/run_icon.gen.h"
#include <string.h>
@@ -252,16 +253,45 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
EditorProgress *ep;
};
+ Vector<PluginConfig> plugins;
+ volatile bool plugins_changed;
+ Mutex plugins_lock;
Vector<Device> devices;
volatile bool devices_changed;
Mutex device_lock;
- Thread *device_thread;
+ Thread *check_for_changes_thread;
volatile bool quit_request;
- static void _device_poll_thread(void *ud) {
+ static void _check_for_changes_poll_thread(void *ud) {
EditorExportPlatformAndroid *ea = (EditorExportPlatformAndroid *)ud;
while (!ea->quit_request) {
+ // Check for plugins updates
+ {
+ // Nothing to do if we already know the plugins have changed.
+ if (!ea->plugins_changed) {
+ Vector<PluginConfig> loaded_plugins = get_plugins();
+
+ MutexLock lock(ea->plugins_lock);
+
+ if (ea->plugins.size() != loaded_plugins.size()) {
+ ea->plugins_changed = true;
+ } else {
+ for (int i = 0; i < ea->plugins.size(); i++) {
+ if (ea->plugins[i].name != loaded_plugins[i].name) {
+ ea->plugins_changed = true;
+ break;
+ }
+ }
+ }
+
+ if (ea->plugins_changed) {
+ ea->plugins = loaded_plugins;
+ }
+ }
+ }
+
+ // Check for devices updates
String adb = EditorSettings::get_singleton()->get("export/android/adb");
if (FileAccess::exists(adb)) {
String devices;
@@ -573,6 +603,73 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
return abis;
}
+ /// List the gdap files in the directory specified by the p_path parameter.
+ static Vector<String> list_gdap_files(const String &p_path) {
+ Vector<String> dir_files;
+ DirAccessRef da = DirAccess::open(p_path);
+ if (da) {
+ da->list_dir_begin();
+ while (true) {
+ String file = da->get_next();
+ if (file == "") {
+ break;
+ }
+
+ if (da->current_is_dir() || da->current_is_hidden()) {
+ continue;
+ }
+
+ if (file.ends_with(PLUGIN_CONFIG_EXT)) {
+ dir_files.push_back(file);
+ }
+ }
+ da->list_dir_end();
+ }
+
+ return dir_files;
+ }
+
+ static Vector<PluginConfig> get_plugins() {
+ Vector<PluginConfig> loaded_plugins;
+
+ String plugins_dir = ProjectSettings::get_singleton()->get_resource_path().plus_file("android/plugins");
+
+ // Add the prebuilt plugins
+ loaded_plugins.append_array(get_prebuilt_plugins(plugins_dir));
+
+ if (DirAccess::exists(plugins_dir)) {
+ Vector<String> plugins_filenames = list_gdap_files(plugins_dir);
+
+ if (!plugins_filenames.empty()) {
+ Ref<ConfigFile> config_file = memnew(ConfigFile);
+ for (int i = 0; i < plugins_filenames.size(); i++) {
+ PluginConfig config = load_plugin_config(config_file, plugins_dir.plus_file(plugins_filenames[i]));
+ if (config.valid_config) {
+ loaded_plugins.push_back(config);
+ } else {
+ print_error("Invalid plugin config file " + plugins_filenames[i]);
+ }
+ }
+ }
+ }
+
+ return loaded_plugins;
+ }
+
+ static Vector<PluginConfig> get_enabled_plugins(const Ref<EditorExportPreset> &p_presets) {
+ Vector<PluginConfig> enabled_plugins;
+ Vector<PluginConfig> all_plugins = get_plugins();
+ for (int i = 0; i < all_plugins.size(); i++) {
+ PluginConfig plugin = all_plugins[i];
+ bool enabled = p_presets->get("plugins/" + plugin.name);
+ if (enabled) {
+ enabled_plugins.push_back(plugin);
+ }
+ }
+
+ return enabled_plugins;
+ }
+
static Error store_in_apk(APKExportData *ed, const String &p_path, const Vector<uint8_t> &p_data, int compression_method = Z_DEFLATED) {
zip_fileinfo zipfi = get_zip_fileinfo();
zipOpenNewFileInZip(ed->apk,
@@ -674,7 +771,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
int xr_mode_index = p_preset->get("xr_features/xr_mode");
- String plugins = p_preset->get("custom_template/plugins");
+ String plugins_names = get_plugins_names(get_enabled_plugins(p_preset));
Vector<String> perms;
@@ -829,9 +926,9 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
}
}
- if (tname == "meta-data" && attrname == "value" && value == "custom_template_plugins_value") {
+ if (tname == "meta-data" && attrname == "value" && value == "plugins_value" && !plugins_names.empty()) {
// Update the meta-data 'android:value' attribute with the list of enabled plugins.
- string_table.write[attr_value] = plugins;
+ string_table.write[attr_value] = plugins_names;
}
iofs += 20;
@@ -1354,7 +1451,14 @@ public:
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE, "*.apk"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE, "*.apk"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "custom_template/use_custom_build"), false));
- r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/plugins", PROPERTY_HINT_PLACEHOLDER_TEXT, "Plugin1,Plugin2,..."), ""));
+
+ Vector<PluginConfig> plugins_configs = get_plugins();
+ for (int i = 0; i < plugins_configs.size(); i++) {
+ print_verbose("Found Android plugin " + plugins_configs[i].name);
+ r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "plugins/" + plugins_configs[i].name), false));
+ }
+ plugins_changed = false;
+
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "command_line/extra_args"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "version/code", PROPERTY_HINT_RANGE, "1,4096,1,or_greater"), 1));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "version/name"), "1.0"));
@@ -1409,6 +1513,15 @@ public:
return logo;
}
+ virtual bool should_update_export_options() {
+ bool export_options_changed = plugins_changed;
+ if (export_options_changed) {
+ // don't clear unless we're reporting true, to avoid race
+ plugins_changed = false;
+ }
+ return export_options_changed;
+ }
+
virtual bool poll_export() {
bool dc = devices_changed;
if (dc) {
@@ -1755,18 +1868,22 @@ public:
#endif
String build_path = ProjectSettings::get_singleton()->get_resource_path().plus_file("android/build");
- String plugins_dir = ProjectSettings::get_singleton()->get_resource_path().plus_file("android/plugins");
build_command = build_path.plus_file(build_command);
String package_name = get_package_name(p_preset->get("package/unique_name"));
- String plugins = p_preset->get("custom_template/plugins");
+
+ Vector<PluginConfig> enabled_plugins = get_enabled_plugins(p_preset);
+ String local_plugins_binaries = get_plugins_binaries(BINARY_TYPE_LOCAL, enabled_plugins);
+ String remote_plugins_binaries = get_plugins_binaries(BINARY_TYPE_REMOTE, enabled_plugins);
+ String custom_maven_repos = get_plugins_custom_maven_repos(enabled_plugins);
List<String> cmdline;
cmdline.push_back("build");
cmdline.push_back("-Pexport_package_name=" + package_name); // argument to specify the package name.
- cmdline.push_back("-Pcustom_template_plugins_dir=" + plugins_dir); // argument to specify the plugins directory.
- cmdline.push_back("-Pcustom_template_plugins=" + plugins); // argument to specify the list of plugins to enable.
+ cmdline.push_back("-Pplugins_local_binaries=" + local_plugins_binaries); // argument to specify the list of plugins local dependencies.
+ cmdline.push_back("-Pplugins_remote_binaries=" + remote_plugins_binaries); // argument to specify the list of plugins remote dependencies.
+ cmdline.push_back("-Pplugins_maven_repos=" + custom_maven_repos); // argument to specify the list of custom maven repos for the plugins dependencies.
cmdline.push_back("-p"); // argument to specify the start directory.
cmdline.push_back(build_path); // start directory.
/*{ used for debug
@@ -2283,14 +2400,15 @@ public:
run_icon->create_from_image(img);
devices_changed = true;
+ plugins_changed = true;
quit_request = false;
- device_thread = Thread::create(_device_poll_thread, this);
+ check_for_changes_thread = Thread::create(_check_for_changes_poll_thread, this);
}
~EditorExportPlatformAndroid() {
quit_request = true;
- Thread::wait_to_finish(device_thread);
- memdelete(device_thread);
+ Thread::wait_to_finish(check_for_changes_thread);
+ memdelete(check_for_changes_thread);
}
};
diff --git a/platform/android/java/app/AndroidManifest.xml b/platform/android/java/app/AndroidManifest.xml
index cc480d1c84..f5b1d29f22 100644
--- a/platform/android/java/app/AndroidManifest.xml
+++ b/platform/android/java/app/AndroidManifest.xml
@@ -32,8 +32,8 @@
<!-- Metadata populated at export time and used by Godot to figure out which plugins must be enabled. -->
<meta-data
- android:name="custom_template_plugins"
- android:value="custom_template_plugins_value"/>
+ android:name="plugins"
+ android:value="plugins_value"/>
<activity
android:name=".GodotApp"
diff --git a/platform/android/java/app/build.gradle b/platform/android/java/app/build.gradle
index 9ae47d6174..ea341b37b1 100644
--- a/platform/android/java/app/build.gradle
+++ b/platform/android/java/app/build.gradle
@@ -21,6 +21,16 @@ allprojects {
mavenCentral()
google()
jcenter()
+
+ // Godot user plugins custom maven repos
+ String[] mavenRepos = getGodotPluginsMavenRepos()
+ if (mavenRepos != null && mavenRepos.size() > 0) {
+ for (String repoUrl : mavenRepos) {
+ maven {
+ url repoUrl
+ }
+ }
+ }
}
}
@@ -40,15 +50,18 @@ dependencies {
releaseImplementation fileTree(dir: 'libs/release', include: ['*.jar', '*.aar'])
}
- // Godot prebuilt plugins
- implementation fileTree(dir: 'libs/plugins', include: ["GodotPayment*.aar"])
+ // Godot user plugins remote dependencies
+ String[] remoteDeps = getGodotPluginsRemoteBinaries()
+ if (remoteDeps != null && remoteDeps.size() > 0) {
+ for (String dep : remoteDeps) {
+ implementation dep
+ }
+ }
- // Godot user plugins dependencies
- String pluginsDir = getGodotPluginsDirectory()
- String[] pluginsBinaries = getGodotPluginsBinaries()
- if (pluginsDir != null && !pluginsDir.isEmpty() &&
- pluginsBinaries != null && pluginsBinaries.size() > 0) {
- implementation fileTree(dir: pluginsDir, include: pluginsBinaries)
+ // Godot user plugins local dependencies
+ String[] pluginsBinaries = getGodotPluginsLocalBinaries()
+ if (pluginsBinaries != null && pluginsBinaries.size() > 0) {
+ implementation files(pluginsBinaries)
}
}
diff --git a/platform/android/java/app/config.gradle b/platform/android/java/app/config.gradle
index aa98194a10..5251bc3066 100644
--- a/platform/android/java/app/config.gradle
+++ b/platform/android/java/app/config.gradle
@@ -4,18 +4,18 @@ ext.versions = [
minSdk : 18,
targetSdk : 29,
buildTools : '29.0.3',
- supportCoreUtils : '28.0.0',
+ supportCoreUtils : '1.0.0',
kotlinVersion : '1.3.61',
- v4Support : '28.0.0'
+ v4Support : '1.0.0'
]
ext.libraries = [
androidGradlePlugin: "com.android.tools.build:gradle:$versions.androidGradlePlugin",
- supportCoreUtils : "com.android.support:support-core-utils:$versions.supportCoreUtils",
+ supportCoreUtils : "androidx.legacy:legacy-support-core-utils:$versions.supportCoreUtils",
kotlinGradlePlugin : "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlinVersion",
kotlinStdLib : "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$versions.kotlinVersion",
- v4Support : "com.android.support:support-v4:$versions.v4Support"
+ v4Support : "androidx.legacy:legacy-support-v4:$versions.v4Support"
]
ext.getExportPackageName = { ->
@@ -28,39 +28,68 @@ ext.getExportPackageName = { ->
return appId
}
+final String PLUGIN_VALUE_SEPARATOR_REGEX = "\\|"
+
/**
- * Parse the project properties for the 'custom_template_plugins' property and return
- * their binaries for inclusion in the build dependencies.
- *
- * The listed plugins must have their binaries in the project plugins directory.
+ * Parse the project properties for the 'plugins_maven_repos' property and return the list
+ * of maven repos.
*/
-ext.getGodotPluginsBinaries = { ->
- String[] binDeps = []
+ext.getGodotPluginsMavenRepos = { ->
+ Set<String> mavenRepos = []
- // Retrieve the list of enabled plugins.
- if (project.hasProperty("custom_template_plugins")) {
- String pluginsList = project.property("custom_template_plugins")
- if (pluginsList != null && !pluginsList.trim().isEmpty()) {
- for (String plugin : pluginsList.split(",")) {
- binDeps += plugin.trim() + "*.aar"
+ // Retrieve the list of maven repos.
+ if (project.hasProperty("plugins_maven_repos")) {
+ String mavenReposProperty = project.property("plugins_maven_repos")
+ if (mavenReposProperty != null && !mavenReposProperty.trim().isEmpty()) {
+ for (String mavenRepoUrl : mavenReposProperty.split(PLUGIN_VALUE_SEPARATOR_REGEX)) {
+ mavenRepos += mavenRepoUrl.trim()
}
}
}
- return binDeps
+ return mavenRepos
+}
+
+/**
+ * Parse the project properties for the 'plugins_remote_binaries' property and return
+ * it for inclusion in the build dependencies.
+ */
+ext.getGodotPluginsRemoteBinaries = { ->
+ Set<String> remoteDeps = []
+
+ // Retrieve the list of remote plugins binaries.
+ if (project.hasProperty("plugins_remote_binaries")) {
+ String remoteDepsList = project.property("plugins_remote_binaries")
+ if (remoteDepsList != null && !remoteDepsList.trim().isEmpty()) {
+ for (String dep: remoteDepsList.split(PLUGIN_VALUE_SEPARATOR_REGEX)) {
+ remoteDeps += dep.trim()
+ }
+ }
+ }
+ return remoteDeps
}
/**
- * Parse the project properties for the 'custom_template_plugins_dir' property and return
- * its value.
+ * Parse the project properties for the 'plugins_local_binaries' property and return
+ * their binaries for inclusion in the build dependencies.
*
- * The returned value is the directory containing user plugins.
+ * Returns the prebuilt plugins if the 'plugins_local_binaries' property is unavailable.
*/
-ext.getGodotPluginsDirectory = { ->
- // The plugins directory is provided by the 'custom_template_plugins_dir' property.
- String pluginsDir = project.hasProperty("custom_template_plugins_dir")
- ? project.property("custom_template_plugins_dir")
- : ""
+ext.getGodotPluginsLocalBinaries = { ->
+ // Set the prebuilt plugins as default. If custom build is enabled,
+ // the 'plugins_local_binaries' will be defined so we can use it instead.
+ Set<String> binDeps = ["libs/plugins/GodotPayment.release.aar"]
+
+ // Retrieve the list of local plugins binaries.
+ if (project.hasProperty("plugins_local_binaries")) {
+ binDeps.clear()
+ String pluginsList = project.property("plugins_local_binaries")
+ if (pluginsList != null && !pluginsList.trim().isEmpty()) {
+ for (String plugin : pluginsList.split(PLUGIN_VALUE_SEPARATOR_REGEX)) {
+ binDeps += plugin.trim()
+ }
+ }
+ }
- return pluginsDir
+ return binDeps
}
diff --git a/platform/android/java/build.gradle b/platform/android/java/build.gradle
index 865b61956c..01a3607b20 100644
--- a/platform/android/java/build.gradle
+++ b/platform/android/java/build.gradle
@@ -140,7 +140,7 @@ task generateGodotTemplates(type: GradleBuild) {
startParameter.excludedTaskNames += ":lib:" + getSconsTaskName(buildType)
}
- tasks = ["copyGodotPaymentPluginToAppModule"]
+ tasks = []
// Only build the apks and aar files for which we have native shared libraries.
for (String target : supportedTargets) {
@@ -161,6 +161,7 @@ task generateGodotTemplates(type: GradleBuild) {
}
}
+ dependsOn 'copyGodotPaymentPluginToAppModule'
finalizedBy 'zipCustomBuild'
}
diff --git a/platform/android/java/gradle.properties b/platform/android/java/gradle.properties
index aac7c9b461..e14cd5ba5c 100644
--- a/platform/android/java/gradle.properties
+++ b/platform/android/java/gradle.properties
@@ -7,6 +7,9 @@
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
+android.enableJetifier=true
+android.useAndroidX=true
+
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
diff --git a/platform/android/java/lib/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java b/platform/android/java/lib/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java
index 0abaf2e052..d481c22204 100644
--- a/platform/android/java/lib/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java
+++ b/platform/android/java/lib/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java
@@ -29,9 +29,9 @@ import com.google.android.vending.expansion.downloader.IDownloaderClient;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
-import android.os.Build;
import android.os.Messenger;
-import android.support.v4.app.NotificationCompat;
+
+import androidx.core.app.NotificationCompat;
/**
* This class handles displaying the notification associated with the download
diff --git a/platform/android/java/lib/src/org/godotengine/godot/Godot.java b/platform/android/java/lib/src/org/godotengine/godot/Godot.java
index cc9c7a9652..f27d8620ec 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/Godot.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/Godot.java
@@ -66,10 +66,6 @@ import android.os.Messenger;
import android.os.VibrationEffect;
import android.os.Vibrator;
import android.provider.Settings.Secure;
-import android.support.annotation.CallSuper;
-import android.support.annotation.Keep;
-import android.support.annotation.NonNull;
-import android.support.v4.app.FragmentActivity;
import android.view.Display;
import android.view.KeyEvent;
import android.view.MotionEvent;
@@ -85,6 +81,11 @@ import android.widget.FrameLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
+import androidx.annotation.CallSuper;
+import androidx.annotation.Keep;
+import androidx.annotation.NonNull;
+import androidx.fragment.app.FragmentActivity;
+
import com.google.android.vending.expansion.downloader.DownloadProgressInfo;
import com.google.android.vending.expansion.downloader.DownloaderClientMarshaller;
import com.google.android.vending.expansion.downloader.DownloaderServiceMarshaller;
diff --git a/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java b/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java
index a8146a1332..431bd4f5f9 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java
@@ -35,13 +35,13 @@ import org.godotengine.godot.Godot;
import android.app.Activity;
import android.content.Intent;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.text.TextUtils;
import android.util.Log;
import android.view.Surface;
import android.view.View;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
diff --git a/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPluginRegistry.java b/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPluginRegistry.java
index bb11300861..12d2ed09fb 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPluginRegistry.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPluginRegistry.java
@@ -35,13 +35,13 @@ import org.godotengine.godot.Godot;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
-import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.util.Log;
+import androidx.annotation.Nullable;
+
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
-import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
@@ -58,7 +58,9 @@ public final class GodotPluginRegistry {
/**
* Name for the metadata containing the list of Godot plugins to enable.
*/
- private static final String GODOT_ENABLED_PLUGINS_LABEL = "custom_template_plugins";
+ private static final String GODOT_ENABLED_PLUGINS_LABEL = "plugins";
+
+ private static final String PLUGIN_VALUE_SEPARATOR_REGEX = "\\|";
private static GodotPluginRegistry instance;
private final ConcurrentHashMap<String, GodotPlugin> registry;
@@ -128,13 +130,13 @@ public final class GodotPluginRegistry {
}
// When using the Godot editor for building and exporting the apk, this is used to check
- // which plugins to enable since the custom build template may contain prebuilt plugins.
+ // which plugins to enable.
// When using a custom process to generate the apk, the metadata is not needed since
// it's assumed that the developer is aware of the dependencies included in the apk.
final Set<String> enabledPluginsSet;
if (metaData.containsKey(GODOT_ENABLED_PLUGINS_LABEL)) {
String enabledPlugins = metaData.getString(GODOT_ENABLED_PLUGINS_LABEL, "");
- String[] enabledPluginsList = enabledPlugins.split(",");
+ String[] enabledPluginsList = enabledPlugins.split(PLUGIN_VALUE_SEPARATOR_REGEX);
if (enabledPluginsList.length == 0) {
// No plugins to enable. Aborting early.
return;
@@ -158,6 +160,8 @@ public final class GodotPluginRegistry {
continue;
}
+ Log.i(TAG, "Initializing Godot plugin " + pluginName);
+
// Retrieve the plugin class full name.
String pluginHandleClassFullName = metaData.getString(metaDataName);
if (!TextUtils.isEmpty(pluginHandleClassFullName)) {
@@ -177,6 +181,7 @@ public final class GodotPluginRegistry {
"Meta-data plugin name does not match the value returned by the plugin handle: " + pluginName + " =/= " + pluginHandle.getPluginName());
}
registry.put(pluginName, pluginHandle);
+ Log.i(TAG, "Completed initialization for Godot plugin " + pluginHandle.getPluginName());
} catch (ClassNotFoundException e) {
Log.w(TAG, "Unable to load Godot plugin " + pluginName, e);
} catch (IllegalAccessException e) {
diff --git a/platform/android/java/lib/src/org/godotengine/godot/plugin/SignalInfo.java b/platform/android/java/lib/src/org/godotengine/godot/plugin/SignalInfo.java
index 71523d8c27..f82c4d3fa0 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/plugin/SignalInfo.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/plugin/SignalInfo.java
@@ -30,9 +30,10 @@
package org.godotengine.godot.plugin;
-import android.support.annotation.NonNull;
import android.text.TextUtils;
+import androidx.annotation.NonNull;
+
import java.util.Arrays;
/**
diff --git a/platform/android/java/lib/src/org/godotengine/godot/utils/PermissionsUtil.java b/platform/android/java/lib/src/org/godotengine/godot/utils/PermissionsUtil.java
index c34e4c18db..6837e4f147 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/utils/PermissionsUtil.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/utils/PermissionsUtil.java
@@ -37,9 +37,10 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PermissionInfo;
import android.os.Build;
-import android.support.v4.content.ContextCompat;
import android.util.Log;
+import androidx.core.content.ContextCompat;
+
import java.util.ArrayList;
import java.util.List;
diff --git a/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/GodotPayment.java b/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/GodotPayment.java
index 6f76007e1e..ded7f0a9aa 100644
--- a/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/GodotPayment.java
+++ b/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/GodotPayment.java
@@ -36,9 +36,10 @@ import org.godotengine.godot.GodotLib;
import org.godotengine.godot.plugin.GodotPlugin;
import android.content.Intent;
-import android.support.annotation.NonNull;
import android.util.Log;
+import androidx.annotation.NonNull;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
diff --git a/platform/android/plugin/godot_plugin_config.h b/platform/android/plugin/godot_plugin_config.h
new file mode 100644
index 0000000000..9ad7de1202
--- /dev/null
+++ b/platform/android/plugin/godot_plugin_config.h
@@ -0,0 +1,251 @@
+/*************************************************************************/
+/* godot_plugin_config.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* 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. */
+/*************************************************************************/
+
+#ifndef GODOT_PLUGIN_CONFIG_H
+#define GODOT_PLUGIN_CONFIG_H
+
+#include "core/error_list.h"
+#include "core/io/config_file.h"
+#include "core/ustring.h"
+
+static const char *PLUGIN_CONFIG_EXT = ".gdap";
+
+static const char *CONFIG_SECTION = "config";
+static const char *CONFIG_NAME_KEY = "name";
+static const char *CONFIG_BINARY_TYPE_KEY = "binary_type";
+static const char *CONFIG_BINARY_KEY = "binary";
+
+static const char *DEPENDENCIES_SECTION = "dependencies";
+static const char *DEPENDENCIES_LOCAL_KEY = "local";
+static const char *DEPENDENCIES_REMOTE_KEY = "remote";
+static const char *DEPENDENCIES_CUSTOM_MAVEN_REPOS_KEY = "custom_maven_repos";
+
+static const char *BINARY_TYPE_LOCAL = "local";
+static const char *BINARY_TYPE_REMOTE = "remote";
+
+static const char *PLUGIN_VALUE_SEPARATOR = "|";
+
+/*
+ The `config` section and fields are required and defined as follow:
+- **name**: name of the plugin
+- **binary_type**: can be either `local` or `remote`. The type affects the **binary** field
+- **binary**:
+ - if **binary_type** is `local`, then this should be the filename of the plugin `aar` file in the `res://android/plugins` directory (e.g: `MyPlugin.aar`).
+ - if **binary_type** is `remote`, then this should be a declaration for a remote gradle binary (e.g: "org.godot.example:my-plugin:0.0.0").
+
+The `dependencies` section and fields are optional and defined as follow:
+- **local**: contains a list of local `.aar` binary files the plugin depends on. The local binary dependencies must also be located in the `res://android/plugins` directory.
+- **remote**: contains a list of remote binary gradle dependencies for the plugin.
+- **custom_maven_repos**: contains a list of urls specifying custom maven repos required for the plugin's dependencies.
+
+ See https://github.com/godotengine/godot/issues/38157#issuecomment-618773871
+ */
+struct PluginConfig {
+ // Set to true when the config file is properly loaded.
+ bool valid_config = false;
+
+ // Required config section
+ String name;
+ String binary_type;
+ String binary;
+
+ // Optional dependencies section
+ Vector<String> local_dependencies;
+ Vector<String> remote_dependencies;
+ Vector<String> custom_maven_repos;
+};
+
+/*
+ * Set of prebuilt plugins.
+ */
+static const PluginConfig GODOT_PAYMENT = {
+ /*.valid_config =*/true,
+ /*.name =*/"GodotPayment",
+ /*.binary_type =*/"local",
+ /*.binary =*/"res://android/build/libs/plugins/GodotPayment.release.aar",
+ /*.local_dependencies =*/{},
+ /*.remote_dependencies =*/{},
+ /*.custom_maven_repos =*/{}
+};
+
+static inline String resolve_local_dependency_path(String plugin_config_dir, String dependency_path) {
+ String absolute_path;
+ if (!dependency_path.empty()) {
+ if (dependency_path.is_abs_path()) {
+ absolute_path = ProjectSettings::get_singleton()->globalize_path(dependency_path);
+ } else {
+ absolute_path = plugin_config_dir.plus_file(dependency_path);
+ }
+ }
+
+ return absolute_path;
+}
+
+static inline PluginConfig resolve_prebuilt_plugin(PluginConfig prebuilt_plugin, String plugin_config_dir) {
+ PluginConfig resolved = prebuilt_plugin;
+ resolved.binary = resolved.binary_type == BINARY_TYPE_LOCAL ? resolve_local_dependency_path(plugin_config_dir, prebuilt_plugin.binary) : prebuilt_plugin.binary;
+ if (!prebuilt_plugin.local_dependencies.empty()) {
+ resolved.local_dependencies.clear();
+ for (int i = 0; i < prebuilt_plugin.local_dependencies.size(); i++) {
+ resolved.local_dependencies.push_back(resolve_local_dependency_path(plugin_config_dir, prebuilt_plugin.local_dependencies[i]));
+ }
+ }
+ return resolved;
+}
+
+static inline Vector<PluginConfig> get_prebuilt_plugins(String plugins_base_dir) {
+ Vector<PluginConfig> prebuilt_plugins;
+ prebuilt_plugins.push_back(resolve_prebuilt_plugin(GODOT_PAYMENT, plugins_base_dir));
+ return prebuilt_plugins;
+}
+
+static inline bool is_plugin_config_valid(PluginConfig plugin_config) {
+ bool valid_name = !plugin_config.name.empty();
+ bool valid_binary_type = plugin_config.binary_type == BINARY_TYPE_LOCAL ||
+ plugin_config.binary_type == BINARY_TYPE_REMOTE;
+
+ bool valid_binary = false;
+ if (valid_binary_type) {
+ valid_binary = !plugin_config.binary.empty() &&
+ (plugin_config.binary_type == BINARY_TYPE_REMOTE ||
+ FileAccess::exists(plugin_config.binary));
+ }
+
+ bool valid_local_dependencies = true;
+ if (!plugin_config.local_dependencies.empty()) {
+ for (int i = 0; i < plugin_config.local_dependencies.size(); i++) {
+ if (!FileAccess::exists(plugin_config.local_dependencies[i])) {
+ valid_local_dependencies = false;
+ break;
+ }
+ }
+ }
+ return valid_name && valid_binary && valid_binary_type && valid_local_dependencies;
+}
+
+static inline PluginConfig load_plugin_config(Ref<ConfigFile> config_file, const String &path) {
+ PluginConfig plugin_config = {};
+
+ if (config_file.is_valid()) {
+ Error err = config_file->load(path);
+ if (err == OK) {
+ String config_base_dir = path.get_base_dir();
+
+ plugin_config.name = config_file->get_value(CONFIG_SECTION, CONFIG_NAME_KEY, String());
+ plugin_config.binary_type = config_file->get_value(CONFIG_SECTION, CONFIG_BINARY_TYPE_KEY, String());
+
+ String binary_path = config_file->get_value(CONFIG_SECTION, CONFIG_BINARY_KEY, String());
+ plugin_config.binary = plugin_config.binary_type == BINARY_TYPE_LOCAL ? resolve_local_dependency_path(config_base_dir, binary_path) : binary_path;
+
+ if (config_file->has_section(DEPENDENCIES_SECTION)) {
+ Vector<String> local_dependencies_paths = config_file->get_value(DEPENDENCIES_SECTION, DEPENDENCIES_LOCAL_KEY, Vector<String>());
+ if (!local_dependencies_paths.empty()) {
+ for (int i = 0; i < local_dependencies_paths.size(); i++) {
+ plugin_config.local_dependencies.push_back(resolve_local_dependency_path(config_base_dir, local_dependencies_paths[i]));
+ }
+ }
+
+ plugin_config.remote_dependencies = config_file->get_value(DEPENDENCIES_SECTION, DEPENDENCIES_REMOTE_KEY, Vector<String>());
+ plugin_config.custom_maven_repos = config_file->get_value(DEPENDENCIES_SECTION, DEPENDENCIES_CUSTOM_MAVEN_REPOS_KEY, Vector<String>());
+ }
+
+ plugin_config.valid_config = is_plugin_config_valid(plugin_config);
+ }
+ }
+
+ return plugin_config;
+}
+
+static inline String get_plugins_binaries(String binary_type, Vector<PluginConfig> plugins_configs) {
+ String plugins_binaries;
+ if (!plugins_configs.empty()) {
+ Vector<String> binaries;
+ for (int i = 0; i < plugins_configs.size(); i++) {
+ PluginConfig config = plugins_configs[i];
+ if (!config.valid_config) {
+ continue;
+ }
+
+ if (config.binary_type == binary_type) {
+ binaries.push_back(config.binary);
+ }
+
+ if (binary_type == BINARY_TYPE_LOCAL) {
+ binaries.append_array(config.local_dependencies);
+ }
+
+ if (binary_type == BINARY_TYPE_REMOTE) {
+ binaries.append_array(config.remote_dependencies);
+ }
+ }
+
+ plugins_binaries = String(PLUGIN_VALUE_SEPARATOR).join(binaries);
+ }
+
+ return plugins_binaries;
+}
+
+static inline String get_plugins_custom_maven_repos(Vector<PluginConfig> plugins_configs) {
+ String custom_maven_repos;
+ if (!plugins_configs.empty()) {
+ Vector<String> repos_urls;
+ for (int i = 0; i < plugins_configs.size(); i++) {
+ PluginConfig config = plugins_configs[i];
+ if (!config.valid_config) {
+ continue;
+ }
+
+ repos_urls.append_array(config.custom_maven_repos);
+ }
+
+ custom_maven_repos = String(PLUGIN_VALUE_SEPARATOR).join(repos_urls);
+ }
+ return custom_maven_repos;
+}
+
+static inline String get_plugins_names(Vector<PluginConfig> plugins_configs) {
+ String plugins_names;
+ if (!plugins_configs.empty()) {
+ Vector<String> names;
+ for (int i = 0; i < plugins_configs.size(); i++) {
+ PluginConfig config = plugins_configs[i];
+ if (!config.valid_config) {
+ continue;
+ }
+
+ names.push_back(config.name);
+ }
+ plugins_names = String(PLUGIN_VALUE_SEPARATOR).join(names);
+ }
+
+ return plugins_names;
+}
+
+#endif // GODOT_PLUGIN_CONFIG_H
diff --git a/platform/haiku/audio_driver_media_kit.cpp b/platform/haiku/audio_driver_media_kit.cpp
index 94c9e83368..2fbbeeb176 100644
--- a/platform/haiku/audio_driver_media_kit.cpp
+++ b/platform/haiku/audio_driver_media_kit.cpp
@@ -39,11 +39,11 @@ int32_t *AudioDriverMediaKit::samples_in = nullptr;
Error AudioDriverMediaKit::init() {
active = false;
- mix_rate = GLOBAL_DEF_RST("audio/mix_rate", DEFAULT_MIX_RATE);
+ mix_rate = GLOBAL_GET("audio/mix_rate");
speaker_mode = SPEAKER_MODE_STEREO;
channels = 2;
- int latency = GLOBAL_DEF_RST("audio/output_latency", DEFAULT_OUTPUT_LATENCY);
+ int latency = GLOBAL_GET("audio/output_latency");
buffer_size = next_power_of_2(latency * mix_rate / 1000);
samples_in = memnew_arr(int32_t, buffer_size * channels);
diff --git a/platform/javascript/audio_driver_javascript.cpp b/platform/javascript/audio_driver_javascript.cpp
index 03ca5f78d1..b52bd4ce60 100644
--- a/platform/javascript/audio_driver_javascript.cpp
+++ b/platform/javascript/audio_driver_javascript.cpp
@@ -30,6 +30,8 @@
#include "audio_driver_javascript.h"
+#include "core/project_settings.h"
+
#include <emscripten.h>
AudioDriverJavaScript *AudioDriverJavaScript::singleton = nullptr;
@@ -62,10 +64,15 @@ void AudioDriverJavaScript::process_capture(float sample) {
}
Error AudioDriverJavaScript::init() {
+ int mix_rate = GLOBAL_GET("audio/mix_rate");
+ int latency = GLOBAL_GET("audio/output_latency");
+
/* clang-format off */
_driver_id = EM_ASM_INT({
+ const MIX_RATE = $0;
+ const LATENCY = $1;
return Module.IDHandler.add({
- 'context': new (window.AudioContext || window.webkitAudioContext),
+ 'context': new (window.AudioContext || window.webkitAudioContext)({ sampleRate: MIX_RATE, latencyHint: LATENCY}),
'input': null,
'stream': null,
'script': null
@@ -74,26 +81,19 @@ Error AudioDriverJavaScript::init() {
/* clang-format on */
int channel_count = get_total_channels_by_speaker_mode(get_speaker_mode());
+ buffer_length = closest_power_of_2((latency * mix_rate / 1000) * channel_count);
/* clang-format off */
buffer_length = EM_ASM_INT({
var ref = Module.IDHandler.get($0);
- var ctx = ref['context'];
- var CHANNEL_COUNT = $1;
-
- var channelCount = ctx.destination.channelCount;
- var script = null;
- try {
- // Try letting the browser recommend a buffer length.
- script = ctx.createScriptProcessor(0, 2, channelCount);
- } catch (e) {
- // ...otherwise, default to 4096.
- script = ctx.createScriptProcessor(4096, 2, channelCount);
- }
+ const ctx = ref['context'];
+ const BUFFER_LENGTH = $1;
+ const CHANNEL_COUNT = $2;
+
+ var script = ctx.createScriptProcessor(BUFFER_LENGTH, 2, CHANNEL_COUNT);
script.connect(ctx.destination);
ref['script'] = script;
-
return script.bufferSize;
- }, _driver_id, channel_count);
+ }, _driver_id, buffer_length, channel_count);
/* clang-format on */
if (!buffer_length) {
return FAILED;
@@ -156,6 +156,25 @@ void AudioDriverJavaScript::resume() {
/* clang-format on */
}
+float AudioDriverJavaScript::get_latency() {
+ /* clang-format off */
+ return EM_ASM_DOUBLE({
+ const ref = Module.IDHandler.get($0);
+ var latency = 0;
+ if (ref && ref['context']) {
+ const ctx = ref['context'];
+ if (ctx.baseLatency) {
+ latency += ctx.baseLatency;
+ }
+ if (ctx.outputLatency) {
+ latency += ctx.outputLatency;
+ }
+ }
+ return latency;
+ }, _driver_id);
+ /* clang-format on */
+}
+
int AudioDriverJavaScript::get_mix_rate() const {
/* clang-format off */
return EM_ASM_INT({
diff --git a/platform/javascript/audio_driver_javascript.h b/platform/javascript/audio_driver_javascript.h
index 7d5237998a..9b26be001e 100644
--- a/platform/javascript/audio_driver_javascript.h
+++ b/platform/javascript/audio_driver_javascript.h
@@ -50,6 +50,7 @@ public:
virtual Error init();
virtual void start();
void resume();
+ virtual float get_latency();
virtual int get_mix_rate() const;
virtual SpeakerMode get_speaker_mode() const;
virtual void lock();
diff --git a/platform/osx/display_server_osx.mm b/platform/osx/display_server_osx.mm
index 1cdcdbcaf5..9a1191490c 100644
--- a/platform/osx/display_server_osx.mm
+++ b/platform/osx/display_server_osx.mm
@@ -278,13 +278,17 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) {
}
- (BOOL)windowShouldClose:(id)sender {
- ERR_FAIL_COND_V(!DS_OSX->windows.has(window_id), YES);
+ if (!DS_OSX || !DS_OSX->windows.has(window_id)) {
+ return YES;
+ }
DS_OSX->_send_window_event(DS_OSX->windows[window_id], DisplayServerOSX::WINDOW_EVENT_CLOSE_REQUEST);
return NO;
}
- (void)windowWillClose:(NSNotification *)notification {
- ERR_FAIL_COND(!DS_OSX->windows.has(window_id));
+ if (!DS_OSX || !DS_OSX->windows.has(window_id)) {
+ return;
+ }
DisplayServerOSX::WindowData &wd = DS_OSX->windows[window_id];
while (wd.transient_children.size()) {
@@ -310,7 +314,9 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) {
}
- (void)windowDidEnterFullScreen:(NSNotification *)notification {
- ERR_FAIL_COND(!DS_OSX->windows.has(window_id));
+ if (!DS_OSX || !DS_OSX->windows.has(window_id)) {
+ return;
+ }
DisplayServerOSX::WindowData &wd = DS_OSX->windows[window_id];
wd.fullscreen = true;
@@ -320,8 +326,9 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) {
}
- (void)windowDidExitFullScreen:(NSNotification *)notification {
- if (!DS_OSX || !DS_OSX->windows.has(window_id))
+ if (!DS_OSX || !DS_OSX->windows.has(window_id)) {
return;
+ }
DisplayServerOSX::WindowData &wd = DS_OSX->windows[window_id];
wd.fullscreen = false;
@@ -383,8 +390,9 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) {
}
- (void)windowDidResize:(NSNotification *)notification {
- if (!DS_OSX || !DS_OSX->windows.has(window_id))
+ if (!DS_OSX || !DS_OSX->windows.has(window_id)) {
return;
+ }
DisplayServerOSX::WindowData &wd = DS_OSX->windows[window_id];
#if defined(OPENGL_ENABLED)
@@ -425,11 +433,26 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) {
}
- (void)windowDidMove:(NSNotification *)notification {
+ if (!DS_OSX || !DS_OSX->windows.has(window_id)) {
+ return;
+ }
+ DisplayServerOSX::WindowData &wd = DS_OSX->windows[window_id];
+
DS_OSX->_release_pressed_events();
+
+ if (!wd.rect_changed_callback.is_null()) {
+ Variant size = Rect2i(DS_OSX->window_get_position(window_id), DS_OSX->window_get_size(window_id));
+ Variant *sizep = &size;
+ Variant ret;
+ Callable::CallError ce;
+ wd.rect_changed_callback.call((const Variant **)&sizep, 1, ret, ce);
+ }
}
- (void)windowDidBecomeKey:(NSNotification *)notification {
- ERR_FAIL_COND(!DS_OSX->windows.has(window_id));
+ if (!DS_OSX || !DS_OSX->windows.has(window_id)) {
+ return;
+ }
DisplayServerOSX::WindowData &wd = DS_OSX->windows[window_id];
const CGFloat backingScaleFactor = (OS::get_singleton()->is_hidpi_allowed()) ? [wd.window_view backingScaleFactor] : 1.0;
@@ -441,7 +464,9 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) {
}
- (void)windowDidResignKey:(NSNotification *)notification {
- ERR_FAIL_COND(!DS_OSX->windows.has(window_id));
+ if (!DS_OSX || !DS_OSX->windows.has(window_id)) {
+ return;
+ }
DisplayServerOSX::WindowData &wd = DS_OSX->windows[window_id];
DS_OSX->window_focused = false;
@@ -451,7 +476,9 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) {
}
- (void)windowDidMiniaturize:(NSNotification *)notification {
- ERR_FAIL_COND(!DS_OSX->windows.has(window_id));
+ if (!DS_OSX || !DS_OSX->windows.has(window_id)) {
+ return;
+ }
DisplayServerOSX::WindowData &wd = DS_OSX->windows[window_id];
DS_OSX->window_focused = false;
@@ -461,7 +488,9 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) {
}
- (void)windowDidDeminiaturize:(NSNotification *)notification {
- ERR_FAIL_COND(!DS_OSX->windows.has(window_id));
+ if (!DS_OSX || !DS_OSX->windows.has(window_id)) {
+ return;
+ }
DisplayServerOSX::WindowData &wd = DS_OSX->windows[window_id];
DS_OSX->window_focused = true;
@@ -2148,7 +2177,7 @@ Rect2i DisplayServerOSX::screen_get_usable_rect(int p_screen) const {
Point2i position = Point2i(nsrect.origin.x, nsrect.origin.y + nsrect.size.height) * displayScale - _get_screens_origin();
position.y *= -1;
- Size2i size = Size2i(nsrect.size.width, nsrect.size.height) / displayScale;
+ Size2i size = Size2i(nsrect.size.width, nsrect.size.height) * displayScale;
return Rect2i(position, size);
}
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index 114b64855e..9e117dba29 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -1695,6 +1695,12 @@ void DisplayServerWindows::_dispatch_input_events(const Ref<InputEvent> &p_event
}
void DisplayServerWindows::_dispatch_input_event(const Ref<InputEvent> &p_event) {
+ _THREAD_SAFE_METHOD_
+ if (in_dispatch_input_event) {
+ return;
+ }
+
+ in_dispatch_input_event = true;
Variant ev = p_event;
Variant *evp = &ev;
Variant ret;
@@ -1706,6 +1712,7 @@ void DisplayServerWindows::_dispatch_input_event(const Ref<InputEvent> &p_event)
ERR_FAIL_COND(!windows.has(event_from_window->get_window_id()));
Callable callable = windows[event_from_window->get_window_id()].input_event_callback;
if (callable.is_null()) {
+ in_dispatch_input_event = false;
return;
}
callable.call((const Variant **)&evp, 1, ret, ce);
@@ -1719,6 +1726,8 @@ void DisplayServerWindows::_dispatch_input_event(const Ref<InputEvent> &p_event)
callable.call((const Variant **)&evp, 1, ret, ce);
}
}
+
+ in_dispatch_input_event = false;
}
LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
@@ -2649,7 +2658,8 @@ void DisplayServerWindows::_process_key_events() {
KeyEvent &ke = key_event_buffer[i];
switch (ke.uMsg) {
case WM_CHAR: {
- if ((i == 0 && ke.uMsg == WM_CHAR) || (i > 0 && key_event_buffer[i - 1].uMsg == WM_CHAR)) {
+ // extended keys should only be processed as WM_KEYDOWN message.
+ if (!KeyMappingWindows::is_extended_key(ke.wParam) && ((i == 0 && ke.uMsg == WM_CHAR) || (i > 0 && key_event_buffer[i - 1].uMsg == WM_CHAR))) {
Ref<InputEventKey> k;
k.instance();
diff --git a/platform/windows/display_server_windows.h b/platform/windows/display_server_windows.h
index ea08b1899f..f8606bb492 100644
--- a/platform/windows/display_server_windows.h
+++ b/platform/windows/display_server_windows.h
@@ -388,6 +388,7 @@ class DisplayServerWindows : public DisplayServer {
uint32_t last_button_state = 0;
bool use_raw_input = false;
bool drop_events = false;
+ bool in_dispatch_input_event = false;
bool console_visible = false;
WNDCLASSEXW wc;
diff --git a/platform/windows/key_mapping_windows.cpp b/platform/windows/key_mapping_windows.cpp
index 1fe7551445..d8d0b13068 100644
--- a/platform/windows/key_mapping_windows.cpp
+++ b/platform/windows/key_mapping_windows.cpp
@@ -411,3 +411,16 @@ unsigned int KeyMappingWindows::get_scansym(unsigned int p_code, bool p_extended
return keycode;
}
+
+bool KeyMappingWindows::is_extended_key(unsigned int p_code) {
+ return p_code == VK_INSERT ||
+ p_code == VK_DELETE ||
+ p_code == VK_HOME ||
+ p_code == VK_END ||
+ p_code == VK_PRIOR ||
+ p_code == VK_NEXT ||
+ p_code == VK_LEFT ||
+ p_code == VK_UP ||
+ p_code == VK_RIGHT ||
+ p_code == VK_DOWN;
+}
diff --git a/platform/windows/key_mapping_windows.h b/platform/windows/key_mapping_windows.h
index 4d0c12c16e..f64f1feb9f 100644
--- a/platform/windows/key_mapping_windows.h
+++ b/platform/windows/key_mapping_windows.h
@@ -43,6 +43,7 @@ class KeyMappingWindows {
public:
static unsigned int get_keysym(unsigned int p_code);
static unsigned int get_scansym(unsigned int p_code, bool p_extended);
+ static bool is_extended_key(unsigned int p_code);
};
#endif // KEY_MAPPING_WINDOWS_H
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 5489638125..5080ba74e2 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -768,9 +768,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
if (mm.is_valid() && dragging) {
just_selected = true;
- // TODO: Remove local mouse pos hack if/when InputEventMouseMotion is fixed to support floats
- //drag_accum+=Vector2(mm->get_relative().x,mm->get_relative().y);
- drag_accum = get_local_mouse_position() - drag_origin;
+ drag_accum += mm->get_relative();
for (int i = get_child_count() - 1; i >= 0; i--) {
GraphNode *gn = Object::cast_to<GraphNode>(get_child(i));
if (gn && gn->is_selected()) {
@@ -789,7 +787,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
}
if (mm.is_valid() && box_selecting) {
- box_selecting_to = get_local_mouse_position();
+ box_selecting_to = mm->get_position();
box_selecting_rect = Rect2(MIN(box_selecting_from.x, box_selecting_to.x),
MIN(box_selecting_from.y, box_selecting_to.y),
@@ -849,7 +847,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
if (gn) {
Rect2 r = gn->get_rect();
r.size *= zoom;
- if (r.has_point(get_local_mouse_position())) {
+ if (r.has_point(b->get_position())) {
gn->set_selected(false);
}
}
@@ -887,7 +885,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
continue;
}
- if (gn_selected->has_point(gn_selected->get_local_mouse_position())) {
+ if (gn_selected->has_point(b->get_position() - gn_selected->get_position())) {
gn = gn_selected;
break;
}
@@ -901,7 +899,6 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
dragging = true;
drag_accum = Vector2();
- drag_origin = get_local_mouse_position();
just_selected = !gn->is_selected();
if (!gn->is_selected() && !Input::get_singleton()->is_key_pressed(KEY_CONTROL)) {
for (int i = 0; i < get_child_count(); i++) {
@@ -939,7 +936,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
}
box_selecting = true;
- box_selecting_from = get_local_mouse_position();
+ box_selecting_from = b->get_position();
if (b->get_control()) {
box_selection_mode_additive = true;
previus_selected.clear();
diff --git a/scene/gui/graph_edit.h b/scene/gui/graph_edit.h
index 8cfc5d32b9..c632490855 100644
--- a/scene/gui/graph_edit.h
+++ b/scene/gui/graph_edit.h
@@ -97,7 +97,6 @@ private:
bool dragging;
bool just_selected;
Vector2 drag_accum;
- Point2 drag_origin; // Workaround for GH-5907
float zoom;
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp
index e7de0f0912..5780cc5e71 100644
--- a/scene/gui/option_button.cpp
+++ b/scene/gui/option_button.cpp
@@ -334,9 +334,6 @@ OptionButton::OptionButton() {
popup = memnew(PopupMenu);
popup->hide();
add_child(popup);
- // popup->set_pass_on_modal_close_click(false);
- // popup->set_notify_transform(true);
- popup->set_allow_search(true);
popup->connect("index_pressed", callable_mp(this, &OptionButton::_selected));
popup->connect("id_focused", callable_mp(this, &OptionButton::_focused));
popup->connect("popup_hide", callable_mp((BaseButton *)this, &BaseButton::set_pressed), varray(false));
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index b439d85983..6e19b820e0 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -1442,7 +1442,7 @@ PopupMenu::PopupMenu() {
during_grabbed_click = false;
invalidated_click = false;
- allow_search = false;
+ allow_search = true;
search_time_msec = 0;
search_string = "";
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 52aee8f089..932dda2f9d 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -1121,9 +1121,7 @@ void TextEdit::_notification(int p_what) {
int ofs_y = (i * get_row_height() + cache.line_spacing / 2) + ofs_readonly;
ofs_y -= cursor.wrap_ofs * get_row_height();
- if (smooth_scroll_enabled) {
- ofs_y += (-get_v_scroll_offset()) * get_row_height();
- }
+ ofs_y -= get_v_scroll_offset() * get_row_height();
// Check if line contains highlighted word.
int highlighted_text_col = -1;
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index ad4d3c54be..c9d430c656 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -1234,17 +1234,13 @@ void Node::add_child(Node *p_child, bool p_legible_unique_name) {
_add_child_nocheck(p_child, p_child->data.name);
}
-void Node::add_child_below_node(Node *p_node, Node *p_child, bool p_legible_unique_name) {
- ERR_FAIL_NULL(p_node);
- ERR_FAIL_NULL(p_child);
-
- add_child(p_child, p_legible_unique_name);
+void Node::add_sibling(Node *p_sibling, bool p_legible_unique_name) {
+ ERR_FAIL_NULL(p_sibling);
+ ERR_FAIL_COND_MSG(p_sibling == this, "Can't add sibling '" + p_sibling->get_name() + "' to itself."); // adding to itself!
+ ERR_FAIL_COND_MSG(data.blocked > 0, "Parent node is busy setting up children, add_sibling() failed. Consider using call_deferred(\"add_sibling\", sibling) instead.");
- if (is_a_parent_of(p_node)) {
- move_child(p_child, p_node->get_index() + 1);
- } else {
- WARN_PRINT("Cannot move under node " + p_node->get_name() + " as " + p_child->get_name() + " does not share a parent.");
- }
+ get_parent()->add_child(p_sibling, p_legible_unique_name);
+ get_parent()->move_child(p_sibling, this->get_index() + 1);
}
void Node::_propagate_validate_owner() {
@@ -2710,7 +2706,7 @@ void Node::_bind_methods() {
GLOBAL_DEF("node/name_casing", NAME_CASING_PASCAL_CASE);
ProjectSettings::get_singleton()->set_custom_property_info("node/name_casing", PropertyInfo(Variant::INT, "node/name_casing", PROPERTY_HINT_ENUM, "PascalCase,camelCase,snake_case"));
- ClassDB::bind_method(D_METHOD("add_child_below_node", "preceding_node", "node", "legible_unique_name"), &Node::add_child_below_node, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("add_sibling", "sibling", "legible_unique_name"), &Node::add_sibling, DEFVAL(false));
ClassDB::bind_method(D_METHOD("set_name", "name"), &Node::set_name);
ClassDB::bind_method(D_METHOD("get_name"), &Node::get_name);
diff --git a/scene/main/node.h b/scene/main/node.h
index d1665d1236..7595aabd9a 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -266,7 +266,7 @@ public:
void set_name(const String &p_name);
void add_child(Node *p_child, bool p_legible_unique_name = false);
- void add_child_below_node(Node *p_node, Node *p_child, bool p_legible_unique_name = false);
+ void add_sibling(Node *p_sibling, bool p_legible_unique_name = false);
void remove_child(Node *p_child);
int get_child_count() const;
diff --git a/scene/main/window.cpp b/scene/main/window.cpp
index 6565f02503..a9be8a1eff 100644
--- a/scene/main/window.cpp
+++ b/scene/main/window.cpp
@@ -992,7 +992,7 @@ void Window::popup_centered_ratio(float p_ratio) {
ERR_FAIL_COND(!is_inside_tree());
ERR_FAIL_COND_MSG(window_id == DisplayServer::MAIN_WINDOW_ID, "Can't popup the main window.");
- Rect2i parent_rect;
+ Rect2 parent_rect;
if (is_embedded()) {
parent_rect = get_parent_viewport()->get_visible_rect();
@@ -1024,6 +1024,15 @@ void Window::popup(const Rect2i &p_screen_rect) {
set_size(adjust.size);
}
+ int scr = DisplayServer::get_singleton()->get_screen_count();
+ for (int i = 0; i < scr; i++) {
+ Rect2i r = DisplayServer::get_singleton()->screen_get_usable_rect(i);
+ if (r.has_point(position)) {
+ current_screen = i;
+ break;
+ }
+ }
+
set_transient(true);
set_visible(true);
_post_popup();
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index 67617a946f..f5b987e8df 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -52,20 +52,9 @@ static Ref<StyleBoxTexture> make_stylebox(T p_src, float p_left, float p_top, fl
} else {
texture = Ref<ImageTexture>(memnew(ImageTexture));
Ref<Image> img = memnew(Image(p_src));
-
- if (scale > 1) {
- Size2 orig_size = Size2(img->get_width(), img->get_height());
-
- img->convert(Image::FORMAT_RGBA8);
- img->expand_x2_hq2x();
- if (scale != 2.0) {
- img->resize(orig_size.x * scale, orig_size.y * scale);
- }
- } else if (scale < 1) {
- Size2 orig_size = Size2(img->get_width(), img->get_height());
- img->convert(Image::FORMAT_RGBA8);
- img->resize(orig_size.x * scale, orig_size.y * scale);
- }
+ const Size2 orig_size = Size2(img->get_width(), img->get_height());
+ img->convert(Image::FORMAT_RGBA8);
+ img->resize(orig_size.x * scale, orig_size.y * scale);
texture->create_from_image(img);
(*tex_cache)[p_src] = texture;
@@ -98,19 +87,9 @@ template <class T>
static Ref<Texture2D> make_icon(T p_src) {
Ref<ImageTexture> texture(memnew(ImageTexture));
Ref<Image> img = memnew(Image(p_src));
- if (scale > 1) {
- Size2 orig_size = Size2(img->get_width(), img->get_height());
-
- img->convert(Image::FORMAT_RGBA8);
- img->expand_x2_hq2x();
- if (scale != 2.0) {
- img->resize(orig_size.x * scale, orig_size.y * scale);
- }
- } else if (scale < 1) {
- Size2 orig_size = Size2(img->get_width(), img->get_height());
- img->convert(Image::FORMAT_RGBA8);
- img->resize(orig_size.x * scale, orig_size.y * scale);
- }
+ const Size2 orig_size = Size2(img->get_width(), img->get_height());
+ img->convert(Image::FORMAT_RGBA8);
+ img->resize(orig_size.x * scale, orig_size.y * scale);
texture->create_from_image(img);
return texture;
diff --git a/scene/resources/sky_material.cpp b/scene/resources/sky_material.cpp
index 92c5151d7a..69e8e0b5bd 100644
--- a/scene/resources/sky_material.cpp
+++ b/scene/resources/sky_material.cpp
@@ -410,6 +410,15 @@ float PhysicalSkyMaterial::get_dither_strength() const {
return dither_strength;
}
+void PhysicalSkyMaterial::set_night_sky(const Ref<Texture2D> &p_night_sky) {
+ night_sky = p_night_sky;
+ RS::get_singleton()->material_set_param(_get_material(), "night_sky", night_sky);
+}
+
+Ref<Texture2D> PhysicalSkyMaterial::get_night_sky() const {
+ return night_sky;
+}
+
bool PhysicalSkyMaterial::_can_do_next_pass() const {
return false;
}
@@ -453,6 +462,9 @@ void PhysicalSkyMaterial::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_dither_strength", "strength"), &PhysicalSkyMaterial::set_dither_strength);
ClassDB::bind_method(D_METHOD("get_dither_strength"), &PhysicalSkyMaterial::get_dither_strength);
+ ClassDB::bind_method(D_METHOD("set_night_sky", "night_sky"), &PhysicalSkyMaterial::set_night_sky);
+ ClassDB::bind_method(D_METHOD("get_night_sky"), &PhysicalSkyMaterial::get_night_sky);
+
ADD_GROUP("Rayleigh", "rayleigh_");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "rayleigh_coefficient", PROPERTY_HINT_RANGE, "0,64,0.01"), "set_rayleigh_coefficient", "get_rayleigh_coefficient");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "rayleigh_color"), "set_rayleigh_color", "get_rayleigh_color");
@@ -467,6 +479,7 @@ void PhysicalSkyMaterial::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "ground_color"), "set_ground_color", "get_ground_color");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "exposure", PROPERTY_HINT_RANGE, "0,128,0.01"), "set_exposure", "get_exposure");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "dither_strength", PROPERTY_HINT_RANGE, "0,10,0.01"), "set_dither_strength", "get_dither_strength");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "night_sky", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_night_sky", "get_night_sky");
}
PhysicalSkyMaterial::PhysicalSkyMaterial() {
@@ -484,6 +497,8 @@ PhysicalSkyMaterial::PhysicalSkyMaterial() {
code += "uniform float exposure : hint_range(0, 128) = 0.1;\n";
code += "uniform float dither_strength : hint_range(0, 10) = 1.0;\n\n";
+ code += "uniform sampler2D night_sky : hint_black;";
+
code += "const float PI = 3.141592653589793238462643383279502884197169;\n";
code += "const vec3 UP = vec3( 0.0, 1.0, 0.0 );\n\n";
@@ -547,7 +562,7 @@ PhysicalSkyMaterial::PhysicalSkyMaterial() {
code += "\tfloat sunAngularDiameterCos2 = cos(LIGHT0_SIZE * sun_disk_scale*0.5);\n";
code += "\tfloat sundisk = smoothstep(sunAngularDiameterCos, sunAngularDiameterCos2, cos_theta);\n";
code += "\tvec3 L0 = (sun_energy * 1900.0 * extinction) * sundisk * LIGHT0_COLOR;\n";
- code += "\t// Note: Add nightime here: L0 += night_sky * extinction\n\n";
+ code += "\tL0 += texture(night_sky, SKY_COORDS).xyz * extinction;\n\n";
code += "\tvec3 color = (Lin + L0) * 0.04;\n";
code += "\tCOLOR = pow(color, vec3(1.0 / (1.2 + (1.2 * sun_fade))));\n";
diff --git a/scene/resources/sky_material.h b/scene/resources/sky_material.h
index cd245a2897..e470137d9e 100644
--- a/scene/resources/sky_material.h
+++ b/scene/resources/sky_material.h
@@ -139,6 +139,7 @@ private:
Color ground_color;
float exposure;
float dither_strength;
+ Ref<Texture2D> night_sky;
protected:
static void _bind_methods();
@@ -175,6 +176,9 @@ public:
void set_dither_strength(float p_dither_strength);
float get_dither_strength() const;
+ void set_night_sky(const Ref<Texture2D> &p_night_sky);
+ Ref<Texture2D> get_night_sky() const;
+
virtual Shader::Mode get_shader_mode() const;
RID get_shader_rid() const;
diff --git a/servers/audio/audio_driver_dummy.cpp b/servers/audio/audio_driver_dummy.cpp
index 70d5ebbded..c539b582da 100644
--- a/servers/audio/audio_driver_dummy.cpp
+++ b/servers/audio/audio_driver_dummy.cpp
@@ -39,11 +39,11 @@ Error AudioDriverDummy::init() {
exit_thread = false;
samples_in = nullptr;
- mix_rate = DEFAULT_MIX_RATE;
+ mix_rate = GLOBAL_GET("audio/mix_rate");
speaker_mode = SPEAKER_MODE_STEREO;
channels = 2;
- int latency = GLOBAL_DEF_RST("audio/output_latency", DEFAULT_OUTPUT_LATENCY);
+ int latency = GLOBAL_GET("audio/output_latency");
buffer_frames = closest_power_of_2(latency * mix_rate / 1000);
samples_in = memnew_arr(int32_t, buffer_frames * channels);
diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp
index 7b1ac534b4..09d2914e05 100644
--- a/servers/audio_server.cpp
+++ b/servers/audio_server.cpp
@@ -182,6 +182,9 @@ int AudioDriverManager::get_driver_count() {
void AudioDriverManager::initialize(int p_driver) {
GLOBAL_DEF_RST("audio/enable_audio_input", false);
+ GLOBAL_DEF_RST("audio/mix_rate", DEFAULT_MIX_RATE);
+ GLOBAL_DEF_RST("audio/output_latency", DEFAULT_OUTPUT_LATENCY);
+
int failed_driver = -1;
// Check if there is a selected driver
diff --git a/servers/audio_server.h b/servers/audio_server.h
index 71b5ae5946..80e244aacd 100644
--- a/servers/audio_server.h
+++ b/servers/audio_server.h
@@ -80,9 +80,6 @@ public:
SPEAKER_SURROUND_71,
};
- static const int DEFAULT_MIX_RATE = 44100;
- static const int DEFAULT_OUTPUT_LATENCY = 15;
-
static AudioDriver *get_singleton();
void set_singleton();
@@ -129,6 +126,9 @@ class AudioDriverManager {
MAX_DRIVERS = 10
};
+ static const int DEFAULT_MIX_RATE = 44100;
+ static const int DEFAULT_OUTPUT_LATENCY = 15;
+
static AudioDriver *drivers[MAX_DRIVERS];
static int driver_count;
diff --git a/servers/rendering/rasterizer_rd/shaders/bokeh_dof.glsl b/servers/rendering/rasterizer_rd/shaders/bokeh_dof.glsl
index 18555d9672..63f086a83d 100644
--- a/servers/rendering/rasterizer_rd/shaders/bokeh_dof.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/bokeh_dof.glsl
@@ -1,5 +1,4 @@
-/* clang-format off */
-[compute]
+#[compute]
#version 450
@@ -8,7 +7,6 @@ VERSION_DEFINES
#define BLOCK_SIZE 8
layout(local_size_x = BLOCK_SIZE, local_size_y = BLOCK_SIZE, local_size_z = 1) in;
-/* clang-format on */
#ifdef MODE_GEN_BLUR_SIZE
layout(rgba16f, set = 0, binding = 0) uniform restrict image2D color_image;
@@ -51,7 +49,6 @@ layout(push_constant, binding = 1, std430) uniform Params {
float jitter_seed;
uint pad[2];
}
-
params;
//used to work around downsampling filter
diff --git a/servers/rendering/rasterizer_rd/shaders/canvas.glsl b/servers/rendering/rasterizer_rd/shaders/canvas.glsl
index fea36eb65c..e33b3face9 100644
--- a/servers/rendering/rasterizer_rd/shaders/canvas.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/canvas.glsl
@@ -1,5 +1,4 @@
-/* clang-format off */
-[vertex]
+#[vertex]
#version 450
@@ -7,7 +6,6 @@ VERSION_DEFINES
#ifdef USE_ATTRIBUTES
layout(location = 0) in vec2 vertex_attrib;
-/* clang-format on */
layout(location = 3) in vec4 color_attrib;
layout(location = 4) in vec2 uv_attrib;
@@ -87,7 +85,6 @@ void main() {
#if 0
if (draw_data.flags & FLAGS_INSTANCING_ENABLED) {
-
uint offset = draw_data.flags & FLAGS_INSTANCING_STRIDE_MASK;
offset *= gl_InstanceIndex;
mat4 instance_xform = mat4(
@@ -158,7 +155,6 @@ VERTEX_SHADER_CODE
#if 0
if (bool(draw_data.flags & FLAGS_USE_SKELETON) && bone_weights != vec4(0.0)) { //must be a valid bone
//skeleton transform
-
ivec4 bone_indicesi = ivec4(bone_indices);
uvec2 tex_ofs = bone_indicesi.x * 2;
@@ -209,8 +205,7 @@ VERTEX_SHADER_CODE
#endif
}
-/* clang-format off */
-[fragment]
+#[fragment]
#version 450
@@ -219,7 +214,6 @@ VERSION_DEFINES
#include "canvas_uniforms_inc.glsl"
layout(location = 0) in vec2 uv_interp;
-/* clang-format on */
layout(location = 1) in vec4 color_interp;
layout(location = 2) in vec2 vertex_interp;
@@ -342,7 +336,6 @@ void main() {
vec3 normal;
#if defined(NORMAL_USED)
-
bool normal_used = true;
#else
bool normal_used = false;
diff --git a/servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl b/servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl
index 3e0d5c4ffc..99e70a1976 100644
--- a/servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl
@@ -1,10 +1,8 @@
-/* clang-format off */
-[vertex]
+#[vertex]
#version 450
layout(location = 0) in highp vec3 vertex;
-/* clang-format on */
layout(push_constant, binding = 0, std430) uniform Constants {
mat4 projection;
@@ -12,7 +10,6 @@ layout(push_constant, binding = 0, std430) uniform Constants {
vec2 direction;
vec2 pad;
}
-
constants;
layout(location = 0) out highp float depth;
@@ -24,13 +21,11 @@ void main() {
gl_Position = constants.projection * vtx;
}
-/* clang-format off */
-[fragment]
+#[fragment]
#version 450
layout(location = 0) in highp float depth;
-/* clang-format on */
layout(location = 0) out highp float distance_buf;
void main() {
diff --git a/servers/rendering/rasterizer_rd/shaders/canvas_uniforms_inc.glsl b/servers/rendering/rasterizer_rd/shaders/canvas_uniforms_inc.glsl
index ba05b8b2fb..a39866004b 100644
--- a/servers/rendering/rasterizer_rd/shaders/canvas_uniforms_inc.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/canvas_uniforms_inc.glsl
@@ -51,7 +51,6 @@ layout(push_constant, binding = 0, std430) uniform DrawData {
vec2 color_texture_pixel_size;
uint lights[4];
}
-
draw_data;
// The values passed per draw primitives are cached within it
@@ -83,7 +82,6 @@ layout(set = 2, binding = 0, std140) uniform CanvasData {
float time_pad;
//uint light_count;
}
-
canvas_data;
layout(set = 2, binding = 1) uniform textureBuffer skeleton_buffer;
@@ -92,7 +90,6 @@ layout(set = 2, binding = 2, std140) uniform SkeletonData {
mat4 skeleton_transform; //in world coordinates
mat4 skeleton_transform_inverse;
}
-
skeleton_data;
#ifdef USE_LIGHTING
@@ -126,7 +123,6 @@ struct Light {
layout(set = 2, binding = 3, std140) uniform LightData {
Light data[MAX_LIGHTS];
}
-
light_array;
layout(set = 2, binding = 4) uniform texture2D light_textures[MAX_LIGHT_TEXTURES];
@@ -139,7 +135,6 @@ layout(set = 2, binding = 6) uniform sampler shadow_sampler;
layout(set = 2, binding = 7, std430) restrict readonly buffer GlobalVariableData {
vec4 data[];
}
-
global_variables;
/* SET3: Render Target Data */
diff --git a/servers/rendering/rasterizer_rd/shaders/copy.glsl b/servers/rendering/rasterizer_rd/shaders/copy.glsl
index 249e7963d0..eb39c28fa9 100644
--- a/servers/rendering/rasterizer_rd/shaders/copy.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/copy.glsl
@@ -1,12 +1,10 @@
-/* clang-format off */
-[compute]
+#[compute]
#version 450
VERSION_DEFINES
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
-/* clang-format on */
#define FLAG_HORIZONTAL (1 << 0)
#define FLAG_USE_BLUR_SECTION (1 << 1)
@@ -37,7 +35,6 @@ layout(push_constant, binding = 1, std430) uniform Params {
float camera_z_near;
uint pad2[2];
}
-
params;
#ifdef MODE_CUBEMAP_ARRAY_TO_PANORAMA
diff --git a/servers/rendering/rasterizer_rd/shaders/copy_to_fb.glsl b/servers/rendering/rasterizer_rd/shaders/copy_to_fb.glsl
index 5f53045afd..b1cfe1e91e 100644
--- a/servers/rendering/rasterizer_rd/shaders/copy_to_fb.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/copy_to_fb.glsl
@@ -1,12 +1,10 @@
-/* clang-format off */
-[vertex]
+#[vertex]
#version 450
VERSION_DEFINES
layout(location = 0) out vec2 uv_interp;
-/* clang-format on */
layout(push_constant, binding = 1, std430) uniform Params {
vec4 section;
@@ -17,7 +15,6 @@ layout(push_constant, binding = 1, std430) uniform Params {
bool force_luminance;
uint pad[3];
}
-
params;
void main() {
@@ -36,8 +33,7 @@ void main() {
}
}
-/* clang-format off */
-[fragment]
+#[fragment]
#version 450
@@ -52,11 +48,10 @@ layout(push_constant, binding = 1, std430) uniform Params {
bool force_luminance;
bool alpha_to_zero;
uint pad[2];
-} params;
-
+}
+params;
layout(location = 0) in vec2 uv_interp;
-/* clang-format on */
layout(set = 0, binding = 0) uniform sampler2D source_color;
@@ -82,8 +77,9 @@ void main() {
vec2 st = vec2(atan(normal.x, normal.z), acos(normal.y));
- if (st.x < 0.0)
+ if (st.x < 0.0) {
st.x += M_PI * 2.0;
+ }
uv = st / vec2(M_PI * 2.0, M_PI);
diff --git a/servers/rendering/rasterizer_rd/shaders/cube_to_dp.glsl b/servers/rendering/rasterizer_rd/shaders/cube_to_dp.glsl
index 133d97ffcb..54d67db6c6 100644
--- a/servers/rendering/rasterizer_rd/shaders/cube_to_dp.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/cube_to_dp.glsl
@@ -1,12 +1,10 @@
-/* clang-format off */
-[compute]
+#[compute]
#version 450
VERSION_DEFINES
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
-/* clang-format on */
layout(set = 0, binding = 0) uniform samplerCube source_cube;
@@ -18,7 +16,6 @@ layout(push_constant, binding = 1, std430) uniform Params {
float z_near;
bool z_flip;
}
-
params;
layout(r32f, set = 1, binding = 0) uniform restrict writeonly image2D depth_buffer;
diff --git a/servers/rendering/rasterizer_rd/shaders/cubemap_downsampler.glsl b/servers/rendering/rasterizer_rd/shaders/cubemap_downsampler.glsl
index 8d88e46727..7f269b7af3 100644
--- a/servers/rendering/rasterizer_rd/shaders/cubemap_downsampler.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/cubemap_downsampler.glsl
@@ -18,8 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
-/* clang-format off */
-[compute]
+#[compute]
#version 450
@@ -28,7 +27,6 @@ VERSION_DEFINES
#define BLOCK_SIZE 8
layout(local_size_x = BLOCK_SIZE, local_size_y = BLOCK_SIZE, local_size_z = 1) in;
-/* clang-format on */
layout(set = 0, binding = 0) uniform samplerCube source_cubemap;
@@ -37,7 +35,6 @@ layout(rgba16f, set = 1, binding = 0) uniform restrict writeonly imageCube dest_
layout(push_constant, binding = 1, std430) uniform Params {
uint face_size;
}
-
params;
#define M_PI 3.14159265359
diff --git a/servers/rendering/rasterizer_rd/shaders/cubemap_filter.glsl b/servers/rendering/rasterizer_rd/shaders/cubemap_filter.glsl
index 20bc0e2d0d..987545fb76 100644
--- a/servers/rendering/rasterizer_rd/shaders/cubemap_filter.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/cubemap_filter.glsl
@@ -18,8 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
-/* clang-format off */
-[compute]
+#[compute]
#version 450
@@ -28,7 +27,6 @@ VERSION_DEFINES
#define GROUP_SIZE 64
layout(local_size_x = GROUP_SIZE, local_size_y = 1, local_size_z = 1) in;
-/* clang-format on */
layout(set = 0, binding = 0) uniform samplerCube source_cubemap;
layout(rgba16f, set = 2, binding = 0) uniform restrict writeonly imageCube dest_cubemap0;
@@ -51,13 +49,11 @@ layout(rgba16f, set = 2, binding = 6) uniform restrict writeonly imageCube dest_
layout(set = 1, binding = 0, std430) buffer restrict readonly Data {
vec4[7][5][3][24] coeffs;
}
-
data;
#else
layout(set = 1, binding = 0, std430) buffer restrict readonly Data {
vec4[7][5][6] coeffs;
}
-
data;
#endif
diff --git a/servers/rendering/rasterizer_rd/shaders/cubemap_roughness.glsl b/servers/rendering/rasterizer_rd/shaders/cubemap_roughness.glsl
index 0e6e51f0de..5cbb00baa4 100644
--- a/servers/rendering/rasterizer_rd/shaders/cubemap_roughness.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/cubemap_roughness.glsl
@@ -1,5 +1,4 @@
-/* clang-format off */
-[compute]
+#[compute]
#version 450
@@ -8,7 +7,6 @@ VERSION_DEFINES
#define GROUP_SIZE 8
layout(local_size_x = GROUP_SIZE, local_size_y = GROUP_SIZE, local_size_z = 1) in;
-/* clang-format on */
layout(set = 0, binding = 0) uniform samplerCube source_cube;
@@ -21,7 +19,6 @@ layout(push_constant, binding = 1, std430) uniform Params {
bool use_direct_write;
float face_size;
}
-
params;
#define M_PI 3.14159265359
diff --git a/servers/rendering/rasterizer_rd/shaders/giprobe.glsl b/servers/rendering/rasterizer_rd/shaders/giprobe.glsl
index 60c4032d80..ea4237a45e 100644
--- a/servers/rendering/rasterizer_rd/shaders/giprobe.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/giprobe.glsl
@@ -1,5 +1,4 @@
-/* clang-format off */
-[compute]
+#[compute]
#version 450
@@ -10,7 +9,6 @@ layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
#else
layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
#endif
-/* clang-format on */
#ifndef MODE_DYNAMIC
@@ -24,7 +22,6 @@ struct CellChildren {
layout(set = 0, binding = 1, std430) buffer CellChildrenBuffer {
CellChildren data[];
}
-
cell_children;
struct CellData {
@@ -37,7 +34,6 @@ struct CellData {
layout(set = 0, binding = 2, std430) buffer CellDataBuffer {
CellData data[];
}
-
cell_data;
#endif // MODE DYNAMIC
@@ -67,7 +63,6 @@ struct Light {
layout(set = 0, binding = 3, std140) uniform Lights {
Light data[MAX_LIGHTS];
}
-
lights;
#endif // MODE COMPUTE LIGHT
@@ -99,13 +94,11 @@ layout(push_constant, binding = 0, std430) uniform Params {
float aniso_strength;
uint pad;
}
-
params;
layout(set = 0, binding = 4, std430) buffer Outputs {
vec4 data[];
}
-
outputs;
#endif // MODE DYNAMIC
@@ -148,7 +141,6 @@ layout(push_constant, binding = 0, std430) uniform Params {
float propagation;
float pad[3];
}
-
params;
#ifdef MODE_DYNAMIC_LIGHTING
diff --git a/servers/rendering/rasterizer_rd/shaders/giprobe_debug.glsl b/servers/rendering/rasterizer_rd/shaders/giprobe_debug.glsl
index db3043fb28..515cc35507 100644
--- a/servers/rendering/rasterizer_rd/shaders/giprobe_debug.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/giprobe_debug.glsl
@@ -1,5 +1,4 @@
-/* clang-format off */
-[vertex]
+#[vertex]
#version 450
@@ -11,12 +10,10 @@ struct CellData {
uint emission; //rgb normalized with e as multiplier
uint normal; //RGB normal encoded
};
-/* clang-format on */
layout(set = 0, binding = 1, std140) buffer CellDataBuffer {
CellData data[];
}
-
cell_data;
layout(set = 0, binding = 2) uniform texture3D color_tex;
@@ -37,7 +34,6 @@ layout(push_constant, binding = 0, std430) uniform Params {
ivec3 bounds;
uint pad;
}
-
params;
layout(location = 0) out vec4 color_interp;
@@ -172,15 +168,13 @@ void main() {
#endif
}
-/* clang-format off */
-[fragment]
+#[fragment]
#version 450
VERSION_DEFINES
layout(location = 0) in vec4 color_interp;
-/* clang-format on */
layout(location = 0) out vec4 frag_color;
void main() {
diff --git a/servers/rendering/rasterizer_rd/shaders/giprobe_sdf.glsl b/servers/rendering/rasterizer_rd/shaders/giprobe_sdf.glsl
index 37ea673fbe..5b3dec0ee7 100644
--- a/servers/rendering/rasterizer_rd/shaders/giprobe_sdf.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/giprobe_sdf.glsl
@@ -1,12 +1,10 @@
-/* clang-format off */
-[compute]
+#[compute]
#version 450
VERSION_DEFINES
layout(local_size_x = 4, local_size_y = 4, local_size_z = 4) in;
-/* clang-format on */
#define MAX_DISTANCE 100000
@@ -20,7 +18,6 @@ struct CellChildren {
layout(set = 0, binding = 1, std430) buffer CellChildrenBuffer {
CellChildren data[];
}
-
cell_children;
struct CellData {
@@ -33,7 +30,6 @@ struct CellData {
layout(set = 0, binding = 2, std430) buffer CellDataBuffer {
CellData data[];
}
-
cell_data;
layout(r8ui, set = 0, binding = 3) uniform restrict writeonly uimage3D sdf_tex;
@@ -44,7 +40,6 @@ layout(push_constant, binding = 0, std430) uniform Params {
uint pad0;
uint pad1;
}
-
params;
void main() {
@@ -73,20 +68,17 @@ void main() {
#if 0
layout(push_constant, binding = 0, std430) uniform Params {
-
ivec3 limits;
uint stack_size;
-} params;
+}
+params;
float distance_to_aabb(ivec3 pos, ivec3 aabb_pos, ivec3 aabb_size) {
-
vec3 delta = vec3(max(ivec3(0), max(aabb_pos - pos, pos - (aabb_pos + aabb_size - ivec3(1)))));
return length(delta);
}
-
void main() {
-
ivec3 pos = ivec3(gl_GlobalInvocationID);
uint stack[10] = uint[](0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
@@ -110,7 +102,6 @@ void main() {
int stack_pos = 0;
while (true) {
-
uint index = stack_indices[stack_pos] >> 24;
if (index == 8) {
diff --git a/servers/rendering/rasterizer_rd/shaders/giprobe_write.glsl b/servers/rendering/rasterizer_rd/shaders/giprobe_write.glsl
index 7a79f6a3ac..9c794f1bcc 100644
--- a/servers/rendering/rasterizer_rd/shaders/giprobe_write.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/giprobe_write.glsl
@@ -1,12 +1,10 @@
-/* clang-format off */
-[compute]
+#[compute]
#version 450
VERSION_DEFINES
layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
-/* clang-format on */
#define NO_CHILDREN 0xFFFFFFFF
#define GREY_VEC vec3(0.33333, 0.33333, 0.33333)
@@ -18,7 +16,6 @@ struct CellChildren {
layout(set = 0, binding = 1, std430) buffer CellChildrenBuffer {
CellChildren data[];
}
-
cell_children;
struct CellData {
@@ -31,7 +28,6 @@ struct CellData {
layout(set = 0, binding = 2, std430) buffer CellDataBuffer {
CellData data[];
}
-
cell_data;
#define LIGHT_TYPE_DIRECTIONAL 0
@@ -59,7 +55,6 @@ struct Light {
layout(set = 0, binding = 3, std140) uniform Lights {
Light data[MAX_LIGHTS];
}
-
lights;
#endif
@@ -77,13 +72,11 @@ layout(push_constant, binding = 0, std430) uniform Params {
uint cell_count;
uint pad[2];
}
-
params;
layout(set = 0, binding = 4, std140) uniform Outputs {
vec4 data[];
}
-
output;
#ifdef MODE_COMPUTE_LIGHT
@@ -94,7 +87,6 @@ uint raymarch(float distance, float distance_adv, vec3 from, vec3 direction) {
ivec3 size = ivec3(max(max(params.limits.x, params.limits.y), params.limits.z));
while (distance > -distance_adv) { //use this to avoid precision errors
-
uint cell = 0;
ivec3 pos = ivec3(from);
@@ -120,8 +112,9 @@ uint raymarch(float distance, float distance_adv, vec3 from, vec3 direction) {
}
cell = cell_children.data[cell].children[child];
- if (cell == NO_CHILDREN)
+ if (cell == NO_CHILDREN) {
break;
+ }
half_size >>= ivec3(1);
}
@@ -142,7 +135,6 @@ bool compute_light_vector(uint light, uint cell, vec3 pos, out float attenuation
if (lights.data[light].type == LIGHT_TYPE_DIRECTIONAL) {
light_pos = pos - lights.data[light].direction * length(vec3(params.limits));
attenuation = 1.0;
-
} else {
light_pos = lights.data[light].position;
float distance = length(pos - light_pos);
diff --git a/servers/rendering/rasterizer_rd/shaders/luminance_reduce.glsl b/servers/rendering/rasterizer_rd/shaders/luminance_reduce.glsl
index 060b1a3101..8a11c35b78 100644
--- a/servers/rendering/rasterizer_rd/shaders/luminance_reduce.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/luminance_reduce.glsl
@@ -1,5 +1,4 @@
-/* clang-format off */
-[compute]
+#[compute]
#version 450
@@ -8,7 +7,6 @@ VERSION_DEFINES
#define BLOCK_SIZE 8
layout(local_size_x = BLOCK_SIZE, local_size_y = BLOCK_SIZE, local_size_z = 1) in;
-/* clang-format on */
shared float tmp_data[BLOCK_SIZE * BLOCK_SIZE];
@@ -37,7 +35,6 @@ layout(push_constant, binding = 1, std430) uniform Params {
float exposure_adjust;
float pad[3];
}
-
params;
void main() {
@@ -68,7 +65,6 @@ void main() {
barrier();
size >>= 1;
-
} while (size >= 1);
if (t == 0) {
diff --git a/servers/rendering/rasterizer_rd/shaders/roughness_limiter.glsl b/servers/rendering/rasterizer_rd/shaders/roughness_limiter.glsl
index e59424e3d6..464895928a 100644
--- a/servers/rendering/rasterizer_rd/shaders/roughness_limiter.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/roughness_limiter.glsl
@@ -1,12 +1,10 @@
-/* clang-format off */
-[compute]
+#[compute]
#version 450
VERSION_DEFINES
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
-/* clang-format on */
layout(set = 0, binding = 0) uniform sampler2D source_normal;
layout(r8, set = 1, binding = 0) uniform restrict writeonly image2D dest_roughness;
@@ -16,7 +14,6 @@ layout(push_constant, binding = 1, std430) uniform Params {
float curve;
uint pad;
}
-
params;
#define HALF_PI 1.5707963267948966
@@ -53,14 +50,14 @@ void main() {
float kappa = (3.0f * r - r * r2) / (1.0f - r2);
float variance = 0.25f / kappa;
limit = sqrt(min(2.0f * variance, threshold * threshold));
-//*/
+ */
/*
//Formula based on probability distribution graph
float width = acos(max(0.0,r)); // convert to angle (width)
float roughness = pow(width,1.7)*0.854492; //approximate (crappy) formula to convert to roughness
limit = min(sqrt(roughness), threshold); //convert to perceptual roughness and apply threshold
-//*/
+ */
limit = min(sqrt(pow(acos(max(0.0, r)) / HALF_PI, params.curve)), threshold); //convert to perceptual roughness and apply threshold
diff --git a/servers/rendering/rasterizer_rd/shaders/scene_high_end.glsl b/servers/rendering/rasterizer_rd/shaders/scene_high_end.glsl
index 86d7ba6f1b..9f42b0f814 100644
--- a/servers/rendering/rasterizer_rd/shaders/scene_high_end.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/scene_high_end.glsl
@@ -1,5 +1,4 @@
-/* clang-format off */
-[vertex]
+#[vertex]
#version 450
@@ -10,7 +9,6 @@ VERSION_DEFINES
/* INPUT ATTRIBS */
layout(location = 0) in vec3 vertex_attrib;
-/* clang-format on */
layout(location = 1) in vec3 normal_attrib;
#if defined(TANGENT_USED) || defined(NORMALMAP_USED) || defined(LIGHT_ANISOTROPY_USED)
layout(location = 2) in vec4 tangent_attrib;
@@ -62,8 +60,6 @@ VERTEX_SHADER_GLOBALS
/* clang-format on */
-// FIXME: This triggers a Mesa bug that breaks rendering, so disabled for now.
-// See GH-13450 and https://bugs.freedesktop.org/show_bug.cgi?id=100316
invariant gl_Position;
layout(location = 7) flat out uint instance_index;
@@ -272,8 +268,7 @@ VERTEX_SHADER_CODE
#endif
}
-/* clang-format off */
-[fragment]
+#[fragment]
#version 450
@@ -284,7 +279,6 @@ VERSION_DEFINES
/* Varyings */
layout(location = 0) in vec3 vertex_interp;
-/* clang-format on */
layout(location = 1) in vec3 normal_interp;
#if defined(COLOR_USED)
diff --git a/servers/rendering/rasterizer_rd/shaders/scene_high_end_inc.glsl b/servers/rendering/rasterizer_rd/shaders/scene_high_end_inc.glsl
index 93ddcc9dbc..1cac12406a 100644
--- a/servers/rendering/rasterizer_rd/shaders/scene_high_end_inc.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/scene_high_end_inc.glsl
@@ -6,7 +6,6 @@ layout(push_constant, binding = 0, std430) uniform DrawCall {
uint pad; //16 bits minimum size
vec2 bake_uv2_offset; //used for bake to uv2, ignored otherwise
}
-
draw_call;
/* Set 0 Scene data that never changes, ever */
@@ -148,7 +147,6 @@ struct InstanceData {
layout(set = 0, binding = 4, std430) restrict readonly buffer Instances {
InstanceData data[];
}
-
instances;
struct LightData { //this structure needs to be as packed as possible
@@ -175,7 +173,6 @@ struct LightData { //this structure needs to be as packed as possible
layout(set = 0, binding = 5, std430) restrict readonly buffer Lights {
LightData data[];
}
-
lights;
struct ReflectionData {
@@ -192,7 +189,6 @@ struct ReflectionData {
layout(set = 0, binding = 6, std140) uniform ReflectionProbeData {
ReflectionData data[MAX_REFLECTION_DATA_STRUCTS];
}
-
reflections;
struct DirectionalLightData {
@@ -231,7 +227,6 @@ struct DirectionalLightData {
layout(set = 0, binding = 7, std140) uniform DirectionalLights {
DirectionalLightData data[MAX_DIRECTIONAL_LIGHT_DATA_STRUCTS];
}
-
directional_lights;
struct GIProbeData {
@@ -253,7 +248,6 @@ struct GIProbeData {
layout(set = 0, binding = 8, std140) uniform GIProbes {
GIProbeData data[MAX_GI_PROBES];
}
-
gi_probes;
layout(set = 0, binding = 9) uniform texture3D gi_probe_textures[MAX_GI_PROBE_TEXTURES];
@@ -268,7 +262,6 @@ struct Lightmap {
layout(set = 0, binding = 10, std140) restrict readonly buffer Lightmaps {
Lightmap data[];
}
-
lightmaps;
layout(set = 0, binding = 11) uniform texture2DArray lightmap_textures[MAX_LIGHTMAP_TEXTURES];
@@ -280,7 +273,6 @@ struct LightmapCapture {
layout(set = 0, binding = 12, std140) restrict readonly buffer LightmapCaptures {
LightmapCapture data[];
}
-
lightmap_captures;
#define CLUSTER_COUNTER_SHIFT 20
@@ -311,7 +303,6 @@ struct DecalData {
layout(set = 0, binding = 15, std430) restrict readonly buffer Decals {
DecalData data[];
}
-
decals;
layout(set = 0, binding = 16) uniform utexture3D cluster_texture;
@@ -319,7 +310,6 @@ layout(set = 0, binding = 16) uniform utexture3D cluster_texture;
layout(set = 0, binding = 17, std430) restrict readonly buffer ClusterData {
uint indices[];
}
-
cluster_data;
layout(set = 0, binding = 18) uniform texture2D directional_shadow_atlas;
@@ -327,7 +317,6 @@ layout(set = 0, binding = 18) uniform texture2D directional_shadow_atlas;
layout(set = 0, binding = 19, std430) restrict readonly buffer GlobalVariableData {
vec4 data[];
}
-
global_variables;
// decal atlas
@@ -363,7 +352,6 @@ layout(set = 3, binding = 4) uniform texture2D ao_buffer;
layout(set = 4, binding = 0, std430) restrict readonly buffer Transforms {
vec4 data[];
}
-
transforms;
/* Set 5 User Material */
diff --git a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection.glsl b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection.glsl
index 39b10871ac..084f28d932 100644
--- a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection.glsl
@@ -1,16 +1,11 @@
-/* clang-format off */
-[compute]
+#[compute]
#version 450
VERSION_DEFINES
-
-
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
-/* clang-format on */
-
layout(rgba16f, set = 0, binding = 0) uniform restrict readonly image2D source_diffuse;
layout(r32f, set = 0, binding = 1) uniform restrict readonly image2D source_depth;
layout(rgba16f, set = 1, binding = 0) uniform restrict writeonly image2D ssr_image;
@@ -42,7 +37,6 @@ layout(push_constant, binding = 2, std430) uniform Params {
mat4 projection;
}
-
params;
vec2 view_to_screen(vec3 view_pos, out float w) {
diff --git a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_filter.glsl b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_filter.glsl
index c36143039c..a5afe74cb2 100644
--- a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_filter.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_filter.glsl
@@ -1,16 +1,11 @@
-/* clang-format off */
-[compute]
+#[compute]
#version 450
VERSION_DEFINES
-
-
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
-/* clang-format on */
-
layout(rgba16f, set = 0, binding = 0) uniform restrict readonly image2D source_ssr;
layout(r8, set = 0, binding = 1) uniform restrict readonly image2D source_radius;
layout(rgba8, set = 1, binding = 0) uniform restrict readonly image2D source_normal;
@@ -33,7 +28,6 @@ layout(push_constant, binding = 2, std430) uniform Params {
bool vertical;
uint steps;
}
-
params;
#define GAUSS_TABLE_SIZE 15
diff --git a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_scale.glsl b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_scale.glsl
index 072f57eb40..218605a962 100644
--- a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_scale.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_scale.glsl
@@ -1,15 +1,11 @@
-/* clang-format off */
-[compute]
+#[compute]
#version 450
VERSION_DEFINES
-
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
-/* clang-format on */
-
layout(set = 0, binding = 0) uniform sampler2D source_ssr;
layout(set = 1, binding = 0) uniform sampler2D source_depth;
layout(set = 1, binding = 1) uniform sampler2D source_normal;
@@ -26,7 +22,6 @@ layout(push_constant, binding = 1, std430) uniform Params {
bool filtered;
uint pad[2];
}
-
params;
void main() {
@@ -72,7 +67,6 @@ void main() {
color /= 4.0;
depth /= 4.0;
normal = normalize(normal / 4.0) * 0.5 + 0.5;
-
} else {
color = texelFetch(source_ssr, ssC << 1, 0);
depth = texelFetch(source_depth, ssC << 1, 0).r;
diff --git a/servers/rendering/rasterizer_rd/shaders/sky.glsl b/servers/rendering/rasterizer_rd/shaders/sky.glsl
index b0be03fe44..9c59be6841 100644
--- a/servers/rendering/rasterizer_rd/shaders/sky.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/sky.glsl
@@ -1,12 +1,10 @@
-/* clang-format off */
-[vertex]
+#[vertex]
#version 450
VERSION_DEFINES
layout(location = 0) out vec2 uv_interp;
-/* clang-format on */
layout(push_constant, binding = 1, std430) uniform Params {
mat3 orientation;
@@ -14,7 +12,6 @@ layout(push_constant, binding = 1, std430) uniform Params {
vec4 position_multiplier;
float time;
}
-
params;
void main() {
@@ -23,8 +20,7 @@ void main() {
gl_Position = vec4(uv_interp, 1.0, 1.0);
}
-/* clang-format off */
-[fragment]
+#[fragment]
#version 450
@@ -33,7 +29,6 @@ VERSION_DEFINES
#define M_PI 3.14159265359
layout(location = 0) in vec2 uv_interp;
-/* clang-format on */
layout(push_constant, binding = 1, std430) uniform Params {
mat3 orientation;
@@ -41,7 +36,6 @@ layout(push_constant, binding = 1, std430) uniform Params {
vec4 position_multiplier;
float time; //TODO consider adding vec2 screen res, and float radiance size
}
-
params;
#define SAMPLER_NEAREST_CLAMP 0
@@ -62,7 +56,6 @@ layout(set = 0, binding = 0) uniform sampler material_samplers[12];
layout(set = 0, binding = 1, std430) restrict readonly buffer GlobalVariableData {
vec4 data[];
}
-
global_variables;
#ifdef USE_MATERIAL_UNIFORMS
diff --git a/servers/rendering/rasterizer_rd/shaders/specular_merge.glsl b/servers/rendering/rasterizer_rd/shaders/specular_merge.glsl
index c693ea5abc..0b8f406213 100644
--- a/servers/rendering/rasterizer_rd/shaders/specular_merge.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/specular_merge.glsl
@@ -1,12 +1,10 @@
-/* clang-format off */
-[vertex]
+#[vertex]
#version 450
VERSION_DEFINES
layout(location = 0) out vec2 uv_interp;
-/* clang-format on */
void main() {
vec2 base_arr[4] = vec2[](vec2(0.0, 0.0), vec2(0.0, 1.0), vec2(1.0, 1.0), vec2(1.0, 0.0));
@@ -15,15 +13,13 @@ void main() {
gl_Position = vec4(uv_interp * 2.0 - 1.0, 0.0, 1.0);
}
-/* clang-format off */
-[fragment]
+#[fragment]
#version 450
VERSION_DEFINES
layout(location = 0) in vec2 uv_interp;
-/* clang-format on */
layout(set = 0, binding = 0) uniform sampler2D specular;
diff --git a/servers/rendering/rasterizer_rd/shaders/ssao.glsl b/servers/rendering/rasterizer_rd/shaders/ssao.glsl
index 764d7eeeac..346338181a 100644
--- a/servers/rendering/rasterizer_rd/shaders/ssao.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/ssao.glsl
@@ -1,12 +1,10 @@
-/* clang-format off */
-[compute]
+#[compute]
#version 450
VERSION_DEFINES
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
-/* clang-format on */
#define TWO_PI 6.283185307179586476925286766559
@@ -49,7 +47,6 @@ const int ROTATIONS[] = int[](
29, 21, 19, 27, 31, 29, 21, 18, 17, 29,
31, 31, 23, 18, 25, 26, 25, 23, 19, 34,
19, 27, 21, 25, 39, 29, 17, 21, 27);
-/* clang-format on */
//#define NUM_SPIRAL_TURNS (7)
const int NUM_SPIRAL_TURNS = ROTATIONS[NUM_SAMPLES - 1];
@@ -78,7 +75,6 @@ layout(push_constant, binding = 1, std430) uniform Params {
float proj_scale;
uint pad;
}
-
params;
vec3 reconstructCSPosition(vec2 S, float z) {
diff --git a/servers/rendering/rasterizer_rd/shaders/ssao_blur.glsl b/servers/rendering/rasterizer_rd/shaders/ssao_blur.glsl
index ca7cc7d71b..3e63e3cb59 100644
--- a/servers/rendering/rasterizer_rd/shaders/ssao_blur.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/ssao_blur.glsl
@@ -1,12 +1,10 @@
-/* clang-format off */
-[compute]
+#[compute]
#version 450
VERSION_DEFINES
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
-/* clang-format on */
layout(set = 0, binding = 0) uniform sampler2D source_ssao;
layout(set = 1, binding = 0) uniform sampler2D source_depth;
@@ -31,7 +29,6 @@ layout(push_constant, binding = 1, std430) uniform Params {
ivec2 axis; /** (1, 0) or (0, 1) */
ivec2 screen_size;
}
-
params;
/** Filter radius in pixels. This will be multiplied by SCALE. */
diff --git a/servers/rendering/rasterizer_rd/shaders/ssao_minify.glsl b/servers/rendering/rasterizer_rd/shaders/ssao_minify.glsl
index c590e406f3..263fca386f 100644
--- a/servers/rendering/rasterizer_rd/shaders/ssao_minify.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/ssao_minify.glsl
@@ -1,12 +1,10 @@
-/* clang-format off */
-[compute]
+#[compute]
#version 450
VERSION_DEFINES
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
-/* clang-format on */
layout(push_constant, binding = 1, std430) uniform Params {
vec2 pixel_size;
@@ -16,7 +14,6 @@ layout(push_constant, binding = 1, std430) uniform Params {
bool orthogonal;
uint pad;
}
-
params;
#ifdef MINIFY_START
diff --git a/servers/rendering/rasterizer_rd/shaders/subsurface_scattering.glsl b/servers/rendering/rasterizer_rd/shaders/subsurface_scattering.glsl
index 9d660c5865..88a953562f 100644
--- a/servers/rendering/rasterizer_rd/shaders/subsurface_scattering.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/subsurface_scattering.glsl
@@ -1,16 +1,11 @@
-/* clang-format off */
-[compute]
+#[compute]
#version 450
VERSION_DEFINES
-
-
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
-/* clang-format on */
-
#ifdef USE_25_SAMPLES
const int kernel_size = 13;
@@ -105,7 +100,6 @@ layout(push_constant, binding = 1, std430) uniform Params {
float depth_scale;
uint pad[3];
}
-
params;
layout(set = 0, binding = 0) uniform sampler2D source_image;
diff --git a/servers/rendering/rasterizer_rd/shaders/tonemap.glsl b/servers/rendering/rasterizer_rd/shaders/tonemap.glsl
index f4754bfea7..b7c46a7d0e 100644
--- a/servers/rendering/rasterizer_rd/shaders/tonemap.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/tonemap.glsl
@@ -1,12 +1,10 @@
-/* clang-format off */
-[vertex]
+#[vertex]
#version 450
VERSION_DEFINES
layout(location = 0) out vec2 uv_interp;
-/* clang-format on */
void main() {
vec2 base_arr[4] = vec2[](vec2(0.0, 0.0), vec2(0.0, 1.0), vec2(1.0, 1.0), vec2(1.0, 0.0));
@@ -14,15 +12,13 @@ void main() {
gl_Position = vec4(uv_interp * 2.0 - 1.0, 0.0, 1.0);
}
-/* clang-format off */
-[fragment]
+#[fragment]
#version 450
VERSION_DEFINES
layout(location = 0) in vec2 uv_interp;
-/* clang-format on */
layout(set = 0, binding = 0) uniform sampler2D source_color;
layout(set = 1, binding = 0) uniform sampler2D source_auto_exposure;
@@ -52,7 +48,6 @@ layout(push_constant, binding = 1, std430) uniform Params {
bool use_fxaa;
uint pad;
}
-
params;
layout(location = 0) out vec4 frag_color;
@@ -297,10 +292,11 @@ vec3 do_fxaa(vec3 color, float exposure, vec2 uv_interp) {
textureLod(source_color, uv_interp + dir * 0.5, 0.0).xyz * exposure);
float lumaB = dot(rgbB, luma);
- if ((lumaB < lumaMin) || (lumaB > lumaMax))
+ if ((lumaB < lumaMin) || (lumaB > lumaMax)) {
return rgbA;
- else
+ } else {
return rgbB;
+ }
}
void main() {
diff --git a/servers/rendering/rendering_device_binds.cpp b/servers/rendering/rendering_device_binds.cpp
index 2936843a9c..291f2ff705 100644
--- a/servers/rendering/rendering_device_binds.cpp
+++ b/servers/rendering/rendering_device_binds.cpp
@@ -41,7 +41,7 @@ Error RDShaderFile::parse_versions_from_text(const String &p_text, const String
"fragment",
"tesselation_control",
"tesselation_evaluation",
- "compute"
+ "compute",
};
String stage_code[RD::SHADER_STAGE_MAX];
int stages_found = 0;
@@ -55,14 +55,11 @@ Error RDShaderFile::parse_versions_from_text(const String &p_text, const String
{
String ls = line.strip_edges();
- if (ls.begins_with("#[")) { //workaround for clang format
- ls = ls.replace_first("#[", "[");
- }
- if (ls.begins_with("[") && ls.ends_with("]")) {
- String section = ls.substr(1, ls.length() - 2).strip_edges();
+ if (ls.begins_with("#[") && ls.ends_with("]")) {
+ String section = ls.substr(2, ls.length() - 3).strip_edges();
if (section == "versions") {
if (stages_found) {
- base_error = "Invalid shader file, [version] must be the first section found.";
+ base_error = "Invalid shader file, #[versions] must be the first section found.";
break;
}
reading_versions = true;
@@ -102,22 +99,27 @@ Error RDShaderFile::parse_versions_from_text(const String &p_text, const String
if (reading_versions) {
String l = line.strip_edges();
if (l != "") {
- int eqpos = l.find("=");
- if (eqpos == -1) {
- base_error = "Version syntax is version=\"<defines with C escaping>\".";
+ if (l.find("=") == -1) {
+ base_error = "Missing `=` in '" + l + "'. Version syntax is `version = \"<defines with C escaping>\";`.";
+ break;
+ }
+ if (l.find(";") != -1) {
+ // We don't require a semicolon per se, but it's needed for clang-format to handle things properly.
+ base_error = "Missing `;` in '" + l + "'. Version syntax is `version = \"<defines with C escaping>\";`.";
break;
}
- String version = l.get_slice("=", 0).strip_edges();
+ Vector<String> slices = l.get_slice(";", 0).split("=");
+ String version = slices[0].strip_edges();
if (!version.is_valid_identifier()) {
base_error = "Version names must be valid identifiers, found '" + version + "' instead.";
break;
}
- String define = l.get_slice("=", 1).strip_edges();
+ String define = slices[1].strip_edges();
if (!define.begins_with("\"") || !define.ends_with("\"")) {
base_error = "Version text must be quoted using \"\", instead found '" + define + "'.";
break;
}
- define = "\n" + define.substr(1, define.length() - 2).c_unescape() + "\n"; //add newline before and after jsut in case
+ define = "\n" + define.substr(1, define.length() - 2).c_unescape() + "\n"; // Add newline before and after just in case.
version_texts[version] = define + "\n" + p_defines;
}
diff --git a/thirdparty/README.md b/thirdparty/README.md
index c000133fe7..5b24d2b96d 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -184,15 +184,13 @@ Patches in the `patches` directory should be re-applied after updates.
## jpeg-compressor
- Upstream: https://github.com/richgel999/jpeg-compressor
-- Version: 2.00 (1eb17d558b9d3b7442d256642a5745974e9eeb1e, 2020)
+- Version: 2.00 (aeb7d3b463aa8228b87a28013c15ee50a7e6fcf3, 2020)
- License: Public domain
Files extracted from upstream source:
- `jpgd*.{c,h}`
-Patches in the `patches` directory should be re-applied after updates.
-
## libogg
@@ -386,7 +384,7 @@ Collection of single-file libraries used in Godot components.
* License: Apache 2.0
- `r128.h`
* Upstream: https://github.com/fahickman/r128
- * Version: 1.4.3 (2019)
+ * Version: git (423f693617faafd01de21e92818add4208eb8bd1, 2020)
* License: Public Domain
- `smaz.{c,h}`
* Upstream: https://github.com/antirez/smaz
diff --git a/thirdparty/jpeg-compressor/patches/fix-msvc-sse2-detection.patch b/thirdparty/jpeg-compressor/patches/fix-msvc-sse2-detection.patch
deleted file mode 100644
index 830b03b0c0..0000000000
--- a/thirdparty/jpeg-compressor/patches/fix-msvc-sse2-detection.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From ae74fa2fcdef8ec44b925a649f66e8cbefce8315 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
-Date: Thu, 7 May 2020 12:14:09 +0200
-Subject: [PATCH] Fix detection of SSE2 with Visual Studio
-
-The previous code assumed that SSE2 is available when building with
-Visual Studio, but that's not accurate on ARM with UWP.
-
-SSE2 could also be enabled on x86 if `_M_IX86_FP == 2`, but it requires
-checking first that it's not actually set to 2 for AVX, AVX2 or AVX512
-(see https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=vs-2019),
-so I left it out for this quick fix.
----
- jpgd.cpp | 16 +++++++---------
- 1 file changed, 7 insertions(+), 9 deletions(-)
-
-diff --git a/jpgd.cpp b/jpgd.cpp
-index 91e66ad..db1f3b4 100644
---- a/jpgd.cpp
-+++ b/jpgd.cpp
-@@ -37,16 +37,14 @@
-
- #ifndef JPGD_USE_SSE2
-
-- #if defined(__GNUC__)
--
-- #if (defined(__x86_64__) || defined(_M_X64))
-- #if defined(__SSE2__)
-- #define JPGD_USE_SSE2 (1)
-- #endif
-+ #if defined(__GNUC__)
-+ #if defined(__SSE2__)
-+ #define JPGD_USE_SSE2 (1)
-+ #endif
-+ #elif defined(_MSC_VER)
-+ #if defined(_M_X64)
-+ #define JPGD_USE_SSE2 (1)
- #endif
--
-- #else
-- #define JPGD_USE_SSE2 (1)
- #endif
-
- #endif
diff --git a/thirdparty/jpeg-compressor/patches/fix-msvc2017-build.patch b/thirdparty/jpeg-compressor/patches/fix-msvc2017-build.patch
deleted file mode 100644
index 7b338de084..0000000000
--- a/thirdparty/jpeg-compressor/patches/fix-msvc2017-build.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-diff --git a/thirdparty/jpeg-compressor/jpgd.cpp b/thirdparty/jpeg-compressor/jpgd.cpp
-index a0c494db61..257d0b7574 100644
---- a/thirdparty/jpeg-compressor/jpgd.cpp
-+++ b/thirdparty/jpeg-compressor/jpgd.cpp
-@@ -2126,7 +2126,7 @@ namespace jpgd {
-
- int jpeg_decoder::decode_next_mcu_row()
- {
-- if (setjmp(m_jmp_state))
-+ if (::setjmp(m_jmp_state))
- return JPGD_FAILED;
-
- const bool chroma_y_filtering = ((m_flags & cFlagBoxChromaFiltering) == 0) && ((m_scan_type == JPGD_YH2V2) || (m_scan_type == JPGD_YH1V2));
-@@ -3042,7 +3042,7 @@ namespace jpgd {
-
- jpeg_decoder::jpeg_decoder(jpeg_decoder_stream* pStream, uint32_t flags)
- {
-- if (setjmp(m_jmp_state))
-+ if (::setjmp(m_jmp_state))
- return;
- decode_init(pStream, flags);
- }
-@@ -3055,7 +3055,7 @@ namespace jpgd {
- if (m_error_code)
- return JPGD_FAILED;
-
-- if (setjmp(m_jmp_state))
-+ if (::setjmp(m_jmp_state))
- return JPGD_FAILED;
-
- decode_start();
diff --git a/thirdparty/misc/hq2x.cpp b/thirdparty/misc/hq2x.cpp
deleted file mode 100644
index 9c089ba85c..0000000000
--- a/thirdparty/misc/hq2x.cpp
+++ /dev/null
@@ -1,2636 +0,0 @@
-/*
- * Copyright 2016 Bruno Ribeiro
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#include "hq2x.h"
-
-#include "core/math/math_funcs.h"
-
-static const uint32_t AMASK = 0xFF000000;
-static const uint32_t YMASK = 0x00FF0000;
-static const uint32_t UMASK = 0x0000FF00;
-static const uint32_t VMASK = 0x000000FF;
-
-_FORCE_INLINE_ static uint32_t ARGBtoAYUV(
- uint32_t value )
-{
- uint32_t A, R, G, B, Y, U, V;
-//todo big endian check
- A = value >> 24;
- R = (value >> 16) & 0xFF;
- G = (value >> 8) & 0xFF;
- B = value & 0xFF;
-
- Y = Math::fast_ftoi( 0.299 * R + 0.587 * G + 0.114 * B);
- U = Math::fast_ftoi(-0.169 * R - 0.331 * G + 0.5 * B) + 128;
- V = Math::fast_ftoi( 0.5 * R - 0.419 * G - 0.081 * B) + 128;
- return (A << 24) + (Y << 16) + (U << 8) + V;
-}
-
-
-/*
- * Use this function for sharper images (good for cartoon style, used by DOSBOX)
- */
-
-_FORCE_INLINE_ static bool isDifferent(
- uint32_t color1,
- uint32_t color2,
- uint32_t trY,
- uint32_t trU,
- uint32_t trV,
- uint32_t trA )
-{
- color1 = ARGBtoAYUV(color1);
- color2 = ARGBtoAYUV(color2);
-
- uint32_t value;
-
- value = ((color1 & YMASK) - (color2 & YMASK));
- value = (value ^ (value >> 31)) - (value >> 31);
- if (value > trY) return true;
-
- value = ((color1 & UMASK) - (color2 & UMASK));
- value = (value ^ (value >> 31)) - (value >> 31);
- if (value > trU) return true;
-
- value = ((color1 & VMASK) - (color2 & VMASK));
- value = (value ^ (value >> 31)) - (value >> 31);
- if (value > trV) return true;
-
- value = ((color1 & AMASK) - (color2 & AMASK));
- value = (value ^ (value >> 31)) - (value >> 31);
- if (value > trA) return true;
-
- return false;
-
-}
-
-
-
-#define MASK_RB 0x00FF00FF
-#define MASK_G 0x0000FF00
-#define MASK_A 0xFF000000
-
-
-/**
- * @brief Mixes two colors using the given weights.
- */
-#define HQX_MIX_2(C0,C1,W0,W1) \
- ((((C0 & MASK_RB) * W0 + (C1 & MASK_RB) * W1) / (W0 + W1)) & MASK_RB) | \
- ((((C0 & MASK_G) * W0 + (C1 & MASK_G) * W1) / (W0 + W1)) & MASK_G) | \
- ((((((C0 & MASK_A) >> 8) * W0 + ((C1 & MASK_A) >> 8) * W1) / (W0 + W1)) << 8) & MASK_A)
-
-/**
- * @brief Mixes three colors using the given weights.
- */
-#define HQX_MIX_3(C0,C1,C2,W0,W1,W2) \
- ((((C0 & MASK_RB) * W0 + (C1 & MASK_RB) * W1 + (C2 & MASK_RB) * W2) / (W0 + W1 + W2)) & MASK_RB) | \
- ((((C0 & MASK_G) * W0 + (C1 & MASK_G) * W1 + (C2 & MASK_G) * W2) / (W0 + W1 + W2)) & MASK_G) | \
- ((((((C0 & MASK_A) >> 8) * W0 + ((C1 & MASK_A) >> 8) * W1 + ((C2 & MASK_A) >> 8) * W2) / (W0 + W1 + W2)) << 8) & MASK_A)
-
-
-#define MIX_00_4 *output = w[4];
-#define MIX_00_MIX_00_4_0_3_1 *output = HQX_MIX_2(w[4],w[0],3U,1U);
-#define MIX_00_4_3_3_1 *output = HQX_MIX_2(w[4],w[3],3U,1U);
-#define MIX_00_4_1_3_1 *output = HQX_MIX_2(w[4],w[1],3U,1U);
-#define MIX_00_3_1_1_1 *output = HQX_MIX_2(w[3],w[1],1U,1U);
-#define MIX_00_4_3_1_2_1_1 *output = HQX_MIX_3(w[4],w[3],w[1],2U,1U,1U);
-#define MIX_00_4_3_1_2_7_7 *output = HQX_MIX_3(w[4],w[3],w[1],2U,7U,7U);
-#define MIX_00_4_0_1_2_1_1 *output = HQX_MIX_3(w[4],w[0],w[1],2U,1U,1U);
-#define MIX_00_4_0_3_2_1_1 *output = HQX_MIX_3(w[4],w[0],w[3],2U,1U,1U);
-#define MIX_00_4_1_3_5_2_1 *output = HQX_MIX_3(w[4],w[1],w[3],5U,2U,1U);
-#define MIX_00_4_3_1_5_2_1 *output = HQX_MIX_3(w[4],w[3],w[1],5U,2U,1U);
-#define MIX_00_4_3_1_6_1_1 *output = HQX_MIX_3(w[4],w[3],w[1],6U,1U,1U);
-#define MIX_00_4_3_1_2_3_3 *output = HQX_MIX_3(w[4],w[3],w[1],2U,3U,3U);
-#define MIX_00_MIX_00_4_0_3_10 *output = HQX_MIX_3(w[4],w[3],w[1],14U,1U,1U);
-
-#define MIX_01_4 *(output + 1) = w[4];
-#define MIX_01_4_2_3_1 *(output + 1) = HQX_MIX_2(w[4],w[2],3U,1U);
-#define MIX_01_4_1_3_1 *(output + 1) = HQX_MIX_2(w[4],w[1],3U,1U);
-#define MIX_01_1_4_3_1 *(output + 1) = HQX_MIX_2(w[1],w[4],3U,1U);
-#define MIX_01_4_5_3_1 *(output + 1) = HQX_MIX_2(w[4],w[5],3U,1U);
-#define MIX_01_4_1_7_1 *(output + 1) = HQX_MIX_2(w[4],w[1],7U,1U);
-#define MIX_01_4_1_5_2_1_1 *(output + 1) = HQX_MIX_3(w[4],w[1],w[5],2U,1U,1U);
-#define MIX_01_4_2_5_2_1_1 *(output + 1) = HQX_MIX_3(w[4],w[2],w[5],2U,1U,1U);
-#define MIX_01_4_2_1_2_1_1 *(output + 1) = HQX_MIX_3(w[4],w[2],w[1],2U,1U,1U);
-#define MIX_01_4_5_1_5_2_1 *(output + 1) = HQX_MIX_3(w[4],w[5],w[1],5U,2U,1U);
-#define MIX_01_4_1_5_5_2_1 *(output + 1) = HQX_MIX_3(w[4],w[1],w[5],5U,2U,1U);
-#define MIX_01_4_1_5_6_1_1 *(output + 1) = HQX_MIX_3(w[4],w[1],w[5],6U,1U,1U);
-#define MIX_01_4_1_5_2_3_3 *(output + 1) = HQX_MIX_3(w[4],w[1],w[5],2U,3U,3U);
-#define MIX_01_4_2_3_10 *(output + 1) = HQX_MIX_3(w[4],w[1],w[5],14U,1U,1U);
-
-#define MIX_02_4 *(output + 2) = w[4];
-#define MIX_02_4_2_3_1 *(output + 2) = HQX_MIX_2(w[4],w[2],3U,1U);
-#define MIX_02_4_1_3_1 *(output + 2) = HQX_MIX_2(w[4],w[1],3U,1U);
-#define MIX_02_4_5_3_1 *(output + 2) = HQX_MIX_2(w[4],w[5],3U,1U);
-#define MIX_02_4_1_5_2_1_1 *(output + 2) = HQX_MIX_3(w[4],w[1],w[5],2U,1U,1U);
-#define MIX_02_4_1_5_2_7_7 *(output + 2) = HQX_MIX_3(w[4],w[1],w[5],2U,7U,7U);
-#define MIX_02_1_5_1_1 *(output + 2) = HQX_MIX_2(w[1],w[5],1U,1U);
-
-#define MIX_10_4 *(output + lineSize) = w[4];
-#define MIX_10_4_6_3_1 *(output + lineSize) = HQX_MIX_2(w[4],w[6],3U,1U);
-#define MIX_10_4_7_3_1 *(output + lineSize) = HQX_MIX_2(w[4],w[7],3U,1U);
-#define MIX_10_4_3_3_1 *(output + lineSize) = HQX_MIX_2(w[4],w[3],3U,1U);
-#define MIX_10_4_7_3_2_1_1 *(output + lineSize) = HQX_MIX_3(w[4],w[7],w[3],2U,1U,1U);
-#define MIX_10_4_6_3_2_1_1 *(output + lineSize) = HQX_MIX_3(w[4],w[6],w[3],2U,1U,1U);
-#define MIX_10_4_6_7_2_1_1 *(output + lineSize) = HQX_MIX_3(w[4],w[6],w[7],2U,1U,1U);
-#define MIX_10_4_3_7_5_2_1 *(output + lineSize) = HQX_MIX_3(w[4],w[3],w[7],5U,2U,1U);
-#define MIX_10_4_7_3_5_2_1 *(output + lineSize) = HQX_MIX_3(w[4],w[7],w[3],5U,2U,1U);
-#define MIX_10_4_7_3_6_1_1 *(output + lineSize) = HQX_MIX_3(w[4],w[7],w[3],6U,1U,1U);
-#define MIX_10_4_7_3_2_3_3 *(output + lineSize) = HQX_MIX_3(w[4],w[7],w[3],2U,3U,3U);
-#define MIX_10_4_6_3_10 *(output + lineSize) = HQX_MIX_3(w[4],w[7],w[3],14U,1U,1U);
-#define MIX_10_4_3_7_1 *(output + lineSize) = HQX_MIX_2(w[4],w[3],7U,1U);
-#define MIX_10_3_4_3_1 *(output + lineSize) = HQX_MIX_2(w[3],w[4],3U,1U);
-
-#define MIX_11_4 *(output + lineSize + 1) = w[4];
-#define MIX_11_4_8_3_1 *(output + lineSize + 1) = HQX_MIX_2(w[4],w[8],3U,1U);
-#define MIX_11_4_5_3_1 *(output + lineSize + 1) = HQX_MIX_2(w[4],w[5],3U,1U);
-#define MIX_11_4_7_3_1 *(output + lineSize + 1) = HQX_MIX_2(w[4],w[7],3U,1U);
-#define MIX_11_4_5_7_2_1_1 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[5],w[7],2U,1U,1U);
-#define MIX_11_4_8_7_2_1_1 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[8],w[7],2U,1U,1U);
-#define MIX_11_4_8_5_2_1_1 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[8],w[5],2U,1U,1U);
-#define MIX_11_4_7_5_5_2_1 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[7],w[5],5U,2U,1U);
-#define MIX_11_4_5_7_5_2_1 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[5],w[7],5U,2U,1U);
-#define MIX_11_4_5_7_6_1_1 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[5],w[7],6U,1U,1U);
-#define MIX_11_4_5_7_2_3_3 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[5],w[7],2U,3U,3U);
-#define MIX_11_4_8_3_10 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[5],w[7],14U,1U,1U);
-
-#define MIX_12_4 *(output + lineSize + 2) = w[4];
-#define MIX_12_4_5_3_1 *(output + lineSize + 2) = HQX_MIX_2(w[4],w[5],3U,1U);
-#define MIX_12_4_5_7_1 *(output + lineSize + 2) = HQX_MIX_2(w[4],w[5],7U,1U);
-#define MIX_12_5_4_3_1 *(output + lineSize + 2) = HQX_MIX_2(w[5],w[4],3U,1U);
-
-#define MIX_20_4 *(output + lineSize + lineSize) = w[4];
-#define MIX_20_4_6_3_1 *(output + lineSize + lineSize) = HQX_MIX_2(w[4],w[6],3U,1U);
-#define MIX_20_4_7_3_1 *(output + lineSize + lineSize) = HQX_MIX_2(w[4],w[7],3U,1U);
-#define MIX_20_4_3_3_1 *(output + lineSize + lineSize) = HQX_MIX_2(w[4],w[3],3U,1U);
-#define MIX_20_4_7_3_2_1_1 *(output + lineSize + lineSize) = HQX_MIX_3(w[4],w[7],w[3],2U,1U,1U);
-#define MIX_20_4_7_3_2_7_7 *(output + lineSize + lineSize) = HQX_MIX_3(w[4],w[7],w[3],2U,7U,7U);
-#define MIX_20_7_3_1_1 *(output + lineSize + lineSize) = HQX_MIX_2(w[7],w[3],1U,1U);
-
-#define MIX_21_4 *(output + lineSize + lineSize + 1) = w[4];
-#define MIX_21_4_7_3_1 *(output + lineSize + lineSize + 1) = HQX_MIX_2(w[4],w[7],3U,1U);
-#define MIX_21_4_7_7_1 *(output + lineSize + lineSize + 1) = HQX_MIX_2(w[4],w[7],7U,1U);
-#define MIX_21_7_4_3_1 *(output + lineSize + lineSize + 1) = HQX_MIX_2(w[7],w[4],3U,1U);
-
-#define MIX_22_4 *(output + lineSize + lineSize + 2) = w[4];
-#define MIX_22_4_8_3_1 *(output + lineSize + lineSize + 2) = HQX_MIX_2(w[4],w[8],3U,1U);
-#define MIX_22_4_7_3_1 *(output + lineSize + lineSize + 2) = HQX_MIX_2(w[4],w[7],3U,1U);
-#define MIX_22_4_5_3_1 *(output + lineSize + lineSize + 2) = HQX_MIX_2(w[4],w[5],3U,1U);
-#define MIX_22_4_5_7_2_1_1 *(output + lineSize + lineSize + 2) = HQX_MIX_3(w[4],w[5],w[7],2U,1U,1U);
-#define MIX_22_4_5_7_2_7_7 *(output + lineSize + lineSize + 2) = HQX_MIX_3(w[4],w[5],w[7],2U,7U,7U);
-#define MIX_22_5_7_1_1 *(output + lineSize + lineSize + 2) = HQX_MIX_2(w[5],w[7],1U,1U);
-
-
-
-uint32_t *hq2x_resize(
- const uint32_t *image,
- uint32_t width,
- uint32_t height,
- uint32_t *output,
- uint32_t trY,
- uint32_t trU,
- uint32_t trV,
- uint32_t trA,
- bool wrapX,
- bool wrapY )
-{
- int lineSize = width * 2;
-
- int previous, next;
- uint32_t w[9];
-
- trY <<= 16;
- trU <<= 8;
- trA <<= 24;
-
- // iterates between the lines
- for (uint32_t row = 0; row < height; row++)
- {
- /*
- * Note: this function uses a 3x3 sliding window over the original image.
- *
- * +----+----+----+
- * | | | |
- * | w0 | w1 | w2 |
- * +----+----+----+
- * | | | |
- * | w3 | w4 | w5 |
- * +----+----+----+
- * | | | |
- * | w6 | w7 | w8 |
- * +----+----+----+
- */
-
- // adjusts the previous and next line pointers
- if (row > 0)
- previous = -width;
- else
- {
- if (wrapY)
- previous = width * (height - 1);
- else
- previous = 0;
- }
- if (row < height - 1)
- next = width;
- else
- {
- if (wrapY)
- next = -(width * (height - 1));
- else
- next = 0;
- }
-
- // iterates between the columns
- for (uint32_t col = 0; col < width; col++)
- {
- w[1] = *(image + previous);
- w[4] = *image;
- w[7] = *(image + next);
-
- if (col > 0)
- {
- w[0] = *(image + previous - 1);
- w[3] = *(image - 1);
- w[6] = *(image + next - 1);
- }
- else
- {
- if (wrapX)
- {
- w[0] = *(image + previous + width - 1);
- w[3] = *(image + width - 1);
- w[6] = *(image + next + width - 1);
- }
- else
- {
- w[0] = w[1];
- w[3] = w[4];
- w[6] = w[7];
- }
- }
-
- if (col < width - 1)
- {
- w[2] = *(image + previous + 1);
- w[5] = *(image + 1);
- w[8] = *(image + next + 1);
- }
- else
- {
- if (wrapX)
- {
- w[2] = *(image + previous - width + 1);
- w[5] = *(image - width + 1);
- w[8] = *(image + next - width + 1);
- }
- else
- {
- w[2] = w[1];
- w[5] = w[4];
- w[8] = w[7];
- }
- }
-
- int pattern = 0;
-
- // computes the pattern to be used considering the neighbor pixels
- for (int k = 0, flag = 1; k < 9; k++)
- {
- // ignores the central pixel
- if (k == 4) continue;
-
- if (w[k] != w[4])
- if (isDifferent(w[4], w[k], trY, trU, trV, trA)) pattern |= flag;
- flag <<= 1;
- }
-
- switch (pattern)
- {
- case 0:
- case 1:
- case 4:
- case 32:
- case 128:
- case 5:
- case 132:
- case 160:
- case 33:
- case 129:
- case 36:
- case 133:
- case 164:
- case 161:
- case 37:
- case 165:
- MIX_00_4_3_1_2_1_1
- MIX_01_4_1_5_2_1_1
- MIX_10_4_7_3_2_1_1
- MIX_11_4_5_7_2_1_1
- break;
- case 2:
- case 34:
- case 130:
- case 162:
- MIX_00_4_0_3_2_1_1
- MIX_01_4_2_5_2_1_1
- MIX_10_4_7_3_2_1_1
- MIX_11_4_5_7_2_1_1
- break;
- case 16:
- case 17:
- case 48:
- case 49:
- MIX_00_4_3_1_2_1_1
- MIX_01_4_2_1_2_1_1
- MIX_10_4_7_3_2_1_1
- MIX_11_4_8_7_2_1_1
- break;
- case 64:
- case 65:
- case 68:
- case 69:
- MIX_00_4_3_1_2_1_1
- MIX_01_4_1_5_2_1_1
- MIX_10_4_6_3_2_1_1
- MIX_11_4_8_5_2_1_1
- break;
- case 8:
- case 12:
- case 136:
- case 140:
- MIX_00_4_0_1_2_1_1
- MIX_01_4_1_5_2_1_1
- MIX_10_4_6_7_2_1_1
- MIX_11_4_5_7_2_1_1
- break;
- case 3:
- case 35:
- case 131:
- case 163:
- MIX_00_4_3_3_1
- MIX_01_4_2_5_2_1_1
- MIX_10_4_7_3_2_1_1
- MIX_11_4_5_7_2_1_1
- break;
- case 6:
- case 38:
- case 134:
- case 166:
- MIX_00_4_0_3_2_1_1
- MIX_01_4_5_3_1
- MIX_10_4_7_3_2_1_1
- MIX_11_4_5_7_2_1_1
- break;
- case 20:
- case 21:
- case 52:
- case 53:
- MIX_00_4_3_1_2_1_1
- MIX_01_4_1_3_1
- MIX_10_4_7_3_2_1_1
- MIX_11_4_8_7_2_1_1
- break;
- case 144:
- case 145:
- case 176:
- case 177:
- MIX_00_4_3_1_2_1_1
- MIX_01_4_2_1_2_1_1
- MIX_10_4_7_3_2_1_1
- MIX_11_4_7_3_1
- break;
- case 192:
- case 193:
- case 196:
- case 197:
- MIX_00_4_3_1_2_1_1
- MIX_01_4_1_5_2_1_1
- MIX_10_4_6_3_2_1_1
- MIX_11_4_5_3_1
- break;
- case 96:
- case 97:
- case 100:
- case 101:
- MIX_00_4_3_1_2_1_1
- MIX_01_4_1_5_2_1_1
- MIX_10_4_3_3_1
- MIX_11_4_8_5_2_1_1
- break;
- case 40:
- case 44:
- case 168:
- case 172:
- MIX_00_4_0_1_2_1_1
- MIX_01_4_1_5_2_1_1
- MIX_10_4_7_3_1
- MIX_11_4_5_7_2_1_1
- break;
- case 9:
- case 13:
- case 137:
- case 141:
- MIX_00_4_1_3_1
- MIX_01_4_1_5_2_1_1
- MIX_10_4_6_7_2_1_1
- MIX_11_4_5_7_2_1_1
- break;
- case 18:
- case 50:
- MIX_00_4_0_3_2_1_1
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4_2_3_1
- }
- else
- {
- MIX_01_4_1_5_2_1_1
- }
- MIX_10_4_7_3_2_1_1
- MIX_11_4_8_7_2_1_1
- break;
- case 80:
- case 81:
- MIX_00_4_3_1_2_1_1
- MIX_01_4_2_1_2_1_1
- MIX_10_4_6_3_2_1_1
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4_8_3_1
- }
- else
- {
- MIX_11_4_5_7_2_1_1
- }
- break;
- case 72:
- case 76:
- MIX_00_4_0_1_2_1_1
- MIX_01_4_1_5_2_1_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4_6_3_1
- }
- else
- {
- MIX_10_4_7_3_2_1_1
- }
- MIX_11_4_8_5_2_1_1
- break;
- case 10:
- case 138:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_MIX_00_4_0_3_1
- }
- else
- {
- MIX_00_4_3_1_2_1_1
- }
- MIX_01_4_2_5_2_1_1
- MIX_10_4_6_7_2_1_1
- MIX_11_4_5_7_2_1_1
- break;
- case 66:
- MIX_00_4_0_3_2_1_1
- MIX_01_4_2_5_2_1_1
- MIX_10_4_6_3_2_1_1
- MIX_11_4_8_5_2_1_1
- break;
- case 24:
- MIX_00_4_0_1_2_1_1
- MIX_01_4_2_1_2_1_1
- MIX_10_4_6_7_2_1_1
- MIX_11_4_8_7_2_1_1
- break;
- case 7:
- case 39:
- case 135:
- MIX_00_4_3_3_1
- MIX_01_4_5_3_1
- MIX_10_4_7_3_2_1_1
- MIX_11_4_5_7_2_1_1
- break;
- case 148:
- case 149:
- case 180:
- MIX_00_4_3_1_2_1_1
- MIX_01_4_1_3_1
- MIX_10_4_7_3_2_1_1
- MIX_11_4_7_3_1
- break;
- case 224:
- case 228:
- case 225:
- MIX_00_4_3_1_2_1_1
- MIX_01_4_1_5_2_1_1
- MIX_10_4_3_3_1
- MIX_11_4_5_3_1
- break;
- case 41:
- case 169:
- case 45:
- MIX_00_4_1_3_1
- MIX_01_4_1_5_2_1_1
- MIX_10_4_7_3_1
- MIX_11_4_5_7_2_1_1
- break;
- case 22:
- case 54:
- MIX_00_4_0_3_2_1_1
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4
- }
- else
- {
- MIX_01_4_1_5_2_1_1
- }
- MIX_10_4_7_3_2_1_1
- MIX_11_4_8_7_2_1_1
- break;
- case 208:
- case 209:
- MIX_00_4_3_1_2_1_1
- MIX_01_4_2_1_2_1_1
- MIX_10_4_6_3_2_1_1
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4
- }
- else
- {
- MIX_11_4_5_7_2_1_1
- }
- break;
- case 104:
- case 108:
- MIX_00_4_0_1_2_1_1
- MIX_01_4_1_5_2_1_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4
- }
- else
- {
- MIX_10_4_7_3_2_1_1
- }
- MIX_11_4_8_5_2_1_1
- break;
- case 11:
- case 139:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_4
- }
- else
- {
- MIX_00_4_3_1_2_1_1
- }
- MIX_01_4_2_5_2_1_1
- MIX_10_4_6_7_2_1_1
- MIX_11_4_5_7_2_1_1
- break;
- case 19:
- case 51:
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_00_4_3_3_1
- MIX_01_4_2_3_1
- }
- else
- {
- MIX_00_4_1_3_5_2_1
- MIX_01_4_1_5_2_3_3
- }
- MIX_10_4_7_3_2_1_1
- MIX_11_4_8_7_2_1_1
- break;
- case 146:
- case 178:
- MIX_00_4_0_3_2_1_1
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4_2_3_1
- MIX_11_4_7_3_1
- }
- else
- {
- MIX_01_4_1_5_2_3_3
- MIX_11_4_5_7_5_2_1
- }
- MIX_10_4_7_3_2_1_1
- break;
- case 84:
- case 85:
- MIX_00_4_3_1_2_1_1
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_01_4_1_3_1
- MIX_11_4_8_3_1
- }
- else
- {
- MIX_01_4_5_1_5_2_1
- MIX_11_4_5_7_2_3_3
- }
- MIX_10_4_6_3_2_1_1
- break;
- case 112:
- case 113:
- MIX_00_4_3_1_2_1_1
- MIX_01_4_2_1_2_1_1
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_10_4_3_3_1
- MIX_11_4_8_3_1
- }
- else
- {
- MIX_10_4_7_3_5_2_1
- MIX_11_4_5_7_2_3_3
- }
- break;
- case 200:
- case 204:
- MIX_00_4_0_1_2_1_1
- MIX_01_4_1_5_2_1_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4_6_3_1
- MIX_11_4_5_3_1
- }
- else
- {
- MIX_10_4_7_3_2_3_3
- MIX_11_4_7_5_5_2_1
- }
- break;
- case 73:
- case 77:
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_00_4_1_3_1
- MIX_10_4_6_3_1
- }
- else
- {
- MIX_00_4_3_1_5_2_1
- MIX_10_4_7_3_2_3_3
- }
- MIX_01_4_1_5_2_1_1
- MIX_11_4_8_5_2_1_1
- break;
- case 42:
- case 170:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_MIX_00_4_0_3_1
- MIX_10_4_7_3_1
- }
- else
- {
- MIX_00_4_3_1_2_3_3
- MIX_10_4_3_7_5_2_1
- }
- MIX_01_4_2_5_2_1_1
- MIX_11_4_5_7_2_1_1
- break;
- case 14:
- case 142:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_MIX_00_4_0_3_1
- MIX_01_4_5_3_1
- }
- else
- {
- MIX_00_4_3_1_2_3_3
- MIX_01_4_1_5_5_2_1
- }
- MIX_10_4_6_7_2_1_1
- MIX_11_4_5_7_2_1_1
- break;
- case 67:
- MIX_00_4_3_3_1
- MIX_01_4_2_5_2_1_1
- MIX_10_4_6_3_2_1_1
- MIX_11_4_8_5_2_1_1
- break;
- case 70:
- MIX_00_4_0_3_2_1_1
- MIX_01_4_5_3_1
- MIX_10_4_6_3_2_1_1
- MIX_11_4_8_5_2_1_1
- break;
- case 28:
- MIX_00_4_0_1_2_1_1
- MIX_01_4_1_3_1
- MIX_10_4_6_7_2_1_1
- MIX_11_4_8_7_2_1_1
- break;
- case 152:
- MIX_00_4_0_1_2_1_1
- MIX_01_4_2_1_2_1_1
- MIX_10_4_6_7_2_1_1
- MIX_11_4_7_3_1
- break;
- case 194:
- MIX_00_4_0_3_2_1_1
- MIX_01_4_2_5_2_1_1
- MIX_10_4_6_3_2_1_1
- MIX_11_4_5_3_1
- break;
- case 98:
- MIX_00_4_0_3_2_1_1
- MIX_01_4_2_5_2_1_1
- MIX_10_4_3_3_1
- MIX_11_4_8_5_2_1_1
- break;
- case 56:
- MIX_00_4_0_1_2_1_1
- MIX_01_4_2_1_2_1_1
- MIX_10_4_7_3_1
- MIX_11_4_8_7_2_1_1
- break;
- case 25:
- MIX_00_4_1_3_1
- MIX_01_4_2_1_2_1_1
- MIX_10_4_6_7_2_1_1
- MIX_11_4_8_7_2_1_1
- break;
- case 26:
- case 31:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_4
- }
- else
- {
- MIX_00_4_3_1_2_1_1
- }
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4
- }
- else
- {
- MIX_01_4_1_5_2_1_1
- }
- MIX_10_4_6_7_2_1_1
- MIX_11_4_8_7_2_1_1
- break;
- case 82:
- case 214:
- MIX_00_4_0_3_2_1_1
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4
- }
- else
- {
- MIX_01_4_1_5_2_1_1
- }
- MIX_10_4_6_3_2_1_1
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4
- }
- else
- {
- MIX_11_4_5_7_2_1_1
- }
- break;
- case 88:
- case 248:
- MIX_00_4_0_1_2_1_1
- MIX_01_4_2_1_2_1_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4
- }
- else
- {
- MIX_10_4_7_3_2_1_1
- }
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4
- }
- else
- {
- MIX_11_4_5_7_2_1_1
- }
- break;
- case 74:
- case 107:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_4
- }
- else
- {
- MIX_00_4_3_1_2_1_1
- }
- MIX_01_4_2_5_2_1_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4
- }
- else
- {
- MIX_10_4_7_3_2_1_1
- }
- MIX_11_4_8_5_2_1_1
- break;
- case 27:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_4
- }
- else
- {
- MIX_00_4_3_1_2_1_1
- }
- MIX_01_4_2_3_1
- MIX_10_4_6_7_2_1_1
- MIX_11_4_8_7_2_1_1
- break;
- case 86:
- MIX_00_4_0_3_2_1_1
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4
- }
- else
- {
- MIX_01_4_1_5_2_1_1
- }
- MIX_10_4_6_3_2_1_1
- MIX_11_4_8_3_1
- break;
- case 216:
- MIX_00_4_0_1_2_1_1
- MIX_01_4_2_1_2_1_1
- MIX_10_4_6_3_1
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4
- }
- else
- {
- MIX_11_4_5_7_2_1_1
- }
- break;
- case 106:
- MIX_00_MIX_00_4_0_3_1
- MIX_01_4_2_5_2_1_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4
- }
- else
- {
- MIX_10_4_7_3_2_1_1
- }
- MIX_11_4_8_5_2_1_1
- break;
- case 30:
- MIX_00_MIX_00_4_0_3_1
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4
- }
- else
- {
- MIX_01_4_1_5_2_1_1
- }
- MIX_10_4_6_7_2_1_1
- MIX_11_4_8_7_2_1_1
- break;
- case 210:
- MIX_00_4_0_3_2_1_1
- MIX_01_4_2_3_1
- MIX_10_4_6_3_2_1_1
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4
- }
- else
- {
- MIX_11_4_5_7_2_1_1
- }
- break;
- case 120:
- MIX_00_4_0_1_2_1_1
- MIX_01_4_2_1_2_1_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4
- }
- else
- {
- MIX_10_4_7_3_2_1_1
- }
- MIX_11_4_8_3_1
- break;
- case 75:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_4
- }
- else
- {
- MIX_00_4_3_1_2_1_1
- }
- MIX_01_4_2_5_2_1_1
- MIX_10_4_6_3_1
- MIX_11_4_8_5_2_1_1
- break;
- case 29:
- MIX_00_4_1_3_1
- MIX_01_4_1_3_1
- MIX_10_4_6_7_2_1_1
- MIX_11_4_8_7_2_1_1
- break;
- case 198:
- MIX_00_4_0_3_2_1_1
- MIX_01_4_5_3_1
- MIX_10_4_6_3_2_1_1
- MIX_11_4_5_3_1
- break;
- case 184:
- MIX_00_4_0_1_2_1_1
- MIX_01_4_2_1_2_1_1
- MIX_10_4_7_3_1
- MIX_11_4_7_3_1
- break;
- case 99:
- MIX_00_4_3_3_1
- MIX_01_4_2_5_2_1_1
- MIX_10_4_3_3_1
- MIX_11_4_8_5_2_1_1
- break;
- case 57:
- MIX_00_4_1_3_1
- MIX_01_4_2_1_2_1_1
- MIX_10_4_7_3_1
- MIX_11_4_8_7_2_1_1
- break;
- case 71:
- MIX_00_4_3_3_1
- MIX_01_4_5_3_1
- MIX_10_4_6_3_2_1_1
- MIX_11_4_8_5_2_1_1
- break;
- case 156:
- MIX_00_4_0_1_2_1_1
- MIX_01_4_1_3_1
- MIX_10_4_6_7_2_1_1
- MIX_11_4_7_3_1
- break;
- case 226:
- MIX_00_4_0_3_2_1_1
- MIX_01_4_2_5_2_1_1
- MIX_10_4_3_3_1
- MIX_11_4_5_3_1
- break;
- case 60:
- MIX_00_4_0_1_2_1_1
- MIX_01_4_1_3_1
- MIX_10_4_7_3_1
- MIX_11_4_8_7_2_1_1
- break;
- case 195:
- MIX_00_4_3_3_1
- MIX_01_4_2_5_2_1_1
- MIX_10_4_6_3_2_1_1
- MIX_11_4_5_3_1
- break;
- case 102:
- MIX_00_4_0_3_2_1_1
- MIX_01_4_5_3_1
- MIX_10_4_3_3_1
- MIX_11_4_8_5_2_1_1
- break;
- case 153:
- MIX_00_4_1_3_1
- MIX_01_4_2_1_2_1_1
- MIX_10_4_6_7_2_1_1
- MIX_11_4_7_3_1
- break;
- case 58:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_MIX_00_4_0_3_1
- }
- else
- {
- MIX_00_4_3_1_6_1_1
- }
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4_2_3_1
- }
- else
- {
- MIX_01_4_1_5_6_1_1
- }
- MIX_10_4_7_3_1
- MIX_11_4_8_7_2_1_1
- break;
- case 83:
- MIX_00_4_3_3_1
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4_2_3_1
- }
- else
- {
- MIX_01_4_1_5_6_1_1
- }
- MIX_10_4_6_3_2_1_1
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4_8_3_1
- }
- else
- {
- MIX_11_4_5_7_6_1_1
- }
- break;
- case 92:
- MIX_00_4_0_1_2_1_1
- MIX_01_4_1_3_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4_6_3_1
- }
- else
- {
- MIX_10_4_7_3_6_1_1
- }
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4_8_3_1
- }
- else
- {
- MIX_11_4_5_7_6_1_1
- }
- break;
- case 202:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_MIX_00_4_0_3_1
- }
- else
- {
- MIX_00_4_3_1_6_1_1
- }
- MIX_01_4_2_5_2_1_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4_6_3_1
- }
- else
- {
- MIX_10_4_7_3_6_1_1
- }
- MIX_11_4_5_3_1
- break;
- case 78:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_MIX_00_4_0_3_1
- }
- else
- {
- MIX_00_4_3_1_6_1_1
- }
- MIX_01_4_5_3_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4_6_3_1
- }
- else
- {
- MIX_10_4_7_3_6_1_1
- }
- MIX_11_4_8_5_2_1_1
- break;
- case 154:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_MIX_00_4_0_3_1
- }
- else
- {
- MIX_00_4_3_1_6_1_1
- }
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4_2_3_1
- }
- else
- {
- MIX_01_4_1_5_6_1_1
- }
- MIX_10_4_6_7_2_1_1
- MIX_11_4_7_3_1
- break;
- case 114:
- MIX_00_4_0_3_2_1_1
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4_2_3_1
- }
- else
- {
- MIX_01_4_1_5_6_1_1
- }
- MIX_10_4_3_3_1
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4_8_3_1
- }
- else
- {
- MIX_11_4_5_7_6_1_1
- }
- break;
- case 89:
- MIX_00_4_1_3_1
- MIX_01_4_2_1_2_1_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4_6_3_1
- }
- else
- {
- MIX_10_4_7_3_6_1_1
- }
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4_8_3_1
- }
- else
- {
- MIX_11_4_5_7_6_1_1
- }
- break;
- case 90:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_MIX_00_4_0_3_1
- }
- else
- {
- MIX_00_4_3_1_6_1_1
- }
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4_2_3_1
- }
- else
- {
- MIX_01_4_1_5_6_1_1
- }
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4_6_3_1
- }
- else
- {
- MIX_10_4_7_3_6_1_1
- }
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4_8_3_1
- }
- else
- {
- MIX_11_4_5_7_6_1_1
- }
- break;
- case 55:
- case 23:
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_00_4_3_3_1
- MIX_01_4
- }
- else
- {
- MIX_00_4_1_3_5_2_1
- MIX_01_4_1_5_2_3_3
- }
- MIX_10_4_7_3_2_1_1
- MIX_11_4_8_7_2_1_1
- break;
- case 182:
- case 150:
- MIX_00_4_0_3_2_1_1
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4
- MIX_11_4_7_3_1
- }
- else
- {
- MIX_01_4_1_5_2_3_3
- MIX_11_4_5_7_5_2_1
- }
- MIX_10_4_7_3_2_1_1
- break;
- case 213:
- case 212:
- MIX_00_4_3_1_2_1_1
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_01_4_1_3_1
- MIX_11_4
- }
- else
- {
- MIX_01_4_5_1_5_2_1
- MIX_11_4_5_7_2_3_3
- }
- MIX_10_4_6_3_2_1_1
- break;
- case 241:
- case 240:
- MIX_00_4_3_1_2_1_1
- MIX_01_4_2_1_2_1_1
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_10_4_3_3_1
- MIX_11_4
- }
- else
- {
- MIX_10_4_7_3_5_2_1
- MIX_11_4_5_7_2_3_3
- }
- break;
- case 236:
- case 232:
- MIX_00_4_0_1_2_1_1
- MIX_01_4_1_5_2_1_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4
- MIX_11_4_5_3_1
- }
- else
- {
- MIX_10_4_7_3_2_3_3
- MIX_11_4_7_5_5_2_1
- }
- break;
- case 109:
- case 105:
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_00_4_1_3_1
- MIX_10_4
- }
- else
- {
- MIX_00_4_3_1_5_2_1
- MIX_10_4_7_3_2_3_3
- }
- MIX_01_4_1_5_2_1_1
- MIX_11_4_8_5_2_1_1
- break;
- case 171:
- case 43:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_4
- MIX_10_4_7_3_1
- }
- else
- {
- MIX_00_4_3_1_2_3_3
- MIX_10_4_3_7_5_2_1
- }
- MIX_01_4_2_5_2_1_1
- MIX_11_4_5_7_2_1_1
- break;
- case 143:
- case 15:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_4
- MIX_01_4_5_3_1
- }
- else
- {
- MIX_00_4_3_1_2_3_3
- MIX_01_4_1_5_5_2_1
- }
- MIX_10_4_6_7_2_1_1
- MIX_11_4_5_7_2_1_1
- break;
- case 124:
- MIX_00_4_0_1_2_1_1
- MIX_01_4_1_3_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4
- }
- else
- {
- MIX_10_4_7_3_2_1_1
- }
- MIX_11_4_8_3_1
- break;
- case 203:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_4
- }
- else
- {
- MIX_00_4_3_1_2_1_1
- }
- MIX_01_4_2_5_2_1_1
- MIX_10_4_6_3_1
- MIX_11_4_5_3_1
- break;
- case 62:
- MIX_00_MIX_00_4_0_3_1
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4
- }
- else
- {
- MIX_01_4_1_5_2_1_1
- }
- MIX_10_4_7_3_1
- MIX_11_4_8_7_2_1_1
- break;
- case 211:
- MIX_00_4_3_3_1
- MIX_01_4_2_3_1
- MIX_10_4_6_3_2_1_1
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4
- }
- else
- {
- MIX_11_4_5_7_2_1_1
- }
- break;
- case 118:
- MIX_00_4_0_3_2_1_1
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4
- }
- else
- {
- MIX_01_4_1_5_2_1_1
- }
- MIX_10_4_3_3_1
- MIX_11_4_8_3_1
- break;
- case 217:
- MIX_00_4_1_3_1
- MIX_01_4_2_1_2_1_1
- MIX_10_4_6_3_1
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4
- }
- else
- {
- MIX_11_4_5_7_2_1_1
- }
- break;
- case 110:
- MIX_00_MIX_00_4_0_3_1
- MIX_01_4_5_3_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4
- }
- else
- {
- MIX_10_4_7_3_2_1_1
- }
- MIX_11_4_8_5_2_1_1
- break;
- case 155:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_4
- }
- else
- {
- MIX_00_4_3_1_2_1_1
- }
- MIX_01_4_2_3_1
- MIX_10_4_6_7_2_1_1
- MIX_11_4_7_3_1
- break;
- case 188:
- MIX_00_4_0_1_2_1_1
- MIX_01_4_1_3_1
- MIX_10_4_7_3_1
- MIX_11_4_7_3_1
- break;
- case 185:
- MIX_00_4_1_3_1
- MIX_01_4_2_1_2_1_1
- MIX_10_4_7_3_1
- MIX_11_4_7_3_1
- break;
- case 61:
- MIX_00_4_1_3_1
- MIX_01_4_1_3_1
- MIX_10_4_7_3_1
- MIX_11_4_8_7_2_1_1
- break;
- case 157:
- MIX_00_4_1_3_1
- MIX_01_4_1_3_1
- MIX_10_4_6_7_2_1_1
- MIX_11_4_7_3_1
- break;
- case 103:
- MIX_00_4_3_3_1
- MIX_01_4_5_3_1
- MIX_10_4_3_3_1
- MIX_11_4_8_5_2_1_1
- break;
- case 227:
- MIX_00_4_3_3_1
- MIX_01_4_2_5_2_1_1
- MIX_10_4_3_3_1
- MIX_11_4_5_3_1
- break;
- case 230:
- MIX_00_4_0_3_2_1_1
- MIX_01_4_5_3_1
- MIX_10_4_3_3_1
- MIX_11_4_5_3_1
- break;
- case 199:
- MIX_00_4_3_3_1
- MIX_01_4_5_3_1
- MIX_10_4_6_3_2_1_1
- MIX_11_4_5_3_1
- break;
- case 220:
- MIX_00_4_0_1_2_1_1
- MIX_01_4_1_3_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4_6_3_1
- }
- else
- {
- MIX_10_4_7_3_6_1_1
- }
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4
- }
- else
- {
- MIX_11_4_5_7_2_1_1
- }
- break;
- case 158:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_MIX_00_4_0_3_1
- }
- else
- {
- MIX_00_4_3_1_6_1_1
- }
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4
- }
- else
- {
- MIX_01_4_1_5_2_1_1
- }
- MIX_10_4_6_7_2_1_1
- MIX_11_4_7_3_1
- break;
- case 234:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_MIX_00_4_0_3_1
- }
- else
- {
- MIX_00_4_3_1_6_1_1
- }
- MIX_01_4_2_5_2_1_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4
- }
- else
- {
- MIX_10_4_7_3_2_1_1
- }
- MIX_11_4_5_3_1
- break;
- case 242:
- MIX_00_4_0_3_2_1_1
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4_2_3_1
- }
- else
- {
- MIX_01_4_1_5_6_1_1
- }
- MIX_10_4_3_3_1
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4
- }
- else
- {
- MIX_11_4_5_7_2_1_1
- }
- break;
- case 59:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_4
- }
- else
- {
- MIX_00_4_3_1_2_1_1
- }
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4_2_3_1
- }
- else
- {
- MIX_01_4_1_5_6_1_1
- }
- MIX_10_4_7_3_1
- MIX_11_4_8_7_2_1_1
- break;
- case 121:
- MIX_00_4_1_3_1
- MIX_01_4_2_1_2_1_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4
- }
- else
- {
- MIX_10_4_7_3_2_1_1
- }
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4_8_3_1
- }
- else
- {
- MIX_11_4_5_7_6_1_1
- }
- break;
- case 87:
- MIX_00_4_3_3_1
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4
- }
- else
- {
- MIX_01_4_1_5_2_1_1
- }
- MIX_10_4_6_3_2_1_1
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4_8_3_1
- }
- else
- {
- MIX_11_4_5_7_6_1_1
- }
- break;
- case 79:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_4
- }
- else
- {
- MIX_00_4_3_1_2_1_1
- }
- MIX_01_4_5_3_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4_6_3_1
- }
- else
- {
- MIX_10_4_7_3_6_1_1
- }
- MIX_11_4_8_5_2_1_1
- break;
- case 122:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_MIX_00_4_0_3_1
- }
- else
- {
- MIX_00_4_3_1_6_1_1
- }
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4_2_3_1
- }
- else
- {
- MIX_01_4_1_5_6_1_1
- }
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4
- }
- else
- {
- MIX_10_4_7_3_2_1_1
- }
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4_8_3_1
- }
- else
- {
- MIX_11_4_5_7_6_1_1
- }
- break;
- case 94:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_MIX_00_4_0_3_1
- }
- else
- {
- MIX_00_4_3_1_6_1_1
- }
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4
- }
- else
- {
- MIX_01_4_1_5_2_1_1
- }
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4_6_3_1
- }
- else
- {
- MIX_10_4_7_3_6_1_1
- }
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4_8_3_1
- }
- else
- {
- MIX_11_4_5_7_6_1_1
- }
- break;
- case 218:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_MIX_00_4_0_3_1
- }
- else
- {
- MIX_00_4_3_1_6_1_1
- }
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4_2_3_1
- }
- else
- {
- MIX_01_4_1_5_6_1_1
- }
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4_6_3_1
- }
- else
- {
- MIX_10_4_7_3_6_1_1
- }
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4
- }
- else
- {
- MIX_11_4_5_7_2_1_1
- }
- break;
- case 91:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_4
- }
- else
- {
- MIX_00_4_3_1_2_1_1
- }
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4_2_3_1
- }
- else
- {
- MIX_01_4_1_5_6_1_1
- }
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4_6_3_1
- }
- else
- {
- MIX_10_4_7_3_6_1_1
- }
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4_8_3_1
- }
- else
- {
- MIX_11_4_5_7_6_1_1
- }
- break;
- case 229:
- MIX_00_4_3_1_2_1_1
- MIX_01_4_1_5_2_1_1
- MIX_10_4_3_3_1
- MIX_11_4_5_3_1
- break;
- case 167:
- MIX_00_4_3_3_1
- MIX_01_4_5_3_1
- MIX_10_4_7_3_2_1_1
- MIX_11_4_5_7_2_1_1
- break;
- case 173:
- MIX_00_4_1_3_1
- MIX_01_4_1_5_2_1_1
- MIX_10_4_7_3_1
- MIX_11_4_5_7_2_1_1
- break;
- case 181:
- MIX_00_4_3_1_2_1_1
- MIX_01_4_1_3_1
- MIX_10_4_7_3_2_1_1
- MIX_11_4_7_3_1
- break;
- case 186:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_MIX_00_4_0_3_1
- }
- else
- {
- MIX_00_4_3_1_6_1_1
- }
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4_2_3_1
- }
- else
- {
- MIX_01_4_1_5_6_1_1
- }
- MIX_10_4_7_3_1
- MIX_11_4_7_3_1
- break;
- case 115:
- MIX_00_4_3_3_1
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4_2_3_1
- }
- else
- {
- MIX_01_4_1_5_6_1_1
- }
- MIX_10_4_3_3_1
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4_8_3_1
- }
- else
- {
- MIX_11_4_5_7_6_1_1
- }
- break;
- case 93:
- MIX_00_4_1_3_1
- MIX_01_4_1_3_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4_6_3_1
- }
- else
- {
- MIX_10_4_7_3_6_1_1
- }
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4_8_3_1
- }
- else
- {
- MIX_11_4_5_7_6_1_1
- }
- break;
- case 206:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_MIX_00_4_0_3_1
- }
- else
- {
- MIX_00_4_3_1_6_1_1
- }
- MIX_01_4_5_3_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4_6_3_1
- }
- else
- {
- MIX_10_4_7_3_6_1_1
- }
- MIX_11_4_5_3_1
- break;
- case 205:
- case 201:
- MIX_00_4_1_3_1
- MIX_01_4_1_5_2_1_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4_6_3_1
- }
- else
- {
- MIX_10_4_7_3_6_1_1
- }
- MIX_11_4_5_3_1
- break;
- case 174:
- case 46:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_MIX_00_4_0_3_1
- }
- else
- {
- MIX_00_4_3_1_6_1_1
- }
- MIX_01_4_5_3_1
- MIX_10_4_7_3_1
- MIX_11_4_5_7_2_1_1
- break;
- case 179:
- case 147:
- MIX_00_4_3_3_1
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4_2_3_1
- }
- else
- {
- MIX_01_4_1_5_6_1_1
- }
- MIX_10_4_7_3_2_1_1
- MIX_11_4_7_3_1
- break;
- case 117:
- case 116:
- MIX_00_4_3_1_2_1_1
- MIX_01_4_1_3_1
- MIX_10_4_3_3_1
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4_8_3_1
- }
- else
- {
- MIX_11_4_5_7_6_1_1
- }
- break;
- case 189:
- MIX_00_4_1_3_1
- MIX_01_4_1_3_1
- MIX_10_4_7_3_1
- MIX_11_4_7_3_1
- break;
- case 231:
- MIX_00_4_3_3_1
- MIX_01_4_5_3_1
- MIX_10_4_3_3_1
- MIX_11_4_5_3_1
- break;
- case 126:
- MIX_00_MIX_00_4_0_3_1
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4
- }
- else
- {
- MIX_01_4_1_5_2_1_1
- }
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4
- }
- else
- {
- MIX_10_4_7_3_2_1_1
- }
- MIX_11_4_8_3_1
- break;
- case 219:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_4
- }
- else
- {
- MIX_00_4_3_1_2_1_1
- }
- MIX_01_4_2_3_1
- MIX_10_4_6_3_1
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4
- }
- else
- {
- MIX_11_4_5_7_2_1_1
- }
- break;
- case 125:
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_00_4_1_3_1
- MIX_10_4
- }
- else
- {
- MIX_00_4_3_1_5_2_1
- MIX_10_4_7_3_2_3_3
- }
- MIX_01_4_1_3_1
- MIX_11_4_8_3_1
- break;
- case 221:
- MIX_00_4_1_3_1
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_01_4_1_3_1
- MIX_11_4
- }
- else
- {
- MIX_01_4_5_1_5_2_1
- MIX_11_4_5_7_2_3_3
- }
- MIX_10_4_6_3_1
- break;
- case 207:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_4
- MIX_01_4_5_3_1
- }
- else
- {
- MIX_00_4_3_1_2_3_3
- MIX_01_4_1_5_5_2_1
- }
- MIX_10_4_6_3_1
- MIX_11_4_5_3_1
- break;
- case 238:
- MIX_00_MIX_00_4_0_3_1
- MIX_01_4_5_3_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4
- MIX_11_4_5_3_1
- }
- else
- {
- MIX_10_4_7_3_2_3_3
- MIX_11_4_7_5_5_2_1
- }
- break;
- case 190:
- MIX_00_MIX_00_4_0_3_1
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4
- MIX_11_4_7_3_1
- }
- else
- {
- MIX_01_4_1_5_2_3_3
- MIX_11_4_5_7_5_2_1
- }
- MIX_10_4_7_3_1
- break;
- case 187:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_4
- MIX_10_4_7_3_1
- }
- else
- {
- MIX_00_4_3_1_2_3_3
- MIX_10_4_3_7_5_2_1
- }
- MIX_01_4_2_3_1
- MIX_11_4_7_3_1
- break;
- case 243:
- MIX_00_4_3_3_1
- MIX_01_4_2_3_1
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_10_4_3_3_1
- MIX_11_4
- }
- else
- {
- MIX_10_4_7_3_5_2_1
- MIX_11_4_5_7_2_3_3
- }
- break;
- case 119:
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_00_4_3_3_1
- MIX_01_4
- }
- else
- {
- MIX_00_4_1_3_5_2_1
- MIX_01_4_1_5_2_3_3
- }
- MIX_10_4_3_3_1
- MIX_11_4_8_3_1
- break;
- case 237:
- case 233:
- MIX_00_4_1_3_1
- MIX_01_4_1_5_2_1_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4
- }
- else
- {
- MIX_10_4_6_3_10
- }
- MIX_11_4_5_3_1
- break;
- case 175:
- case 47:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_4
- }
- else
- {
- MIX_00_MIX_00_4_0_3_10
- }
- MIX_01_4_5_3_1
- MIX_10_4_7_3_1
- MIX_11_4_5_7_2_1_1
- break;
- case 183:
- case 151:
- MIX_00_4_3_3_1
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4
- }
- else
- {
- MIX_01_4_2_3_10
- }
- MIX_10_4_7_3_2_1_1
- MIX_11_4_7_3_1
- break;
- case 245:
- case 244:
- MIX_00_4_3_1_2_1_1
- MIX_01_4_1_3_1
- MIX_10_4_3_3_1
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4
- }
- else
- {
- MIX_11_4_8_3_10
- }
- break;
- case 250:
- MIX_00_MIX_00_4_0_3_1
- MIX_01_4_2_3_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4
- }
- else
- {
- MIX_10_4_7_3_2_1_1
- }
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4
- }
- else
- {
- MIX_11_4_5_7_2_1_1
- }
- break;
- case 123:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_4
- }
- else
- {
- MIX_00_4_3_1_2_1_1
- }
- MIX_01_4_2_3_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4
- }
- else
- {
- MIX_10_4_7_3_2_1_1
- }
- MIX_11_4_8_3_1
- break;
- case 95:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_4
- }
- else
- {
- MIX_00_4_3_1_2_1_1
- }
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4
- }
- else
- {
- MIX_01_4_1_5_2_1_1
- }
- MIX_10_4_6_3_1
- MIX_11_4_8_3_1
- break;
- case 222:
- MIX_00_MIX_00_4_0_3_1
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4
- }
- else
- {
- MIX_01_4_1_5_2_1_1
- }
- MIX_10_4_6_3_1
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4
- }
- else
- {
- MIX_11_4_5_7_2_1_1
- }
- break;
- case 252:
- MIX_00_4_0_1_2_1_1
- MIX_01_4_1_3_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4
- }
- else
- {
- MIX_10_4_7_3_2_1_1
- }
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4
- }
- else
- {
- MIX_11_4_8_3_10
- }
- break;
- case 249:
- MIX_00_4_1_3_1
- MIX_01_4_2_1_2_1_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4
- }
- else
- {
- MIX_10_4_6_3_10
- }
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4
- }
- else
- {
- MIX_11_4_5_7_2_1_1
- }
- break;
- case 235:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_4
- }
- else
- {
- MIX_00_4_3_1_2_1_1
- }
- MIX_01_4_2_5_2_1_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4
- }
- else
- {
- MIX_10_4_6_3_10
- }
- MIX_11_4_5_3_1
- break;
- case 111:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_4
- }
- else
- {
- MIX_00_MIX_00_4_0_3_10
- }
- MIX_01_4_5_3_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4
- }
- else
- {
- MIX_10_4_7_3_2_1_1
- }
- MIX_11_4_8_5_2_1_1
- break;
- case 63:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_4
- }
- else
- {
- MIX_00_MIX_00_4_0_3_10
- }
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4
- }
- else
- {
- MIX_01_4_1_5_2_1_1
- }
- MIX_10_4_7_3_1
- MIX_11_4_8_7_2_1_1
- break;
- case 159:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_4
- }
- else
- {
- MIX_00_4_3_1_2_1_1
- }
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4
- }
- else
- {
- MIX_01_4_2_3_10
- }
- MIX_10_4_6_7_2_1_1
- MIX_11_4_7_3_1
- break;
- case 215:
- MIX_00_4_3_3_1
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4
- }
- else
- {
- MIX_01_4_2_3_10
- }
- MIX_10_4_6_3_2_1_1
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4
- }
- else
- {
- MIX_11_4_5_7_2_1_1
- }
- break;
- case 246:
- MIX_00_4_0_3_2_1_1
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4
- }
- else
- {
- MIX_01_4_1_5_2_1_1
- }
- MIX_10_4_3_3_1
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4
- }
- else
- {
- MIX_11_4_8_3_10
- }
- break;
- case 254:
- MIX_00_MIX_00_4_0_3_1
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4
- }
- else
- {
- MIX_01_4_1_5_2_1_1
- }
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4
- }
- else
- {
- MIX_10_4_7_3_2_1_1
- }
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4
- }
- else
- {
- MIX_11_4_8_3_10
- }
- break;
- case 253:
- MIX_00_4_1_3_1
- MIX_01_4_1_3_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4
- }
- else
- {
- MIX_10_4_6_3_10
- }
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4
- }
- else
- {
- MIX_11_4_8_3_10
- }
- break;
- case 251:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_4
- }
- else
- {
- MIX_00_4_3_1_2_1_1
- }
- MIX_01_4_2_3_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4
- }
- else
- {
- MIX_10_4_6_3_10
- }
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4
- }
- else
- {
- MIX_11_4_5_7_2_1_1
- }
- break;
- case 239:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_4
- }
- else
- {
- MIX_00_MIX_00_4_0_3_10
- }
- MIX_01_4_5_3_1
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4
- }
- else
- {
- MIX_10_4_6_3_10
- }
- MIX_11_4_5_3_1
- break;
- case 127:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_4
- }
- else
- {
- MIX_00_MIX_00_4_0_3_10
- }
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4
- }
- else
- {
- MIX_01_4_1_5_2_1_1
- }
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- {
- MIX_10_4
- }
- else
- {
- MIX_10_4_7_3_2_1_1
- }
- MIX_11_4_8_3_1
- break;
- case 191:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_4
- }
- else
- {
- MIX_00_MIX_00_4_0_3_10
- }
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4
- }
- else
- {
- MIX_01_4_2_3_10
- }
- MIX_10_4_7_3_1
- MIX_11_4_7_3_1
- break;
- case 223:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- {
- MIX_00_4
- }
- else
- {
- MIX_00_4_3_1_2_1_1
- }
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4
- }
- else
- {
- MIX_01_4_2_3_10
- }
- MIX_10_4_6_3_1
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4
- }
- else
- {
- MIX_11_4_5_7_2_1_1
- }
- break;
- case 247:
- MIX_00_4_3_3_1
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- {
- MIX_01_4
- }
- else
- {
- MIX_01_4_2_3_10
- }
- MIX_10_4_3_3_1
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- {
- MIX_11_4
- }
- else
- {
- MIX_11_4_8_3_10
- }
- break;
- case 255:
- if (isDifferent(w[3], w[1], trY, trU, trV, trA))
- MIX_00_4
- else
- MIX_00_MIX_00_4_0_3_10
-
- if (isDifferent(w[1], w[5], trY, trU, trV, trA))
- MIX_01_4
- else
- MIX_01_4_2_3_10
-
- if (isDifferent(w[7], w[3], trY, trU, trV, trA))
- MIX_10_4
- else
- MIX_10_4_6_3_10
-
- if (isDifferent(w[5], w[7], trY, trU, trV, trA))
- MIX_11_4
- else
- MIX_11_4_8_3_10
- break;
- }
- image++;
- output += 2;
- }
- output += lineSize;
- }
-
- return output;
-}
diff --git a/thirdparty/misc/hq2x.h b/thirdparty/misc/hq2x.h
deleted file mode 100644
index bebd917950..0000000000
--- a/thirdparty/misc/hq2x.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef HQ2X_H
-#define HQ2X_H
-
-#include "core/typedefs.h"
-
-
-uint32_t *hq2x_resize(
- const uint32_t *image,
- uint32_t width,
- uint32_t height,
- uint32_t *output,
- uint32_t trY = 0x30,
- uint32_t trU = 0x07,
- uint32_t trV = 0x06,
- uint32_t trA = 0x50,
- bool wrapX = false,
- bool wrapY = false );
-
-#endif // HQ2X_H
diff --git a/thirdparty/misc/r128.h b/thirdparty/misc/r128.h
index be7cd3024d..1f7aab78fb 100644
--- a/thirdparty/misc/r128.h
+++ b/thirdparty/misc/r128.h
@@ -665,7 +665,7 @@ static int r128__clz64(R128_U64 x)
// 32*32->64
static R128_U64 r128__umul64(R128_U32 a, R128_U32 b)
{
-# if defined(_M_IX86) && !defined(R128_STDC_ONLY)
+# if defined(_M_IX86) && !defined(R128_STDC_ONLY) && !defined(__MINGW32__)
return __emulu(a, b);
# elif defined(_M_ARM) && !defined(R128_STDC_ONLY)
return _arm_umull(a, b);
@@ -680,7 +680,7 @@ static R128_U32 r128__udiv64(R128_U32 nlo, R128_U32 nhi, R128_U32 d, R128_U32 *r
# if defined(_M_IX86) && (_MSC_VER >= 1920) && !defined(R128_STDC_ONLY)
unsigned __int64 n = ((unsigned __int64)nhi << 32) | nlo;
return _udiv64(n, d, rem);
-# elif defined(_M_IX86) && !defined(R128_STDC_ONLY)
+# elif defined(_M_IX86) && !defined(R128_STDC_ONLY) && !defined(__MINGW32__)
__asm {
mov eax, nlo
mov edx, nhi
@@ -795,7 +795,7 @@ static void r128__umul128(R128 *dst, R128_U64 a, R128_U64 b)
}
// 128/64->64
-#if defined(_M_X64) && (_MSC_VER < 1920) && !defined(R128_STDC_ONLY)
+#if defined(_M_X64) && (_MSC_VER < 1920) && !defined(R128_STDC_ONLY) && !defined(__MINGW32__)
// MSVC x64 provides neither inline assembly nor (pre-2019) a div intrinsic, so we do fake
// "inline assembly" to avoid long division or outline assembly.
#pragma code_seg(".text")
@@ -810,7 +810,7 @@ static const r128__udiv128Proc r128__udiv128 = (r128__udiv128Proc)(void*)r128__u
#else
static R128_U64 r128__udiv128(R128_U64 nlo, R128_U64 nhi, R128_U64 d, R128_U64 *rem)
{
-#if defined(_M_X64) && !defined(R128_STDC_ONLY)
+#if defined(_M_X64) && !defined(R128_STDC_ONLY) && !defined(__MINGW32__)
return _udiv128(nhi, nlo, d, rem);
#elif defined(__x86_64__) && !defined(R128_STDC_ONLY)
R128_U64 q, r;
@@ -1602,7 +1602,7 @@ void r128Shl(R128 *dst, const R128 *src, int amount)
R128_ASSERT(dst != NULL);
R128_ASSERT(src != NULL);
-#if defined(_M_IX86) && !defined(R128_STDC_ONLY)
+#if defined(_M_IX86) && !defined(R128_STDC_ONLY) && !defined(__MINGW32__)
__asm {
// load src
mov edx, dword ptr[src]
@@ -1664,7 +1664,7 @@ void r128Shr(R128 *dst, const R128 *src, int amount)
R128_ASSERT(dst != NULL);
R128_ASSERT(src != NULL);
-#if defined(_M_IX86) && !defined(R128_STDC_ONLY)
+#if defined(_M_IX86) && !defined(R128_STDC_ONLY) && !defined(__MINGW32__)
__asm {
// load src
mov edx, dword ptr[src]
@@ -1726,7 +1726,7 @@ void r128Sar(R128 *dst, const R128 *src, int amount)
R128_ASSERT(dst != NULL);
R128_ASSERT(src != NULL);
-#if defined(_M_IX86) && !defined(R128_STDC_ONLY)
+#if defined(_M_IX86) && !defined(R128_STDC_ONLY) && !defined(__MINGW32__)
__asm {
// load src
mov edx, dword ptr[src]