diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2021-11-28 18:51:36 +0100 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2021-11-28 18:51:36 +0100 |
commit | 565f9c0448cabfffbca76003143893a9f5afc3dc (patch) | |
tree | d058e61ad9dc344125d57b067c7a3eda5e7c7afc | |
parent | 69a194f051c5f02243092e305633b9ffbd03b05f (diff) |
Use 16-bit depth to improve dynamic VoxelGI performance
In a complex scene with several dynamic emissive objects, this
saves over 1 ms of GPU time on a GTX 1080 in 2560×1440.
-rw-r--r-- | servers/rendering/renderer_rd/renderer_scene_gi_rd.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/servers/rendering/renderer_rd/renderer_scene_gi_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_gi_rd.cpp index b6b5c90b39..26adb07a6c 100644 --- a/servers/rendering/renderer_rd/renderer_scene_gi_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_scene_gi_rd.cpp @@ -2182,8 +2182,9 @@ void RendererSceneGIRD::VoxelGIInstance::update(bool p_update_light_instances, c dmap.texture = RD::get_singleton()->texture_create(dtf, RD::TextureView()); if (dynamic_maps.size() == 0) { - //render depth for first one - dtf.format = RD::get_singleton()->texture_is_format_supported_for_usage(RD::DATA_FORMAT_D32_SFLOAT, RD::TEXTURE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) ? RD::DATA_FORMAT_D32_SFLOAT : RD::DATA_FORMAT_X8_D24_UNORM_PACK32; + // Render depth for first one. + // Use 16-bit depth when supported to improve performance. + dtf.format = RD::get_singleton()->texture_is_format_supported_for_usage(RD::DATA_FORMAT_D16_UNORM, RD::TEXTURE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) ? RD::DATA_FORMAT_D16_UNORM : RD::DATA_FORMAT_X8_D24_UNORM_PACK32; dtf.usage_bits = RD::TEXTURE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; dmap.fb_depth = RD::get_singleton()->texture_create(dtf, RD::TextureView()); } |