summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
Diffstat (limited to 'servers')
-rw-r--r--servers/display_server.cpp5
-rw-r--r--servers/display_server.h2
-rw-r--r--servers/physics_2d/body_2d_sw.cpp2
-rw-r--r--servers/physics_2d/collision_solver_2d_sw.cpp2
-rw-r--r--servers/physics_2d/physics_server_2d_sw.cpp4
-rw-r--r--servers/physics_2d/physics_server_2d_wrap_mt.h4
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp2
-rw-r--r--servers/rendering/rasterizer_rd/shaders/canvas.glsl2
-rw-r--r--servers/rendering/rasterizer_rd/shaders/particles.glsl2
-rw-r--r--servers/rendering/rasterizer_rd/shaders/scene_high_end.glsl2
-rw-r--r--servers/rendering/rasterizer_rd/shaders/scene_high_end_inc.glsl2
-rw-r--r--servers/rendering/rasterizer_rd/shaders/sdfgi_direct_light.glsl2
-rw-r--r--servers/rendering/rasterizer_rd/shaders/sdfgi_integrate.glsl4
-rw-r--r--servers/rendering/rasterizer_rd/shaders/sdfgi_preprocess.glsl6
-rw-r--r--servers/rendering/rasterizer_rd/shaders/volumetric_fog.glsl2
-rw-r--r--servers/rendering/rendering_server_canvas.cpp1
-rw-r--r--servers/rendering/rendering_server_canvas.h4
-rw-r--r--servers/rendering/shader_language.cpp8
-rw-r--r--servers/rendering_server.cpp5
-rw-r--r--servers/rendering_server.h3
20 files changed, 49 insertions, 15 deletions
diff --git a/servers/display_server.cpp b/servers/display_server.cpp
index 8f6d6d3b99..356f4b884a 100644
--- a/servers/display_server.cpp
+++ b/servers/display_server.cpp
@@ -194,6 +194,10 @@ void DisplayServer::delete_sub_window(WindowID p_id) {
ERR_FAIL_MSG("Sub-windows not supported by this display server.");
}
+void DisplayServer::window_set_mouse_passthrough(const Vector<Vector2> &p_region, WindowID p_window) {
+ ERR_FAIL_MSG("Mouse passthrough not supported by this display server.");
+}
+
void DisplayServer::window_set_ime_active(const bool p_active, WindowID p_window) {
WARN_PRINT("IME not supported by this display server.");
}
@@ -412,6 +416,7 @@ void DisplayServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("delete_sub_window", "window_id"), &DisplayServer::delete_sub_window);
ClassDB::bind_method(D_METHOD("window_set_title", "title", "window_id"), &DisplayServer::window_set_title, DEFVAL(MAIN_WINDOW_ID));
+ ClassDB::bind_method(D_METHOD("window_set_mouse_passthrough", "region", "window_id"), &DisplayServer::window_set_mouse_passthrough, DEFVAL(MAIN_WINDOW_ID));
ClassDB::bind_method(D_METHOD("window_get_current_screen", "window_id"), &DisplayServer::window_get_current_screen, DEFVAL(MAIN_WINDOW_ID));
ClassDB::bind_method(D_METHOD("window_set_current_screen", "screen", "window_id"), &DisplayServer::window_set_current_screen, DEFVAL(MAIN_WINDOW_ID));
diff --git a/servers/display_server.h b/servers/display_server.h
index b652418244..3ee0da709b 100644
--- a/servers/display_server.h
+++ b/servers/display_server.h
@@ -247,6 +247,8 @@ public:
virtual void window_set_title(const String &p_title, WindowID p_window = MAIN_WINDOW_ID) = 0;
+ virtual void window_set_mouse_passthrough(const Vector<Vector2> &p_region, WindowID p_window = MAIN_WINDOW_ID);
+
virtual int window_get_current_screen(WindowID p_window = MAIN_WINDOW_ID) const = 0;
virtual void window_set_current_screen(int p_screen, WindowID p_window = MAIN_WINDOW_ID) = 0;
diff --git a/servers/physics_2d/body_2d_sw.cpp b/servers/physics_2d/body_2d_sw.cpp
index 856bba78f7..75c9a95739 100644
--- a/servers/physics_2d/body_2d_sw.cpp
+++ b/servers/physics_2d/body_2d_sw.cpp
@@ -468,7 +468,7 @@ void Body2DSW::integrate_forces(real_t p_step) {
linear_velocity = motion / p_step;
real_t rot = new_transform.get_rotation() - get_transform().get_rotation();
- angular_velocity = rot / p_step;
+ angular_velocity = remainder(rot, 2.0 * Math_PI) / p_step;
do_motion = true;
diff --git a/servers/physics_2d/collision_solver_2d_sw.cpp b/servers/physics_2d/collision_solver_2d_sw.cpp
index beba709807..0e056691c7 100644
--- a/servers/physics_2d/collision_solver_2d_sw.cpp
+++ b/servers/physics_2d/collision_solver_2d_sw.cpp
@@ -47,7 +47,7 @@ bool CollisionSolver2DSW::solve_static_line(const Shape2DSW *p_shape_A, const Tr
Vector2 supports[2];
int support_count;
- p_shape_B->get_supports(p_transform_A.affine_inverse().basis_xform(-n).normalized(), supports, support_count);
+ p_shape_B->get_supports(p_transform_B.affine_inverse().basis_xform(-n).normalized(), supports, support_count);
bool found = false;
diff --git a/servers/physics_2d/physics_server_2d_sw.cpp b/servers/physics_2d/physics_server_2d_sw.cpp
index ffdaab0d92..1b396190e9 100644
--- a/servers/physics_2d/physics_server_2d_sw.cpp
+++ b/servers/physics_2d/physics_server_2d_sw.cpp
@@ -1342,6 +1342,10 @@ PhysicsServer2DSW::PhysicsServer2DSW() {
island_count = 0;
active_objects = 0;
collision_pairs = 0;
+#ifdef NO_THREADS
+ using_threads = false;
+#else
using_threads = int(ProjectSettings::get_singleton()->get("physics/2d/thread_model")) == 2;
+#endif
flushing_queries = false;
};
diff --git a/servers/physics_2d/physics_server_2d_wrap_mt.h b/servers/physics_2d/physics_server_2d_wrap_mt.h
index bc918b20f4..586dbe9e12 100644
--- a/servers/physics_2d/physics_server_2d_wrap_mt.h
+++ b/servers/physics_2d/physics_server_2d_wrap_mt.h
@@ -317,6 +317,9 @@ public:
template <class T>
static PhysicsServer2D *init_server() {
+#ifdef NO_THREADS
+ return memnew(T); // Always single unsafe when no threads are available.
+#else
int tm = GLOBAL_DEF("physics/2d/thread_model", 1);
if (tm == 0) { // single unsafe
return memnew(T);
@@ -325,6 +328,7 @@ public:
} else { // multi threaded
return memnew(PhysicsServer2DWrapMT(memnew(T), true));
}
+#endif
}
#undef ServerNameWrapMT
diff --git a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp
index a13e7d786b..db2c707984 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp
@@ -5871,7 +5871,7 @@ RID RasterizerStorageRD::decal_atlas_get_texture() const {
}
RID RasterizerStorageRD::decal_atlas_get_texture_srgb() const {
- return decal_atlas.texture;
+ return decal_atlas.texture_srgb;
}
void RasterizerStorageRD::_update_decal_atlas() {
diff --git a/servers/rendering/rasterizer_rd/shaders/canvas.glsl b/servers/rendering/rasterizer_rd/shaders/canvas.glsl
index e33b3face9..4a40584e16 100644
--- a/servers/rendering/rasterizer_rd/shaders/canvas.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/canvas.glsl
@@ -101,7 +101,7 @@ void main() {
offset += 1;
} else {
instance_color = vec4(texelFetch(instancing_buffer, offset + 0), texelFetch(instancing_buffer, offset + 1), texelFetch(instancing_buffer, offset + 2), texelFetch(instancing_buffer, offset + 3));
- offser += 4;
+ offset += 4;
}
color *= instance_color;
diff --git a/servers/rendering/rasterizer_rd/shaders/particles.glsl b/servers/rendering/rasterizer_rd/shaders/particles.glsl
index 3de807b57c..a924509771 100644
--- a/servers/rendering/rasterizer_rd/shaders/particles.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/particles.glsl
@@ -147,7 +147,7 @@ bool emit_particle(mat4 p_xform, vec3 p_velocity, vec4 p_color, vec4 p_custom, u
while(attempts-- > 0) {
dst_index = dst_particles.particle_count;
if (dst_index == dst_particles.particle_max) {
- return false; //cant emit anymore
+ return false; //can't emit anymore
}
if (atomicCompSwap(dst_particles.particle_count, dst_index, dst_index +1 ) != dst_index) {
diff --git a/servers/rendering/rasterizer_rd/shaders/scene_high_end.glsl b/servers/rendering/rasterizer_rd/shaders/scene_high_end.glsl
index 2a7b73d9aa..e11f3983c5 100644
--- a/servers/rendering/rasterizer_rd/shaders/scene_high_end.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/scene_high_end.glsl
@@ -681,7 +681,7 @@ LIGHT_SHADER_CODE
#ifndef USE_NO_SHADOWS
-// Produces cheap white noise, optmized for window-space
+// Produces cheap white noise, optimized for window-space
// Comes from: https://www.shadertoy.com/view/4djSRW
// Copyright: Dave Hoskins, MIT License
float quick_hash(vec2 pos) {
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 66bfefbe89..0cc2b90c53 100644
--- a/servers/rendering/rasterizer_rd/shaders/scene_high_end_inc.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/scene_high_end_inc.glsl
@@ -252,7 +252,7 @@ layout(set = 1, binding = 0) uniform textureCube radiance_cubemap;
#endif
-/* Set 2, Reflection and Shadow Atlases (view dependant) */
+/* Set 2, Reflection and Shadow Atlases (view dependent) */
layout(set = 2, binding = 0) uniform textureCubeArray reflection_atlas;
diff --git a/servers/rendering/rasterizer_rd/shaders/sdfgi_direct_light.glsl b/servers/rendering/rasterizer_rd/shaders/sdfgi_direct_light.glsl
index c4b29216d5..61e4bf5e18 100644
--- a/servers/rendering/rasterizer_rd/shaders/sdfgi_direct_light.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/sdfgi_direct_light.glsl
@@ -22,7 +22,7 @@ dispatch_data;
struct ProcessVoxel {
uint position; //xyz 7 bit packed, extra 11 bits for neigbours
uint albedo; //rgb bits 0-15 albedo, bits 16-21 are normal bits (set if geometry exists toward that side), extra 11 bits for neibhbours
- uint light; //rgbe8985 encoded total saved light, extra 2 bits for neighbous
+ uint light; //rgbe8985 encoded total saved light, extra 2 bits for neighbours
uint light_aniso; //55555 light anisotropy, extra 2 bits for neighbours
//total neighbours: 26
};
diff --git a/servers/rendering/rasterizer_rd/shaders/sdfgi_integrate.glsl b/servers/rendering/rasterizer_rd/shaders/sdfgi_integrate.glsl
index 1ec471d204..d516ab22c3 100644
--- a/servers/rendering/rasterizer_rd/shaders/sdfgi_integrate.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/sdfgi_integrate.glsl
@@ -336,7 +336,7 @@ void main() {
#ifdef MODE_STORE
- // converting to octahedral in this step is requiered because
+ // converting to octahedral in this step is required because
// octahedral is much faster to read from the screen than spherical harmonics,
// despite the very slight quality loss
@@ -512,7 +512,7 @@ void main() {
imageStore(lightprobe_average_scroll_texture, dst_pos, value);
}
} else if (params.cascade < params.max_cascades - 1) {
- //cant scroll, must look for position in parent cascade
+ //can't scroll, must look for position in parent cascade
//to global coords
float probe_cell_size = float(params.grid_size.x / float(params.probe_axis_size - 1)) / cascades.data[params.cascade].to_cell;
diff --git a/servers/rendering/rasterizer_rd/shaders/sdfgi_preprocess.glsl b/servers/rendering/rasterizer_rd/shaders/sdfgi_preprocess.glsl
index dd0ca5c506..916c60ac89 100644
--- a/servers/rendering/rasterizer_rd/shaders/sdfgi_preprocess.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/sdfgi_preprocess.glsl
@@ -103,7 +103,7 @@ dispatch_data;
struct ProcessVoxel {
uint position; //xyz 7 bit packed, extra 11 bits for neigbours
uint albedo; //rgb bits 0-15 albedo, bits 16-21 are normal bits (set if geometry exists toward that side), extra 11 bits for neibhbours
- uint light; //rgbe8985 encoded total saved light, extra 2 bits for neighbous
+ uint light; //rgbe8985 encoded total saved light, extra 2 bits for neighbours
uint light_aniso; //55555 light anisotropy, extra 2 bits for neighbours
//total neighbours: 26
};
@@ -136,7 +136,7 @@ dispatch_data;
struct ProcessVoxel {
uint position; //xyz 7 bit packed, extra 11 bits for neigbours
uint albedo; //rgb bits 0-15 albedo, bits 16-21 are normal bits (set if geometry exists toward that side), extra 11 bits for neibhbours
- uint light; //rgbe8985 encoded total saved light, extra 2 bits for neighbous
+ uint light; //rgbe8985 encoded total saved light, extra 2 bits for neighbours
uint light_aniso; //55555 light anisotropy, extra 2 bits for neighbours
//total neighbours: 26
};
@@ -274,7 +274,7 @@ void main() {
#ifdef MODE_JUMPFLOOD
- //regular jumpflood, efficent for large steps, inefficient for small steps
+ //regular jumpflood, efficient for large steps, inefficient for small steps
ivec3 pos = ivec3(gl_GlobalInvocationID.xyz);
vec3 posf = vec3(pos);
diff --git a/servers/rendering/rasterizer_rd/shaders/volumetric_fog.glsl b/servers/rendering/rasterizer_rd/shaders/volumetric_fog.glsl
index cb19fb0b69..13b162f0c9 100644
--- a/servers/rendering/rasterizer_rd/shaders/volumetric_fog.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/volumetric_fog.glsl
@@ -485,7 +485,7 @@ void main() {
//get depth at cell pos
float z = get_depth_at_pos(fog_cell_size.z, i);
- //get distance from previos pos
+ //get distance from previous pos
float d = abs(prev_z - z);
//compute exinction based on beer's
float extinction = t * exp(-d * fog.a);
diff --git a/servers/rendering/rendering_server_canvas.cpp b/servers/rendering/rendering_server_canvas.cpp
index 07eabfd430..b3d5b0ad83 100644
--- a/servers/rendering/rendering_server_canvas.cpp
+++ b/servers/rendering/rendering_server_canvas.cpp
@@ -81,6 +81,7 @@ void _collect_ysort_children(RenderingServerCanvas::Item *p_canvas_item, Transfo
child_items[i]->ysort_xform = p_transform;
child_items[i]->ysort_pos = p_transform.xform(child_items[i]->xform.elements[2]);
child_items[i]->material_owner = child_items[i]->use_parent_material ? p_material_owner : nullptr;
+ child_items[i]->ysort_index = r_index;
}
r_index++;
diff --git a/servers/rendering/rendering_server_canvas.h b/servers/rendering/rendering_server_canvas.h
index 59c0d1fa52..cebe32fba0 100644
--- a/servers/rendering/rendering_server_canvas.h
+++ b/servers/rendering/rendering_server_canvas.h
@@ -51,6 +51,7 @@ public:
Color ysort_modulate;
Transform2D ysort_xform;
Vector2 ysort_pos;
+ int ysort_index;
RS::CanvasItemTextureFilter texture_filter;
RS::CanvasItemTextureRepeat texture_repeat;
@@ -69,6 +70,7 @@ public:
ysort_children_count = -1;
ysort_xform = Transform2D();
ysort_pos = Vector2();
+ ysort_index = 0;
texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT;
texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT;
}
@@ -83,7 +85,7 @@ public:
struct ItemPtrSort {
_FORCE_INLINE_ bool operator()(const Item *p_left, const Item *p_right) const {
if (Math::is_equal_approx(p_left->ysort_pos.y, p_right->ysort_pos.y)) {
- return p_left->ysort_pos.x < p_right->ysort_pos.x;
+ return p_left->ysort_index < p_right->ysort_index;
}
return p_left->ysort_pos.y < p_right->ysort_pos.y;
diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp
index 28c41fb2dc..6c835fcadf 100644
--- a/servers/rendering/shader_language.cpp
+++ b/servers/rendering/shader_language.cpp
@@ -6099,6 +6099,14 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
case TK_UNIFORM:
case TK_VARYING: {
bool uniform = tk.type == TK_UNIFORM;
+
+ if (!uniform) {
+ if (shader_type_identifier == "particles" || shader_type_identifier == "sky") {
+ _set_error(vformat("Varyings cannot be used in '%s' shaders!", shader_type_identifier));
+ return ERR_PARSE_ERROR;
+ }
+ }
+
DataPrecision precision = PRECISION_DEFAULT;
DataInterpolation interpolation = INTERPOLATION_SMOOTH;
DataType type;
diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp
index 8f863a6fc8..9ad19e4b38 100644
--- a/servers/rendering_server.cpp
+++ b/servers/rendering_server.cpp
@@ -1505,9 +1505,14 @@ ShaderLanguage::DataType RenderingServer::global_variable_type_get_shader_dataty
}
}
+RenderingDevice *RenderingServer::create_local_rendering_device() const {
+ return RenderingDevice::get_singleton()->create_local_device();
+}
+
void RenderingServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("force_sync"), &RenderingServer::sync);
ClassDB::bind_method(D_METHOD("force_draw", "swap_buffers", "frame_step"), &RenderingServer::draw, DEFVAL(true), DEFVAL(0.0));
+ ClassDB::bind_method(D_METHOD("create_local_rendering_device"), &RenderingServer::create_local_rendering_device);
#ifndef _MSC_VER
#warning TODO all texture methods need re-binding
diff --git a/servers/rendering_server.h b/servers/rendering_server.h
index 49f840948f..7dae45f126 100644
--- a/servers/rendering_server.h
+++ b/servers/rendering_server.h
@@ -39,6 +39,7 @@
#include "core/typed_array.h"
#include "core/variant.h"
#include "servers/display_server.h"
+#include "servers/rendering/rendering_device.h"
#include "servers/rendering/shader_language.h"
class RenderingServer : public Object {
@@ -1311,6 +1312,8 @@ public:
virtual bool is_low_end() const = 0;
+ RenderingDevice *create_local_rendering_device() const;
+
bool is_render_loop_enabled() const;
void set_render_loop_enabled(bool p_enabled);