cv2pdb 0.52 can stop with an integer divide by zero (0xC0000094) while
it converts the DWARF of an arm64 release build. The fault is in the
DW_OP_div case of its location expression evaluator (decodeLocation in
src/readDwarf.cpp). The "Generate PDB" job then fails with exit code 1
and no message, and the other PDB jobs of the run are cancelled. Whether
a build triggers it depends on the binary: the same source on another
base commit converts.
cv2pdb 0.53 and 0.54 convert the same binary. 0.54 is the latest
release and also contains "Fixed processing of ARM64 images".
The Vulkan renderer shares its display image with the GL contexts through
external memory, which only works when the Vulkan device is the GPU those
contexts run on. Until now the renderer selected its device by the saved
display.vulkan.preferred_physical_device name, or else the first compatible
device, and wrote the result back to the config. On multi-GPU systems this
could pick a device other than the one driving the display and crash on
import, and the saved name could be wrong on a later boot.
Read GL_DEVICE_UUID_EXT from the renderer's GL context and require the
Vulkan device with the matching UUID. The UUID is read before the Vulkan
instance is created, as loading Vulkan drivers can unbind the current GL
context. If no supported device matches, initialization fails with a clear
message and pgraph falls back to the default renderer instead of degrading.
As a last resort, display.vulkan.force_physical_device names a device to
use regardless of detection. It is never written by xemu, and it uses a
new key so stale preferred_physical_device entries saved by older builds
are ignored rather than forcing a device.
Bug reports now always include the GL strings, which describe the same GPU
as the Vulkan device, in place of the saved device name.
The fixed-function vertex shader generator mixed `.rgb` and `.xyz` when
operating on colors. Switch the remaining color accesses (light and
material color defines, diffuse/specular light accumulation into
oD0/oD1, the non-separate specular sum, and the specular alpha override
on vtxD1/vtxB1) to the `rgba` aliases so it is obvious which vectors
hold colors.
The `rgba` and `xyzw` swizzle sets are aliases for the same components,
so the generated shaders are functionally identical. Non-color vectors
(positions, normals, texture coordinates, light/spot/specular
coefficients) are left untouched.
Resolves#3115.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Texture formats are used without checking that the device supports
them. Most are mandatory for sampling, but VK_FORMAT_R16_UNORM, used for
the Y16 depth texture formats, is not, and creating an image with an
unsupported format is invalid. Surface formats are checked, but only
after most of the renderer has been initialized, and a failure is an
assertion.
Check both during physical device selection instead. Every mapped
texture format must support SAMPLED_IMAGE and TRANSFER_DST with optimal
tiling, which the spec guarantees for every format it requires to be
sampleable. Every color surface format and the D16 zeta format must be
creatable with their usage, and at least one of the two depth-stencil
formats that surface init chooses between must be as well. A device
missing any of these is reported and treated as incompatible, like one
missing a required extension, so initialization fails cleanly through
the existing "Failed to find a suitable GPU" path.
The surface check reuses the image format query from surface.c, now
taking a VkPhysicalDevice so it can run before the device is selected.
The color surface format assertion in surface init is removed, as it
can no longer fail; the zeta checks remain because they select between
the two depth-stencil formats.
No fallback is provided for R16_UNORM. The only candidate, sampling the
high byte of the depth value through R8G8_UNORM, would quantize depth
comparisons to 8 bits, which is not acceptable. Such devices are rare
enough that a fallback can wait for a concrete use case.
R6G5B5 texture data is converted to 8-bit signed components, which the
Vulkan renderer uploads as VK_FORMAT_R8G8B8_SNORM. That format has no
mandatory feature support and is not supported for sampling on some
drivers (e.g. llvmpipe), in which case every R6G5B5 texture creates an
invalid image.
Emit 4 bytes per texel from the conversion instead, with alpha set to
1.0, and sample it as VK_FORMAT_R8G8B8A8_SNORM, which is mandatory for
sampling since Vulkan 1.0. Alpha is swizzled to one, as before.
The OpenGL renderer shares the conversion, so upload with GL_RGBA source
data into the unchanged GL_RGB8_SNORM internal format. This also avoids
3-byte rows for small mip levels, which were not 4-byte aligned under
the default GL_UNPACK_ALIGNMENT.
Drop R8G8B8_SNORM from vk_format_texel_size rather than replacing it, so
that R6G5B5 textures continue to never be treated as raw copies of
surfaces.
Building against Vulkan headers older than 1.3 fails because
VK_API_VERSION_1_3 is not defined.
Cap the requested API version at the newest version the headers
define, and guard the Vulkan 1.3 shader target selection accordingly.
The cap must follow the headers since VMA asserts when given an API
version newer than it was compiled for.
Verified to compile with Vulkan-Headers 1.2.162 and later.
VK_FORMAT_A4R4G4B4_UNORM_PACK16 is only available on Vulkan 1.1/1.2
devices via VK_EXT_4444_formats, which the renderer does not enable, and
remains optional when promoted to core in Vulkan 1.3. Using it without
checking for support is invalid on devices that lack it.
Instead, use VK_FORMAT_B4G4R4A4_UNORM_PACK16, which is mandatory for
sampling since Vulkan 1.0. Its 4-bit components occupy the same bit
positions as the NV2A A4R4G4B4 format's A, R, G, B components, so the
texel data is uploaded and copied unchanged and an image view swizzle of
{G, R, A, B} restores the expected channel order.
Raise the instance API version cap from 1.3 to 1.4. The negotiated
version remains the minimum of the instance and device versions, so
devices reporting older versions are unaffected.
When the negotiated version is 1.4, compile shaders targeting the
Vulkan 1.4 client environment (SPIR-V 1.6, as with 1.3).
Both changes are guarded on VK_API_VERSION_1_4 so the build continues
to work with older Vulkan headers (e.g. Ubuntu 22.04 ships 1.3.204),
in which case the cap remains 1.3.
GLSLANG_TARGET_VULKAN_1_4 was introduced in glslang 15.1.0, so raise
the minimum system glslang version accordingly. Older system versions
fall back to the bundled subproject.
Pass PGRAPHVkState to pgraph_vk_compile_glsl_to_spv and choose the
Vulkan client and SPIR-V target versions there, removing the
pgraph_vk_set_glsl_target helper and its file-scope globals.
Use r->vk_api_version, the negotiated version the device is created
with (min of instance and device versions), rather than the device's
reported apiVersion.
Shaders are compiled for Vulkan 1.3 and SPIR-V 1.6 regardless of what
the device reports. On anything older the result is a module the driver
is not required to accept: the validation layer calls it "Invalid SPIR-V
binary version 1.6 for target environment", and it happens for every
shader the renderer builds.
V3DV on the Raspberry Pi 5 reports Vulkan 1.2, so every shader compiled
there is out of spec today.
Select the client and SPIR-V versions from the device's own apiVersion,
which is known before the compiler is initialised.
Tron 2.0 uses a pattern of setting a particular region of memory as a swizzled
texture, temporarily setting it as a linear render target in order to invoke
NV097_CLEAR_SURFACE in order to clear it, then switching back to use as a
swizzled texture.
xemu incorrectly uses the previously cached texture after the surface clear,
causing stale data to be used for rendering rather than the cleared data that
would be used on HW.
Bonus fix: The surface writeback loop was updating `surface` in a way that I
believe was unintentional. Switched to using a separate iterator so that cases
with multiple overlapping surfaces won't modify the previously detected surface
when it's used later in the function.
Test: https://github.com/abaire/nxdk_pgraph_tests/blob/c6755886df253dfe23995d87e371ba80099813a6/src/tests/texture_render_target_tests.cpp#L469
HW results: https://abaire.github.io/nxdk_pgraph_tests_golden_results/results/Texture_render_target/index.htmlFixes#2036
On Wayland compositors without server-side decorations, such as GNOME,
SDL draws window decorations by dlopening the host's libdecor, which
loads a decoration plugin (on GNOME, the GTK plugin). That plugin pulls
in the host's GTK, GIO and GObject, which resolve against the older
GLib (Ubuntu 22.04) already loaded from the AppImage and fail on
missing symbols (e.g. g_free_sized). With no usable plugin, libdecor
falls back to drawing no decorations, leaving the xemu window without
a title bar or buttons.
Stop bundling GLib so the host's libdecor plugins load against the
host's GLib and draw native decorations. GLib is ABI stable and xemu
is limited to the GLib 2.66 API via GLIB_VERSION_MAX_ALLOWED, so any
host meeting the AppImage's existing glibc 2.34 requirement (including
RHEL 9, with GLib 2.68) provides every GLib symbol xemu and libslirp
use. libpcre, needed only by the bundled GLib, is dropped as well.
This enables clear color handling for `LE_X1A7R8G8B8_O1A7R8G8B8` and
`LE_X1A7R8G8B8_Z1A7R8G8B8` surface formats.
Also fixes clear color handling for and adds mappings for various
special alpha surface formats to prevent assertion failures.
Improves but does not fix#2426
Improves but does not fix#2427
See the PGRAPH "Surface format" and "Clear" suites.
Paired MAC+ILU and duplicate output instructions can write to oPos while reading
from R12. This leads to a case where xemu's serialized emulation erroneously
uses the output of a previous instruction when calculating the value of a later
one.
E.g., in
```
/* 0x00000000 0x0080201A 0xC4002868 0x7CB0E800 */
MAD oPos.xyz, R12.xyz, R1.x, C[1].xyz
+ MAD R11.xy, R12.xyz, R1.x, C[1].xyz
```
the value of oPos prior to the first instruction should be used for both MAD
calculations.
This could alternatively be fixed by writing oPos to a temp vector and deferring
the output vector update until after the token is fully processed.
Note that we always process output registers writes before temp register writes
so the only interesting case should be the oPos/R12 alias. An op that writes to
one of its temp inputs will always execute the non-modifying output register
write before updating the temp register.
[Tests](https://github.com/abaire/nxdk_pgraph_tests/blob/1745a45290a5d607f9582303d6882cbf62f003de/src/tests/vertex_shader_independence_tests.cpp#L125)
[HW results](https://abaire.github.io/nxdk_pgraph_tests_golden_results/results/Vertex_shader_independence_tests/index.html)