Matteo Bruni (@Mystral) commented about dlls/d3dx9_36/texture.c:
for (x = 0; x < desc.Width; x++) {
BYTE *dst = data + y * lock_rect.Pitch + x * format->bytes_per_pixel;
struct d3dx_color color;
coord.x = (x + 0.5f) / desc.Width; function(&value, &coord, &size, funcdata);
fill_texture(format, data + y * lock_rect.Pitch + x * format->bytes_per_pixel, &value);
set_d3dx_color(&color, (const struct vec4 *)&value, RANGE_FULL);
An alternative would be to make `value` a union of `D3DXVECTOR4` and `struct vec4`. It doesn't matter much.