rusticl: skip lowering image/sampler derefs if drivers tells so

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19381>
This commit is contained in:
Karol Herbst 2022-09-26 00:07:29 +02:00 committed by Marge Bot
parent d459a58473
commit 0cd23a6ae2
2 changed files with 13 additions and 1 deletions

View file

@ -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(),

View file

@ -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(