microsoft/compiler: Add a max shader model option
Reviewed-by: Enrico Galli <enrico.galli@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17603>
This commit is contained in:
@@ -5703,6 +5703,11 @@ nir_to_dxil(struct nir_shader *s, const struct nir_to_dxil_options *opts,
|
||||
debug_dxil = (int)debug_get_option_debug_dxil();
|
||||
blob_init(blob);
|
||||
|
||||
if (opts->shader_model_max < SHADER_MODEL_6_1) {
|
||||
debug_printf("D3D12: cannot support emitting shader model 6.0 or lower\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
struct ntd_context *ctx = calloc(1, sizeof(*ctx));
|
||||
if (!ctx)
|
||||
return false;
|
||||
@@ -5775,6 +5780,13 @@ nir_to_dxil(struct nir_shader *s, const struct nir_to_dxil_options *opts,
|
||||
goto out;
|
||||
}
|
||||
|
||||
assert(ctx->mod.major_version == 6 && ctx->mod.minor_version >= 1);
|
||||
if ((ctx->mod.major_version << 16 | ctx->mod.minor_version) > opts->shader_model_max) {
|
||||
debug_printf("D3D12: max shader model exceeded\n");
|
||||
retval = false;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (debug_dxil & DXIL_DEBUG_DUMP_MODULE) {
|
||||
struct dxil_dumper *dumper = dxil_dump_create();
|
||||
dxil_dump_module(dumper, &ctx->mod);
|
||||
|
||||
@@ -80,6 +80,12 @@ enum dxil_environment {
|
||||
DXIL_ENVIRONMENT_VULKAN,
|
||||
};
|
||||
|
||||
enum dxil_shader_model {
|
||||
SHADER_MODEL_6_0 = 0x60000,
|
||||
SHADER_MODEL_6_1,
|
||||
SHADER_MODEL_6_2,
|
||||
};
|
||||
|
||||
struct nir_to_dxil_options {
|
||||
bool interpolate_at_vertex;
|
||||
bool lower_int16;
|
||||
@@ -90,6 +96,7 @@ struct nir_to_dxil_options {
|
||||
unsigned num_kernel_globals;
|
||||
unsigned input_clip_size;
|
||||
enum dxil_environment environment;
|
||||
uint32_t shader_model_max;
|
||||
};
|
||||
|
||||
bool
|
||||
|
||||
Reference in New Issue
Block a user