mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 21:50:12 +01:00
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:
parent
d216d32756
commit
c8f63e07da
7 changed files with 27 additions and 1 deletions
|
|
@ -148,6 +148,7 @@ compile_nir(struct d3d12_context *ctx, struct d3d12_shader_selector *sel,
|
|||
opts.provoking_vertex = key->fs.provoking_vertex;
|
||||
opts.input_clip_size = key->input_clip_size;
|
||||
opts.environment = DXIL_ENVIRONMENT_GL;
|
||||
opts.shader_model_max = SHADER_MODEL_6_2;
|
||||
|
||||
struct blob tmp;
|
||||
if (!nir_to_dxil(nir, &opts, &tmp)) {
|
||||
|
|
|
|||
|
|
@ -1113,6 +1113,7 @@ clc_spirv_to_dxil(struct clc_libclc *lib,
|
|||
.disable_math_refactoring = true,
|
||||
.num_kernel_globals = num_global_inputs,
|
||||
.environment = DXIL_ENVIRONMENT_CL,
|
||||
.shader_model_max = SHADER_MODEL_6_2,
|
||||
};
|
||||
|
||||
for (unsigned i = 0; i < out_dxil->kernel->num_args; i++) {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -145,6 +145,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_6_2,
|
||||
};
|
||||
struct blob dxil_blob;
|
||||
if (!nir_to_dxil(nir, &opts, &dxil_blob)) {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,10 @@ dzn_meta_compile_shader(struct dzn_device *device, nir_shader *nir,
|
|||
(instance->debug_flags & DZN_DEBUG_INTERNAL))
|
||||
nir_print_shader(nir, stderr);
|
||||
|
||||
struct nir_to_dxil_options opts = { .environment = DXIL_ENVIRONMENT_VULKAN };
|
||||
struct nir_to_dxil_options opts = {
|
||||
.environment = DXIL_ENVIRONMENT_VULKAN,
|
||||
.shader_model_max = SHADER_MODEL_6_2,
|
||||
};
|
||||
struct blob dxil_blob;
|
||||
ASSERTED bool ret = nir_to_dxil(nir, &opts, &dxil_blob);
|
||||
assert(ret);
|
||||
|
|
|
|||
|
|
@ -347,6 +347,7 @@ dzn_pipeline_compile_shader(struct dzn_device *device,
|
|||
container_of(device->vk.physical->instance, struct dzn_instance, vk);
|
||||
struct nir_to_dxil_options opts = {
|
||||
.environment = DXIL_ENVIRONMENT_VULKAN,
|
||||
.shader_model_max = SHADER_MODEL_6_2,
|
||||
};
|
||||
struct blob dxil_blob;
|
||||
VkResult result = VK_SUCCESS;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue