Commit 345edcb
committed
gfx/d3d9: Upload RGUI menu framebuffer directly as ARGB4444
Both d3d9_hlsl and d3d9_cg previously expanded RGUI's 16bpp menu
framebuffer to 32bpp on the CPU every frame via a per-pixel loop,
then uploaded the result into a D3DFMT_A8R8G8B8 texture. RGUI
already assembles its framebuffer in 16bpp; D3D9 has supported
D3DFMT_A4R4G4B4 as a baseline texture format since launch.
Add D3D9_ARGB4444_FORMAT to d3d9_common.h (with D3DFMT_LIN_A4R4G4B4
for the _XBOX build path), and "d3d9_hlsl"/"d3d9_cg" cases to the
RGUI pixel format dispatcher selecting argb32_to_argb4444 (already
in use for the rsx/PS3 driver, which targets the same ARGB4444
bit layout).
In both menu set_texture_frame paths, allocate the menu texture
as D3DFMT_A4R4G4B4 when rgb32 is false (the only case in current
practice; RGUI is the sole caller), and upload row-by-row via
memcpy. The rgb32 = true API branch is preserved for forward
compatibility and continues to use D3DFMT_A8R8G8B8.
Track the bpp of the currently-allocated menu texture in a new
d3d9_video_t::menu_tex_rgb32 field so the texture is recreated
when the rgb32 flag flips between calls.
Endian-safe by construction: argb32_to_argb4444 produces a
host-endian uint16_t with A in bits 15..12 down to B in 3..0;
D3DFMT_A4R4G4B4 is read by D3D as host-endian 16-bit units with
the same bit assignments. Same contract as the original
ARGB8888 path, just one storage size smaller, so the ordering
holds on both LE (PC) and BE (Xbox 360) hosts without a byte swap.1 parent f2f2f5a commit 345edcb
4 files changed
Lines changed: 68 additions & 43 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| 41 | + | |
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
| |||
90 | 92 | | |
91 | 93 | | |
92 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
93 | 103 | | |
94 | 104 | | |
95 | 105 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4552 | 4552 | | |
4553 | 4553 | | |
4554 | 4554 | | |
4555 | | - | |
| 4555 | + | |
| 4556 | + | |
4556 | 4557 | | |
4557 | 4558 | | |
4558 | 4559 | | |
4559 | 4560 | | |
4560 | 4561 | | |
4561 | 4562 | | |
| 4563 | + | |
| 4564 | + | |
| 4565 | + | |
| 4566 | + | |
| 4567 | + | |
| 4568 | + | |
| 4569 | + | |
4562 | 4570 | | |
4563 | 4571 | | |
4564 | 4572 | | |
4565 | | - | |
| 4573 | + | |
| 4574 | + | |
4566 | 4575 | | |
4567 | 4576 | | |
4568 | 4577 | | |
| |||
4575 | 4584 | | |
4576 | 4585 | | |
4577 | 4586 | | |
| 4587 | + | |
4578 | 4588 | | |
4579 | 4589 | | |
4580 | 4590 | | |
| |||
4583 | 4593 | | |
4584 | 4594 | | |
4585 | 4595 | | |
4586 | | - | |
| 4596 | + | |
4587 | 4597 | | |
4588 | 4598 | | |
4589 | 4599 | | |
| |||
4599 | 4609 | | |
4600 | 4610 | | |
4601 | 4611 | | |
4602 | | - | |
4603 | | - | |
| 4612 | + | |
| 4613 | + | |
| 4614 | + | |
| 4615 | + | |
| 4616 | + | |
| 4617 | + | |
| 4618 | + | |
| 4619 | + | |
| 4620 | + | |
| 4621 | + | |
| 4622 | + | |
4604 | 4623 | | |
4605 | | - | |
4606 | | - | |
4607 | | - | |
| 4624 | + | |
4608 | 4625 | | |
4609 | | - | |
4610 | | - | |
4611 | | - | |
4612 | | - | |
4613 | | - | |
4614 | | - | |
4615 | | - | |
4616 | | - | |
4617 | | - | |
4618 | | - | |
4619 | | - | |
4620 | | - | |
4621 | | - | |
| 4626 | + | |
| 4627 | + | |
| 4628 | + | |
4622 | 4629 | | |
4623 | 4630 | | |
4624 | 4631 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7852 | 7852 | | |
7853 | 7853 | | |
7854 | 7854 | | |
7855 | | - | |
| 7855 | + | |
| 7856 | + | |
7856 | 7857 | | |
7857 | 7858 | | |
7858 | 7859 | | |
7859 | 7860 | | |
7860 | 7861 | | |
| 7862 | + | |
| 7863 | + | |
| 7864 | + | |
| 7865 | + | |
| 7866 | + | |
| 7867 | + | |
| 7868 | + | |
7861 | 7869 | | |
7862 | 7870 | | |
7863 | | - | |
| 7871 | + | |
7864 | 7872 | | |
7865 | 7873 | | |
7866 | 7874 | | |
| |||
7872 | 7880 | | |
7873 | 7881 | | |
7874 | 7882 | | |
| 7883 | + | |
7875 | 7884 | | |
7876 | 7885 | | |
7877 | 7886 | | |
7878 | 7887 | | |
7879 | 7888 | | |
7880 | 7889 | | |
7881 | 7890 | | |
7882 | | - | |
| 7891 | + | |
7883 | 7892 | | |
7884 | 7893 | | |
7885 | 7894 | | |
| |||
7895 | 7904 | | |
7896 | 7905 | | |
7897 | 7906 | | |
7898 | | - | |
7899 | | - | |
| 7907 | + | |
| 7908 | + | |
| 7909 | + | |
| 7910 | + | |
| 7911 | + | |
| 7912 | + | |
| 7913 | + | |
| 7914 | + | |
| 7915 | + | |
| 7916 | + | |
| 7917 | + | |
7900 | 7918 | | |
7901 | | - | |
7902 | | - | |
7903 | | - | |
| 7919 | + | |
7904 | 7920 | | |
7905 | | - | |
7906 | | - | |
7907 | | - | |
7908 | | - | |
7909 | | - | |
7910 | | - | |
7911 | | - | |
7912 | | - | |
7913 | | - | |
7914 | | - | |
7915 | | - | |
7916 | | - | |
7917 | | - | |
| 7921 | + | |
| 7922 | + | |
| 7923 | + | |
7918 | 7924 | | |
7919 | 7925 | | |
7920 | 7926 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1396 | 1396 | | |
1397 | 1397 | | |
1398 | 1398 | | |
1399 | | - | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
1400 | 1402 | | |
1401 | 1403 | | |
1402 | 1404 | | |
| |||
0 commit comments