From 0cd23a6ae2071067a72ff52d9ed6e5e925d5e5ce Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Mon, 26 Sep 2022 00:07:29 +0200 Subject: [PATCH] rusticl: skip lowering image/sampler derefs if drivers tells so Signed-off-by: Karol Herbst Part-of: --- src/gallium/frontends/rusticl/core/device.rs | 8 ++++++++ src/gallium/frontends/rusticl/core/kernel.rs | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/gallium/frontends/rusticl/core/device.rs b/src/gallium/frontends/rusticl/core/device.rs index b8f1a2d9dff..5a73f6f389c 100644 --- a/src/gallium/frontends/rusticl/core/device.rs +++ b/src/gallium/frontends/rusticl/core/device.rs @@ -742,6 +742,14 @@ impl Device { self.screen.param(pipe_cap::PIPE_CAP_SHAREABLE_SHADERS) == 1 } + pub fn images_as_deref(&self) -> bool { + self.screen.param(pipe_cap::PIPE_CAP_NIR_IMAGES_AS_DEREF) == 1 + } + + pub fn samplers_as_deref(&self) -> bool { + self.screen.param(pipe_cap::PIPE_CAP_NIR_SAMPLERS_AS_DEREF) == 1 + } + pub fn helper_ctx(&self) -> impl HelperContextWrapper + '_ { HelperContext { lock: self.helper_ctx.lock().unwrap(), diff --git a/src/gallium/frontends/rusticl/core/kernel.rs b/src/gallium/frontends/rusticl/core/kernel.rs index 5023336c7ff..2d35682fc43 100644 --- a/src/gallium/frontends/rusticl/core/kernel.rs +++ b/src/gallium/frontends/rusticl/core/kernel.rs @@ -534,7 +534,11 @@ fn lower_and_optimize_nir_late( } nir.pass1(nir_lower_readonly_images_to_tex, true); - nir.pass2(nir_lower_cl_images, true, true); + nir.pass2( + nir_lower_cl_images, + !dev.images_as_deref(), + !dev.samplers_as_deref(), + ); nir.reset_scratch_size(); nir.pass2(