-
-
Notifications
You must be signed in to change notification settings - Fork 21.7k
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
Rewrote how barriers work for faster rendering #45672
Conversation
8d25277
to
846a049
Compare
Tried out Windows artifact from Github Actions, editor crashes when removing material from MeshInstance. Stacktrace:
Specs: Windows 10 / Nvidia GeForce GTX 1080 Ti (457.30) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a brief review, but didn't get through renderer_scene_render_rd. I will take another look tomorrow night.
Do we still need to do a pass over the rest of the effects in effects_rd.cpp to optimize barrier usage?
846a049
to
388b576
Compare
_fill_render_list(RENDER_LIST_SECONDARY, p_instances, pass_mode, p_projection, p_transform, false, false, p_camera_plane, p_lod_distance_multiplier, p_screen_lod_threshold, true); | ||
uint32_t render_list_size = render_list[RENDER_LIST_SECONDARY].elements.size() - render_list_from; | ||
render_list[RENDER_LIST_SECONDARY].sort_by_key_range(render_list_from, render_list_size); | ||
_fill_instance_data(RENDER_LIST_SECONDARY, render_list_from, render_list_size, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While testing, I got a crash in RendererSceneRenderForward::_fill_instance_data()
because it was being called from here with render_list_size = 0
.
My understanding is that _fill_render_list()
did not add any elements for some reason. I got the crash by changing the scale of a MeshInstance in the inspector, but I could only reproduce this once.
@reduz Do you think we should just guard against this possibility? Or we should look into why _fill_render_list()
didn't add any elements to the render list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should not be a problem, I tested with zero elements and seems to work ok, if you can figure out how to reproduce it again that would be great, else I guess we will eventually rely on user reports to track this down.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be more precise, it crashed at renderer_scene_render_forward.cpp
line 1300.
total_elements
was 10, the size of instance_data
was also 10, and p_offset
was 10 as well. This made me think this line:
uint32_t element_total = p_max_elements > 0 ? p_max_elements : rl->elements.size();
may be incorrect, because in this case there were 0 elements in total.
Maybe the check needs to be p_max_elements >= 0
and the default argument value should be -1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look like it was the correct fix, then? :)
When running https://github.com/qarmin/RegressionTestProject/archive/4.0.zip
Time can be adjusted by adding at the end argument with time in seconds
|
@qarmin you are my hero, as always |
388b576
to
0b30f19
Compare
Ok, if no further crashes found, we can merge. |
0b30f19
to
af2dbc5
Compare
dst_stage_mask = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT; | ||
} | ||
|
||
_buffer_memory_barrier(buffer->buffer, p_offset, p_size, VK_PIPELINE_STAGE_TRANSFER_BIT, dst_stage_mask, VK_ACCESS_TRANSFER_WRITE_BIT, dst_access, dst_stage_mask); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't there be a check if p_post_barrier != RD::BARRIER_MASK_NO_BARRIER
@clayjohn I really can't reproduce the crash, so any help with the debugger I would greatly appreciate |
-Added more finegrained control in RenderingDevice API -Optimized barriers (use less ones for thee same) -General optimizations -Shadows render all together unbarriered -GI can render together with shadows. -SDFGI can render together with depth-preoass. -General fixes -Added GPU detection
af2dbc5
to
f20999f
Compare
Video of crash:0001-0671.mp4 |
OK, crash and broken Sponza should be both fixed. |
Can confirm - crashes are gone 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets merge now that crashes are gone. I can confirm Sponza is fixed. I'm sure there are other bugs that we haven't uncovered yet. But I think it is ready to merge so you can move on.
Thanks! |
-Added more finegrained control in RenderingDevice API
-Optimized barriers (use less ones for thee same)
-General optimizations
-Shadows render all together unbarriered
-GI can render together with shadows.
-SDFGI can render together with depth-preoass.
-General fixes