Emulator Issues #4696
OGL: Metroid Prime thermal and X-ray visors don't work.
What steps will reproduce the problem?
1. Set the video backend to OpenGL.
2. Start Metroid Prime 1.
3. Switch to the thermal or X-ray visors.
What is the expected output? What do you see instead?
Expected: The thermal visor should apply a purple-to-orange palette effect to the framebuffer. The X-ray visor should apply a blue-to-white palette effect to the framebuffer.
Observed: The world graphics either turn black or display a grayscale version of the world without any palette effect.
Dolphin version with the problem? Other Dolphin version without the
This has occurred ever since the texcache-rewrite merge in r7625. There's something wrong with the GLSL depalettizer. Previous versions performed depalettizing on the CPU. This problem occurs with any combination of EFB Copy settings.
32-bit or 64-bit and any other build parameters?
Happens in all 64-bit builds, 32-bit not tried.
OS version and versions of tools/libraries used?
OS: Windows 7 x64
Graphics: Radeon HD 5750, AMD Catalyst 11.6 drivers
Please provide any additional information below.
Both visor effects work by rendering the framebuffer to a texture in 8-bit grayscale, then interpreting the texture with a 256-color palette. This works fine in DX9 and DX11, but in OpenGL it seems to use the grayscale texture directly without applying the palette. Sometimes, the effect appears all black until I switch in and out of the visors a few times.
gDEBugger reveals that the depalettizer is generating a texture with the palette applied, but this colorized texture is somehow being discarded or mixed up with the original grayscale.
Other palette effects, including MP1's text and Twilight Princess's map, work fine.
Does this happen on other systems? Please comment.
#3 Updated by EmanModnar over 8 years ago
Okay, I was able to test on my Geforce GTX 285. At first it looked like the Thermal Visor was doing something different than what you described, but it turned out to be coloring from the gasses in the save room you were in. Further testing just confirmed what you already reported. At least this rules out any implementation differences. :/
Wish I could help further.
#8 Updated by pierre over 8 years ago
The problem with the OGL Depalettize() is, that we are modifying the texture state and don't restore it properly. The reason for this is probably that Depalettize() is called from the VertexManagers vFlush() while setting up textures(via g_textureCache->LoadEntry()).