mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/glsl: Implement VKD3DSIH_ADD.
This commit is contained in:
parent
ae40184631
commit
ab07637ee1
Notes:
Henri Verbeet
2024-09-19 14:46:44 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1084
@ -272,6 +272,24 @@ static void shader_glsl_unhandled(struct vkd3d_glsl_generator *gen, const struct
|
||||
"Internal compiler error: Unhandled instruction %#x.", ins->opcode);
|
||||
}
|
||||
|
||||
static void shader_glsl_binop(struct vkd3d_glsl_generator *gen,
|
||||
const struct vkd3d_shader_instruction *ins, const char *op)
|
||||
{
|
||||
struct glsl_src src[2];
|
||||
struct glsl_dst dst;
|
||||
uint32_t mask;
|
||||
|
||||
mask = glsl_dst_init(&dst, gen, ins, &ins->dst[0]);
|
||||
glsl_src_init(&src[0], gen, &ins->src[0], mask);
|
||||
glsl_src_init(&src[1], gen, &ins->src[1], mask);
|
||||
|
||||
shader_glsl_print_assignment(gen, &dst, "%s %s %s", src[0].str->buffer, op, src[1].str->buffer);
|
||||
|
||||
glsl_src_cleanup(&src[1], &gen->string_buffers);
|
||||
glsl_src_cleanup(&src[0], &gen->string_buffers);
|
||||
glsl_dst_cleanup(&dst, &gen->string_buffers);
|
||||
}
|
||||
|
||||
static void shader_glsl_mov(struct vkd3d_glsl_generator *gen, const struct vkd3d_shader_instruction *ins)
|
||||
{
|
||||
struct glsl_src src;
|
||||
@ -431,6 +449,9 @@ static void vkd3d_glsl_handle_instruction(struct vkd3d_glsl_generator *gen,
|
||||
|
||||
switch (ins->opcode)
|
||||
{
|
||||
case VKD3DSIH_ADD:
|
||||
shader_glsl_binop(gen, ins, "+");
|
||||
break;
|
||||
case VKD3DSIH_DCL_INPUT:
|
||||
case VKD3DSIH_DCL_OUTPUT:
|
||||
case VKD3DSIH_DCL_OUTPUT_SIV:
|
||||
|
@ -203,5 +203,5 @@ float4 main() : sv_target
|
||||
|
||||
[test]
|
||||
uniform 0 float4 0.2 0.3 9.1 3.2
|
||||
todo(glsl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (0.4, 0.6, 18.2, 6.4)
|
||||
|
@ -821,7 +821,7 @@ float4 main() : sv_target
|
||||
[test]
|
||||
uniform 0 float4 1.0 2.0 3.0 4.0
|
||||
uniform 4 float4 0.1 0.2 0.3 0.4
|
||||
todo(glsl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (1.1, 2.2, 3.3, 4.4)
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@ float4 main() : sv_target
|
||||
[test]
|
||||
uniform 0 float4 1.0 2.0 3.0 4.0
|
||||
uniform 4 float4 0.1 0.2 0.3 0.4
|
||||
todo(glsl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (1.1, 2.2, 3.3, 4.4)
|
||||
|
||||
[pixel shader fail(sm<6)]
|
||||
|
@ -9,7 +9,7 @@ float4 main() : sv_target
|
||||
[test]
|
||||
uniform 0 float4 1.0 2.0 3.0 4.0
|
||||
uniform 4 float4 5.0 6.0 7.0 8.0
|
||||
todo(glsl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (8.0, 8.0, 8.0, 8.0)
|
||||
|
||||
|
||||
|
@ -18,7 +18,7 @@ float4 main() : sv_target
|
||||
|
||||
[test]
|
||||
uniform 0 float 5.0
|
||||
todo(glsl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (50.0, 50.0, 50.0, 50.0)
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ float4 main() : sv_target
|
||||
|
||||
[test]
|
||||
uniform 0 float 4.0
|
||||
todo(glsl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (20.0, 20.0, 20.0, 20.0)
|
||||
|
||||
[pixel shader]
|
||||
|
Loading…
Reference in New Issue
Block a user