lavapipe: store compiler options to physical device
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 26 Sep 2022 13:38:44 +0000 (09:38 -0400)
committerMarge Bot <emma+marge@anholt.net>
Thu, 13 Oct 2022 04:17:28 +0000 (04:17 +0000)
this minimizes noise in gallium trace

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18867>

src/gallium/frontends/lavapipe/lvp_device.c
src/gallium/frontends/lavapipe/lvp_pipeline.c
src/gallium/frontends/lavapipe/lvp_private.h

index 941ec0d..bdc9911 100644 (file)
@@ -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;
index 14f359e..87d9da5 100644 (file)
@@ -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;
index fe2b767..d928d74 100644 (file)
@@ -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;