mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-19 19:18:21 +02:00
intel/fs: Stop stack allocating large arrays
Normally, we haven't worried too much about stack sizes as Linux tends
to be fairly friendly towards large stacks. However, when running DXVK
apps under wine, we're suddenly subject to Windows' more stringent stack
limitations and can run out of space more easily. In particular, some
of the shaders in Elite Dangerous: Horizons have quite a few registers
and the arrays in split_virtual_grfs are large enough to blow a 1 MiB
stack leading to crashes during shader compilation.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108662
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: mesa-stable@lists.freedesktop.org
(cherry picked from commit fa63fad333)
This commit is contained in:
parent
87efbe488e
commit
3cd11985c0
1 changed files with 12 additions and 6 deletions
|
|
@ -1890,8 +1890,8 @@ fs_visitor::split_virtual_grfs()
|
|||
* destination), we mark the used slots as inseparable. Then we go
|
||||
* through and split the registers into the smallest pieces we can.
|
||||
*/
|
||||
bool split_points[reg_count];
|
||||
memset(split_points, 0, sizeof(split_points));
|
||||
bool *split_points = new bool[reg_count];
|
||||
memset(split_points, 0, reg_count * sizeof(*split_points));
|
||||
|
||||
/* Mark all used registers as fully splittable */
|
||||
foreach_block_and_inst(block, fs_inst, inst, cfg) {
|
||||
|
|
@ -1925,8 +1925,8 @@ fs_visitor::split_virtual_grfs()
|
|||
}
|
||||
}
|
||||
|
||||
int new_virtual_grf[reg_count];
|
||||
int new_reg_offset[reg_count];
|
||||
int *new_virtual_grf = new int[reg_count];
|
||||
int *new_reg_offset = new int[reg_count];
|
||||
|
||||
int reg = 0;
|
||||
for (int i = 0; i < num_vars; i++) {
|
||||
|
|
@ -1982,6 +1982,10 @@ fs_visitor::split_virtual_grfs()
|
|||
}
|
||||
}
|
||||
invalidate_live_intervals();
|
||||
|
||||
delete[] split_points;
|
||||
delete[] new_virtual_grf;
|
||||
delete[] new_reg_offset;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1997,8 +2001,8 @@ bool
|
|||
fs_visitor::compact_virtual_grfs()
|
||||
{
|
||||
bool progress = false;
|
||||
int remap_table[this->alloc.count];
|
||||
memset(remap_table, -1, sizeof(remap_table));
|
||||
int *remap_table = new int[this->alloc.count];
|
||||
memset(remap_table, -1, this->alloc.count * sizeof(int));
|
||||
|
||||
/* Mark which virtual GRFs are used. */
|
||||
foreach_block_and_inst(block, const fs_inst, inst, cfg) {
|
||||
|
|
@ -2054,6 +2058,8 @@ fs_visitor::compact_virtual_grfs()
|
|||
}
|
||||
}
|
||||
|
||||
delete[] remap_table;
|
||||
|
||||
return progress;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue