mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/msl: Implement VKD3DSIH_ELSE.
This commit is contained in:
parent
bbe10dcf17
commit
ebf5828542
Notes:
Henri Verbeet
2024-12-05 21:36:59 +01:00
Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1302
@ -486,6 +486,20 @@ static void msl_cast(struct msl_generator *gen, const struct vkd3d_shader_instru
|
||||
msl_dst_cleanup(&dst, &gen->string_buffers);
|
||||
}
|
||||
|
||||
static void msl_end_block(struct msl_generator *gen)
|
||||
{
|
||||
--gen->indent;
|
||||
msl_print_indent(gen->buffer, gen->indent);
|
||||
vkd3d_string_buffer_printf(gen->buffer, "}\n");
|
||||
}
|
||||
|
||||
static void msl_begin_block(struct msl_generator *gen)
|
||||
{
|
||||
msl_print_indent(gen->buffer, gen->indent);
|
||||
vkd3d_string_buffer_printf(gen->buffer, "{\n");
|
||||
++gen->indent;
|
||||
}
|
||||
|
||||
static void msl_if(struct msl_generator *gen, const struct vkd3d_shader_instruction *ins)
|
||||
{
|
||||
const char *condition;
|
||||
@ -499,16 +513,15 @@ static void msl_if(struct msl_generator *gen, const struct vkd3d_shader_instruct
|
||||
|
||||
msl_src_cleanup(&src, &gen->string_buffers);
|
||||
|
||||
msl_print_indent(gen->buffer, gen->indent);
|
||||
vkd3d_string_buffer_printf(gen->buffer, "{\n");
|
||||
++gen->indent;
|
||||
msl_begin_block(gen);
|
||||
}
|
||||
|
||||
static void msl_endif(struct msl_generator *gen)
|
||||
static void msl_else(struct msl_generator *gen)
|
||||
{
|
||||
--gen->indent;
|
||||
msl_end_block(gen);
|
||||
msl_print_indent(gen->buffer, gen->indent);
|
||||
vkd3d_string_buffer_printf(gen->buffer, "}\n");
|
||||
vkd3d_string_buffer_printf(gen->buffer, "else\n");
|
||||
msl_begin_block(gen);
|
||||
}
|
||||
|
||||
static void msl_unary_op(struct msl_generator *gen, const struct vkd3d_shader_instruction *ins, const char *op)
|
||||
@ -598,8 +611,11 @@ static void msl_handle_instruction(struct msl_generator *gen, const struct vkd3d
|
||||
case VKD3DSIH_DP4:
|
||||
msl_dot(gen, ins, VKD3DSP_WRITEMASK_ALL);
|
||||
break;
|
||||
case VKD3DSIH_ELSE:
|
||||
msl_else(gen);
|
||||
break;
|
||||
case VKD3DSIH_ENDIF:
|
||||
msl_endif(gen);
|
||||
msl_end_block(gen);
|
||||
break;
|
||||
case VKD3DSIH_IEQ:
|
||||
msl_relop(gen, ins, "==");
|
||||
|
@ -11,10 +11,10 @@ float4 main() : sv_target
|
||||
|
||||
[test]
|
||||
uniform 0 float4 0.0 0.0 0.0 0.0
|
||||
todo(sm<4 | msl) draw quad
|
||||
todo(sm<4) draw quad
|
||||
probe (0, 0) rgba (0.9, 0.8, 0.7, 0.6)
|
||||
uniform 0 float4 0.1 0.0 0.0 0.0
|
||||
todo(sm<4 | msl) draw quad
|
||||
todo(sm<4) draw quad
|
||||
probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4)
|
||||
|
||||
[pixel shader todo(sm<4)]
|
||||
@ -43,7 +43,7 @@ float4 main() : sv_target
|
||||
|
||||
[test]
|
||||
uniform 0 float4 0.0 0.0 0.0 0.0
|
||||
todo(sm<4 | msl) draw quad
|
||||
todo(sm<4) draw quad
|
||||
probe (0, 0) rgba (0.9, 0.8, 0.7, 0.6)
|
||||
|
||||
[pixel shader fail(sm<6)]
|
||||
@ -108,7 +108,7 @@ float4 main() : sv_target
|
||||
|
||||
[test]
|
||||
uniform 0 float4 0.0 0.0 0.0 0.0
|
||||
todo(msl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (0.9, 0.8, 0.7, 0.6)
|
||||
|
||||
[pixel shader]
|
||||
@ -209,13 +209,13 @@ if(sm<4) uniform 0 float -3
|
||||
if(sm<4) uniform 4 float -2
|
||||
if(sm>=4) uniform 0 int -3
|
||||
if(sm>=4) uniform 1 int -2
|
||||
todo(msl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (-1.0, -1.0, -1.0, -1.0)
|
||||
if(sm<4) uniform 0 float 4
|
||||
if(sm<4) uniform 4 float 4
|
||||
if(sm>=4) uniform 0 int 4
|
||||
if(sm>=4) uniform 1 int 4
|
||||
todo(msl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (1.0, 1.0, 1.0, 1.0)
|
||||
|
||||
|
||||
|
@ -79,16 +79,16 @@ float4 main() : sv_target
|
||||
|
||||
[test]
|
||||
uniform 0 float 0.1
|
||||
todo(sm<4 | msl) draw quad
|
||||
todo(sm<4) draw quad
|
||||
probe (0, 0) rgba (0.3, 0.2, 0.6, 0.3) 1
|
||||
uniform 0 float 0.4
|
||||
todo(sm<4 | msl) draw quad
|
||||
todo(sm<4) draw quad
|
||||
probe (0, 0) rgba (0.6, 0.5, 0.6, 0.3) 1
|
||||
uniform 0 float 0.6
|
||||
todo(sm<4 | msl) draw quad
|
||||
todo(sm<4) draw quad
|
||||
probe (0, 0) rgba (0.6, 0.5, 0.4, 0.5) 1
|
||||
uniform 0 float 0.8
|
||||
todo(sm<4 | msl) draw quad
|
||||
todo(sm<4) draw quad
|
||||
probe (0, 0) rgba (0.8, 0.7, 0.4, 0.5) 1
|
||||
|
||||
[pixel shader todo(sm<4)]
|
||||
|
@ -63,10 +63,10 @@ void main(out float4 ret : sv_target)
|
||||
|
||||
[test]
|
||||
uniform 0 float 0.2
|
||||
todo(sm<4 | msl) draw quad
|
||||
todo(sm<4) draw quad
|
||||
probe (0, 0) rgba (0.3, 0.4, 0.5, 0.6)
|
||||
uniform 0 float 0.8
|
||||
todo(sm<4 | msl) draw quad
|
||||
todo(sm<4) draw quad
|
||||
probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4)
|
||||
|
||||
[pixel shader todo(sm<4)]
|
||||
@ -204,10 +204,10 @@ void main(out float4 ret : sv_target)
|
||||
|
||||
[test]
|
||||
uniform 0 float 0.2
|
||||
todo(sm<4 | msl) draw quad
|
||||
todo(sm<4) draw quad
|
||||
probe (0, 0) rgba (0.2, 0.2, 0.2, 0.2)
|
||||
uniform 0 float 0.8
|
||||
todo(sm<4 | msl) draw quad
|
||||
todo(sm<4) draw quad
|
||||
probe (0, 0) rgba (0.5, 0.5, 0.5, 0.5)
|
||||
|
||||
[pixel shader todo(sm<4)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user