mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/fx: Add an option to include empty buffers in the effect binary.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
parent
c509c85f63
commit
e1e6367210
Notes:
Alexandre Julliard
2024-04-03 00:23:27 +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/742
@ -322,6 +322,14 @@ enum vkd3d_shader_compile_option_name
|
||||
* \since 1.12
|
||||
*/
|
||||
VKD3D_SHADER_COMPILE_OPTION_WARN_IMPLICIT_TRUNCATION = 0x0000000c,
|
||||
/**
|
||||
* If \a value is nonzero, empty constant buffers descriptions are
|
||||
* written out in the output effect binary. This option applies only
|
||||
* to fx_4_0 and fx_4_1 profiles and is otherwise ignored.
|
||||
*
|
||||
* \since 1.12
|
||||
*/
|
||||
VKD3D_SHADER_COMPILE_OPTION_INCLUDE_EMPTY_BUFFERS_IN_EFFECTS = 0x0000000d,
|
||||
|
||||
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_NAME),
|
||||
};
|
||||
|
@ -90,6 +90,7 @@ struct fx_write_context
|
||||
int status;
|
||||
|
||||
bool child_effect;
|
||||
bool include_empty_buffers;
|
||||
|
||||
const struct fx_write_context_ops *ops;
|
||||
};
|
||||
@ -191,6 +192,7 @@ static void fx_write_context_init(struct hlsl_ctx *ctx, const struct fx_write_co
|
||||
list_init(&fx->types);
|
||||
|
||||
fx->child_effect = fx->ops->are_child_effects_supported && ctx->child_effect;
|
||||
fx->include_empty_buffers = version == 4 && ctx->include_empty_buffers;
|
||||
|
||||
hlsl_block_init(&block);
|
||||
hlsl_prepend_global_uniform_copy(fx->ctx, &block);
|
||||
@ -1065,7 +1067,9 @@ static void write_buffers(struct fx_write_context *fx)
|
||||
|
||||
LIST_FOR_EACH_ENTRY(buffer, &fx->ctx->buffers, struct hlsl_buffer, entry)
|
||||
{
|
||||
if (!buffer->size)
|
||||
if (!buffer->size && !fx->include_empty_buffers)
|
||||
continue;
|
||||
if (!strcmp(buffer->name, "$Params"))
|
||||
continue;
|
||||
|
||||
write_fx_4_buffer(buffer, fx);
|
||||
|
@ -3622,6 +3622,10 @@ static bool hlsl_ctx_init(struct hlsl_ctx *ctx, const struct vkd3d_shader_compil
|
||||
ctx->warn_implicit_truncation = option->value;
|
||||
break;
|
||||
|
||||
case VKD3D_SHADER_COMPILE_OPTION_INCLUDE_EMPTY_BUFFERS_IN_EFFECTS:
|
||||
ctx->include_empty_buffers = option->value;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -927,6 +927,7 @@ struct hlsl_ctx
|
||||
|
||||
bool semantic_compat_mapping;
|
||||
bool child_effect;
|
||||
bool include_empty_buffers;
|
||||
bool warn_implicit_truncation;
|
||||
};
|
||||
|
||||
|
@ -42,6 +42,7 @@ enum
|
||||
OPTION_CHILD_EFFECT,
|
||||
OPTION_ENTRY,
|
||||
OPTION_FRAGMENT_COORDINATE_ORIGIN,
|
||||
OPTION_INCLUDE_EMPTY_BUFFERS,
|
||||
OPTION_MATRIX_STORAGE_ORDER,
|
||||
OPTION_OUTPUT,
|
||||
OPTION_PRINT_SOURCE_TYPES,
|
||||
@ -202,6 +203,9 @@ static void print_usage(const char *program_name)
|
||||
" targets. Valid values are 'upper-left' (default) and\n"
|
||||
" 'lower-left'. The only value supported by Vulkan\n"
|
||||
" environments is 'upper-left'.\n"
|
||||
" --fx-include-empty-buffers\n"
|
||||
" Write empty constant buffers descriptions. This option\n"
|
||||
" is only meaningful for fx_4_0 and fx_4_1 profiles.\n"
|
||||
" --matrix-storage-order=<order>\n"
|
||||
" Specify the default matrix storage order. Valid values\n"
|
||||
" are 'column' (default) and 'row'.\n"
|
||||
@ -485,6 +489,7 @@ static bool parse_command_line(int argc, char **argv, struct options *options)
|
||||
{"child-effect", no_argument, NULL, OPTION_CHILD_EFFECT},
|
||||
{"entry", required_argument, NULL, OPTION_ENTRY},
|
||||
{"fragment-coordinate-origin", required_argument, NULL, OPTION_FRAGMENT_COORDINATE_ORIGIN},
|
||||
{"fx-include-empty-buffers", no_argument, NULL, OPTION_INCLUDE_EMPTY_BUFFERS},
|
||||
{"matrix-storage-order", required_argument, NULL, OPTION_MATRIX_STORAGE_ORDER},
|
||||
{"output", required_argument, NULL, OPTION_OUTPUT},
|
||||
{"formatting", required_argument, NULL, OPTION_TEXT_FORMATTING},
|
||||
@ -559,6 +564,10 @@ static bool parse_command_line(int argc, char **argv, struct options *options)
|
||||
options->output_filename = optarg;
|
||||
break;
|
||||
|
||||
case OPTION_INCLUDE_EMPTY_BUFFERS:
|
||||
add_compile_option(options, VKD3D_SHADER_COMPILE_OPTION_INCLUDE_EMPTY_BUFFERS_IN_EFFECTS, 1);
|
||||
break;
|
||||
|
||||
case OPTION_MATRIX_STORAGE_ORDER:
|
||||
if (!parse_matrix_storage_order(&pack_matrix_order, optarg))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user