mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-24 04:08:10 +02:00
jay/lower_scoreboard: add asserts on key bounds
if these are botched you get UB (-: Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41688>
This commit is contained in:
parent
4c97493b69
commit
4b0c3f5c32
1 changed files with 3 additions and 1 deletions
|
|
@ -157,6 +157,7 @@ lower_send_local(jay_function *func, jay_block *block)
|
|||
typedef uint32_t u32_per_pipe[TGL_NUM_PIPES];
|
||||
|
||||
struct swsb_state {
|
||||
uint32_t nr_keys;
|
||||
unsigned ip[TGL_NUM_PIPES];
|
||||
unsigned last_shape[TGL_NUM_PIPES];
|
||||
|
||||
|
|
@ -232,6 +233,7 @@ depend_on_writer(struct swsb_state *state,
|
|||
bool except_exec)
|
||||
{
|
||||
for (unsigned i = 0; i < r.width; ++i) {
|
||||
assert(r.base + i < state->nr_keys);
|
||||
uint32_t w = state->access[r.base + i][0];
|
||||
enum tgl_pipe write = writer_pipe(w);
|
||||
|
||||
|
|
@ -466,7 +468,7 @@ jay_lower_scoreboard(jay_shader *shader)
|
|||
|
||||
jay_foreach_function(shader, f) {
|
||||
memset(access, 0, sizeof(*access) * nr_keys);
|
||||
struct swsb_state state = { .access = access };
|
||||
struct swsb_state state = { .nr_keys = nr_keys, .access = access };
|
||||
|
||||
jay_foreach_block(f, block) {
|
||||
lower_send_local(f, block);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue