vkd3d-shader: Refactor out quirk selection.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
This commit is contained in:
parent
4a774f872c
commit
2152500014
|
@ -770,6 +770,9 @@ int vkd3d_shader_compile_dxil_export(const struct vkd3d_shader_code *dxil,
|
|||
const struct vkd3d_shader_interface_local_info *shader_interface_local_info,
|
||||
const struct vkd3d_shader_compile_arguments *compiler_args);
|
||||
|
||||
uint32_t vkd3d_shader_compile_arguments_select_quirks(
|
||||
const struct vkd3d_shader_compile_arguments *args, vkd3d_shader_hash_t hash);
|
||||
|
||||
#endif /* VKD3D_SHADER_NO_PROTOTYPES */
|
||||
|
||||
/*
|
||||
|
|
|
@ -2364,25 +2364,11 @@ struct vkd3d_dxbc_compiler *vkd3d_dxbc_compiler_create(const struct vkd3d_shader
|
|||
memset(compiler, 0, sizeof(*compiler));
|
||||
|
||||
compiler->shader_version = *shader_version;
|
||||
compiler->quirks = vkd3d_shader_compile_arguments_select_quirks(compile_args, shader_hash);
|
||||
#ifdef VKD3D_ENABLE_DESCRIPTOR_QA
|
||||
compiler->descriptor_qa_shader_hash = shader_hash;
|
||||
#endif
|
||||
|
||||
if (compile_args && compile_args->quirks)
|
||||
{
|
||||
for (i = 0; i < compile_args->quirks->num_hashes; i++)
|
||||
{
|
||||
if (compile_args->quirks->hashes[i].shader_hash == shader_hash)
|
||||
{
|
||||
compiler->quirks = compile_args->quirks->hashes[i].quirks;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == compile_args->quirks->num_hashes)
|
||||
compiler->quirks = compile_args->quirks->default_quirks;
|
||||
}
|
||||
|
||||
max_element_count = max(output_signature->element_count, patch_constant_signature->element_count);
|
||||
if (!(compiler->output_info = vkd3d_calloc(max_element_count, sizeof(*compiler->output_info))))
|
||||
{
|
||||
|
|
|
@ -721,3 +721,18 @@ vkd3d_shader_hash_t vkd3d_shader_hash(const struct vkd3d_shader_code *shader)
|
|||
|
||||
return h;
|
||||
}
|
||||
|
||||
uint32_t vkd3d_shader_compile_arguments_select_quirks(
|
||||
const struct vkd3d_shader_compile_arguments *compile_args, vkd3d_shader_hash_t shader_hash)
|
||||
{
|
||||
unsigned int i;
|
||||
if (compile_args && compile_args->quirks)
|
||||
{
|
||||
for (i = 0; i < compile_args->quirks->num_hashes; i++)
|
||||
if (compile_args->quirks->hashes[i].shader_hash == shader_hash)
|
||||
return compile_args->quirks->hashes[i].quirks;
|
||||
return compile_args->quirks->default_quirks;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue