summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--servers/rendering/renderer_rd/effects/ss_effects.cpp28
-rw-r--r--servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp4
2 files changed, 24 insertions, 8 deletions
diff --git a/servers/rendering/renderer_rd/effects/ss_effects.cpp b/servers/rendering/renderer_rd/effects/ss_effects.cpp
index 9389f8149e..96e3683560 100644
--- a/servers/rendering/renderer_rd/effects/ss_effects.cpp
+++ b/servers/rendering/renderer_rd/effects/ss_effects.cpp
@@ -572,7 +572,15 @@ void SSEffects::gather_ssil(RD::ComputeListID p_compute_list, const RID *p_ssil_
RD::get_singleton()->compute_list_bind_uniform_set(p_compute_list, uniform_set_cache->get_cache(shader, 2, u_ssil_slice, u_edges_slice), 2);
RD::get_singleton()->compute_list_set_push_constant(p_compute_list, &ssil.gather_push_constant, sizeof(SSILGatherPushConstant));
- Size2i size = Size2i(p_settings.full_screen_size.x >> (ssil_half_size ? 2 : 1), p_settings.full_screen_size.y >> (ssil_half_size ? 2 : 1));
+ Size2i size;
+ // Calculate size same way as we created the buffer
+ if (ssil_half_size) {
+ size.x = (p_settings.full_screen_size.x + 3) / 4;
+ size.y = (p_settings.full_screen_size.y + 3) / 4;
+ } else {
+ size.x = (p_settings.full_screen_size.x + 1) / 2;
+ size.y = (p_settings.full_screen_size.y + 1) / 2;
+ }
RD::get_singleton()->compute_list_dispatch_threads(p_compute_list, size.x, size.y, 1);
}
@@ -887,8 +895,9 @@ void SSEffects::screen_space_indirect_lighting(Ref<RenderSceneBuffersRD> p_rende
RD::get_singleton()->compute_list_set_push_constant(compute_list, &ssil.blur_push_constant, sizeof(SSILBlurPushConstant));
- int x_groups = (p_settings.full_screen_size.x >> (ssil_half_size ? 2 : 1));
- int y_groups = (p_settings.full_screen_size.y >> (ssil_half_size ? 2 : 1));
+ // Use the size of the actual buffer we're processing here or we won't cover the entire image.
+ int x_groups = p_ssil_buffers.buffer_width;
+ int y_groups = p_ssil_buffers.buffer_height;
RD::get_singleton()->compute_list_dispatch_threads(compute_list, x_groups, y_groups, 1);
if (ssil_quality > RS::ENV_SSIL_QUALITY_VERY_LOW) {
@@ -985,7 +994,15 @@ void SSEffects::gather_ssao(RD::ComputeListID p_compute_list, const RID *p_ao_sl
RD::get_singleton()->compute_list_bind_uniform_set(p_compute_list, uniform_set_cache->get_cache(shader, 2, u_ao_slice), 2);
RD::get_singleton()->compute_list_set_push_constant(p_compute_list, &ssao.gather_push_constant, sizeof(SSAOGatherPushConstant));
- Size2i size = Size2i(p_settings.full_screen_size.x >> (ssao_half_size ? 2 : 1), p_settings.full_screen_size.y >> (ssao_half_size ? 2 : 1));
+ Size2i size;
+ // Make sure we use the same size as with which our buffer was created
+ if (ssao_half_size) {
+ size.x = (p_settings.full_screen_size.x + 3) / 4;
+ size.y = (p_settings.full_screen_size.y + 3) / 4;
+ } else {
+ size.x = (p_settings.full_screen_size.x + 1) / 2;
+ size.y = (p_settings.full_screen_size.y + 1) / 2;
+ }
RD::get_singleton()->compute_list_dispatch_threads(p_compute_list, size.x, size.y, 1);
}
@@ -1266,8 +1283,7 @@ void SSEffects::generate_ssao(Ref<RenderSceneBuffersRD> p_render_buffers, SSAORe
}
RD::get_singleton()->compute_list_set_push_constant(compute_list, &ssao.blur_push_constant, sizeof(SSAOBlurPushConstant));
- Size2i size(p_settings.full_screen_size.x >> (ssao_half_size ? 2 : 1), p_settings.full_screen_size.y >> (ssao_half_size ? 2 : 1));
- RD::get_singleton()->compute_list_dispatch_threads(compute_list, size.x, size.y, 1);
+ RD::get_singleton()->compute_list_dispatch_threads(compute_list, p_ssao_buffers.buffer_width, p_ssao_buffers.buffer_height, 1);
}
if (ssao_quality > RS::ENV_SSAO_QUALITY_VERY_LOW) {
diff --git a/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp b/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp
index e1dc9f8624..609fb2afe7 100644
--- a/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp
@@ -151,11 +151,11 @@ void RenderSceneBuffersRD::configure(RID p_render_target, const Size2i p_interna
uint32_t usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT;
if (msaa_3d == RS::VIEWPORT_MSAA_DISABLED) {
- format = RD::get_singleton()->texture_is_format_supported_for_usage(RD::DATA_FORMAT_D24_UNORM_S8_UINT, (RD::TEXTURE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | RD::TEXTURE_USAGE_SAMPLING_BIT)) ? RD::DATA_FORMAT_D24_UNORM_S8_UINT : RD::DATA_FORMAT_D32_SFLOAT_S8_UINT;
usage_bits |= RD::TEXTURE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
+ format = RD::get_singleton()->texture_is_format_supported_for_usage(RD::DATA_FORMAT_D24_UNORM_S8_UINT, usage_bits) ? RD::DATA_FORMAT_D24_UNORM_S8_UINT : RD::DATA_FORMAT_D32_SFLOAT_S8_UINT;
} else {
format = RD::DATA_FORMAT_R32_SFLOAT;
- usage_bits |= RD::TEXTURE_USAGE_CAN_COPY_TO_BIT | RD::TEXTURE_USAGE_STORAGE_BIT;
+ usage_bits |= RD::TEXTURE_USAGE_CAN_COPY_TO_BIT | (can_be_storage ? RD::TEXTURE_USAGE_STORAGE_BIT : 0);
}
create_texture(RB_SCOPE_BUFFERS, RB_TEX_DEPTH, format, usage_bits);