vkd3d-shader/glsl: Implement support for VKD3DSPSM_NEG modifiers.

This commit is contained in:
Henri Verbeet 2024-04-27 00:37:48 +02:00
parent b9366def96
commit 28ef331704
Notes: Henri Verbeet 2024-09-23 15:56:22 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1097
7 changed files with 10 additions and 7 deletions

View File

@ -305,6 +305,9 @@ static void glsl_src_init(struct glsl_src *glsl_src, struct vkd3d_glsl_generator
{ {
case VKD3DSPSM_NONE: case VKD3DSPSM_NONE:
break; break;
case VKD3DSPSM_NEG:
vkd3d_string_buffer_printf(glsl_src->str, "-%s", str->buffer);
break;
case VKD3DSPSM_ABS: case VKD3DSPSM_ABS:
vkd3d_string_buffer_printf(glsl_src->str, "abs(%s)", str->buffer); vkd3d_string_buffer_printf(glsl_src->str, "abs(%s)", str->buffer);
break; break;

View File

@ -10,7 +10,7 @@ float4 main() : SV_TARGET
[test] [test]
uniform 0 float4 5.0 15.0 0.0 0.0 uniform 0 float4 5.0 15.0 0.0 0.0
todo(glsl) draw quad draw quad
probe (0, 0) rgba (20.0, -10.0, 75.0, 0.33333333) 1 probe (0, 0) rgba (20.0, -10.0, 75.0, 0.33333333) 1
[pixel shader] [pixel shader]

View File

@ -12,7 +12,7 @@ float4 main() : sv_target
[test] [test]
uniform 0 float4 1 -2 3 4 uniform 0 float4 1 -2 3 4
uniform 4 float4 10 100 1000 10000 uniform 4 float4 10 100 1000 10000
todo(glsl) draw quad draw quad
probe (0, 0) rgba (-2300, -970, 120, 0) probe (0, 0) rgba (-2300, -970, 120, 0)
@ -29,5 +29,5 @@ float4 main() : sv_target
[test] [test]
uniform 0 float4 1 -2 3 4 uniform 0 float4 1 -2 3 4
todo(glsl) draw quad draw quad
probe (0, 0) rgba (-20, 8, 12, 3.5) probe (0, 0) rgba (-20, 8, 12, 3.5)

View File

@ -35,7 +35,7 @@ float4 main() : sv_target
[test] [test]
uniform 0 float4 1.0 2.0 3.0 4.0 uniform 0 float4 1.0 2.0 3.0 4.0
uniform 4 float4 5.0 6.0 7.0 8.0 uniform 4 float4 5.0 6.0 7.0 8.0
todo(glsl) draw quad draw quad
probe (0, 0) rgba (-4.0, -4.0, -4.0, -4.0) probe (0, 0) rgba (-4.0, -4.0, -4.0, -4.0)
[pixel shader] [pixel shader]

View File

@ -12,7 +12,7 @@ float4 main() : SV_TARGET
uniform 0 float4 2.0 3.0 4.0 5.0 uniform 0 float4 2.0 3.0 4.0 5.0
uniform 4 float4 0.0 -10.0 10.0 100.0 uniform 4 float4 0.0 -10.0 10.0 100.0
uniform 8 float4 0.0 1.0 -1.0 0.75 uniform 8 float4 0.0 1.0 -1.0 0.75
todo(glsl) draw quad draw quad
probe (0, 0) rgba (2.0, -10.0, -2.0, 76.25) probe (0, 0) rgba (2.0, -10.0, -2.0, 76.25)

View File

@ -14,5 +14,5 @@ float4 main() : SV_TARGET
[test] [test]
uniform 0 float4 2.5 0.3 0.2 0.7 uniform 0 float4 2.5 0.3 0.2 0.7
uniform 4 float4 0.1 1.5 0.0 0.0 uniform 4 float4 0.1 1.5 0.0 0.0
todo(glsl) draw quad draw quad
probe (0, 0) rgba (-12.43, 9.833333, 1.6, 35.0) 1 probe (0, 0) rgba (-12.43, 9.833333, 1.6, 35.0) 1

View File

@ -62,7 +62,7 @@ float4 main() : sv_target
[test] [test]
uniform 0 float4 0.5 0.0 0.0 0.0 uniform 0 float4 0.5 0.0 0.0 0.0
uniform 4 float4 0.6 0.0 0.0 0.0 uniform 4 float4 0.6 0.0 0.0 0.0
todo(glsl) draw quad draw quad
probe (0, 0) rgba (0.14, 0.14, 0.14, 0.14) 4 probe (0, 0) rgba (0.14, 0.14, 0.14, 0.14) 4
[pixel shader] [pixel shader]