mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/hlsl: Write SM4 break instructions.
This commit is contained in:
parent
99acf5038e
commit
7c3dadce6b
Notes:
Alexandre Julliard
2023-02-15 22:20:08 +01:00
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/92
@ -1861,6 +1861,20 @@ const char *hlsl_node_type_to_string(enum hlsl_ir_node_type type)
|
|||||||
return names[type];
|
return names[type];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *hlsl_jump_type_to_string(enum hlsl_ir_jump_type type)
|
||||||
|
{
|
||||||
|
static const char * const names[] =
|
||||||
|
{
|
||||||
|
"HLSL_IR_JUMP_BREAK",
|
||||||
|
"HLSL_IR_JUMP_CONTINUE",
|
||||||
|
"HLSL_IR_JUMP_DISCARD",
|
||||||
|
"HLSL_IR_JUMP_RETURN",
|
||||||
|
};
|
||||||
|
|
||||||
|
assert(type < ARRAY_SIZE(names));
|
||||||
|
return names[type];
|
||||||
|
}
|
||||||
|
|
||||||
static void dump_instr(struct hlsl_ctx *ctx, struct vkd3d_string_buffer *buffer, const struct hlsl_ir_node *instr);
|
static void dump_instr(struct hlsl_ctx *ctx, struct vkd3d_string_buffer *buffer, const struct hlsl_ir_node *instr);
|
||||||
|
|
||||||
static void dump_instr_list(struct hlsl_ctx *ctx, struct vkd3d_string_buffer *buffer, const struct list *list)
|
static void dump_instr_list(struct hlsl_ctx *ctx, struct vkd3d_string_buffer *buffer, const struct list *list)
|
||||||
|
@ -1003,6 +1003,8 @@ struct hlsl_ir_var *hlsl_get_var(struct hlsl_scope *scope, const char *name);
|
|||||||
struct hlsl_type *hlsl_get_element_type_from_path_index(struct hlsl_ctx *ctx, const struct hlsl_type *type,
|
struct hlsl_type *hlsl_get_element_type_from_path_index(struct hlsl_ctx *ctx, const struct hlsl_type *type,
|
||||||
struct hlsl_ir_node *idx);
|
struct hlsl_ir_node *idx);
|
||||||
|
|
||||||
|
const char *hlsl_jump_type_to_string(enum hlsl_ir_jump_type type);
|
||||||
|
|
||||||
struct hlsl_type *hlsl_new_array_type(struct hlsl_ctx *ctx, struct hlsl_type *basic_type, unsigned int array_size);
|
struct hlsl_type *hlsl_new_array_type(struct hlsl_ctx *ctx, struct hlsl_type *basic_type, unsigned int array_size);
|
||||||
struct hlsl_ir_node *hlsl_new_binary_expr(struct hlsl_ctx *ctx, enum hlsl_ir_expr_op op, struct hlsl_ir_node *arg1,
|
struct hlsl_ir_node *hlsl_new_binary_expr(struct hlsl_ctx *ctx, enum hlsl_ir_expr_op op, struct hlsl_ir_node *arg1,
|
||||||
struct hlsl_ir_node *arg2);
|
struct hlsl_ir_node *arg2);
|
||||||
|
@ -2118,6 +2118,28 @@ static void write_sm4_if(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buf
|
|||||||
write_sm4_instruction(buffer, &instr);
|
write_sm4_instruction(buffer, &instr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void write_sm4_jump(struct hlsl_ctx *ctx,
|
||||||
|
struct vkd3d_bytecode_buffer *buffer, const struct hlsl_ir_jump *jump)
|
||||||
|
{
|
||||||
|
struct sm4_instruction instr = {0};
|
||||||
|
|
||||||
|
switch (jump->type)
|
||||||
|
{
|
||||||
|
case HLSL_IR_JUMP_BREAK:
|
||||||
|
instr.opcode = VKD3D_SM4_OP_BREAK;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HLSL_IR_JUMP_RETURN:
|
||||||
|
vkd3d_unreachable();
|
||||||
|
|
||||||
|
default:
|
||||||
|
hlsl_fixme(ctx, &jump->node.loc, "Jump type %s.\n", hlsl_jump_type_to_string(jump->type));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
write_sm4_instruction(buffer, &instr);
|
||||||
|
}
|
||||||
|
|
||||||
static void write_sm4_load(struct hlsl_ctx *ctx,
|
static void write_sm4_load(struct hlsl_ctx *ctx,
|
||||||
struct vkd3d_bytecode_buffer *buffer, const struct hlsl_ir_load *load)
|
struct vkd3d_bytecode_buffer *buffer, const struct hlsl_ir_load *load)
|
||||||
{
|
{
|
||||||
@ -2375,6 +2397,10 @@ static void write_sm4_block(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *
|
|||||||
write_sm4_if(ctx, buffer, hlsl_ir_if(instr));
|
write_sm4_if(ctx, buffer, hlsl_ir_if(instr));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case HLSL_IR_JUMP:
|
||||||
|
write_sm4_jump(ctx, buffer, hlsl_ir_jump(instr));
|
||||||
|
break;
|
||||||
|
|
||||||
case HLSL_IR_LOAD:
|
case HLSL_IR_LOAD:
|
||||||
write_sm4_load(ctx, buffer, hlsl_ir_load(instr));
|
write_sm4_load(ctx, buffer, hlsl_ir_load(instr));
|
||||||
break;
|
break;
|
||||||
|
@ -145,7 +145,7 @@ uniform 0 float 0.9
|
|||||||
draw quad
|
draw quad
|
||||||
probe all rgba (1.0, 0.9, 1.0, 0.6) 1
|
probe all rgba (1.0, 0.9, 1.0, 0.6) 1
|
||||||
|
|
||||||
[pixel shader todo]
|
[pixel shader]
|
||||||
|
|
||||||
float func(out float o)
|
float func(out float o)
|
||||||
{
|
{
|
||||||
@ -184,10 +184,10 @@ float4 main() : sv_target
|
|||||||
}
|
}
|
||||||
|
|
||||||
[test]
|
[test]
|
||||||
todo draw quad
|
draw quad
|
||||||
probe all rgba (0.4, 0.3, 0.3, 0.9) 1
|
probe all rgba (0.4, 0.3, 0.3, 0.9) 1
|
||||||
|
|
||||||
[pixel shader todo]
|
[pixel shader]
|
||||||
|
|
||||||
uniform float f;
|
uniform float f;
|
||||||
|
|
||||||
@ -239,23 +239,23 @@ float4 main() : sv_target
|
|||||||
|
|
||||||
[test]
|
[test]
|
||||||
uniform 0 float 0.0
|
uniform 0 float 0.0
|
||||||
todo draw quad
|
draw quad
|
||||||
probe all rgba (0.3, 0.2, 0.3, 0.3) 1
|
probe all rgba (0.3, 0.2, 0.3, 0.3) 1
|
||||||
|
|
||||||
uniform 0 float 0.1
|
uniform 0 float 0.1
|
||||||
todo draw quad
|
draw quad
|
||||||
probe all rgba (0.3, 0.3, 0.3, 0.3) 1
|
probe all rgba (0.3, 0.3, 0.3, 0.3) 1
|
||||||
|
|
||||||
uniform 0 float 0.3
|
uniform 0 float 0.3
|
||||||
todo draw quad
|
draw quad
|
||||||
probe all rgba (0.3, 0.5, 0.3, 0.3) 1
|
probe all rgba (0.3, 0.5, 0.3, 0.3) 1
|
||||||
|
|
||||||
uniform 0 float 0.7
|
uniform 0 float 0.7
|
||||||
todo draw quad
|
draw quad
|
||||||
probe all rgba (0.3, 0.9, 0.7, 0.6) 1
|
probe all rgba (0.3, 0.9, 0.7, 0.6) 1
|
||||||
|
|
||||||
uniform 0 float 0.9
|
uniform 0 float 0.9
|
||||||
todo draw quad
|
draw quad
|
||||||
probe all rgba (0.4, 0.1, 0.7, 0.6) 1
|
probe all rgba (0.4, 0.1, 0.7, 0.6) 1
|
||||||
|
|
||||||
[pixel shader todo]
|
[pixel shader todo]
|
||||||
|
@ -128,7 +128,7 @@ uniform 0 float 0.9
|
|||||||
draw quad
|
draw quad
|
||||||
probe all rgba (0.4, 0.5, 0.6, 0.7) 1
|
probe all rgba (0.4, 0.5, 0.6, 0.7) 1
|
||||||
|
|
||||||
[pixel shader todo]
|
[pixel shader]
|
||||||
|
|
||||||
void main(out float4 ret : sv_target)
|
void main(out float4 ret : sv_target)
|
||||||
{
|
{
|
||||||
@ -143,10 +143,10 @@ void main(out float4 ret : sv_target)
|
|||||||
}
|
}
|
||||||
|
|
||||||
[test]
|
[test]
|
||||||
todo draw quad
|
draw quad
|
||||||
todo probe all rgba (0.2, 0.4, 0.6, 0.8)
|
probe all rgba (0.2, 0.4, 0.6, 0.8)
|
||||||
|
|
||||||
[pixel shader todo]
|
[pixel shader]
|
||||||
|
|
||||||
uniform float f;
|
uniform float f;
|
||||||
|
|
||||||
@ -166,26 +166,26 @@ void main(out float4 ret : sv_target)
|
|||||||
|
|
||||||
[test]
|
[test]
|
||||||
uniform 0 float 0.0
|
uniform 0 float 0.0
|
||||||
todo draw quad
|
draw quad
|
||||||
todo probe all rgba (0.1, 0.1, 0.1, 0.1) 1
|
probe all rgba (0.1, 0.1, 0.1, 0.1) 1
|
||||||
|
|
||||||
uniform 0 float 0.1
|
uniform 0 float 0.1
|
||||||
todo draw quad
|
draw quad
|
||||||
todo probe all rgba (0.2, 0.2, 0.2, 0.2) 1
|
probe all rgba (0.2, 0.2, 0.2, 0.2) 1
|
||||||
|
|
||||||
uniform 0 float 0.3
|
uniform 0 float 0.3
|
||||||
todo draw quad
|
draw quad
|
||||||
todo probe all rgba (0.4, 0.4, 0.4, 0.4) 1
|
todo probe all rgba (0.4, 0.4, 0.4, 0.4) 1
|
||||||
|
|
||||||
uniform 0 float 0.7
|
uniform 0 float 0.7
|
||||||
todo draw quad
|
draw quad
|
||||||
todo probe all rgba (0.8, 0.8, 0.8, 0.8) 1
|
todo probe all rgba (0.8, 0.8, 0.8, 0.8) 1
|
||||||
|
|
||||||
uniform 0 float 0.9
|
uniform 0 float 0.9
|
||||||
todo draw quad
|
draw quad
|
||||||
todo probe all rgba (0.9, 0.9, 0.9, 0.9) 1
|
todo probe all rgba (0.9, 0.9, 0.9, 0.9) 1
|
||||||
|
|
||||||
[pixel shader todo]
|
[pixel shader]
|
||||||
|
|
||||||
uniform float f;
|
uniform float f;
|
||||||
|
|
||||||
@ -211,10 +211,10 @@ void main(out float4 ret : sv_target)
|
|||||||
|
|
||||||
[test]
|
[test]
|
||||||
uniform 0 float 0.2
|
uniform 0 float 0.2
|
||||||
todo draw quad
|
draw quad
|
||||||
todo probe all rgba (0.2, 0.2, 0.2, 0.2)
|
probe all rgba (0.2, 0.2, 0.2, 0.2)
|
||||||
uniform 0 float 0.8
|
uniform 0 float 0.8
|
||||||
todo draw quad
|
draw quad
|
||||||
probe all rgba (0.5, 0.5, 0.5, 0.5)
|
probe all rgba (0.5, 0.5, 0.5, 0.5)
|
||||||
|
|
||||||
[pixel shader todo]
|
[pixel shader todo]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user