mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/hlsl: Parse ConstructGSWithSO().
This commit is contained in:
parent
1f9fc2a422
commit
4aa262d773
Notes:
Henri Verbeet
2024-09-14 16:53:12 +02:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1057
@ -1878,6 +1878,10 @@ struct hlsl_ir_node *hlsl_new_compile(struct hlsl_ctx *ctx, enum hlsl_compile_ty
|
|||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case HLSL_COMPILE_TYPE_CONSTRUCTGSWITHSO:
|
||||||
|
type = hlsl_get_type(ctx->cur_scope, "GeometryShader", true, true);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(compile = hlsl_alloc(ctx, sizeof(*compile))))
|
if (!(compile = hlsl_alloc(ctx, sizeof(*compile))))
|
||||||
@ -3314,6 +3318,10 @@ static void dump_ir_compile(struct hlsl_ctx *ctx, struct vkd3d_string_buffer *bu
|
|||||||
case HLSL_COMPILE_TYPE_COMPILE:
|
case HLSL_COMPILE_TYPE_COMPILE:
|
||||||
vkd3d_string_buffer_printf(buffer, "compile %s {\n", compile->profile->name);
|
vkd3d_string_buffer_printf(buffer, "compile %s {\n", compile->profile->name);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case HLSL_COMPILE_TYPE_CONSTRUCTGSWITHSO:
|
||||||
|
vkd3d_string_buffer_printf(buffer, "ConstructGSWithSO {\n");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
dump_block(ctx, buffer, &compile->instrs);
|
dump_block(ctx, buffer, &compile->instrs);
|
||||||
|
@ -879,6 +879,8 @@ struct hlsl_ir_compile
|
|||||||
{
|
{
|
||||||
/* A shader compilation through the CompileShader() function or the "compile" syntax. */
|
/* A shader compilation through the CompileShader() function or the "compile" syntax. */
|
||||||
HLSL_COMPILE_TYPE_COMPILE,
|
HLSL_COMPILE_TYPE_COMPILE,
|
||||||
|
/* A call to ConstructGSWithSO(), which receives a geometry shader and retrieves one as well. */
|
||||||
|
HLSL_COMPILE_TYPE_CONSTRUCTGSWITHSO,
|
||||||
} compile_type;
|
} compile_type;
|
||||||
|
|
||||||
/* Special field to store the profile argument for HLSL_COMPILE_TYPE_COMPILE. */
|
/* Special field to store the profile argument for HLSL_COMPILE_TYPE_COMPILE. */
|
||||||
|
@ -82,6 +82,7 @@ ComputeShader {return KW_COMPUTESHADER; }
|
|||||||
compile {return KW_COMPILE; }
|
compile {return KW_COMPILE; }
|
||||||
CompileShader {return KW_COMPILESHADER; }
|
CompileShader {return KW_COMPILESHADER; }
|
||||||
const {return KW_CONST; }
|
const {return KW_CONST; }
|
||||||
|
ConstructGSWithSO {return KW_CONSTRUCTGSWITHSO; }
|
||||||
continue {return KW_CONTINUE; }
|
continue {return KW_CONTINUE; }
|
||||||
DepthStencilState {return KW_DEPTHSTENCILSTATE; }
|
DepthStencilState {return KW_DEPTHSTENCILSTATE; }
|
||||||
DepthStencilView {return KW_DEPTHSTENCILVIEW; }
|
DepthStencilView {return KW_DEPTHSTENCILVIEW; }
|
||||||
|
@ -5235,6 +5235,36 @@ static struct hlsl_block *add_shader_compilation(struct hlsl_ctx *ctx, const cha
|
|||||||
return make_block(ctx, compile);
|
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,
|
static struct hlsl_block *add_constructor(struct hlsl_ctx *ctx, struct hlsl_type *type,
|
||||||
struct parse_initializer *params, const struct vkd3d_shader_location *loc)
|
struct parse_initializer *params, const struct vkd3d_shader_location *loc)
|
||||||
{
|
{
|
||||||
@ -6236,6 +6266,7 @@ static bool state_block_add_entry(struct hlsl_state_block *state_block, struct h
|
|||||||
%token KW_COMPILESHADER
|
%token KW_COMPILESHADER
|
||||||
%token KW_COMPUTESHADER
|
%token KW_COMPUTESHADER
|
||||||
%token KW_CONST
|
%token KW_CONST
|
||||||
|
%token KW_CONSTRUCTGSWITHSO
|
||||||
%token KW_CONTINUE
|
%token KW_CONTINUE
|
||||||
%token KW_DEFAULT
|
%token KW_DEFAULT
|
||||||
%token KW_DEPTHSTENCILSTATE
|
%token KW_DEPTHSTENCILSTATE
|
||||||
@ -8596,6 +8627,11 @@ primary_expr:
|
|||||||
vkd3d_free($3);
|
vkd3d_free($3);
|
||||||
vkd3d_free($5);
|
vkd3d_free($5);
|
||||||
}
|
}
|
||||||
|
| KW_CONSTRUCTGSWITHSO '(' func_arguments ')'
|
||||||
|
{
|
||||||
|
if (!($$ = add_compile_variant(ctx, HLSL_COMPILE_TYPE_CONSTRUCTGSWITHSO, &$3, &@1)))
|
||||||
|
YYABORT;
|
||||||
|
}
|
||||||
| var_identifier '(' func_arguments ')'
|
| var_identifier '(' func_arguments ')'
|
||||||
{
|
{
|
||||||
if (!($$ = add_call(ctx, $1, &$3, &@1)))
|
if (!($$ = add_call(ctx, $1, &$3, &@1)))
|
||||||
|
@ -18,7 +18,7 @@ float4 main() : sv_target { return 0; }
|
|||||||
GeometryShader gs1 = CompileShader(gs_5_0, main());
|
GeometryShader gs1 = CompileShader(gs_5_0, main());
|
||||||
GeometryShader gs2 = ConstructGSWithSO(gs1);
|
GeometryShader gs2 = ConstructGSWithSO(gs1);
|
||||||
|
|
||||||
[pixel shader todo]
|
[pixel shader]
|
||||||
float4 main() : sv_target { return 0; }
|
float4 main() : sv_target { return 0; }
|
||||||
GeometryShader gs2 = ConstructGSWithSO("foo", "bar");
|
GeometryShader gs2 = ConstructGSWithSO("foo", "bar");
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ GeometryShader gs2 = ConstructGSWithSO("foo", "bar");
|
|||||||
float4 main() : sv_target { return 0; }
|
float4 main() : sv_target { return 0; }
|
||||||
GeometryShader gs2 = ConstructGSWithSO(1, 2, 3);
|
GeometryShader gs2 = ConstructGSWithSO(1, 2, 3);
|
||||||
|
|
||||||
[pixel shader todo]
|
[pixel shader]
|
||||||
float4 main() : sv_target { return 0; }
|
float4 main() : sv_target { return 0; }
|
||||||
GeometryShader gs2 = ConstructGSWithSO("foo", "bar", float2(42, 42), 3, 4, NULL);
|
GeometryShader gs2 = ConstructGSWithSO("foo", "bar", float2(42, 42), 3, 4, NULL);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user