mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/tpf: Convert some of the semantic names to system values names when in compatibility mode.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
committed by
Alexandre Julliard
parent
a4ed06bc5b
commit
e242b46922
Notes:
Alexandre Julliard
2023-10-19 23:22:28 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Zebediah Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/381
@@ -3421,6 +3421,10 @@ static bool hlsl_ctx_init(struct hlsl_ctx *ctx, const struct vkd3d_shader_compil
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -862,6 +862,8 @@ struct hlsl_ctx
|
||||
uint32_t in_state_block : 1;
|
||||
/* Whether the numthreads() attribute has been provided in the entry-point function. */
|
||||
uint32_t found_numthreads : 1;
|
||||
|
||||
bool semantic_compat_mapping;
|
||||
};
|
||||
|
||||
struct hlsl_resource_load_params
|
||||
|
||||
@@ -2762,20 +2762,21 @@ bool hlsl_sm4_usage_from_semantic(struct hlsl_ctx *ctx, const struct hlsl_semant
|
||||
{"position", true, VKD3D_SHADER_TYPE_VERTEX, D3D_NAME_POSITION},
|
||||
{"sv_position", true, VKD3D_SHADER_TYPE_VERTEX, D3D_NAME_POSITION},
|
||||
};
|
||||
bool needs_compat_mapping = ascii_strncasecmp(semantic->name, "sv_", 3);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(semantics); ++i)
|
||||
{
|
||||
if (!ascii_strcasecmp(semantic->name, semantics[i].name)
|
||||
&& output == semantics[i].output
|
||||
&& ctx->profile->type == semantics[i].shader_type
|
||||
&& !ascii_strncasecmp(semantic->name, "sv_", 3))
|
||||
&& (ctx->semantic_compat_mapping == needs_compat_mapping || !needs_compat_mapping)
|
||||
&& ctx->profile->type == semantics[i].shader_type)
|
||||
{
|
||||
*usage = semantics[i].usage;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ascii_strncasecmp(semantic->name, "sv_", 3))
|
||||
if (!needs_compat_mapping)
|
||||
return false;
|
||||
|
||||
*usage = D3D_NAME_UNDEFINED;
|
||||
|
||||
@@ -187,7 +187,7 @@ HRESULT WINAPI D3DCompile2(const void *data, SIZE_T data_size, const char *filen
|
||||
{
|
||||
struct vkd3d_shader_preprocess_info preprocess_info;
|
||||
struct vkd3d_shader_hlsl_source_info hlsl_info;
|
||||
struct vkd3d_shader_compile_option options[3];
|
||||
struct vkd3d_shader_compile_option options[4];
|
||||
struct vkd3d_shader_compile_info compile_info;
|
||||
struct vkd3d_shader_compile_option *option;
|
||||
struct vkd3d_shader_code byte_code;
|
||||
@@ -302,6 +302,13 @@ HRESULT WINAPI D3DCompile2(const void *data, SIZE_T data_size, const char *filen
|
||||
option->value |= VKD3D_SHADER_COMPILE_OPTION_PACK_MATRIX_COLUMN_MAJOR;
|
||||
}
|
||||
|
||||
if (flags & D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY)
|
||||
{
|
||||
option = &options[compile_info.option_count++];
|
||||
option->name = VKD3D_SHADER_COMPILE_OPTION_BACKWARD_COMPATIBILITY;
|
||||
option->value = VKD3D_SHADER_COMPILE_OPTION_BACKCOMPAT_MAP_SEMANTIC_NAMES;
|
||||
}
|
||||
|
||||
ret = vkd3d_shader_compile(&compile_info, &byte_code, &messages);
|
||||
|
||||
if (messages && messages_blob)
|
||||
|
||||
Reference in New Issue
Block a user