Commit ace9c9f
committed
gfx_widgets+d3d: animate task-message hourglass on all drivers
The hourglass icon on the task-progress notification widget never
visibly rotated. The animation system was correctly easing
msg->hourglass_rotation through 0 -> -2*pi every six seconds, but
the rendered icon stayed static across every backend.
Three independent bugs, each blocking a different family of
drivers:
1. gfx/gfx_widgets.c - the call site that draws the hourglass
forwarded the live `radians` value to gfx_widgets_draw_icon
but left `cosine`/`sine` at their cos(0)/sin(0) defaults.
The matrix-rotation path (gl, gl1, glcore, vulkan, d3d8)
consumes those trig values via gfx_display_rotate_z, so it
was always building an identity rotation regardless of
`radians`.
Fix: recompute cosf(radians)/sinf(radians) alongside `radians`
in the in-progress branch.
2. gfx/drivers/d3d_shaders/sprite_sm4.hlsl.h - the sprite shader
used by the d3d10 / d3d11 / d3d12 menu display drivers. The
C code on those drivers dutifully writes
`sprite->params.rotation = draw->rotation` into the vertex
stream, but the shader pipeline never reads it: the GSInput
struct doesn't have a `params` field, so rotation is dropped
at the VS->GS boundary, and the geometry shader builds the
four corner vertices straight from `position.xy + position.zw
* cornerOffset` with no rotation applied.
Fix: forward `params` from VS to GS (params.x is already
consumed by the VS for scaling; we need params.y in the GS
for rotation), and rewrite the GS to compute corner offsets
by rotating per-corner pixel-space sign vectors `(sx, sy) in
{+/-1}^2` and scaling them back by `position.z * 0.5` (X) and
`position.w * 0.5` (Y). Because position.z = 2W/vw and
position.w = 2W/vh both encode the same pixel-space length W
for a square icon, this preserves the icon's shape under
rotation on a non-square viewport. Non-square icons would
skew, but the only caller of rotation today (the hourglass)
is square.
3. gfx/drivers/d3d9hlsl.c, gfx/drivers/d3d9cg.c - the d3d9
menu display drivers' single-sprite path (no explicit vertex
array supplied by caller, which is what gfx_widgets_draw_icon
does) builds an axis-aligned quad from draw->x / draw->y /
draw->width / draw->height directly, applies scale_factor,
and never references draw->rotation or draw->matrix_data at
all - so rotation was silently dropped on both shader
paths.
Fix: when draw->rotation is non-zero, rotate each of the
four pixel-space corner offsets around the quad centre, then
normalise back to [0,1] via 1/video_width and 1/video_height.
Same aspect-correct approach as the d3d_shaders fix above.
Add <math.h> to d3d9hlsl.c (d3d9cg.c already had it).
The d3d9 multi-vertex path uses the matrix_data route, so it's
handled by fix (1) alone and needs no driver-side change.
Tested on gl / gl1 / glcore / vulkan / d3d9_cg / d3d9_hlsl /
d3d10 / d3d11 / d3d12.1 parent 832250b commit ace9c9f
4 files changed
Lines changed: 179 additions & 34 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
870 | 870 | | |
871 | 871 | | |
872 | 872 | | |
873 | | - | |
874 | | - | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
875 | 908 | | |
876 | | - | |
877 | | - | |
| 909 | + | |
| 910 | + | |
878 | 911 | | |
879 | | - | |
880 | | - | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
881 | 920 | | |
882 | | - | |
883 | | - | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
884 | 930 | | |
885 | 931 | | |
886 | 932 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
944 | 945 | | |
945 | 946 | | |
946 | 947 | | |
947 | | - | |
948 | | - | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
949 | 986 | | |
950 | | - | |
951 | | - | |
| 987 | + | |
| 988 | + | |
952 | 989 | | |
953 | | - | |
954 | | - | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
955 | 998 | | |
956 | | - | |
957 | | - | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
958 | 1008 | | |
959 | 1009 | | |
960 | 1010 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
45 | 49 | | |
46 | 50 | | |
47 | 51 | | |
48 | 52 | | |
49 | 53 | | |
50 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
51 | 72 | | |
52 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
53 | 76 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
58 | 96 | | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
| 97 | + | |
68 | 98 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
73 | 115 | | |
74 | 116 | | |
75 | 117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1278 | 1278 | | |
1279 | 1279 | | |
1280 | 1280 | | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
1281 | 1288 | | |
1282 | 1289 | | |
1283 | 1290 | | |
| |||
0 commit comments