spirv2dxil: Split read-only image as SRV logic into declared and inferred

Fixes: e0a090ad ("spirv2dxil: Only lower readonly images to SRVs when the option is set")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22289>
This commit is contained in:
Pedro J. Estébanez
2023-04-04 18:51:42 +02:00
committed by Marge Bot
parent 9663546cf4
commit e59fdcb93c
4 changed files with 10 additions and 4 deletions
+2 -2
View File
@@ -1000,7 +1000,7 @@ dxil_spirv_nir_passes(nir_shader *nir,
nir_var_mem_ubo | nir_var_mem_push_const |
nir_var_mem_ssbo);
if (conf->read_only_images_as_srvs) {
if (conf->inferred_read_only_images_as_srvs) {
const nir_opt_access_options opt_access_options = {
.is_vulkan = true,
};
@@ -1088,7 +1088,7 @@ dxil_spirv_nir_passes(nir_shader *nir,
} while (progress);
}
if (conf->read_only_images_as_srvs)
if (conf->declared_read_only_images_as_srvs)
NIR_PASS_V(nir, nir_lower_readonly_images_to_tex, true);
nir_lower_tex_options lower_tex_options = {
.lower_txp = UINT32_MAX,
+1
View File
@@ -186,6 +186,7 @@ main(int argc, char **argv)
conf.runtime_data_cbv.base_shader_register = 0;
conf.runtime_data_cbv.register_space = 31;
conf.zero_based_vertex_instance_id = true;
conf.declared_read_only_images_as_srvs = true;
conf.shader_model_max = SHADER_MODEL_6_2;
bool any_shaders = false;
+5 -1
View File
@@ -165,7 +165,11 @@ struct dxil_spirv_runtime_conf {
// 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;
bool declared_read_only_images_as_srvs;
// The caller supports read-write images to be turned into SRV accesses,
// if they are found not to be written
bool inferred_read_only_images_as_srvs;
// Force sample rate shading on a fragment shader
bool force_sample_rate_shading;
+2 -1
View File
@@ -243,7 +243,8 @@ dzn_pipeline_get_nir_shader(struct dzn_device *device,
.y_mask = options->y_flip_mask,
.z_mask = options->z_flip_mask,
},
.read_only_images_as_srvs = !device->bindless,
.declared_read_only_images_as_srvs = !device->bindless,
.inferred_read_only_images_as_srvs = !device->bindless,
.force_sample_rate_shading = options->force_sample_rate_shading,
.lower_view_index = options->lower_view_index,
.lower_view_index_to_rt_layer = options->lower_view_index_to_rt_layer,