mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/glsl: Implement VKD3DSIH_MAX.
This commit is contained in:
parent
2ea5f187f9
commit
4f054aed48
Notes:
Henri Verbeet
2024-10-01 17:35:47 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1134
@ -455,16 +455,24 @@ static void shader_glsl_dot(struct vkd3d_glsl_generator *gen,
|
||||
static void shader_glsl_intrinsic(struct vkd3d_glsl_generator *gen,
|
||||
const struct vkd3d_shader_instruction *ins, const char *op)
|
||||
{
|
||||
struct vkd3d_string_buffer *args;
|
||||
struct glsl_src src;
|
||||
struct glsl_dst dst;
|
||||
unsigned int i;
|
||||
uint32_t mask;
|
||||
|
||||
mask = glsl_dst_init(&dst, gen, ins, &ins->dst[0]);
|
||||
glsl_src_init(&src, gen, &ins->src[0], mask);
|
||||
|
||||
shader_glsl_print_assignment(gen, &dst, "%s(%s)", op, src.str->buffer);
|
||||
args = vkd3d_string_buffer_get(&gen->string_buffers);
|
||||
|
||||
for (i = 0; i < ins->src_count; ++i)
|
||||
{
|
||||
glsl_src_init(&src, gen, &ins->src[i], mask);
|
||||
vkd3d_string_buffer_printf(args, "%s%s", i ? ", " : "", src.str->buffer);
|
||||
glsl_src_cleanup(&src, &gen->string_buffers);
|
||||
}
|
||||
shader_glsl_print_assignment(gen, &dst, "%s(%s)", op, args->buffer);
|
||||
|
||||
vkd3d_string_buffer_release(&gen->string_buffers, args);
|
||||
glsl_dst_cleanup(&dst, &gen->string_buffers);
|
||||
}
|
||||
|
||||
@ -784,6 +792,9 @@ static void vkd3d_glsl_handle_instruction(struct vkd3d_glsl_generator *gen,
|
||||
case VKD3DSIH_LTO:
|
||||
shader_glsl_relop(gen, ins, "<", "lessThan");
|
||||
break;
|
||||
case VKD3DSIH_MAX:
|
||||
shader_glsl_intrinsic(gen, ins, "max");
|
||||
break;
|
||||
case VKD3DSIH_INE:
|
||||
case VKD3DSIH_NEU:
|
||||
shader_glsl_relop(gen, ins, "!=", "notEqual");
|
||||
|
@ -8,17 +8,17 @@ float4 main() : sv_target
|
||||
|
||||
[test]
|
||||
uniform 0 float4 -0.1 10.0 0.0 0.0
|
||||
todo(glsl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (1.0, 0.0, 0.0, 1.0)
|
||||
|
||||
[test]
|
||||
uniform 0 float4 1.2 -0.1 0.0 0.0
|
||||
todo(glsl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (1.0, 1.2, 0.0, 1.0)
|
||||
|
||||
[test]
|
||||
uniform 0 float4 1.2 2.0 3.0 0.0
|
||||
todo(glsl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (1.0, 1.2, 8.0, 1.0)
|
||||
|
||||
[pixel shader]
|
||||
@ -31,7 +31,7 @@ float4 main() : sv_target
|
||||
|
||||
[test]
|
||||
uniform 0 float4 1.2 2.0 3.0 0.0
|
||||
todo(glsl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (2.0, 2.4, 16.0, 2.0)
|
||||
|
||||
[pixel shader fail]
|
||||
|
@ -8,7 +8,7 @@ float4 main() : sv_target
|
||||
|
||||
[test]
|
||||
uniform 0 float4 0.7 -0.1 0.0 0.0
|
||||
todo(glsl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (0.7, 2.1, 2.0, -1.0)
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ float4 main() : sv_target
|
||||
|
||||
[test]
|
||||
uniform 0 float4 0.7 -0.1 0.4 0.8
|
||||
todo(glsl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (0.7, 0.8, 0.7, 0.2)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user