microsoft/spirv_to_dxil: Properly handle load- and is_helper_invocation
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19908>
This commit is contained in:
committed by
Marge Bot
parent
e22491c832
commit
b2c4338862
@@ -4559,7 +4559,7 @@ emit_intrinsic(struct ntd_context *ctx, nir_intrinsic_instr *intr)
|
||||
case nir_intrinsic_load_sample_pos_from_id:
|
||||
return emit_load_sample_pos_from_id(ctx, intr);
|
||||
|
||||
case nir_intrinsic_load_helper_invocation:
|
||||
case nir_intrinsic_is_helper_invocation:
|
||||
return emit_load_unary_external_function(
|
||||
ctx, intr, "dx.op.isHelperLane", DXIL_INTR_IS_HELPER_LANE);
|
||||
|
||||
@@ -6097,6 +6097,12 @@ nir_to_dxil(struct nir_shader *s, const struct nir_to_dxil_options *opts,
|
||||
NIR_PASS_V(s, nir_lower_pack);
|
||||
NIR_PASS_V(s, dxil_nir_lower_system_values);
|
||||
NIR_PASS_V(s, nir_lower_io_to_scalar, nir_var_shader_in | nir_var_system_value | nir_var_shader_out);
|
||||
if (opts->shader_model_max < SHADER_MODEL_6_6) {
|
||||
/* In a later pass, load_helper_invocation will be lowered to sample mask based fallback,
|
||||
* so both load- and is- will be emulated eventually.
|
||||
*/
|
||||
NIR_PASS_V(s, nir_lower_is_helper_invocation);
|
||||
}
|
||||
|
||||
if (ctx->mod.shader_kind == DXIL_HULL_SHADER)
|
||||
NIR_PASS_V(s, dxil_nir_split_tess_ctrl, &ctx->tess_ctrl_patch_constant_func);
|
||||
|
||||
@@ -630,6 +630,12 @@ dxil_spirv_nir_passes(nir_shader *nir,
|
||||
.use_layer_id_sysval = true,
|
||||
});
|
||||
|
||||
/* This will lower load_helper to a memoized is_helper if needed; otherwise, load_helper
|
||||
* will stay, but trivially translatable to IsHelperLane(), which will be known to be
|
||||
* constant across the invocation since no demotion would have been used.
|
||||
*/
|
||||
NIR_PASS_V(nir, nir_lower_discard_or_demote, nir->info.use_legacy_math_rules);
|
||||
|
||||
NIR_PASS_V(nir, dxil_nir_lower_discard_and_terminate);
|
||||
NIR_PASS_V(nir, nir_lower_returns);
|
||||
NIR_PASS_V(nir, dxil_nir_lower_sample_pos);
|
||||
|
||||
Reference in New Issue
Block a user