summaryrefslogtreecommitdiffstats
path: root/servers
diff options
context:
space:
mode:
Diffstat (limited to 'servers')
-rw-r--r--servers/physics_server_2d.cpp2
-rw-r--r--servers/physics_server_3d.cpp2
-rw-r--r--servers/rendering/renderer_rd/environment/gi.cpp4
-rw-r--r--servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp4
-rw-r--r--servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp13
-rw-r--r--servers/rendering/renderer_rd/shaders/effects/bokeh_dof_raster.glsl19
-rw-r--r--servers/rendering/renderer_rd/shaders/effects/tonemap.glsl19
-rw-r--r--servers/rendering/renderer_rd/storage_rd/material_storage.cpp3
-rw-r--r--servers/rendering/rendering_device.cpp3
9 files changed, 55 insertions, 14 deletions
diff --git a/servers/physics_server_2d.cpp b/servers/physics_server_2d.cpp
index aea0c52a63..da25621ba5 100644
--- a/servers/physics_server_2d.cpp
+++ b/servers/physics_server_2d.cpp
@@ -754,6 +754,8 @@ void PhysicsServer2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("body_set_omit_force_integration", "body", "enable"), &PhysicsServer2D::body_set_omit_force_integration);
ClassDB::bind_method(D_METHOD("body_is_omitting_force_integration", "body"), &PhysicsServer2D::body_is_omitting_force_integration);
+ ClassDB::bind_method(D_METHOD("body_set_state_sync_callback", "body", "callable"), &PhysicsServer2D::body_set_state_sync_callback);
+
ClassDB::bind_method(D_METHOD("body_set_force_integration_callback", "body", "callable", "userdata"), &PhysicsServer2D::body_set_force_integration_callback, DEFVAL(Variant()));
ClassDB::bind_method(D_METHOD("body_test_motion", "body", "parameters", "result"), &PhysicsServer2D::_body_test_motion, DEFVAL(Variant()));
diff --git a/servers/physics_server_3d.cpp b/servers/physics_server_3d.cpp
index cda04e0aae..698805bbdd 100644
--- a/servers/physics_server_3d.cpp
+++ b/servers/physics_server_3d.cpp
@@ -829,6 +829,8 @@ void PhysicsServer3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("body_set_omit_force_integration", "body", "enable"), &PhysicsServer3D::body_set_omit_force_integration);
ClassDB::bind_method(D_METHOD("body_is_omitting_force_integration", "body"), &PhysicsServer3D::body_is_omitting_force_integration);
+ ClassDB::bind_method(D_METHOD("body_set_state_sync_callback", "body", "callable"), &PhysicsServer3D::body_set_state_sync_callback);
+
ClassDB::bind_method(D_METHOD("body_set_force_integration_callback", "body", "callable", "userdata"), &PhysicsServer3D::body_set_force_integration_callback, DEFVAL(Variant()));
ClassDB::bind_method(D_METHOD("body_set_ray_pickable", "body", "enable"), &PhysicsServer3D::body_set_ray_pickable);
diff --git a/servers/rendering/renderer_rd/environment/gi.cpp b/servers/rendering/renderer_rd/environment/gi.cpp
index c7752f8a86..12ff28d7b0 100644
--- a/servers/rendering/renderer_rd/environment/gi.cpp
+++ b/servers/rendering/renderer_rd/environment/gi.cpp
@@ -1790,6 +1790,10 @@ void GI::SDFGI::debug_probes(RID p_framebuffer, const uint32_t p_view_count, con
}
void GI::SDFGI::pre_process_gi(const Transform3D &p_transform, RenderDataRD *p_render_data) {
+ if (p_render_data->sdfgi_update_data == nullptr) {
+ return;
+ }
+
RendererRD::LightStorage *light_storage = RendererRD::LightStorage::get_singleton();
/* Update general SDFGI Buffer */
diff --git a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp
index f97ed3d215..ad19f36257 100644
--- a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp
+++ b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp
@@ -1126,6 +1126,10 @@ void RenderForwardClustered::_setup_lightmaps(const RenderDataRD *p_render_data,
/* SDFGI */
void RenderForwardClustered::_update_sdfgi(RenderDataRD *p_render_data) {
+ if (p_render_data->sdfgi_update_data == nullptr) {
+ return;
+ }
+
Ref<RenderSceneBuffersRD> rb;
if (p_render_data && p_render_data->render_buffers.is_valid()) {
rb = p_render_data->render_buffers;
diff --git a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
index e58e45f13e..5c68fb82b1 100644
--- a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
@@ -1451,10 +1451,15 @@ void RendererCanvasRenderRD::canvas_render_items(RID p_to_render_target, Item *p
normal_transform.columns[2] = Vector2();
_update_transform_2d_to_mat4(normal_transform, state_buffer.canvas_normal_transform);
- state_buffer.canvas_modulate[0] = p_modulate.r;
- state_buffer.canvas_modulate[1] = p_modulate.g;
- state_buffer.canvas_modulate[2] = p_modulate.b;
- state_buffer.canvas_modulate[3] = p_modulate.a;
+ bool use_linear_colors = texture_storage->render_target_is_using_hdr(p_to_render_target);
+ Color modulate = p_modulate;
+ if (use_linear_colors) {
+ modulate = p_modulate.srgb_to_linear();
+ }
+ state_buffer.canvas_modulate[0] = modulate.r;
+ state_buffer.canvas_modulate[1] = modulate.g;
+ state_buffer.canvas_modulate[2] = modulate.b;
+ state_buffer.canvas_modulate[3] = modulate.a;
Size2 render_target_size = texture_storage->render_target_get_size(p_to_render_target);
state_buffer.screen_pixel_size[0] = 1.0 / render_target_size.x;
diff --git a/servers/rendering/renderer_rd/shaders/effects/bokeh_dof_raster.glsl b/servers/rendering/renderer_rd/shaders/effects/bokeh_dof_raster.glsl
index 2010b58474..f2b93059b0 100644
--- a/servers/rendering/renderer_rd/shaders/effects/bokeh_dof_raster.glsl
+++ b/servers/rendering/renderer_rd/shaders/effects/bokeh_dof_raster.glsl
@@ -11,9 +11,22 @@ layout(location = 0) out vec2 uv_interp;
/* clang-format on */
void main() {
- vec2 base_arr[3] = vec2[](vec2(-1.0, -1.0), vec2(-1.0, 3.0), vec2(3.0, -1.0));
- gl_Position = vec4(base_arr[gl_VertexIndex], 0.0, 1.0);
- uv_interp = clamp(gl_Position.xy, vec2(0.0, 0.0), vec2(1.0, 1.0)) * 2.0; // saturate(x) * 2.0
+ // old code, ARM driver bug on Mali-GXXx GPUs and Vulkan API 1.3.xxx
+ // https://github.com/godotengine/godot/pull/92817#issuecomment-2168625982
+ //vec2 base_arr[3] = vec2[](vec2(-1.0, -1.0), vec2(-1.0, 3.0), vec2(3.0, -1.0));
+ //gl_Position = vec4(base_arr[gl_VertexIndex], 0.0, 1.0);
+ //uv_interp = clamp(gl_Position.xy, vec2(0.0, 0.0), vec2(1.0, 1.0)) * 2.0; // saturate(x) * 2.0
+
+ vec2 vertex_base;
+ if (gl_VertexIndex == 0) {
+ vertex_base = vec2(-1.0, -1.0);
+ } else if (gl_VertexIndex == 1) {
+ vertex_base = vec2(-1.0, 3.0);
+ } else {
+ vertex_base = vec2(3.0, -1.0);
+ }
+ gl_Position = vec4(vertex_base, 0.0, 1.0);
+ uv_interp = clamp(vertex_base, vec2(0.0, 0.0), vec2(1.0, 1.0)) * 2.0; // saturate(x) * 2.0
}
/* clang-format off */
diff --git a/servers/rendering/renderer_rd/shaders/effects/tonemap.glsl b/servers/rendering/renderer_rd/shaders/effects/tonemap.glsl
index 38eec2b61a..841f02f673 100644
--- a/servers/rendering/renderer_rd/shaders/effects/tonemap.glsl
+++ b/servers/rendering/renderer_rd/shaders/effects/tonemap.glsl
@@ -13,9 +13,22 @@
layout(location = 0) out vec2 uv_interp;
void main() {
- vec2 base_arr[3] = vec2[](vec2(-1.0, -1.0), vec2(-1.0, 3.0), vec2(3.0, -1.0));
- gl_Position = vec4(base_arr[gl_VertexIndex], 0.0, 1.0);
- uv_interp = clamp(gl_Position.xy, vec2(0.0, 0.0), vec2(1.0, 1.0)) * 2.0; // saturate(x) * 2.0
+ // old code, ARM driver bug on Mali-GXXx GPUs and Vulkan API 1.3.xxx
+ // https://github.com/godotengine/godot/pull/92817#issuecomment-2168625982
+ //vec2 base_arr[3] = vec2[](vec2(-1.0, -1.0), vec2(-1.0, 3.0), vec2(3.0, -1.0));
+ //gl_Position = vec4(base_arr[gl_VertexIndex], 0.0, 1.0);
+ //uv_interp = clamp(gl_Position.xy, vec2(0.0, 0.0), vec2(1.0, 1.0)) * 2.0; // saturate(x) * 2.0
+
+ vec2 vertex_base;
+ if (gl_VertexIndex == 0) {
+ vertex_base = vec2(-1.0, -1.0);
+ } else if (gl_VertexIndex == 1) {
+ vertex_base = vec2(-1.0, 3.0);
+ } else {
+ vertex_base = vec2(3.0, -1.0);
+ }
+ gl_Position = vec4(vertex_base, 0.0, 1.0);
+ uv_interp = clamp(vertex_base, vec2(0.0, 0.0), vec2(1.0, 1.0)) * 2.0; // saturate(x) * 2.0
}
#[fragment]
diff --git a/servers/rendering/renderer_rd/storage_rd/material_storage.cpp b/servers/rendering/renderer_rd/storage_rd/material_storage.cpp
index 13b00be1c4..8b74ebfacd 100644
--- a/servers/rendering/renderer_rd/storage_rd/material_storage.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/material_storage.cpp
@@ -807,7 +807,8 @@ void MaterialStorage::MaterialData::update_textures(const HashMap<StringName, Va
if (V->value.is_array()) {
Array array = (Array)V->value;
if (uniform_array_size > 0) {
- for (int j = 0; j < array.size(); j++) {
+ int size = MIN(uniform_array_size, array.size());
+ for (int j = 0; j < size; j++) {
textures.push_back(array[j]);
}
} else {
diff --git a/servers/rendering/rendering_device.cpp b/servers/rendering/rendering_device.cpp
index 2784e22429..7a472a4289 100644
--- a/servers/rendering/rendering_device.cpp
+++ b/servers/rendering/rendering_device.cpp
@@ -1585,9 +1585,6 @@ Vector<uint8_t> RenderingDevice::texture_get_data(RID p_texture, uint32_t p_laye
"Texture requires the `RenderingDevice.TEXTURE_USAGE_CAN_COPY_FROM_BIT` to be set to be retrieved.");
uint32_t layer_count = tex->layers;
- if (tex->type == TEXTURE_TYPE_CUBE || tex->type == TEXTURE_TYPE_CUBE_ARRAY) {
- layer_count *= 6;
- }
ERR_FAIL_COND_V(p_layer >= layer_count, Vector<uint8_t>());
if ((tex->usage_flags & TEXTURE_USAGE_CPU_READ_BIT)) {