Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite culling to be more cache/thread friendly. #44699

Merged
merged 1 commit into from
Dec 27, 2020

Conversation

reduz
Copy link
Member

@reduz reduz commented Dec 26, 2020

-Uses a single array with all data.
-Massive performance improvement (Ryzen 7, 10k objects, culling goes down from 4ms to 1.2ms).
-Does not support threads yet, but code is now thread friendly, so this should improve performance several times more eventually.

Plane near_plane(p_cam_transform.origin, -p_cam_transform.basis.get_axis(Vector3::AXIS_Z));
near_plane.d += p_cam_projection.get_z_near();
float z_max = p_cam_projection.get_z_far() - p_cam_projection.get_z_near();

uint32_t geometry_index = 0;

//fill list

for (int i = 0; i < (int)p_instances.size(); i++) {
InstanceBase *inst = p_instances[i];

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code was moved here from cull. I am not sure why it was in there originally, as it makes more sense here.

@reduz reduz force-pushed the cache-thread-friendly-culling branch 2 times, most recently from d7b8a98 to ae93dfc Compare December 26, 2020 14:00
servers/rendering/renderer_scene_cull.cpp Outdated Show resolved Hide resolved
servers/rendering/renderer_scene_cull.cpp Show resolved Hide resolved
servers/rendering/renderer_scene_cull.cpp Show resolved Hide resolved
servers/rendering/renderer_scene_cull.cpp Outdated Show resolved Hide resolved
servers/rendering/renderer_scene_cull.cpp Outdated Show resolved Hide resolved
servers/rendering/renderer_scene_cull.cpp Outdated Show resolved Hide resolved
-Uses a single array with all data
-Massive performance improvement
-Does not support threads yet, but code is now thread friendly
@reduz reduz force-pushed the cache-thread-friendly-culling branch from ae93dfc to 5485241 Compare December 26, 2020 22:12
@reduz reduz merged commit 3dc52c2 into godotengine:master Dec 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants