spirv2dxil: Move shader model into runtime conf struct

We'll want to use it to control the shape of the nir that we generate

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21029>
This commit is contained in:
Jesse Natalie 2023-02-01 10:52:57 -08:00 committed by Marge Bot
parent 4c527f4fc0
commit 536ab16bc1
4 changed files with 11 additions and 7 deletions

View file

@ -75,7 +75,6 @@ struct shader {
bool validate = false, debug = false;
enum dxil_validator_version val_ver = DXIL_VALIDATOR_1_4;
enum dxil_shader_model shader_model = SHADER_MODEL_6_2;
struct nir_shader_compiler_options nir_options;
@ -187,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.shader_model_max = SHADER_MODEL_6_2;
bool any_shaders = false;
while ((ch = getopt_long(argc, argv, "-s:e:o:m:x:vd", long_options, NULL)) !=
@ -213,8 +213,8 @@ main(int argc, char **argv)
debug = true;
break;
case 'm':
shader_model = SHADER_MODEL_6_0 + atoi(optarg);
nir_options.lower_helper_invocation = shader_model < SHADER_MODEL_6_6;
conf.shader_model_max = SHADER_MODEL_6_0 + atoi(optarg);
nir_options.lower_helper_invocation = conf.shader_model_max < SHADER_MODEL_6_6;
break;
case 'x':
val_ver = DXIL_VALIDATOR_1_0 + atoi(optarg);
@ -250,7 +250,7 @@ main(int argc, char **argv)
struct nir_to_dxil_options opts = {
.environment = DXIL_ENVIRONMENT_VULKAN,
.shader_model_max = shader_model,
.shader_model_max = conf.shader_model_max,
.validator_version_max = val_ver,
};

View file

@ -46,7 +46,6 @@ spirv_to_dxil(const uint32_t *words, size_t word_count,
struct dxil_spirv_specialization *specializations,
unsigned int num_specializations, dxil_spirv_shader_stage stage,
const char *entry_point_name,
enum dxil_shader_model shader_model_max,
enum dxil_validator_version validator_version_max,
const struct dxil_spirv_debug_options *dgb_opts,
const struct dxil_spirv_runtime_conf *conf,
@ -60,7 +59,7 @@ spirv_to_dxil(const uint32_t *words, size_t word_count,
struct nir_to_dxil_options opts = {
.environment = DXIL_ENVIRONMENT_VULKAN,
.shader_model_max = shader_model_max,
.shader_model_max = conf->shader_model_max,
.validator_version_max = validator_version_max,
};

View file

@ -174,6 +174,9 @@ struct dxil_spirv_runtime_conf {
bool lower_view_index;
// View index also needs to be forwarded to RT layer output
bool lower_view_index_to_rt_layer;
// Affects which features can be used by the shader
enum dxil_shader_model shader_model_max;
};
struct dxil_spirv_debug_options {
@ -204,7 +207,6 @@ spirv_to_dxil(const uint32_t *words, size_t word_count,
struct dxil_spirv_specialization *specializations,
unsigned int num_specializations, dxil_spirv_shader_stage stage,
const char *entry_point_name,
enum dxil_shader_model shader_model_max,
enum dxil_validator_version validator_version_max,
const struct dxil_spirv_debug_options *debug_options,
const struct dxil_spirv_runtime_conf *conf,

View file

@ -215,6 +215,8 @@ dzn_pipeline_get_nir_shader(struct dzn_device *device,
return VK_SUCCESS;
}
struct dzn_physical_device *pdev =
container_of(device->vk.physical, struct dzn_physical_device, vk);
VK_FROM_HANDLE(vk_shader_module, module, stage_info->module);
const struct spirv_to_nir_options *spirv_opts = dxil_spirv_nir_get_spirv_options();
@ -245,6 +247,7 @@ dzn_pipeline_get_nir_shader(struct dzn_device *device,
.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,
.shader_model_max = dzn_get_shader_model(pdev),
};
bool requires_runtime_data;