lima: lower bool to float when building shaders
Both processors of Mali Utgard are float-only, so bool are not acceptable data type of them. Fortunately the NIR compiler infrastructure has a lower pass to lower bool to float. Call this lower pass to lower bool to float for both GP and PP. This makes Glamor on Xorg server 1.20.3 at least doesn't hang when starting gtk3-demo. The old map of nir op bcsel is changed to fcsel, and the map of b2f32 in PP is dropped because it's not needed now (it's originally only mapped to ppir_op_mov). Signed-off-by: Icenowy Zheng <icenowy@aosc.io> Reviewed-by: Qiang Yu <yuq825@gmail.com>
This commit is contained in:
@@ -111,7 +111,7 @@ static int nir_to_gpir_opcodes[nir_num_opcodes] = {
|
||||
[nir_op_frsq] = gpir_op_rsqrt,
|
||||
[nir_op_slt] = gpir_op_lt,
|
||||
[nir_op_sge] = gpir_op_ge,
|
||||
[nir_op_bcsel] = gpir_op_select,
|
||||
[nir_op_fcsel] = gpir_op_select,
|
||||
[nir_op_ffloor] = gpir_op_floor,
|
||||
[nir_op_fsign] = gpir_op_sign,
|
||||
[nir_op_seq] = gpir_op_eq,
|
||||
|
@@ -147,9 +147,8 @@ static int nir_to_ppir_opcodes[nir_num_opcodes] = {
|
||||
[nir_op_sne] = ppir_op_ne,
|
||||
[nir_op_fne] = ppir_op_ne,
|
||||
[nir_op_fnot] = ppir_op_not,
|
||||
[nir_op_bcsel] = ppir_op_select,
|
||||
[nir_op_fcsel] = ppir_op_select,
|
||||
[nir_op_inot] = ppir_op_not,
|
||||
[nir_op_b2f32] = ppir_op_mov,
|
||||
};
|
||||
|
||||
static ppir_node *ppir_emit_alu(ppir_block *block, nir_instr *ni)
|
||||
|
@@ -89,6 +89,7 @@ lima_program_optimize_vs_nir(struct nir_shader *s)
|
||||
NIR_PASS_V(s, lima_nir_lower_uniform_to_scalar);
|
||||
NIR_PASS_V(s, nir_lower_io_to_scalar,
|
||||
nir_var_shader_in|nir_var_shader_out);
|
||||
NIR_PASS_V(s, nir_lower_bool_to_float);
|
||||
|
||||
do {
|
||||
progress = false;
|
||||
@@ -124,6 +125,7 @@ lima_program_optimize_fs_nir(struct nir_shader *s)
|
||||
|
||||
NIR_PASS_V(s, nir_lower_io, nir_var_all, type_size, 0);
|
||||
NIR_PASS_V(s, nir_lower_regs_to_ssa);
|
||||
NIR_PASS_V(s, nir_lower_bool_to_float);
|
||||
|
||||
do {
|
||||
progress = false;
|
||||
|
Reference in New Issue
Block a user