vkd3d-shader/glsl: Implement VKD3DSIH_INEG.

This commit is contained in:
Henri Verbeet 2024-10-03 16:16:00 +02:00
parent e55bc76fd2
commit c2a42214ff
Notes: Henri Verbeet 2024-10-08 22:11:09 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1155
3 changed files with 35 additions and 32 deletions

View File

@ -1189,13 +1189,6 @@ static void vkd3d_glsl_handle_instruction(struct vkd3d_glsl_generator *gen,
case VKD3DSIH_IMUL:
shader_glsl_mul_extended(gen, ins);
break;
case VKD3DSIH_ISHL:
shader_glsl_binop(gen, ins, "<<");
break;
case VKD3DSIH_ISHR:
case VKD3DSIH_USHR:
shader_glsl_binop(gen, ins, ">>");
break;
case VKD3DSIH_MAX:
shader_glsl_intrinsic(gen, ins, "max");
break;
@ -1206,6 +1199,16 @@ static void vkd3d_glsl_handle_instruction(struct vkd3d_glsl_generator *gen,
case VKD3DSIH_NEU:
shader_glsl_relop(gen, ins, "!=", "notEqual");
break;
case VKD3DSIH_INEG:
shader_glsl_unary_op(gen, ins, "-");
break;
case VKD3DSIH_ISHL:
shader_glsl_binop(gen, ins, "<<");
break;
case VKD3DSIH_ISHR:
case VKD3DSIH_USHR:
shader_glsl_binop(gen, ins, ">>");
break;
case VKD3DSIH_ITOF:
case VKD3DSIH_UTOF:
shader_glsl_cast(gen, ins, "float", "vec");

View File

@ -11,77 +11,77 @@ float4 main() : sv_target
[test]
uniform 0 uint 0x5140
todo(glsl) draw quad
draw quad
probe (0, 0) rgba(42.0, 42.0, 42.0, 42.0)
% zero
uniform 0 uint 0x0
todo(glsl) draw quad
draw quad
probe (0, 0) rgba(0.0, 0.0, 0.0, 0.0)
% negative zero
uniform 0 uint 0x8000
todo(glsl) draw quad
draw quad
probe (0, 0) rgba(-0.0, -0.0, -0.0, -0.0)
% subnormal number
uniform 0 uint 0x1
todo(glsl) draw quad
draw quad
probe (0, 0) rgba(5.9604645e-08, 5.9604645e-08, 5.9604645e-08, 5.9604645e-08)
% subnormal number
uniform 0 uint 0x2
todo(glsl) draw quad
draw quad
probe (0, 0) rgba(1.1920929e-07, 1.1920929e-07, 1.1920929e-07, 1.1920929e-07)
% subnormal number
uniform 0 uint 0x4
todo(glsl) draw quad
draw quad
probe (0, 0) rgba(2.3841858e-07, 2.3841858e-07, 2.3841858e-07, 2.3841858e-07)
% subnormal number
uniform 0 uint 0x8
todo(glsl) draw quad
draw quad
probe (0, 0) rgba(4.7683716e-07, 4.7683716e-07, 4.7683716e-07, 4.7683716e-07)
% subnormal number
uniform 0 uint 0x10
todo(glsl) draw quad
draw quad
probe (0, 0) rgba(9.536743e-07, 9.536743e-07, 9.536743e-07, 9.536743e-07)
% subnormal number
uniform 0 uint 0x20
todo(glsl) draw quad
draw quad
probe (0, 0) rgba(1.9073486e-06, 1.9073486e-06, 1.9073486e-06, 1.9073486e-06)
% subnormal number
uniform 0 uint 0x40
todo(glsl) draw quad
draw quad
probe (0, 0) rgba(3.8146973e-06, 3.8146973e-06, 3.8146973e-06, 3.8146973e-06)
% subnormal number
uniform 0 uint 0x80
todo(glsl) draw quad
draw quad
probe (0, 0) rgba(7.6293945e-06, 7.6293945e-06, 7.6293945e-06, 7.6293945e-06)
% subnormal number
uniform 0 uint 0x100
todo(glsl) draw quad
draw quad
probe (0, 0) rgba(1.5258789e-05, 1.5258789e-05, 1.5258789e-05, 1.5258789e-05)
% subnormal number
uniform 0 uint 0x200
todo(glsl) draw quad
draw quad
probe (0, 0) rgba(3.0517578e-05, 3.0517578e-05, 3.0517578e-05, 3.0517578e-05)
% I'd love to use rgba probes here but msvc doesn't scanf infinity :(
% positive infinity
uniform 0 uint 0x7c00
todo(glsl) draw quad
draw quad
probe (0, 0) rgbaui(0x7f800000, 0x7f800000, 0x7f800000, 0x7f800000)
% negative infinity
uniform 0 uint 0xfc00
todo(glsl) draw quad
draw quad
probe (0, 0) rgbaui(0xff800000, 0xff800000, 0xff800000, 0xff800000)

View File

@ -8,13 +8,13 @@ float4 main() : sv_target
[test]
uniform 0 float4 1.0 0.0 0.0 0.0
todo(sm<4 | glsl) draw quad
todo(sm<4) draw quad
probe (0, 0) rgba (1.0, 1.0, 1.0, 1.0)
uniform 0 float4 -1.0 0.0 0.0 0.0
todo(sm<4 | glsl) draw quad
todo(sm<4) draw quad
probe (0, 0) rgba (-1.0, -1.0, -1.0, -1.0)
uniform 0 float4 0.0 0.0 0.0 0.0
todo(sm<4 | glsl) draw quad
todo(sm<4) draw quad
probe (0, 0) rgba (0.0, 0.0, 0.0, 0.0)
@ -28,7 +28,7 @@ float4 main() : sv_target
[test]
uniform 0 float4 1.0 2.0 3.0 4.0
todo(sm<4 | glsl) draw quad
todo(sm<4) draw quad
probe (0, 0) rgba (1.0, 1.0, 1.0, 1.0)
@ -43,7 +43,7 @@ float4 main() : sv_target
[test]
uniform 0 float4 1.0 2.0 0.0 0.0
uniform 4 float4 3.0 4.0 0.0 0.0
todo(sm<4 | glsl) draw quad
todo(sm<4) draw quad
probe (0, 0) rgba (1.0, 1.0, 1.0, 1.0)
@ -58,15 +58,15 @@ float4 main() : sv_target
[test]
if(sm<4) uniform 0 float4 1 0 0 0
if(sm>=4) uniform 0 int4 1 0 0 0
todo(sm<4 | glsl) draw quad
todo(sm<4) draw quad
probe (0, 0) rgba (1, 1, 1, 1)
if(sm<4) uniform 0 float4 -1 0 0 0
if(sm>=4) uniform 0 int4 -1 0 0 0
todo(sm<4 | glsl) draw quad
todo(sm<4) draw quad
probe (0, 0) rgba (-1, -1, -1, -1)
if(sm<4) uniform 0 float4 0 0 0 0
if(sm>=4) uniform 0 int4 0 0 0 0
todo(sm<4 | glsl) draw quad
todo(sm<4) draw quad
probe (0, 0) rgba (0, 0, 0, 0)
@ -81,7 +81,7 @@ float4 main() : sv_target
[test]
if(sm<4) uniform 0 float4 1 2 3 4
if(sm>=4) uniform 0 int4 1 2 3 4
todo(sm<4 | glsl) draw quad
todo(sm<4) draw quad
probe (0, 0) rgba (1, 1, 1, 1)
@ -98,5 +98,5 @@ if(sm<4) uniform 0 float4 1 2 0 0
if(sm<4) uniform 4 float4 3 4 0 0
if(sm>=4) uniform 0 int4 1 2 0 0
if(sm>=4) uniform 4 int4 3 4 0 0
todo(sm<4 | glsl) draw quad
todo(sm<4) draw quad
probe (0, 0) rgba (1, 1, 1, 1)