Commit Graph

118873 Commits

Author SHA1 Message Date
Matt Borgerson 6e3dfb36d8 nv2a/vk: Don't set compressed, swizzled when attribute is uniform 2025-03-10 14:23:43 -07:00
Matt Borgerson 4665515d80 nv2a: Group attributes in pgraph_get_glsl_vtx_header 2025-03-10 12:30:16 -07:00
Alexandre Bouvier dfbf4dfd36
meson: Drop glslang dependency method param for CMake search 2025-03-08 15:14:58 -07:00
coldhex 3eb22b6b81 nv2a: Explicit float representation for RCC and vertex shader W range 2025-03-08 14:54:18 -07:00
coldhex 63cb75ce84 nv2a: Fix -0.0 clamping of RCC instruction and vertex shader W-output
Xbox rounds -0.0 to the negative range and 0.0 to the positive range. This
commit also restores RCC instruction clamping to be done on the output of
reciprocal calculation (which current Xemu release does) with fix for the
input=Infinity case.
2025-03-08 14:54:18 -07:00
coldhex 8dc6c90e11 nv2a/vk: Drop unnecessary dirty check for NV_PGRAPH_ZCOMPRESSOCCLUDE
This was used to enable/disable Vulkan depth clamping, but that was
removed in previous commit.
2025-03-08 14:54:18 -07:00
coldhex 854a001063 nv2a: Fix zero-vector input in fixed function vertex shader
If tPosition is a zero-vector, then invViewport matrix had no effect.
Bounding w-coordinate away from zero and infinity must be done before
applying invViewport (which is needed for OpenGL/Vulkan) to emulate
Xbox hardware behaviour properly.
2025-03-08 14:54:18 -07:00
coldhex 798ad30819 nv2a: Perspective-correct interpolation for w-buffering
z_perspective is true implies w-buffering and then the w-coordinate stored
in the depth buffer should also be interpolated in a perspective-correct
way. We do this by calculating w and setting gl_FragDepth in the fragment
shader.

Since enabling polygon offset and setting values using glPolygonOffset
won't have any effect when manually setting gl_FragDepth for w-buffering,
we introduce the depthOffset variable to obtain similar behaviour (but the
glPolygonOffset factor-argument is currently not emulated.) (Note that
glPolygonOffset is OpenGL implementation-dependent and it might be good to
use depthOffset for z-buffering as well, but this is not done here and we
still use OpenGL/Vulkan zbias functionality.)

This also implements depth clipping and clamping in the fragment shader.
If triangles are clipped, the shadows of the small rocks in Halo 2 Beaver
Creek map can have flickering horizontal lines. The shadows are drawn on
the ground in another pass with the same models as for the ground, but for
some reason with depth clamping enabled. The flickering happens if Xemu
clips the ground triangles, but the exact same shadow triangles are depth
clamped, so there are small differences in the coordinates. The shadows
are drawn with depth function GL_EQUAL so there is no tolerance for any
differences. Clipping in the fragment shader solves the problem because
the ground and shadow triangles remain exactly the same regardless of
depth clipping/clamping. For some performance gain, it might be a good
idea to cull triangles by depth in the geometry shader, but this is not
implemented here.

In the programmable vertex shader we always multiply position output by w
because this improves numerical stability in subsequent floating point
computations by modern GPUs. This usually means that the perspective
divide done by the vertex program gets undone.

The magic bounding constants 5.42101e-020 and 1.884467e+019 are replaced
by 5.421011e-20 and 1.8446744e19, i.e. more decimals added. This makes the
32-bit floating point numbers represent exactly 2^(-64) and 2^64 (raw bits
0x1f800000 and 0x5f800000) which seem more likely the correct values
although testing with hardware was not done to this precision.

Testing indicates that the same RCC instruction magic constants are also
applied to both fixed function and programmable vertex shader w-coordinate
output. This bounding replaces the special test for w==0.0 and abs(w)==inf
which used to set vtx_inv_w=1.0 (which did not match Xbox hardware
behaviour.)
2025-03-08 14:54:18 -07:00
Matt Borgerson 45078ef51f ui: InputTextMultiline buf_size should include the null-terminator 2025-03-08 04:00:18 -07:00
Matt Borgerson 355228913c meson: Update imgui,implot 2025-03-08 04:00:18 -07:00
Matt Borgerson 1d662cb49e meson: Replace in-tree nlohmann_json with a subproject wrap 2025-03-08 02:36:24 -07:00
Matt Borgerson f1ce017bd2 meson: Support system glslang 2025-03-08 00:55:46 -07:00
Alexandre Bouvier 7b9b7a0c25 meson: Optionally use system tomlplusplus, xxhash, json 2025-03-08 00:55:46 -07:00
Matt Borgerson 05072e23f1 build.sh: Change macOS PKG_CONFIG_PATH -> PKG_CONFIG_LIBDIR 2025-03-08 00:55:46 -07:00
Matt Borgerson 67bb27f760 meson: Enable curl platform-specific features 2025-03-08 00:55:46 -07:00
Matt Borgerson f305279f67 scripts/gen-license.py: Drop openssl 2025-03-07 22:12:49 -07:00
Matt Borgerson 7c8cde51d1 build.sh: Drop openssl11 fixes 2025-03-07 22:12:49 -07:00
Matt Borgerson 38b7cbe668 scripts/download-macos-libs.py: Drop openssl11 dep 2025-03-07 22:12:49 -07:00
Matt Borgerson f2830ce9ae meson: Drop openssl dep 2025-03-07 22:12:49 -07:00
Matt Borgerson d2948f18fe scripts/gen-license.py: Drop cpp-httplib 2025-03-07 22:12:49 -07:00
Matt Borgerson 5428760104 meson: Drop cpp-httplib dep 2025-03-07 22:12:49 -07:00
Matt Borgerson 8d2c1dbc32 ui: Migrate updater from httplib to libcurl wrapper 2025-03-07 22:12:49 -07:00
Matt Borgerson f6de4f03d7 ui: Migrate reporter from httplib to libcurl wrapper 2025-03-07 22:12:49 -07:00
Matt Borgerson 1cf3858ba1 util/http: Add simple wrapper functions for libcurl 2025-03-07 22:12:49 -07:00
Matt Borgerson ccbf45aecf scripts/gen-license.py: Add libcurl 2025-03-07 22:12:49 -07:00
Matt Borgerson 3decda5614 meson: Add libcurl subproject fallback 2025-03-07 22:12:49 -07:00
Matt Borgerson 714ec0c4da meson: Require libcurl 2025-03-07 22:12:49 -07:00
Matt Borgerson 14c35466f3 debian: Add libcurl4-gnutls-dev dep 2025-03-07 22:12:49 -07:00
Matt Borgerson 046d127f31 ui: Trim FontAwesome font to glyphs in use (save 940KiB) 2025-03-06 03:00:45 -07:00
Matt Borgerson fdb78c5dbd meson: Don't build glslang with hlsl support 2025-03-06 00:50:08 -07:00
Matt Borgerson eeaee81223 ci: Drop -fuse-ld option on Ubuntu builds 2025-03-06 00:49:06 -07:00
Erik Abair f701573d44 nv2a: Use rounded values for alpha testing 2025-03-05 17:12:14 -07:00
Matt Borgerson 203b33ecf0 ci: Zero Ubuntu dpkg version to eliminate cflag differences 2025-03-05 14:40:46 -07:00
Matt Borgerson c3120831bb ci: Update Ubuntu x86-64 release runner to ubuntu-24.04 2025-03-05 14:40:46 -07:00
Matt Borgerson 41ad49c9e9 scripts/download-macos-libs.py: Skip libsndfile 2025-03-04 22:58:26 -07:00
Matt Borgerson 4ca9cd9691 ci: Bump Windows build container 2025-03-04 22:58:26 -07:00
Matt Borgerson 3bdb9e7fd4 ubuntu-win64-cross: Bump mxe/build-win64-mxe 2025-02-15 16:56:30 -07:00
Matt Borgerson 906d085d66 meson: Update xxHash wrap 2025-02-15 16:56:30 -07:00
Matt Borgerson 65844f02e3 meson: Update VulkanMemoryAllocator wrap 2025-02-15 16:56:30 -07:00
Daniel Cook 33046acd82
ui: Add 720x480 resolution to Window size options 2025-02-15 16:17:58 -07:00
mborgerson de1f311efa
Merge QEMU v9.2.1 2025-02-15 15:17:25 -07:00
coldhex 0427ae8cfc mcpx: Implement APU multipass voice processing
Voice Processor (VP) multipass feature allows configuring lists of voices
that are first mixed (in order) into a designated mixbin which is then used
as a sample source when processing voices with multipass flag set to true
in NV_PAVS_VOICE_CFG_FMT. Setting correct voice order in lists is the
responsibility of the game/application and in practice is handled by the
DirectSound library. The multipass mixbin is hardcoded to 31 in
DirectSound, but hardware would allow other bins.

This implementation also adds additional info to audio debug UI to see what
the source and destination voices involved are. The info is only shown
when DSP processing is off, i.e. "VP Only" (MON_VP) is selected. This is
because storing the voice numbers requires additional digging which is
required for MON_VP anyway and therefore is free. The multipass feature
itself works fine with DSP (i.e. GP and EP) enabled, only the additional
debug info is not shown.
2025-02-15 15:01:29 -07:00
Matt Borgerson 366aacb398 v9.2.1 release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEZKoqtTHVaQM2a/75gqpKJDselHgFAmenP10ACgkQgqpKJDse
 lHhYXxAAhSGXrrfEjfyNPO0N5tRKqCzYkoeB5GDScRMb3UogF2/jg/VV2uAVBKnl
 ikCO87w81+8FctiYKfMYnhTk+axlxYq//H8JALX3tyt35BpSfSkyxS8RGzVl4S3l
 0TMA0l+cs3zPDq+yA3UAhppV5CgwBbzaN8xCm9mNFe49nlIHymgcFc3tFFtS0x+H
 PLjbqGX3X7joyqZ0O2cYk3UwzF01ZR1RKgM3sUumvsoSOwuKGul4jc0iLCn9hTHX
 QdxrThxb9KL5iL+fY5DlYc/LiJNPk1NcU1dQzqJinzrux9wNr4RpF7iSrs+m0Y/d
 3FNzMTPuiqwBh4JJFGuSguR83q6nJLlVR/kKxPmPNBSX86q4L1Dw0rbyb40ZRGAA
 xV88kv8gzvmhR2hnScn7S+2d3EG9D3DKDCKTPp0unHhMjZk9rP+hcPmQaTqi1CIW
 c400CI2gP0e0a8TFLKTnTFVP2+scvOkVn6rBy9+pQat0eTMgWjA9VSxvG5GRJ4W9
 +i/9RSTyCLy3s7DWX3JN9nytZ5mS/RDv5YB3FfeMlT/1wH5PFYitxHdyxjHrBE+8
 KjXPtqDsJTMvwqPP+2nDD7D1MQWJgz0468GeuPK5itJCYBVYilIOUlibKfAEPbo+
 0eUtq1oVMJfKnJadARf2cQrzR2IGEWF1rZqrRrkxfl+mHnTxnss=
 =XhYS
 -----END PGP SIGNATURE-----

Merge QEMU v9.2.1
2025-02-15 13:59:10 -07:00
Michael Tokarev cac3fb4414 Update version for 9.2.1 release
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-08 14:26:21 +03:00
Matt Borgerson ac781ea8d1 ci: Fix ubuntu artifact unpack 2025-02-04 18:08:08 -07:00
Matt Borgerson 9f97cdc027 ci: Build AppImage for aarch64 2025-02-04 16:41:21 -07:00
Matt Borgerson a730f078e5 ci: Fix Windows ccache key 2025-02-04 16:41:21 -07:00
Dominik 'Disconnect3d' Czarnota 4404720764 gdbstub/user-target: fix gdbserver int format (%d -> %x)
This commit fixes an incorrect format string for formatting integers
provided to GDB when debugging a target run in QEMU user mode.

The correct format is hexadecimal for both success and errno values,
some of which can be seen here [0].

[0] e65a355022/gdbserver/hostio.cc (L196-L213)

Signed-off-by: Dominik 'Disconnect3d' Czarnota <dominik.b.czarnota@gmail.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Fixes: e282010b2e ("gdbstub: Add support for info proc mappings")
Cc: qemu-stable@nongnu.org
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit 8b647bd352505234cab2acd2422aba183a1aa1fd)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-01 12:21:08 +03:00
Laurent Vivier 7dc66ede71 net/dump: Correctly compute Ethernet packet offset
When a packet is sent with QEMU_NET_PACKET_FLAG_RAW by QEMU it
never includes virtio-net header even if qemu_get_vnet_hdr_len()
is not 0, and filter-dump is not managing this case.

The only user of QEMU_NET_PACKET_FLAG_RAW is announce_self,
we can show the problem using it and tcpddump:

- QEMU parameters:

  .. -monitor stdio \
     -netdev bridge,id=netdev0,br=virbr0 \
     -device virtio-net,mac=9a:2b:2c:2d:2e:2f,netdev=netdev0 \
     -object filter-dump,netdev=netdev0,file=log.pcap,id=pcap0

- HMP command:

  (qemu) announce_self

- TCP dump:

  $ tcpdump -nxr log.pcap

  without the fix:

    08:00:06:04:00:03 > 2e:2f:80:35:00:01, ethertype Unknown (0x9a2b), length 50:
         0x0000:  2c2d 2e2f 0000 0000 9a2b 2c2d 2e2f 0000
         0x0010:  0000 0000 0000 0000 0000 0000 0000 0000
         0x0020:  0000 0000

  with the fix:

    ARP, Reverse Request who-is 9a:2b:2c:2d:2e:2f tell 9a:2b:2c:2d:2e:2f, length 46
         0x0000:  0001 0800 0604 0003 9a2b 2c2d 2e2f 0000
         0x0010:  0000 9a2b 2c2d 2e2f 0000 0000 0000 0000
         0x0020:  0000 0000 0000 0000 0000 0000 0000

Fixes: 481c52320a ("net: Strip virtio-net header when dumping")
Cc: akihiko.odaki@daynix.com
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit c6a1b591a68b4d7230d6c3f56965e18080d737e5)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-01 12:01:02 +03:00
Laurent Vivier eec417351f net: Fix announce_self
b9ad513e18 ("net: Remove receive_raw()") adds an iovec entry
in qemu_deliver_packet_iov() to add the virtio-net header
in the data when QEMU_NET_PACKET_FLAG_RAW is set but forgets
to increase the number of iovec entries in the array, so
receive_iov() will only send the first entry (the virtio-net
entry, full of 0) and no data. The packet will be discarded.

The only user of QEMU_NET_PACKET_FLAG_RAW is announce_self.

We can see the problem with tcpdump:

- QEMU parameters:

  .. -monitor stdio \
     -netdev bridge,id=netdev0,br=virbr0 \
     -device virtio-net,mac=9a:2b:2c:2d:2e:2f,netdev=netdev0 \

- HMP command:

  (qemu) announce_self

- TCP dump:

  $ sudo tcpdump -nxi virbr0

  without the fix:

    <nothing>

  with the fix:

   ARP, Reverse Request who-is 9a:2b:2c:2d:2e:2f tell 9a:2b:2c:2d:2e:2f, length 46
        0x0000:  0001 0800 0604 0003 9a2b 2c2d 2e2f 0000
        0x0010:  0000 9a2b 2c2d 2e2f 0000 0000 0000 0000
        0x0020:  0000 0000 0000 0000 0000 0000 0000

Reported-by: Xiaohui Li <xiaohli@redhat.com>
Bug: https://issues.redhat.com/browse/RHEL-73891
Fixes: b9ad513e18 ("net: Remove receive_raw()")
Cc: akihiko.odaki@daynix.com
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit 84dfdcbff33fff185528501be408c25c44499f32)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-01 12:00:13 +03:00