bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Drop in fps when drawing a spheres at the same position

Open Bcompartment opened this issue 2 years ago • 1 comments

Bevy version

0.9, 0.10

System information

OS: Win 10 AdapterInfo { name: "AMD Radeon(TM) Graphics", vendor: 4098, device: 5686, device_type: IntegratedGpu, driver: "AMD proprietary driver", driver_info: "21.3.1", backend: Vulkan }

What you did

Created scene with many spheres

What went wrong

I experiencing a big drop in fps when drawing a N=1000+ of spheres at the same position compared to when they are drawn in different positions (use small random delta vector with magnitude<3f32). In discord user suggested that quote: "Looking at trace captures, the same position case shows the prepare set systems all taking a long time and then finishing at about the same time. This means the GPU is busy using the buffers that the prepare systems want to update so they have to wait"

If it's not clear, break this out into: -Spheres spawned on startup; -Tested on Bevy 0.9, 0.10; -Tested on N range(1000-20000); -All spheres inside camera view; -All spheres Visibility::Visible; -All spheres using PbrBundle;

Additional information

Other information that can be used to further reproduce or isolate the problem. - screenshots Screenshot_48 Screenshot_47 Screenshot_46 Screenshot_45 Screenshot_44 Screenshot_43 - link to discussion https://discord.com/channels/691052431525675048/1083114604391051334

Bcompartment avatar Mar 09 '23 18:03 Bcompartment

My hunch is that shading the same fragment multiple times causes more problems than just the cost of shading the fragment multiple times, in the sense that it causes some additional serialisation of GPU processing. This is based on the fact that drawing the spheres at different locations doesn't have the performance problem.

superdump avatar Mar 09 '23 21:03 superdump