mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Handle discard statement.
Signed-off-by: Ethan Lee <flibitijibibo@gmail.com> Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
parent
6da7d16d4c
commit
59c63ec584
Notes:
Alexandre Julliard
2023-04-26 22:59:12 +02: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/136
@ -4075,6 +4075,7 @@ static void validate_texture_format_type(struct hlsl_ctx *ctx, struct hlsl_type
|
||||
%type <list> conditional_expr
|
||||
%type <list> declaration
|
||||
%type <list> declaration_statement
|
||||
%type <list> discard_statement
|
||||
%type <list> equality_expr
|
||||
%type <list> expr
|
||||
%type <list> expr_optional
|
||||
@ -5322,6 +5323,7 @@ statement:
|
||||
declaration_statement
|
||||
| expr_statement
|
||||
| compound_statement
|
||||
| discard_statement
|
||||
| jump_statement
|
||||
| selection_statement
|
||||
| loop_statement
|
||||
@ -5341,6 +5343,18 @@ jump_statement:
|
||||
YYABORT;
|
||||
}
|
||||
|
||||
discard_statement:
|
||||
KW_DISCARD ';'
|
||||
{
|
||||
struct hlsl_ir_node *discard;
|
||||
|
||||
if (!($$ = make_empty_list(ctx)))
|
||||
YYABORT;
|
||||
if (!(discard = hlsl_new_jump(ctx, HLSL_IR_JUMP_DISCARD, &@1)))
|
||||
return false;
|
||||
list_add_tail($$, &discard->entry);
|
||||
}
|
||||
|
||||
selection_statement:
|
||||
KW_IF '(' expr ')' if_body
|
||||
{
|
||||
|
@ -4327,6 +4327,22 @@ static void write_sm4_jump(struct hlsl_ctx *ctx,
|
||||
instr.opcode = VKD3D_SM4_OP_BREAK;
|
||||
break;
|
||||
|
||||
case HLSL_IR_JUMP_DISCARD:
|
||||
{
|
||||
struct sm4_register *reg = &instr.srcs[0].reg;
|
||||
|
||||
instr.opcode = VKD3D_SM4_OP_DISCARD | VKD3D_SM4_CONDITIONAL_NZ;
|
||||
|
||||
memset(&instr.srcs[0], 0, sizeof(*instr.srcs));
|
||||
instr.srcs[0].swizzle_type = VKD3D_SM4_SWIZZLE_NONE;
|
||||
instr.src_count = 1;
|
||||
reg->type = VKD3D_SM4_RT_IMMCONST;
|
||||
reg->dim = VKD3D_SM4_DIMENSION_SCALAR;
|
||||
reg->immconst_uint[0] = ~0u;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case HLSL_IR_JUMP_RETURN:
|
||||
vkd3d_unreachable();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user