From 8059608af97098a1f5fc6bdd2c36ff10e86ab0fd Mon Sep 17 00:00:00 2001 From: Shaun Ren Date: Fri, 11 Apr 2025 13:02:40 -0400 Subject: [PATCH] vkd3d-shader/hlsl: Parse the RestartStrip() method for stream outputs. --- libs/vkd3d-shader/hlsl.c | 1 + libs/vkd3d-shader/hlsl.h | 1 + libs/vkd3d-shader/hlsl.y | 22 ++++++++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index 8fdf972f3..8c3a1aeb7 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -3733,6 +3733,7 @@ static void dump_ir_resource_store(struct vkd3d_string_buffer *buffer, const str { [HLSL_RESOURCE_STORE] = "store_resource", [HLSL_RESOURCE_STREAM_APPEND] = "stream_append", + [HLSL_RESOURCE_STREAM_RESTART] = "stream_restart", }; VKD3D_ASSERT(store->store_type < ARRAY_SIZE(type_names)); diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index e3e436e3a..66cee60be 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -898,6 +898,7 @@ enum hlsl_resource_store_type { HLSL_RESOURCE_STORE, HLSL_RESOURCE_STREAM_APPEND, + HLSL_RESOURCE_STREAM_RESTART, }; struct hlsl_ir_resource_store diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index d1fffd3ca..702fd30bd 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -6251,6 +6251,27 @@ static bool add_so_append_method_call(struct hlsl_ctx *ctx, struct hlsl_block *b return true; } +static bool add_so_restartstrip_method_call(struct hlsl_ctx *ctx, struct hlsl_block *block, struct hlsl_ir_node *object, + const char *name, const struct parse_initializer *params, const struct vkd3d_shader_location *loc) +{ + struct hlsl_deref so_deref; + + if (params->args_count) + { + hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_WRONG_PARAMETER_COUNT, + "Wrong number of arguments to method '%s': expected 0.", name); + return false; + } + + if (!hlsl_init_deref_from_index_chain(ctx, &so_deref, object)) + return false; + + hlsl_block_add_resource_store(ctx, block, HLSL_RESOURCE_STREAM_RESTART, &so_deref, NULL, NULL, loc); + hlsl_cleanup_deref(&so_deref); + + return true; +} + static const struct method_function { const char *name; @@ -6297,6 +6318,7 @@ static const struct method_function uav_methods[] = static const struct method_function so_methods[] = { { "Append", add_so_append_method_call, "" }, + { "RestartStrip", add_so_restartstrip_method_call, "" }, }; static int object_method_function_name_compare(const void *a, const void *b)