mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader: Add an option to enable child effects compilation.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
committed by
Alexandre Julliard
parent
7f1fdd447c
commit
13227f3852
Notes:
Alexandre Julliard
2024-03-12 22:56:09 +01:00
Approved-by: Zebediah Figura (@zfigura) 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/692
@@ -299,6 +299,15 @@ enum vkd3d_shader_compile_option_name
|
|||||||
* \since 1.11
|
* \since 1.11
|
||||||
*/
|
*/
|
||||||
VKD3D_SHADER_COMPILE_OPTION_FEATURE = 0x0000000a,
|
VKD3D_SHADER_COMPILE_OPTION_FEATURE = 0x0000000a,
|
||||||
|
/**
|
||||||
|
* If \a value is non-zero compilation will produce a child effect using
|
||||||
|
* shared object descriptions, as instructed by the "shared" modifier.
|
||||||
|
* Child effects are supported with fx_2_0, fx_4_0, and fx_4_1. This option
|
||||||
|
* and "shared" modifiers are ignored for fx_5_0 profile, and non-fx profiles.
|
||||||
|
*
|
||||||
|
* \since 1.12
|
||||||
|
*/
|
||||||
|
VKD3D_SHADER_COMPILE_OPTION_CHILD_EFFECT = 0x0000000b,
|
||||||
|
|
||||||
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_NAME),
|
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_NAME),
|
||||||
};
|
};
|
||||||
|
@@ -3597,6 +3597,10 @@ static bool hlsl_ctx_init(struct hlsl_ctx *ctx, const struct vkd3d_shader_compil
|
|||||||
{
|
{
|
||||||
ctx->semantic_compat_mapping = option->value & VKD3D_SHADER_COMPILE_OPTION_BACKCOMPAT_MAP_SEMANTIC_NAMES;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@@ -922,6 +922,7 @@ struct hlsl_ctx
|
|||||||
uint32_t found_numthreads : 1;
|
uint32_t found_numthreads : 1;
|
||||||
|
|
||||||
bool semantic_compat_mapping;
|
bool semantic_compat_mapping;
|
||||||
|
bool child_effect;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct hlsl_resource_load_params
|
struct hlsl_resource_load_params
|
||||||
|
@@ -244,7 +244,7 @@ HRESULT WINAPI D3DCompile2(const void *data, SIZE_T data_size, const char *filen
|
|||||||
{
|
{
|
||||||
struct vkd3d_shader_preprocess_info preprocess_info;
|
struct vkd3d_shader_preprocess_info preprocess_info;
|
||||||
struct vkd3d_shader_hlsl_source_info hlsl_info;
|
struct vkd3d_shader_hlsl_source_info hlsl_info;
|
||||||
struct vkd3d_shader_compile_option options[4];
|
struct vkd3d_shader_compile_option options[5];
|
||||||
struct vkd3d_shader_compile_info compile_info;
|
struct vkd3d_shader_compile_info compile_info;
|
||||||
struct vkd3d_shader_compile_option *option;
|
struct vkd3d_shader_compile_option *option;
|
||||||
struct vkd3d_shader_code byte_code;
|
struct vkd3d_shader_code byte_code;
|
||||||
@@ -262,7 +262,7 @@ HRESULT WINAPI D3DCompile2(const void *data, SIZE_T data_size, const char *filen
|
|||||||
|
|
||||||
if (flags & ~(D3DCOMPILE_DEBUG | D3DCOMPILE_PACK_MATRIX_ROW_MAJOR | D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR))
|
if (flags & ~(D3DCOMPILE_DEBUG | D3DCOMPILE_PACK_MATRIX_ROW_MAJOR | D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR))
|
||||||
FIXME("Ignoring flags %#x.\n", flags);
|
FIXME("Ignoring flags %#x.\n", flags);
|
||||||
if (effect_flags)
|
if (effect_flags & ~D3DCOMPILE_EFFECT_CHILD_EFFECT)
|
||||||
FIXME("Ignoring effect flags %#x.\n", effect_flags);
|
FIXME("Ignoring effect flags %#x.\n", effect_flags);
|
||||||
if (secondary_flags)
|
if (secondary_flags)
|
||||||
FIXME("Ignoring secondary flags %#x.\n", secondary_flags);
|
FIXME("Ignoring secondary flags %#x.\n", secondary_flags);
|
||||||
@@ -330,6 +330,13 @@ HRESULT WINAPI D3DCompile2(const void *data, SIZE_T data_size, const char *filen
|
|||||||
option->value = VKD3D_SHADER_COMPILE_OPTION_BACKCOMPAT_MAP_SEMANTIC_NAMES;
|
option->value = VKD3D_SHADER_COMPILE_OPTION_BACKCOMPAT_MAP_SEMANTIC_NAMES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (effect_flags & D3DCOMPILE_EFFECT_CHILD_EFFECT)
|
||||||
|
{
|
||||||
|
option = &options[compile_info.option_count++];
|
||||||
|
option->name = VKD3D_SHADER_COMPILE_OPTION_CHILD_EFFECT;
|
||||||
|
option->value = true;
|
||||||
|
}
|
||||||
|
|
||||||
ret = vkd3d_shader_compile(&compile_info, &byte_code, &messages);
|
ret = vkd3d_shader_compile(&compile_info, &byte_code, &messages);
|
||||||
|
|
||||||
if (messages && messages_blob)
|
if (messages && messages_blob)
|
||||||
|
@@ -39,6 +39,7 @@ enum
|
|||||||
{
|
{
|
||||||
OPTION_HELP = CHAR_MAX + 1,
|
OPTION_HELP = CHAR_MAX + 1,
|
||||||
OPTION_BUFFER_UAV,
|
OPTION_BUFFER_UAV,
|
||||||
|
OPTION_CHILD_EFFECT,
|
||||||
OPTION_ENTRY,
|
OPTION_ENTRY,
|
||||||
OPTION_FRAGMENT_COORDINATE_ORIGIN,
|
OPTION_FRAGMENT_COORDINATE_ORIGIN,
|
||||||
OPTION_MATRIX_STORAGE_ORDER,
|
OPTION_MATRIX_STORAGE_ORDER,
|
||||||
@@ -186,6 +187,8 @@ static void print_usage(const char *program_name)
|
|||||||
" --buffer-uav=<type> Specify the buffer type to use for buffer UAV bindings.\n"
|
" --buffer-uav=<type> Specify the buffer type to use for buffer UAV bindings.\n"
|
||||||
" Valid values are 'buffer-texture' (default) and\n"
|
" Valid values are 'buffer-texture' (default) and\n"
|
||||||
" 'storage-buffer'.\n"
|
" 'storage-buffer'.\n"
|
||||||
|
" --child-effect Compile effect as a child effect. This option is only meaningful\n"
|
||||||
|
" for fx_2_0 and fx_4_0/fx_4_1 profiles.\n"
|
||||||
" -e, --entry=<name> Use <name> as the entry point (default is \"main\").\n"
|
" -e, --entry=<name> Use <name> as the entry point (default is \"main\").\n"
|
||||||
" -E Preprocess the source code instead of compiling it.\n"
|
" -E Preprocess the source code instead of compiling it.\n"
|
||||||
" --formatting=<flags> Specify the formatting options for text output.\n"
|
" --formatting=<flags> Specify the formatting options for text output.\n"
|
||||||
@@ -479,6 +482,7 @@ static bool parse_command_line(int argc, char **argv, struct options *options)
|
|||||||
{
|
{
|
||||||
{"help", no_argument, NULL, OPTION_HELP},
|
{"help", no_argument, NULL, OPTION_HELP},
|
||||||
{"buffer-uav", required_argument, NULL, OPTION_BUFFER_UAV},
|
{"buffer-uav", required_argument, NULL, OPTION_BUFFER_UAV},
|
||||||
|
{"child-effect", no_argument, NULL, OPTION_CHILD_EFFECT},
|
||||||
{"entry", required_argument, NULL, OPTION_ENTRY},
|
{"entry", required_argument, NULL, OPTION_ENTRY},
|
||||||
{"fragment-coordinate-origin", required_argument, NULL, OPTION_FRAGMENT_COORDINATE_ORIGIN},
|
{"fragment-coordinate-origin", required_argument, NULL, OPTION_FRAGMENT_COORDINATE_ORIGIN},
|
||||||
{"matrix-storage-order", required_argument, NULL, OPTION_MATRIX_STORAGE_ORDER},
|
{"matrix-storage-order", required_argument, NULL, OPTION_MATRIX_STORAGE_ORDER},
|
||||||
@@ -523,6 +527,10 @@ static bool parse_command_line(int argc, char **argv, struct options *options)
|
|||||||
add_compile_option(options, VKD3D_SHADER_COMPILE_OPTION_BUFFER_UAV, buffer_uav);
|
add_compile_option(options, VKD3D_SHADER_COMPILE_OPTION_BUFFER_UAV, buffer_uav);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case OPTION_CHILD_EFFECT:
|
||||||
|
add_compile_option(options, VKD3D_SHADER_COMPILE_OPTION_CHILD_EFFECT, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
case OPTION_ENTRY:
|
case OPTION_ENTRY:
|
||||||
case 'e':
|
case 'e':
|
||||||
options->entry_point = optarg;
|
options->entry_point = optarg;
|
||||||
|
Reference in New Issue
Block a user