From ea429b90b755d6fc34f4fa9f7473c33920173341 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 26 Sep 2022 09:38:44 -0400 Subject: [PATCH] lavapipe: store compiler options to physical device this minimizes noise in gallium trace Reviewed-by: Roland Scheidegger Part-of: --- src/gallium/frontends/lavapipe/lvp_device.c | 2 ++ src/gallium/frontends/lavapipe/lvp_pipeline.c | 3 +-- src/gallium/frontends/lavapipe/lvp_private.h | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gallium/frontends/lavapipe/lvp_device.c b/src/gallium/frontends/lavapipe/lvp_device.c index 941ec0d..bdc9911 100644 --- a/src/gallium/frontends/lavapipe/lvp_device.c +++ b/src/gallium/frontends/lavapipe/lvp_device.c @@ -240,6 +240,8 @@ lvp_physical_device_init(struct lvp_physical_device *device, device->pscreen = pipe_loader_create_screen_vk(device->pld, true); if (!device->pscreen) return vk_error(instance, VK_ERROR_OUT_OF_HOST_MEMORY); + for (unsigned i = 0; i < ARRAY_SIZE(device->drv_options); i++) + device->drv_options[i] = device->pscreen->get_compiler_options(device->pscreen, PIPE_SHADER_IR_NIR, i); device->sync_timeline_type = vk_sync_timeline_get_type(&lvp_pipe_sync_type); device->sync_types[0] = &lvp_pipe_sync_type; diff --git a/src/gallium/frontends/lavapipe/lvp_pipeline.c b/src/gallium/frontends/lavapipe/lvp_pipeline.c index 14f359e..87d9da5 100644 --- a/src/gallium/frontends/lavapipe/lvp_pipeline.c +++ b/src/gallium/frontends/lavapipe/lvp_pipeline.c @@ -364,7 +364,6 @@ lvp_shader_compile_to_ir(struct lvp_pipeline *pipeline, struct lvp_device *pdevice = pipeline->device; gl_shader_stage stage = vk_to_mesa_shader_stage(sinfo->stage); assert(stage <= MESA_SHADER_COMPUTE && stage != MESA_SHADER_NONE); - const nir_shader_compiler_options *drv_options = pdevice->pscreen->get_compiler_options(pipeline->device->pscreen, PIPE_SHADER_IR_NIR, (enum pipe_shader_type)stage); VkResult result; nir_shader *nir; @@ -420,7 +419,7 @@ lvp_shader_compile_to_ir(struct lvp_pipeline *pipeline, }; result = vk_pipeline_shader_stage_to_nir(&pdevice->vk, sinfo, - &spirv_options, drv_options, + &spirv_options, pdevice->physical_device->drv_options[stage], NULL, &nir); if (result != VK_SUCCESS) return result; diff --git a/src/gallium/frontends/lavapipe/lvp_private.h b/src/gallium/frontends/lavapipe/lvp_private.h index fe2b767..d928d74 100644 --- a/src/gallium/frontends/lavapipe/lvp_private.h +++ b/src/gallium/frontends/lavapipe/lvp_private.h @@ -126,6 +126,7 @@ struct lvp_physical_device { struct pipe_loader_device *pld; struct pipe_screen *pscreen; + const nir_shader_compiler_options *drv_options[MESA_SHADER_STAGES]; uint32_t max_images; struct vk_sync_timeline_type sync_timeline_type; -- 2.7.4