mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/msl: Implement VKD3DSIH_ITOF.
This commit is contained in:
parent
9e0c02a0ea
commit
16409569fd
Notes:
Henri Verbeet
2024-11-27 14:12:36 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1283
@ -425,6 +425,25 @@ static void msl_relop(struct msl_generator *gen, const struct vkd3d_shader_instr
|
||||
msl_dst_cleanup(&dst, &gen->string_buffers);
|
||||
}
|
||||
|
||||
static void msl_cast(struct msl_generator *gen, const struct vkd3d_shader_instruction *ins, const char *constructor)
|
||||
{
|
||||
unsigned int component_count;
|
||||
struct msl_src src;
|
||||
struct msl_dst dst;
|
||||
uint32_t mask;
|
||||
|
||||
mask = msl_dst_init(&dst, gen, ins, &ins->dst[0]);
|
||||
msl_src_init(&src, gen, &ins->src[0], mask);
|
||||
|
||||
if ((component_count = vsir_write_mask_component_count(mask)) > 1)
|
||||
msl_print_assignment(gen, &dst, "%s%u(%s)", constructor, component_count, src.str->buffer);
|
||||
else
|
||||
msl_print_assignment(gen, &dst, "%s(%s)", constructor, src.str->buffer);
|
||||
|
||||
msl_src_cleanup(&src, &gen->string_buffers);
|
||||
msl_dst_cleanup(&dst, &gen->string_buffers);
|
||||
}
|
||||
|
||||
static void msl_mov(struct msl_generator *gen, const struct vkd3d_shader_instruction *ins)
|
||||
{
|
||||
struct msl_src src;
|
||||
@ -501,6 +520,9 @@ static void msl_handle_instruction(struct msl_generator *gen, const struct vkd3d
|
||||
case VKD3DSIH_NEU:
|
||||
msl_relop(gen, ins, "!=");
|
||||
break;
|
||||
case VKD3DSIH_ITOF:
|
||||
msl_cast(gen, ins, "float");
|
||||
break;
|
||||
case VKD3DSIH_MOV:
|
||||
msl_mov(gen, ins);
|
||||
break;
|
||||
|
@ -36,7 +36,7 @@ float4 main() : sv_target
|
||||
uniform 0 int4 11 12 0 0
|
||||
uniform 4 int4 13 14 0 0
|
||||
uniform 8 int4 20 21 22 23
|
||||
todo(msl) draw quad
|
||||
draw quad
|
||||
probe (320,240) rgba (13.0, 21.0, 0.0, 0.0)
|
||||
|
||||
|
||||
|
@ -27,7 +27,7 @@ float4 main() : SV_TARGET
|
||||
uniform 0 float4 0.0 0.0 2.0 4.0
|
||||
if(sm<4) uniform 4 float4 0 1 0 10
|
||||
if(sm>=4) uniform 4 int4 0 1 0 10
|
||||
todo(msl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (0.0, 10.0, 1.0, 11.0)
|
||||
|
||||
|
||||
@ -42,5 +42,5 @@ float4 main() : sv_target
|
||||
[test]
|
||||
if(sm<4) uniform 0 float4 1.0 1.0 1.0 0.0
|
||||
if(sm>=4) uniform 0 uint4 0x00000001 0x00000002 0x80000000 0x00000000
|
||||
todo(msl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (2.0, 2.0, 2.0, 0.0)
|
||||
|
@ -111,7 +111,7 @@ if(sm<4) uniform 8 float4 70 90 0 0
|
||||
if(sm<4) uniform 12 float4 80 100 0 0
|
||||
if(sm>=4) uniform 8 int4 70 90 0 0
|
||||
if(sm>=4) uniform 12 int4 80 100 0 0
|
||||
todo(msl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (70, 80, 90, 100)
|
||||
|
||||
|
||||
@ -216,7 +216,7 @@ if(sm<4) uniform 8 float4 70 90 0 0
|
||||
if(sm<4) uniform 12 float4 80 100 0 0
|
||||
if(sm>=4) uniform 8 int4 70 90 0 0
|
||||
if(sm>=4) uniform 12 int4 80 100 0 0
|
||||
todo(msl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (70, 80, 90, 100)
|
||||
|
||||
|
||||
|
@ -33,7 +33,7 @@ if(sm<4) uniform 8 float4 0 1 -1 1000000
|
||||
if(sm>=4) uniform 0 int4 2 3 4 0
|
||||
if(sm>=4) uniform 4 int4 0 -10 10 1000000
|
||||
if(sm>=4) uniform 8 int4 0 1 -1 1000000
|
||||
todo(msl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (2.0, -10.0, -2.0, 1e12) 4
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user