diff options
author | Kenneth Graunke <[email protected]> | 2019-12-22 15:43:51 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2019-12-22 16:18:30 -0800 |
commit | c96c1141fba7d94b4b3b048111d8858ecac7cf55 (patch) | |
tree | 7dc49923c79e262206165eebf31ff1f8b6cd19e5 /src/gallium | |
parent | 1ef4514c5bee5568140569573140e6791abef485 (diff) |
iris: Fix shader recompile debug printing
I was passing iris keys to brw_debug_key_recompile, leading to out of
bounds memory reads.
Fixes: 2e654db27a1 ("iris: Create smaller program keys without legacy features")
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/iris/iris_program.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c index 9e2f34f2b11..c162141a9f9 100644 --- a/src/gallium/drivers/iris/iris_program.c +++ b/src/gallium/drivers/iris/iris_program.c @@ -991,6 +991,7 @@ iris_debug_recompile(struct iris_context *ice, const struct brw_base_prog_key *key) { struct iris_screen *screen = (struct iris_screen *) ice->ctx.screen; + const struct gen_device_info *devinfo = &screen->devinfo; const struct brw_compiler *c = screen->compiler; if (!info) @@ -1001,10 +1002,35 @@ iris_debug_recompile(struct iris_context *ice, info->name ? info->name : "(no identifier)", info->label ? info->label : ""); - const void *old_key = + const void *old_iris_key = iris_find_previous_compile(ice, info->stage, key->program_string_id); - brw_debug_key_recompile(c, &ice->dbg, info->stage, old_key, key); + union brw_any_prog_key old_key; + + switch (info->stage) { + case MESA_SHADER_VERTEX: + old_key.vs = iris_to_brw_vs_key(devinfo, old_iris_key); + break; + case MESA_SHADER_TESS_CTRL: + old_key.tcs = iris_to_brw_tcs_key(devinfo, old_iris_key); + break; + case MESA_SHADER_TESS_EVAL: + old_key.tes = iris_to_brw_tes_key(devinfo, old_iris_key); + break; + case MESA_SHADER_GEOMETRY: + old_key.gs = iris_to_brw_gs_key(devinfo, old_iris_key); + break; + case MESA_SHADER_FRAGMENT: + old_key.wm = iris_to_brw_fs_key(devinfo, old_iris_key); + break; + case MESA_SHADER_COMPUTE: + old_key.cs = iris_to_brw_cs_key(devinfo, old_iris_key); + break; + default: + unreachable("invalid shader stage"); + } + + brw_debug_key_recompile(c, &ice->dbg, info->stage, &old_key.base, key); } /** |