mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader: Add a compile option to control whether implicit truncation warnings are printed.
d3dcompiler and d3dx9 versions before 42 don't emit this error; this will be necessary to emulate that behaviour. Other warnings exist that are introduced in different d3dcompiler versions, although there are not very many distinct HLSL warnings to begin with. We could of course group all these together under a single compiler option, but I find that using separate top-level options is unilaterally friendlier to an API consumer, and simpler to implement as well. It also in some sense maps conceptually to e.g. "-Wno-implicit-conversion".
This commit is contained in:
committed by
Alexandre Julliard
parent
b382d1843d
commit
6b6e4bc212
Notes:
Alexandre Julliard
2024-03-27 23:08:04 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/735
@@ -3593,24 +3593,35 @@ static bool hlsl_ctx_init(struct hlsl_ctx *ctx, const struct vkd3d_shader_compil
|
||||
return false;
|
||||
ctx->cur_buffer = ctx->globals_buffer;
|
||||
|
||||
ctx->warn_implicit_truncation = true;
|
||||
|
||||
for (i = 0; i < compile_info->option_count; ++i)
|
||||
{
|
||||
const struct vkd3d_shader_compile_option *option = &compile_info->options[i];
|
||||
|
||||
if (option->name == VKD3D_SHADER_COMPILE_OPTION_PACK_MATRIX_ORDER)
|
||||
switch (option->name)
|
||||
{
|
||||
if (option->value == VKD3D_SHADER_COMPILE_OPTION_PACK_MATRIX_ROW_MAJOR)
|
||||
ctx->matrix_majority = HLSL_MODIFIER_ROW_MAJOR;
|
||||
else if (option->value == VKD3D_SHADER_COMPILE_OPTION_PACK_MATRIX_COLUMN_MAJOR)
|
||||
ctx->matrix_majority = HLSL_MODIFIER_COLUMN_MAJOR;
|
||||
}
|
||||
else if (option->name == VKD3D_SHADER_COMPILE_OPTION_BACKWARD_COMPATIBILITY)
|
||||
{
|
||||
ctx->semantic_compat_mapping = option->value & VKD3D_SHADER_COMPILE_OPTION_BACKCOMPAT_MAP_SEMANTIC_NAMES;
|
||||
}
|
||||
else if (option->name == VKD3D_SHADER_COMPILE_OPTION_CHILD_EFFECT)
|
||||
{
|
||||
ctx->child_effect = !!option->value;
|
||||
case VKD3D_SHADER_COMPILE_OPTION_PACK_MATRIX_ORDER:
|
||||
if (option->value == VKD3D_SHADER_COMPILE_OPTION_PACK_MATRIX_ROW_MAJOR)
|
||||
ctx->matrix_majority = HLSL_MODIFIER_ROW_MAJOR;
|
||||
else if (option->value == VKD3D_SHADER_COMPILE_OPTION_PACK_MATRIX_COLUMN_MAJOR)
|
||||
ctx->matrix_majority = HLSL_MODIFIER_COLUMN_MAJOR;
|
||||
break;
|
||||
|
||||
case VKD3D_SHADER_COMPILE_OPTION_BACKWARD_COMPATIBILITY:
|
||||
ctx->semantic_compat_mapping = option->value & VKD3D_SHADER_COMPILE_OPTION_BACKCOMPAT_MAP_SEMANTIC_NAMES;
|
||||
break;
|
||||
|
||||
case VKD3D_SHADER_COMPILE_OPTION_CHILD_EFFECT:
|
||||
ctx->child_effect = option->value;
|
||||
break;
|
||||
|
||||
case VKD3D_SHADER_COMPILE_OPTION_WARN_IMPLICIT_TRUNCATION:
|
||||
ctx->warn_implicit_truncation = option->value;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user