mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-12-15 08:03:30 -08:00
vkd3d-shader/hlsl: Make ConstructGSWithSO an intrinsic function.
It's not a keyword.
This commit is contained in:
committed by
Henri Verbeet
parent
cd64aa69c8
commit
c8b2aca23d
Notes:
Henri Verbeet
2025-10-07 13:18:10 +02:00
Approved-by: navi (@navi) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1750
@@ -83,7 +83,6 @@ ComputeShader {return KW_COMPUTESHADER; }
|
||||
compile {return KW_COMPILE; }
|
||||
CompileShader {return KW_COMPILESHADER; }
|
||||
const {return KW_CONST; }
|
||||
ConstructGSWithSO {return KW_CONSTRUCTGSWITHSO; }
|
||||
continue {return KW_CONTINUE; }
|
||||
DepthStencilState {return KW_DEPTHSTENCILSTATE; }
|
||||
DepthStencilView {return KW_DEPTHSTENCILVIEW; }
|
||||
|
||||
@@ -5337,6 +5337,23 @@ static bool intrinsic_AllMemoryBarrierWithGroupSync(struct hlsl_ctx *ctx,
|
||||
| VKD3DSSF_GROUP_SHARED_MEMORY | VKD3DSSF_THREAD_GROUP, loc);
|
||||
}
|
||||
|
||||
static bool intrinsic_ConstructGSWithSO(struct hlsl_ctx *ctx,
|
||||
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
struct hlsl_ir_node *compile;
|
||||
|
||||
if (params->args_count != 2 && params->args_count != 6)
|
||||
hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_WRONG_PARAMETER_COUNT,
|
||||
"Wrong number of arguments to ConstructGSWithSO(): expected 2 or 6, but got %u.", params->args_count);
|
||||
|
||||
if (!(compile = hlsl_new_compile(ctx, HLSL_COMPILE_TYPE_CONSTRUCTGSWITHSO,
|
||||
NULL, params->args, params->args_count, params->instrs, loc)))
|
||||
return false;
|
||||
|
||||
hlsl_block_add_instr(params->instrs, compile);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool intrinsic_DeviceMemoryBarrier(struct hlsl_ctx *ctx,
|
||||
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
@@ -5386,6 +5403,7 @@ intrinsic_functions[] =
|
||||
/* Note: these entries should be kept in alphabetical order. */
|
||||
{"AllMemoryBarrier", 0, true, intrinsic_AllMemoryBarrier},
|
||||
{"AllMemoryBarrierWithGroupSync", 0, true, intrinsic_AllMemoryBarrierWithGroupSync},
|
||||
{"ConstructGSWithSO", -1, false, intrinsic_ConstructGSWithSO},
|
||||
{"D3DCOLORtoUBYTE4", 1, true, intrinsic_d3dcolor_to_ubyte4},
|
||||
{"DeviceMemoryBarrier", 0, true, intrinsic_DeviceMemoryBarrier},
|
||||
{"DeviceMemoryBarrierWithGroupSync", 0, true, intrinsic_DeviceMemoryBarrierWithGroupSync},
|
||||
@@ -5629,36 +5647,6 @@ static struct hlsl_block *add_shader_compilation(struct hlsl_ctx *ctx, const cha
|
||||
return make_block(ctx, compile);
|
||||
}
|
||||
|
||||
static struct hlsl_block *add_compile_variant(struct hlsl_ctx *ctx, enum hlsl_compile_type compile_type,
|
||||
struct parse_initializer *args, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
struct hlsl_ir_node *compile;
|
||||
|
||||
switch (compile_type)
|
||||
{
|
||||
case HLSL_COMPILE_TYPE_COMPILE:
|
||||
vkd3d_unreachable();
|
||||
|
||||
case HLSL_COMPILE_TYPE_CONSTRUCTGSWITHSO:
|
||||
if (args->args_count != 2 && args->args_count != 6)
|
||||
{
|
||||
hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_WRONG_PARAMETER_COUNT,
|
||||
"Wrong number of arguments to ConstructGSWithSO: expected 2 or 6, but got %u.",
|
||||
args->args_count);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(compile = hlsl_new_compile(ctx, compile_type, NULL, args->args, args->args_count, args->instrs, loc)))
|
||||
{
|
||||
free_parse_initializer(args);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
free_parse_initializer(args);
|
||||
return make_block(ctx, compile);
|
||||
}
|
||||
|
||||
static struct hlsl_block *add_constructor(struct hlsl_ctx *ctx, struct hlsl_type *type,
|
||||
struct parse_initializer *params, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
@@ -6939,7 +6927,6 @@ static void validate_uav_type(struct hlsl_ctx *ctx, enum hlsl_sampler_dim dim,
|
||||
%token KW_COMPILESHADER
|
||||
%token KW_COMPUTESHADER
|
||||
%token KW_CONST
|
||||
%token KW_CONSTRUCTGSWITHSO
|
||||
%token KW_CONTINUE
|
||||
%token KW_DEFAULT
|
||||
%token KW_DEPTHSTENCILSTATE
|
||||
@@ -9453,11 +9440,6 @@ primary_expr:
|
||||
vkd3d_free($3);
|
||||
vkd3d_free($5);
|
||||
}
|
||||
| KW_CONSTRUCTGSWITHSO '(' func_arguments ')'
|
||||
{
|
||||
if (!($$ = add_compile_variant(ctx, HLSL_COMPILE_TYPE_CONSTRUCTGSWITHSO, &$3, &@1)))
|
||||
YYABORT;
|
||||
}
|
||||
| var_identifier '(' func_arguments ')'
|
||||
{
|
||||
if (!($$ = add_call(ctx, $1, &$3, &@1)))
|
||||
|
||||
@@ -4,6 +4,8 @@ float4 main() : sv_target { return 0; }
|
||||
GeometryShader gs1 = CompileShader(gs_5_0, main());
|
||||
GeometryShader gs2 = ConstructGSWithSO(gs1, "random_string", "another_string", NULL, NULL, 1);
|
||||
|
||||
float4 ConstructGSWithSO;
|
||||
|
||||
technique11
|
||||
{
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user