Commit Graph

119207 Commits

Author SHA1 Message Date
e6e828362e nv2a: Handle 2D textures given to 3D texture modes
Hardware transparently supports passing 2D textures to operations that
are intended to operate on cubemaps. This change introduces a remapping
function to mimic the hardware behavior in cases where the texture
sampler does not match the expectations of the texture mode.

Fixes #1622

Tests: 4a1fde9085/src/tests/texture_2d_as_cubemap_tests.cpp (L79)
HW results: https://abaire.github.io/nxdk_pgraph_tests_golden_results/results/Texture_2D_as_cubemap/index.html
2025-11-16 13:13:21 -07:00
a4b8caf743 nv2a: Prevent GL assert on END without BEGIN 2025-11-14 12:01:13 -07:00
febb54bd4d nv2a: Enforce point params min/max size
[Tests](5920c89548/src/tests/point_sprite_tests.cpp (L27))
[HW results](https://abaire.github.io/nxdk_pgraph_tests_golden_results/results/Point_sprite/index.html)

Fixes #2378
2025-11-10 10:50:21 -07:00
a9c699d6ec ci: bump docker/metadata-action from 5.8.0 to 5.9.0
Bumps [docker/metadata-action](https://github.com/docker/metadata-action) from 5.8.0 to 5.9.0.
- [Release notes](https://github.com/docker/metadata-action/releases)
- [Commits](c1e51972af...318604b99e)

---
updated-dependencies:
- dependency-name: docker/metadata-action
  dependency-version: 5.9.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-10 10:33:49 -07:00
c034d7ae60 ci: bump softprops/action-gh-release from 2.4.1 to 2.4.2
Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 2.4.1 to 2.4.2.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](6da8fa9354...5be0e66d93)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-version: 2.4.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-10 10:32:49 -07:00
24b4b99a54 nv2a/gl: Prevent depth surface being used as display source 2025-11-06 11:53:21 -07:00
db8d27b9f4 nv2a: More accurate handling of exceptional fog values in VSH
The handling of infinite fog coordinates in #660 does not exactly
match HW behavior for all bias and multiplier values. Further testing
indicates that the handling of the infinite value appears to override
all combinations of FOG_PARAM bias/multipliers, rather than keeping
the bias. This change emulates this behavior and also fixes NaN
handling, which similarly seems to be fog-mode dependent.

Fixes #2474
Fixes #2412
Fixes #2200
Fixes #632
2025-10-29 13:21:58 -07:00
95fdb7cd32 ci: bump actions/download-artifact from 5.0.0 to 6.0.0
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 5.0.0 to 6.0.0.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](634f93cb29...018cc2cf5b)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: 6.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-28 17:14:09 -07:00
ed85a7c211 ci: bump astral-sh/setup-uv from 7.1.1 to 7.1.2
Bumps [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) from 7.1.1 to 7.1.2.
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](2ddd2b9cb3...85856786d1)

---
updated-dependencies:
- dependency-name: astral-sh/setup-uv
  dependency-version: 7.1.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-28 17:14:03 -07:00
fc72163692 ci: bump actions/upload-artifact from 4.6.2 to 5.0.0
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.6.2 to 5.0.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](ea165f8d65...330a01c490)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: 5.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-28 17:13:56 -07:00
dc672ab87b nv2a/gl: Move GPU property check context creation to main thread
GL context must be created from main thread on macOS.
2025-10-28 11:39:19 -07:00
5eb603b28d nv2a: Emit separate triangles and line segment from geometry shader
Mesa OpenGL radeonsi driver has a bug where triangles in triangle strips
emitted from geometry shader may have provoking vertices not corresponding
to either first or last vertex convention when GL_FIRST_VERTEX_CONVENTION
is used.

This commit changes geometry shader such that it always emits separate
triangles and line segments and it doesn't matter what vertex OpenGL or
Vulkan implementation chooses as provoking.
2025-10-24 15:31:28 -04:00
46741f23cc nv2a/glsl: Delete deprecated FIXME comment about about vertex order 2025-10-24 15:31:28 -04:00
ba9761fc97 nv2a/vk: Apply the Nvidia geometry shader bug work around with Vulkan too
This is possibly not needed with Vulkan, but apply it anyway just in case.
2025-10-24 15:31:28 -04:00
834c4bbfda nv2a/gl: Work around an Nvidia geometry shader compiler bug
This adds redundant computation to the simple geometry shader for winding
testing based on the assumption that Nvidia GeForce compiler has a bug
which may incorrectly detect a simple geometry shader as a passthrough
shader.
2025-10-24 15:31:28 -04:00
36e4772996 nv2a: Vertex reordering for flat shading in geometry shader
Test OpenGL/Vulkan geometry shader triangle, strip and fan vertex ordering
during backend initialization. OpenGL/Vulkan does not guarantee absolute
vertex order for geometry shader input triangles. The test results are
used to reorder input triangle vertices into the first vertex convention
order so that correct provoking vertex can be chosen for flat shading.

Also, this removes use of the Vulkan provoking vertex extension. The
default first vertex convention is now used when emitting line strips
in geometry shader. (It would of course be possible to always emit only
separate line segments and then the convention wouldn't matter at all.)
2025-10-24 15:31:28 -04:00
b2ded13f6b nv2a: Fix polygon line mode and implement flat shading provoking vertex
Xbox draws lines in polygon mode without trying to avoid overlaps, e.g.
internal edge lines are drawn twice for triangle strips and fans. This is
evidenced by using additive blending and also stencil adds. This commit
removes the gl_PrimitiveIDIn==0 checks which were there to avoid drawing
lines twice.

This commit also implements flat shading first/last provoking vertex
handling. This fixes triangle strip and fan flat shading in
nxdk_pgraph_tests shade model tests.
2025-10-24 15:31:28 -04:00
d6cb7536a2 nv2a: Depth buffer precision improvements and polygon offset slope factor
1. Use barycentric coordinates to interpolate depth values. Linux, Mesa
and AMD Radeon RX 6600 with Vulkan driver currently has quite poor
interpolation precision, which results in artifacts in at least Chronicles
of Riddick. Intel integrated UHD 770 has much better precision, for
example. This commit handles depth interpolation manually. Also note that
the previous w-buffer interpolation used gl_FragCoord.w which can't produce
all w-values, e.g. 1.0f/16777046.0f equals 1.0f/16777047.0f with 32-bit
floats. This also uses depth value differences in interpolation which has
the desired property that a triangle with the same z-value on all vertices
will result in exactly that same z-value when interpolated. At least the
game Shenmue II sky rendering relies on this.

2. Computes polygon depth bias slope for both z-buffering and w-buffering.
These are computed by taking the max and abs of partial derivatives of
either of the functions z=z(x,y) or w=w(x,y), where x,y,z,w are
screen-space coordinates. This matches Xbox hardware for z-buffering where
the partial derivatives are constants over any fixed triangle. However,
for w-buffering the partial derivatives vary over any fixed triangle, but
Xbox appears to compute just a single depth slope at the first visible
pixel (where "first" means something like first in top-left order) and uses
that over the whole triangle. This commit computes the slope per-pixel.
The way to compute the partial derivatives is by using the chain-rule, e.g.
dw/dx = -w^2 * d(1/w)/dx. This is useful since 1/w is linear in
screen-space and therefore d(1/w)/dx is constant over any fixed triangle.
But, as mentioned, finding out the w-value for the first visible pixel
of a triangle is difficult in OpenGL/Vulkan and is not done here. Instead
we calculate depth slope per-pixel.
2025-10-24 15:31:28 -04:00
594f787343 nv2a: Fix vertex ordering of triangle strips in polygon line mode
This fixes nxdk_pgraph_tests W_param tests a bit more. Note that the
geometry shader approach in Xemu for polygon line mode doesn't currently
implement face culling. It could be improved by using the built-in
gl_FrontFacing variable in the geometry shader.
2025-10-24 15:31:28 -04:00
a18240e897 ci: bump astral-sh/setup-uv from 7.1.0 to 7.1.1
Bumps [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) from 7.1.0 to 7.1.1.
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](3259c6206f...2ddd2b9cb3)

---
updated-dependencies:
- dependency-name: astral-sh/setup-uv
  dependency-version: 7.1.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-24 14:43:00 -04:00
19f18873d9 ui: Add xiso files to loader menu 2025-10-15 21:17:27 -04:00
705b5d4759 ui: Add games directory to popup-menu 2025-10-15 21:17:27 -04:00
5c30af2923 meson: Bump SPIRV-Reflect to vulkan-sdk-1.4.328.1 2025-10-15 19:20:54 -04:00
a128e31c07 ci: bump softprops/action-gh-release from 2.3.4 to 2.4.1
Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 2.3.4 to 2.4.1.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](62c96d0c4e...6da8fa9354)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-version: 2.4.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-15 19:19:54 -04:00
4f2c4a33bf ci: bump astral-sh/setup-uv from 6.8.0 to 7.1.0
Bumps [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) from 6.8.0 to 7.1.0.
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](d0cc045d04...3259c6206f)

---
updated-dependencies:
- dependency-name: astral-sh/setup-uv
  dependency-version: 7.1.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-15 19:19:44 -04:00
5a165cb0fc .clang-tidy: Add basic .clang-tidy for identifier naming 2025-10-15 19:19:11 -04:00
2736bab0bd ci: bump softprops/action-gh-release from 2.3.3 to 2.3.4
Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 2.3.3 to 2.3.4.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](6cbd405e2c...62c96d0c4e)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-version: 2.3.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-07 12:31:49 -07:00
5b7d7e3dd0 ci: bump docker/login-action from 3.5.0 to 3.6.0
Bumps [docker/login-action](https://github.com/docker/login-action) from 3.5.0 to 3.6.0.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](184bdaa072...5e57cd1181)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-version: 3.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-07 12:31:43 -07:00
b1d13d6a56 ci: bump astral-sh/setup-uv from 6.7.0 to 6.8.0
Bumps [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) from 6.7.0 to 6.8.0.
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](b75a909f75...d0cc045d04)

---
updated-dependencies:
- dependency-name: astral-sh/setup-uv
  dependency-version: 6.8.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-07 12:31:37 -07:00
1973482781 ci: bump actions/cache from 4.2.4 to 4.3.0
Bumps [actions/cache](https://github.com/actions/cache) from 4.2.4 to 4.3.0.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](0400d5f644...0057852bfa)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: 4.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-28 23:43:17 -07:00
93b16e5ccd meson: Bump glslang to 16.0.0 2025-09-28 23:42:09 -07:00
518208e849 nv2a: Handle anisotropic filter setting 2025-09-25 12:12:28 -07:00
59626b1f5d .github: Fix nesting of template field IDs 2025-09-23 14:51:25 -07:00
01327a9689 .github: Add IDs to issue template fields 2025-09-23 13:19:41 -07:00
2d26f185a0 nv2a: Implement texture LOD bias 2025-09-23 12:56:08 -07:00
ff1617d664 configure: bump Meson to 1.9.0 for use with Rust
Meson 1.9.0 provides mixed linking of Rust and C objects.  As a side effect,
this also allows adding dependencies with "sources: ..." files to Rust crates
that use structured_sources().

It can also clean up up the meson.build files for Rust noticeably, but due
to an issue with doctests (see https://github.com/mesonbuild/meson/pull/14973)
that will have to wait for 1.9.1.

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Link: https://lore.kernel.org/r/20250908105005.2119297-3-pbonzini@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

xemu: Update minimum Meson requirement to 1.8.4 to facilitate building on
macOS with Clang 17.
Fixes #2442
2025-09-19 16:54:08 -07:00
c700b2a647 nv2a: Fix fixed point NV_PVIDEO_POINT_IN handling
Tests: c047da43bb/src/tests/pvideo_tests.cpp (L1063)

Fixes #2432
2025-09-18 11:26:02 -07:00
234840d342 nv2a: Improve some assert messages 2025-09-16 13:24:19 -07:00
fe030fdac9 nv2a: Fix handling of PVIDEO color key red channel 2025-09-16 13:12:49 -07:00
1fb9e050a4 nv2a: Ignore alpha when processing PVIDEO color keying
Discards the alpha value passed to the color key register, matching tested
hardware behavior.

Fixes #2421

Tests: c64f5af5f7/src/tests/pvideo_tests.cpp (L761)

Note: PVIDEO tests do not produce artifacts so they must be compared manually
against HW. I have verified that they are identical for the subset of surface
formats supported by xemu.
2025-09-16 12:56:19 -07:00
e9b3d0b1b8 ci: bump astral-sh/setup-uv from 6.6.1 to 6.7.0
Bumps [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) from 6.6.1 to 6.7.0.
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](557e51de59...b75a909f75)

---
updated-dependencies:
- dependency-name: astral-sh/setup-uv
  dependency-version: 6.7.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-15 21:40:18 -07:00
smx
c678433840 nv2a/vk: Set addressModeW only for 3D textures 2025-09-08 13:34:42 -07:00
442ce64613 ci: bump softprops/action-gh-release from 2.3.2 to 2.3.3
Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 2.3.2 to 2.3.3.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](72f2c25fcb...6cbd405e2c)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-version: 2.3.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-08 13:30:09 -07:00
47d2ec711c ci: bump astral-sh/setup-uv from 6.6.0 to 6.6.1
Bumps [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) from 6.6.0 to 6.6.1.
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](4959332f0f...557e51de59)

---
updated-dependencies:
- dependency-name: astral-sh/setup-uv
  dependency-version: 6.6.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-08 13:29:48 -07:00
a692d52c22 ci: bump actions/setup-python from 5.6.0 to 6.0.0
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5.6.0 to 6.0.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v5.6.0...v6.0.0)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: 6.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-08 13:29:14 -07:00
22ea58291d ci: bump astral-sh/setup-uv from 6.5.0 to 6.6.0
Bumps [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) from 6.5.0 to 6.6.0.
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](d9e0f98d3f...4959332f0f)

---
updated-dependencies:
- dependency-name: astral-sh/setup-uv
  dependency-version: 6.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-03 15:44:33 -07:00
1fedff4795 nv2a: Fix edge cases leading to GL debug group stack overflows 2025-09-03 15:34:31 -07:00
b8cd8ba8cd ci: bump astral-sh/setup-uv from 6.4.3 to 6.5.0
Bumps [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) from 6.4.3 to 6.5.0.
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](e92bafb625...d9e0f98d3f)

---
updated-dependencies:
- dependency-name: astral-sh/setup-uv
  dependency-version: 6.5.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-20 11:40:12 -07:00
9e2d90665c ci: bump actions/checkout from 4.2.2 to 5.0.0
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.2 to 5.0.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](11bd71901b...08c6903cd8)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 5.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-20 11:39:39 -07:00
7676418520 ci: bump actions/cache from 4.2.3 to 4.2.4
Bumps [actions/cache](https://github.com/actions/cache) from 4.2.3 to 4.2.4.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](5a3ec84eff...0400d5f644)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: 4.2.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-10 23:10:38 -07:00