cemu-project / Cemu

Cemu - Wii U emulator
https://cemu.info
Mozilla Public License 2.0
6.6k stars 506 forks source link

Shader multiplication accuracy causes visual bugs on some gpus. #1240

Closed YounesSamatta closed 1 week ago

YounesSamatta commented 1 week ago

Current Behavior

For example : blocks appear distorted in Mario Maker image

Expected Behavior

When disabled it renders everything correctly: Cemu_JMgXQhOF4u

Steps to Reproduce

Enable Shader multiplication accuracy on some gpus (probably old nvidia gpu only but im not sure)

System Info

OS: Windows 10 GPU: GeForce GT 620

Emulation Settings

Graphics API: Open GL

Logs

[01:31:11.474] Invariant TSC not supported [01:31:11.732] ------- Init Cemu 2.0-86 (experimental) ------- [01:31:11.732] Init Wii U memory space (base: 0x00000227b8bc0000) [01:31:11.732] mlc01 path: C:/Games/Cemu_2.0-86/mlc01 [01:31:11.732] CPU: Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz [01:31:11.732] RAM: 6142MB [01:31:11.732] Platform: Windows 10 Pro (Build 9200) [01:31:11.732] Used CPU extensions: SSSE3, SSE4.1 [01:31:11.739] IOSU_CRYPTO: No otp.bin found. Online mode cannot be used [01:31:11.739] IOSU_CRYPTO: No Seeprom.bin found. Online mode cannot be used [01:31:11.788] vkEnumerateInstanceVersion not available. Outdated graphics driver or Vulkan runtime? [01:31:12.787] Mounting title 000500001018dd00 [01:31:12.787] Base: C:/Games/WiiU Games/Super Mario Maker [Game] [000500001018dd00] [Folder] [01:31:12.787] Update: C:/Games/WiiU Games/Super Mario Maker [Update] [0005000e1018dd00] [Folder] [01:31:12.787] DLC: Not present [01:31:12.820] COS: System fonts found. Generated shareddata (26609KB) [01:31:12.835] Recompiler initialized [01:31:14.513] ------- Loaded title ------- [01:31:14.513] TitleId: 00050000-1018dd00 [01:31:14.513] TitleVersion: v272 [01:31:14.513] TitleRegion: EU [01:31:14.513] Save path: C:/Games/Cemu_2.0-86/mlc01/usr/save/00050000/1018DD00/user/ [01:31:14.513] Shader cache file: shaderCache/transferable/000500001018dd00.bin [01:31:14.513] gameprofile path: gameProfiles/000500001018dd00.ini [01:31:14.513] RPX hash (updated): 9f644cc7 [01:31:14.513] RPX hash (base): 44fc5929 [01:31:14.517] HID: Output packet length not available or out of range (length = -1) [01:31:14.517] nsyshid::BackendWindowsHID: device not on whitelist: 1a2c:0b23 [01:31:14.517] HID: Output packet length not available or out of range (length = -1) [01:31:14.517] nsyshid::BackendWindowsHID: device not on whitelist: 1a2c:0b23 [01:31:14.518] nsyshid::BackendWindowsHID: device not on whitelist: 1234:bead [01:31:14.656] Loaded module 'block' with checksum 0xf110487f [01:31:14.659] Loaded module 'nn_olv2' with checksum 0x402b2215 [01:31:14.659] RPL link time: 141ms [01:31:14.748] HLE scan time: 78ms [01:31:14.748] ------- Active settings ------- [01:31:14.748] CPU-Mode: Single-core recompiler (gameprofile) [01:31:14.748] Load shared libraries: true (gameprofile) [01:31:14.748] Use precompiled shaders: auto (gameprofile) [01:31:14.748] Full sync at GX2DrawDone: true [01:31:14.748] Strict shader mul: true [01:31:14.748] Console language: 1 [01:31:14.749] ------- Init OpenGL graphics backend ------- [01:31:14.766] GL_VENDOR: NVIDIA Corporation [01:31:14.766] GL_RENDERER: GeForce GT 620/PCIe/SSE2 [01:31:14.766] GL_VERSION: 4.6.0 NVIDIA 391.35 [01:31:14.766] OpenGL extensions: [01:31:14.766] ARB_clip_control: available [01:31:14.766] ARB_get_program_binary: available [01:31:14.766] ARB_clear_texture: available [01:31:14.766] ARB_copy_image: available [01:31:14.766] NV_depth_buffer_float: available [01:31:14.773] ------- Activate graphic packs ------- [01:31:14.773] ------- Init Audio backend ------- [01:31:14.773] DirectSound: available [01:31:14.773] XAudio 2.8: available [01:31:14.773] Cubeb: available [01:31:14.774] ------- Init Audio input backend ------- [01:31:14.774] Cubeb: available [01:31:14.774] ------- Run title ------- [01:31:14.830] Using precompiled shaders: false [01:31:15.017] Shader cache loaded with 73 shaders. Commited mem 52MB. Took 187ms [01:31:15.102] IOSU_ACT: using account default in first slot

Squall-Leonhart commented 1 week ago

There is a graphics pack that fixes this.

Go to graphics packs and then download community packs. Turn on Grid and Border Fix in SMM’s Workarounds.

YounesSamatta commented 1 week ago

There is a graphics pack that fixes this.

Go to graphics packs and then download community packs. Turn on Grid and Border Fix in SMM’s Workarounds.

I tested both workarounds and they both didn't work.

Squall-Leonhart commented 1 week ago

I got mixed up in a reddit comment chain, the only workaround is to set the shader multiplication acuracy in the games profile or using vulkan, which you can't on that Fermi gpu.

Exzap commented 1 week ago

This is an interesting one. The cause of this issue is a bug in Nvidia's shader compiler where it optimizes too aggressively and breaks some math sequences. Randomly alternating instructions in the shader code can fix it, such as by changing the shader mul accuracy option. Nvidia fixed this bug many years ago already so it only affects GPUs that are beyond what we provide support for nowadays. Cemu had a workaround for the SMM bug specifically until either 1.26 or 2.0 (not sure which version is the cutoff), so maybe just stick to a slightly older version.

If someone wants to bother, they could probably make a proper graphic pack workaround for this that works with Cemu 2.0+. But otherwise I would say this is out of scope as we don't have the capacity to support ancient hardware with massively outdated drivers forever.