Commit Graph

38325 Commits

Author SHA1 Message Date
Matt Borgerson 0c2a617819 nv2a: Bump vmstate version for new NV2A_MAX_BATCH_LENGTH 2025-04-18 11:58:22 -07:00
Erik Abair 270dbe01ea nv2a: Increase MAX_BATCH_LENGTH beyond highest known retail use 2025-04-18 10:46:43 -07:00
Matt Borgerson 5685a6290c nv2a/vk: Set specular power uniform 2025-04-16 20:26:22 -07:00
Erik Abair 679f6d06bd nv2a: Handle LOCALEYE light control 2025-04-16 18:24:46 -07:00
Erik Abair 34ed0f75de nv2a: Handle LOCAL_RANGE 2025-04-16 18:24:46 -07:00
Erik Abair 69c8df2a3e nv2a: Partial implementation of SET_SPECULAR_PARAMS 2025-04-16 18:24:46 -07:00
Erik Abair 7a34eedd6f nv2a: Partially handle SET_LIGHT_CONTROL 2025-04-16 18:24:46 -07:00
Erik Abair 86c85023e6 nv2a: Handle SET_FOG_COORD and SET_WEIGHT* commands 2025-04-16 14:09:13 -07:00
Matt Borgerson 2cc926588b nv2a/gl: Fix COLOR_LE_G8B8 GL surface format type 2025-04-11 04:18:28 -07:00
Erik Abair ebec5e3028 nv2a: Fix assert when setting fog gen mode to fog_x 2025-04-08 16:24:50 -07:00
Matt Borgerson 57cdee770e mcpx/dsp: Fix some formatting/spelling nits 2025-03-31 12:40:31 -07:00
Matt Borgerson 9439f605a8 mcpx/dsp: Drop redundant value/address assertions 2025-03-31 12:40:31 -07:00
Matt Borgerson e08011b772 mcpx/dsp: Rename *.inl -> *.c.inc 2025-03-31 12:40:31 -07:00
Matt Borgerson 4b81c28901 mcpx/dsp: Migrate some DPRINTFs to trace events 2025-03-31 12:40:31 -07:00
Matt Borgerson 31d8237ee3 mcpx/dsp: Remove dsp56k_execute_one_disasm_instruction 2025-03-31 12:40:31 -07:00
Matt Borgerson 8dafd513b9 mcpx/dsp: Move some debug functions out to debug.c 2025-03-31 12:40:31 -07:00
Matt Borgerson d18125994c mcpx/dsp: Drop some dead code 2025-03-31 12:40:31 -07:00
Matt Borgerson f8cbcbadaa mcpx/dsp: Move dma reg defs to a header 2025-03-31 12:40:31 -07:00
Matt Borgerson c68cdd9479 mcpx/dsp: Fix minor header issues 2025-03-31 12:40:31 -07:00
Matt Borgerson 31c491a702 mcpx/dsp: Move cpu reg defs to a header 2025-03-31 12:40:31 -07:00
Matt Borgerson 5ba2ef790c mcpx/dsp: Factor out debug bits to a header 2025-03-31 12:40:31 -07:00
Matt Borgerson 148f04e1c7 mcpx/dsp: Replace printf -> DPRINTF 2025-03-31 12:40:31 -07:00
Matt Borgerson 115456f255 mcpx/dsp: Bring back disassembly 2025-03-31 12:40:31 -07:00
Matt Borgerson 89f98947f6 mcpx/dsp: Fix dprintf use 2025-03-31 12:40:31 -07:00
Matt Borgerson 9af3c1a005 mcpx/dsp: Add missing copyright 2025-03-31 12:40:31 -07:00
Matt Borgerson bf51af891d mcpx/dsp: Move to a library 2025-03-31 12:40:31 -07:00
Erik Abair 672e9cd553 nv2a: Handle SET_SPECULAR_ENABLE 2025-03-28 02:18:42 -07:00
Matt Borgerson 312bd94573 mcpx: Move voice_list_regs to apu.c 2025-03-27 23:33:40 -07:00
Matt Borgerson 2d73e8aafe nv2a: Use root-relative paths to reference parent dir headers 2025-03-27 23:33:40 -07:00
Matt Borgerson 0e18d11d90 nv2a: Rename methods.h -> methods.h.inc 2025-03-27 23:33:40 -07:00
Matt Borgerson a830cc4526 xbox: Disable clang-format for deliberately aligned reg defs 2025-03-27 23:33:40 -07:00
Matt Borgerson 1893b56c38 nv2a/vk: Fix vertex ram buffer dirty bit check 2025-03-19 02:25:33 -07:00
Matt Borgerson b929d4eced nv2a: Drop surface compat clip constraint 2025-03-17 14:48:47 -07:00
Matt Borgerson c3a8b9569f nv2a: Simplify surface clip to scissor size calculation 2025-03-17 14:48:47 -07:00
Logan Stromberg 860bccb722
nv2a: Fix surface clip to scissor origin 2025-03-17 14:32:40 -07:00
coldhex 02659dd3cc nv2a: Fix cubemap fourth texture coordinate component handling
Xbox hardware ignores fourth texture coordinate component for cubemaps.
2025-03-17 11:37:41 -07:00
wilkovatch a00820746f
nv2a: Handle texture dimensions not divisible by 4 in S3TC decoder 2025-03-14 18:44:25 -07:00
Matt Borgerson a143f66ce4 nv2a/psh: Handle 3D textures in PROJECT2D mode 2025-03-10 16:13:09 -07:00
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
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
Erik Abair f701573d44 nv2a: Use rounded values for alpha testing 2025-03-05 17:12:14 -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
Hongren Zheng e82fbf01b6 hw/usb/canokey: Fix buffer overflow for OUT packet
When USBPacket in OUT direction has larger payload
than the ep_out_buffer (of size 512), a buffer overflow
would occur.

It could be fixed by limiting the size of usb_packet_copy
to be at most buffer size. Further optimization gets rid
of the ep_out_buffer and directly uses ep_out as the target
buffer.

This is reported by a security researcher who artificially
constructed an OUT packet of size 2047. The report has gone
through the QEMU security process, and as this device is for
testing purpose and no deployment of it in virtualization
environment is observed, it is triaged not to be a security bug.

Cc: qemu-stable@nongnu.org
Fixes: d7d3491855 ("hw/usb: Add CanoKey Implementation")
Reported-by: Juan Jose Lopez Jaimez <thatjiaozi@gmail.com>
Signed-off-by: Hongren Zheng <i@zenithal.me>
Message-id: Z4TfMOrZz6IQYl_h@Sun
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 664280abddcb3cacc9c6204706bb739fcc1316f7)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-29 22:29:03 +03:00