summaryrefslogtreecommitdiff
path: root/servers/rendering/renderer_rd
diff options
context:
space:
mode:
Diffstat (limited to 'servers/rendering/renderer_rd')
-rw-r--r--servers/rendering/renderer_rd/effects/copy_effects.cpp4
-rw-r--r--servers/rendering/renderer_rd/effects/tone_mapper.cpp2
-rw-r--r--servers/rendering/renderer_rd/effects/vrs.cpp2
-rw-r--r--servers/rendering/renderer_rd/environment/sky.cpp4
-rw-r--r--servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp4
-rw-r--r--servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp4
-rw-r--r--servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp5
-rw-r--r--servers/rendering/renderer_rd/renderer_compositor_rd.h3
-rw-r--r--servers/rendering/renderer_rd/shaders/effects/ssao.glsl4
-rw-r--r--servers/rendering/renderer_rd/shaders/effects/ssil.glsl4
-rw-r--r--servers/rendering/renderer_rd/storage_rd/particles_storage.cpp10
11 files changed, 23 insertions, 23 deletions
diff --git a/servers/rendering/renderer_rd/effects/copy_effects.cpp b/servers/rendering/renderer_rd/effects/copy_effects.cpp
index bcea9225ea..86484c982a 100644
--- a/servers/rendering/renderer_rd/effects/copy_effects.cpp
+++ b/servers/rendering/renderer_rd/effects/copy_effects.cpp
@@ -110,7 +110,7 @@ CopyEffects::CopyEffects(bool p_prefer_raster_effects) {
copy_to_fb.shader.initialize(copy_modes);
- if (!RendererCompositorRD::singleton->is_xr_enabled()) {
+ if (!RendererCompositorRD::get_singleton()->is_xr_enabled()) {
copy_to_fb.shader.set_variant_enabled(COPY_TO_FB_MULTIVIEW, false);
copy_to_fb.shader.set_variant_enabled(COPY_TO_FB_MULTIVIEW_WITH_DEPTH, false);
}
@@ -266,7 +266,7 @@ CopyEffects::CopyEffects(bool p_prefer_raster_effects) {
specular_merge.shader.initialize(specular_modes);
- if (!RendererCompositorRD::singleton->is_xr_enabled()) {
+ if (!RendererCompositorRD::get_singleton()->is_xr_enabled()) {
specular_merge.shader.set_variant_enabled(SPECULAR_MERGE_ADD_MULTIVIEW, false);
specular_merge.shader.set_variant_enabled(SPECULAR_MERGE_SSR_MULTIVIEW, false);
specular_merge.shader.set_variant_enabled(SPECULAR_MERGE_ADDITIVE_ADD_MULTIVIEW, false);
diff --git a/servers/rendering/renderer_rd/effects/tone_mapper.cpp b/servers/rendering/renderer_rd/effects/tone_mapper.cpp
index 7b152b524f..821960bb3b 100644
--- a/servers/rendering/renderer_rd/effects/tone_mapper.cpp
+++ b/servers/rendering/renderer_rd/effects/tone_mapper.cpp
@@ -56,7 +56,7 @@ ToneMapper::ToneMapper() {
tonemap.shader.initialize(tonemap_modes);
- if (!RendererCompositorRD::singleton->is_xr_enabled()) {
+ if (!RendererCompositorRD::get_singleton()->is_xr_enabled()) {
tonemap.shader.set_variant_enabled(TONEMAP_MODE_NORMAL_MULTIVIEW, false);
tonemap.shader.set_variant_enabled(TONEMAP_MODE_BICUBIC_GLOW_FILTER_MULTIVIEW, false);
tonemap.shader.set_variant_enabled(TONEMAP_MODE_1D_LUT_MULTIVIEW, false);
diff --git a/servers/rendering/renderer_rd/effects/vrs.cpp b/servers/rendering/renderer_rd/effects/vrs.cpp
index 4bc5d7b597..6ec8612029 100644
--- a/servers/rendering/renderer_rd/effects/vrs.cpp
+++ b/servers/rendering/renderer_rd/effects/vrs.cpp
@@ -44,7 +44,7 @@ VRS::VRS() {
vrs_shader.shader.initialize(vrs_modes);
- if (!RendererCompositorRD::singleton->is_xr_enabled()) {
+ if (!RendererCompositorRD::get_singleton()->is_xr_enabled()) {
vrs_shader.shader.set_variant_enabled(VRS_MULTIVIEW, false);
}
diff --git a/servers/rendering/renderer_rd/environment/sky.cpp b/servers/rendering/renderer_rd/environment/sky.cpp
index 7fff349b3c..788ec1cee4 100644
--- a/servers/rendering/renderer_rd/environment/sky.cpp
+++ b/servers/rendering/renderer_rd/environment/sky.cpp
@@ -276,7 +276,7 @@ void SkyRD::ReflectionData::update_reflection_data(int p_size, int p_mipmaps, bo
int mipmaps = p_mipmaps;
uint32_t w = p_size, h = p_size;
- EffectsRD *effects = RendererCompositorRD::singleton->get_effects();
+ EffectsRD *effects = RendererCompositorRD::get_singleton()->get_effects();
ERR_FAIL_NULL_MSG(effects, "Effects haven't been initialized");
bool prefer_raster_effects = effects->get_prefer_raster_effects();
@@ -756,7 +756,7 @@ void SkyRD::init() {
sky_shader.shader.initialize(sky_modes, defines);
- if (!RendererCompositorRD::singleton->is_xr_enabled()) {
+ if (!RendererCompositorRD::get_singleton()->is_xr_enabled()) {
sky_shader.shader.set_variant_enabled(SKY_VERSION_BACKGROUND_MULTIVIEW, false);
sky_shader.shader.set_variant_enabled(SKY_VERSION_HALF_RES_MULTIVIEW, false);
sky_shader.shader.set_variant_enabled(SKY_VERSION_QUARTER_RES_MULTIVIEW, false);
diff --git a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp
index 3b3979b198..ff180b5465 100644
--- a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp
+++ b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp
@@ -504,7 +504,7 @@ void SceneShaderForwardClustered::init(const String p_defines) {
shader.initialize(shader_versions, p_defines);
- if (!RendererCompositorRD::singleton->is_xr_enabled()) {
+ if (!RendererCompositorRD::get_singleton()->is_xr_enabled()) {
shader.set_variant_enabled(SHADER_VERSION_DEPTH_PASS_MULTIVIEW, false);
shader.set_variant_enabled(SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_MULTIVIEW, false);
shader.set_variant_enabled(SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_AND_VOXEL_GI_MULTIVIEW, false);
@@ -730,7 +730,7 @@ void SceneShaderForwardClustered::init(const String p_defines) {
actions.global_buffer_array_variable = "global_shader_uniforms.data";
actions.instance_uniform_index_variable = "instances.data[instance_index_interp].instance_uniforms_ofs";
- actions.check_multiview_samplers = true; // make sure we check sampling multiview textures
+ actions.check_multiview_samplers = RendererCompositorRD::get_singleton()->is_xr_enabled(); // Make sure we check sampling multiview textures.
compiler.initialize(actions);
}
diff --git a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp
index cc4a7dfa47..0e992eb965 100644
--- a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp
+++ b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp
@@ -421,7 +421,7 @@ void SceneShaderForwardMobile::init(const String p_defines) {
shader.initialize(shader_versions, p_defines);
- if (!RendererCompositorRD::singleton->is_xr_enabled()) {
+ if (!RendererCompositorRD::get_singleton()->is_xr_enabled()) {
shader.set_variant_enabled(SHADER_VERSION_COLOR_PASS_MULTIVIEW, false);
shader.set_variant_enabled(SHADER_VERSION_LIGHTMAP_COLOR_PASS_MULTIVIEW, false);
shader.set_variant_enabled(SHADER_VERSION_SHADOW_PASS_MULTIVIEW, false);
@@ -610,7 +610,7 @@ void SceneShaderForwardMobile::init(const String p_defines) {
actions.instance_uniform_index_variable = "draw_call.instance_uniforms_ofs";
actions.apply_luminance_multiplier = true; // apply luminance multiplier to screen texture
- actions.check_multiview_samplers = true; // make sure we check sampling multiview textures
+ actions.check_multiview_samplers = RendererCompositorRD::get_singleton()->is_xr_enabled(); // Make sure we check sampling multiview textures.
compiler.initialize(actions);
}
diff --git a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
index f102bc0650..78bdd3f541 100644
--- a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
@@ -919,7 +919,7 @@ void RendererCanvasRenderRD::_render_item(RD::DrawListID p_draw_list, RID p_rend
} break;
case Item::Command::TYPE_ANIMATION_SLICE: {
const Item::CommandAnimationSlice *as = static_cast<const Item::CommandAnimationSlice *>(c);
- double current_time = RendererCompositorRD::singleton->get_total_time();
+ double current_time = RendererCompositorRD::get_singleton()->get_total_time();
double local_time = Math::fposmod(current_time - as->offset, as->animation_length);
skipping = !(local_time >= as->slice_begin && local_time < as->slice_end);
@@ -1252,13 +1252,12 @@ void RendererCanvasRenderRD::canvas_render_items(RID p_to_render_target, Item *p
l = l->next_ptr;
ERR_CONTINUE(!clight);
}
- Transform2D to_light_xform = (p_canvas_transform * l->light_shader_xform).affine_inverse();
Vector2 canvas_light_pos = p_canvas_transform.xform(l->xform.get_origin()); //convert light position to canvas coordinates, as all computation is done in canvas coords to avoid precision loss
state.light_uniforms[index].position[0] = canvas_light_pos.x;
state.light_uniforms[index].position[1] = canvas_light_pos.y;
- _update_transform_2d_to_mat2x4(to_light_xform, state.light_uniforms[index].matrix);
+ _update_transform_2d_to_mat2x4(l->light_shader_xform.affine_inverse(), state.light_uniforms[index].matrix);
_update_transform_2d_to_mat2x4(l->xform_cache.affine_inverse(), state.light_uniforms[index].shadow_matrix);
state.light_uniforms[index].height = l->height * (p_canvas_transform.columns[0].length() + p_canvas_transform.columns[1].length()) * 0.5; //approximate height conversion to the canvas size, since all calculations are done in canvas coords to avoid precision loss
diff --git a/servers/rendering/renderer_rd/renderer_compositor_rd.h b/servers/rendering/renderer_rd/renderer_compositor_rd.h
index 43c8d78dee..eae4327908 100644
--- a/servers/rendering/renderer_rd/renderer_compositor_rd.h
+++ b/servers/rendering/renderer_rd/renderer_compositor_rd.h
@@ -101,6 +101,7 @@ protected:
double delta = 0.0;
static uint64_t frame;
+ static RendererCompositorRD *singleton;
public:
RendererUtilities *get_utilities() { return utilities; };
@@ -145,7 +146,7 @@ public:
low_end = false;
}
- static RendererCompositorRD *singleton;
+ static RendererCompositorRD *get_singleton() { return singleton; }
RendererCompositorRD();
~RendererCompositorRD();
};
diff --git a/servers/rendering/renderer_rd/shaders/effects/ssao.glsl b/servers/rendering/renderer_rd/shaders/effects/ssao.glsl
index ffaa6872c9..58efc68bc7 100644
--- a/servers/rendering/renderer_rd/shaders/effects/ssao.glsl
+++ b/servers/rendering/renderer_rd/shaders/effects/ssao.glsl
@@ -307,8 +307,8 @@ void generate_SSAO_shadows_internal(out float r_shadow_term, out vec4 r_edges, o
// edge mask for between this and left/right/top/bottom neighbor pixels - not used in quality level 0 so initialize to "no edge" (1 is no edge, 0 is edge)
vec4 edgesLRTB = vec4(1.0, 1.0, 1.0, 1.0);
- // Move center pixel slightly towards camera to avoid imprecision artifacts due to using of 16bit depth buffer; a lot smaller offsets needed when using 32bit floats
- pix_center_pos *= 0.9992;
+ // Move center pixel slightly towards camera to avoid imprecision artifacts due to using of 16bit depth buffer.
+ pix_center_pos *= 0.99;
if (!p_adaptive_base && (p_quality_level >= SSAO_DEPTH_BASED_EDGES_ENABLE_AT_QUALITY_PRESET)) {
edgesLRTB = calculate_edges(pix_z, pix_left_z, pix_right_z, pix_top_z, pix_bottom_z);
diff --git a/servers/rendering/renderer_rd/shaders/effects/ssil.glsl b/servers/rendering/renderer_rd/shaders/effects/ssil.glsl
index de7b97953f..fac13b0e3f 100644
--- a/servers/rendering/renderer_rd/shaders/effects/ssil.glsl
+++ b/servers/rendering/renderer_rd/shaders/effects/ssil.glsl
@@ -321,8 +321,8 @@ void generate_SSIL(out vec3 r_color, out vec4 r_edges, out float r_obscurance, o
// edge mask for between this and left/right/top/bottom neighbor pixels - not used in quality level 0 so initialize to "no edge" (1 is no edge, 0 is edge)
vec4 edgesLRTB = vec4(1.0, 1.0, 1.0, 1.0);
- // Move center pixel slightly towards camera to avoid imprecision artifacts due to using of 16bit depth buffer; a lot smaller offsets needed when using 32bit floats
- pix_center_pos *= 0.9992;
+ // Move center pixel slightly towards camera to avoid imprecision artifacts due to using of 16bit depth buffer.
+ pix_center_pos *= 0.99;
if (!p_adaptive_base && (p_quality_level >= SSIL_DEPTH_BASED_EDGES_ENABLE_AT_QUALITY_PRESET)) {
edgesLRTB = calculate_edges(pix_z, pix_left_z, pix_right_z, pix_top_z, pix_bottom_z);
diff --git a/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp b/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp
index 00fb8acca8..3ed5d7dda8 100644
--- a/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp
@@ -774,7 +774,7 @@ void ParticlesStorage::_particles_process(Particles *p_particles, double p_delta
p_particles->phase = new_phase;
- frame_params.time = RendererCompositorRD::singleton->get_total_time();
+ frame_params.time = RendererCompositorRD::get_singleton()->get_total_time();
frame_params.delta = p_delta * p_particles->speed_scale;
frame_params.random_seed = p_particles->random_seed;
frame_params.explosiveness = p_particles->explosiveness;
@@ -1228,7 +1228,7 @@ void ParticlesStorage::particles_set_view_axis(RID p_particles, const Vector3 &p
RD::get_singleton()->compute_list_dispatch_threads(compute_list, particles->amount, 1, 1);
RD::get_singleton()->compute_list_end();
- RendererCompositorRD::singleton->get_effects()->sort_buffer(particles->particles_sort_uniform_set, particles->amount);
+ RendererCompositorRD::get_singleton()->get_effects()->sort_buffer(particles->particles_sort_uniform_set, particles->amount);
}
if (particles->trails_enabled && particles->trail_bind_poses.size() > 1) {
@@ -1341,7 +1341,7 @@ void ParticlesStorage::update_particles() {
particles->inactive = false;
particles->inactive_time = 0;
} else {
- particles->inactive_time += particles->speed_scale * RendererCompositorRD::singleton->get_frame_delta_time();
+ particles->inactive_time += particles->speed_scale * RendererCompositorRD::get_singleton()->get_frame_delta_time();
if (particles->inactive_time > particles->lifetime * 1.2) {
particles->inactive = true;
continue;
@@ -1442,7 +1442,7 @@ void ParticlesStorage::update_particles() {
frame_time = 1.0 / fixed_fps;
decr = frame_time;
}
- double delta = RendererCompositorRD::singleton->get_frame_delta_time();
+ double delta = RendererCompositorRD::get_singleton()->get_frame_delta_time();
if (delta > 0.1) { //avoid recursive stalls if fps goes below 10
delta = 0.1;
} else if (delta <= 0.0) { //unlikely but..
@@ -1461,7 +1461,7 @@ void ParticlesStorage::update_particles() {
if (zero_time_scale) {
_particles_process(particles, 0.0);
} else {
- _particles_process(particles, RendererCompositorRD::singleton->get_frame_delta_time());
+ _particles_process(particles, RendererCompositorRD::get_singleton()->get_frame_delta_time());
}
}