mirror of
https://gitee.com/openharmony/third_party_mesa3d
synced 2024-11-23 23:41:13 +00:00
gallivm: don't lower local invocation index in frontend
The frontend can't handle variable block sizes properly, so just lower it here in the backend. Fixes CTS basic local_linear_id + get_linear_ids Reviewed-by: Roland Scheidegger <sroland@vmware.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12285>
This commit is contained in:
parent
baf800b236
commit
c3bede9c96
@ -1695,6 +1695,7 @@ static void visit_intrinsic(struct lp_build_nir_context *bld_base,
|
||||
case nir_intrinsic_load_first_vertex:
|
||||
case nir_intrinsic_load_workgroup_id:
|
||||
case nir_intrinsic_load_local_invocation_id:
|
||||
case nir_intrinsic_load_local_invocation_index:
|
||||
case nir_intrinsic_load_num_workgroups:
|
||||
case nir_intrinsic_load_invocation_id:
|
||||
case nir_intrinsic_load_front_face:
|
||||
|
@ -1528,6 +1528,20 @@ static void emit_sysval_intrin(struct lp_build_nir_context *bld_base,
|
||||
for (unsigned i = 0; i < 3; i++)
|
||||
result[i] = LLVMBuildExtractValue(gallivm->builder, bld->system_values.thread_id, i, "");
|
||||
break;
|
||||
case nir_intrinsic_load_local_invocation_index: {
|
||||
LLVMValueRef tmp, tmp2;
|
||||
tmp = lp_build_broadcast_scalar(&bld_base->uint_bld, LLVMBuildExtractElement(gallivm->builder, bld->system_values.block_size, lp_build_const_int32(gallivm, 1), ""));
|
||||
tmp2 = lp_build_broadcast_scalar(&bld_base->uint_bld, LLVMBuildExtractElement(gallivm->builder, bld->system_values.block_size, lp_build_const_int32(gallivm, 0), ""));
|
||||
tmp = lp_build_mul(&bld_base->uint_bld, tmp, tmp2);
|
||||
tmp = lp_build_mul(&bld_base->uint_bld, tmp, LLVMBuildExtractValue(gallivm->builder, bld->system_values.thread_id, 2, ""));
|
||||
|
||||
tmp2 = lp_build_broadcast_scalar(&bld_base->uint_bld, LLVMBuildExtractElement(gallivm->builder, bld->system_values.block_size, lp_build_const_int32(gallivm, 0), ""));
|
||||
tmp2 = lp_build_mul(&bld_base->uint_bld, tmp2, LLVMBuildExtractValue(gallivm->builder, bld->system_values.thread_id, 1, ""));
|
||||
tmp = lp_build_add(&bld_base->uint_bld, tmp, tmp2);
|
||||
tmp = lp_build_add(&bld_base->uint_bld, tmp, LLVMBuildExtractValue(gallivm->builder, bld->system_values.thread_id, 0, ""));
|
||||
result[0] = tmp;
|
||||
break;
|
||||
}
|
||||
case nir_intrinsic_load_num_workgroups: {
|
||||
LLVMValueRef tmp[3];
|
||||
for (unsigned i = 0; i < 3; i++) {
|
||||
|
@ -595,7 +595,6 @@ static const struct nir_shader_compiler_options gallivm_nir_options = {
|
||||
.max_unroll_iterations = 32,
|
||||
.use_interpolated_input_intrinsics = true,
|
||||
.lower_to_scalar = true,
|
||||
.lower_cs_local_index_from_id = true,
|
||||
.lower_uniforms_to_ubo = true,
|
||||
.lower_vector_cmp = true,
|
||||
.lower_device_index_to_zero = true,
|
||||
|
Loading…
Reference in New Issue
Block a user