microsoft/spirv_to_dxil: check for variables r/w access

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14765>
This commit is contained in:
Louis-Francis Ratté-Boulianne 2021-11-09 22:54:29 -05:00 committed by Marge Bot
parent 39592f8ad4
commit e65303c6e6
2 changed files with 14 additions and 0 deletions

View file

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

View file

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