-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Use specialization constants in clustered renderer #50402
Conversation
* Keep track of when projector, softshadow or directional sofshadow were enabled. * Enable them via specializaton constant where it makes sense. * Re-implements soft shadows. * Re-implements light projectors.
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.
Looks good to me!
@@ -6047,7 +6045,7 @@ RID RenderingDeviceVulkan::render_pipeline_create(RID p_shader, FramebufferForma | |||
const PipelineSpecializationConstant &psc = p_specialization_constants[j]; | |||
if (psc.constant_id == sc.constant.constant_id) { | |||
ERR_FAIL_COND_V_MSG(psc.type != sc.constant.type, RID(), "Specialization constant provided for id (" + itos(sc.constant.constant_id) + ") is of the wrong type."); | |||
data_ptr[i] = sc.constant.int_value; | |||
data_ptr[i] = psc.int_value; |
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.
took the chance to fix this bug
|
||
pipeline_stages.write[k].pSpecializationInfo = specialization_info.ptr(); | ||
pipeline_stages.write[i].pSpecializationInfo = specialization_info.ptr() + i; |
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.
this also a bugfix
@@ -318,11 +318,11 @@ void RenderForwardClustered::_render_list_template(RenderingDevice::DrawListID p | |||
RID prev_pipeline_rd; | |||
RID prev_xforms_uniform_set; | |||
|
|||
bool shadow_pass = (p_params->pass_mode == PASS_MODE_SHADOW) || (p_params->pass_mode == PASS_MODE_SHADOW_DP); | |||
bool shadow_pass = (p_pass_mode == PASS_MODE_SHADOW) || (p_pass_mode == PASS_MODE_SHADOW_DP); |
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.
these should be using p_pass_mode which is resolved at compile time for more performance., so replaced it.
Need to look at this more closely but sounds like a good way to improve multiview as well, instead of using defines add a constant in. Though not sure if that would rhyme well with us not wanting to compile any multiview shaders if XR is not enabled. |
@BastiaanOlij specialization constants work as long as you dont add any new input or output to the shaders, not sure if this is the case with multiview, but probably not. |
Hmmm, thats a good point because Multiview adds the gl_ViewIndex built-in input. |
Bugsquad edit: Follow-up to #50325. This closes #45733 and closes #50094.