Mesa (main): microsoft/spirv_to_dxil: check for variables r/w access
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jan 31 20:32:42 UTC 2022
Module: Mesa
Branch: main
Commit: e65303c6e681bc01b4ae4f93492fee7452952ac3
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e65303c6e681bc01b4ae4f93492fee7452952ac3
Author: Louis-Francis Ratté-Boulianne <lfrb at collabora.com>
Date: Tue Nov 9 22:54:29 2021 -0500
microsoft/spirv_to_dxil: check for variables r/w access
Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14765>
---
src/microsoft/spirv_to_dxil/spirv_to_dxil.c | 10 ++++++++++
src/microsoft/spirv_to_dxil/spirv_to_dxil.h | 4 ++++
2 files changed, 14 insertions(+)
diff --git a/src/microsoft/spirv_to_dxil/spirv_to_dxil.c b/src/microsoft/spirv_to_dxil/spirv_to_dxil.c
index 2e895b96741..50dda8d5f31 100644
--- a/src/microsoft/spirv_to_dxil/spirv_to_dxil.c
+++ b/src/microsoft/spirv_to_dxil/spirv_to_dxil.c
@@ -336,6 +336,16 @@ spirv_to_dxil(const uint32_t *words, size_t word_count,
conf->runtime_data_cbv.register_space,
conf->runtime_data_cbv.base_shader_register);
+ NIR_PASS_V(nir, nir_opt_deref);
+
+ if (conf->read_only_images_as_srvs) {
+ const nir_opt_access_options opt_access_options = {
+ .is_vulkan = true,
+ .infer_non_readable = true,
+ };
+ NIR_PASS_V(nir, nir_opt_access, &opt_access_options);
+ }
+
NIR_PASS_V(nir, nir_split_per_member_structs);
NIR_PASS_V(nir, nir_remove_dead_variables,
diff --git a/src/microsoft/spirv_to_dxil/spirv_to_dxil.h b/src/microsoft/spirv_to_dxil/spirv_to_dxil.h
index 6284355d159..23bcaeb8787 100644
--- a/src/microsoft/spirv_to_dxil/spirv_to_dxil.h
+++ b/src/microsoft/spirv_to_dxil/spirv_to_dxil.h
@@ -144,6 +144,10 @@ struct dxil_spirv_runtime_conf {
uint16_t y_mask;
uint16_t z_mask;
} yz_flip;
+
+ // The caller supports read-only images to be turned into SRV accesses,
+ // which allows us to run the nir_opt_access() pass
+ bool read_only_images_as_srvs;
};
struct dxil_spirv_debug_options {
More information about the mesa-commit
mailing list