mupen64plus / mupen64plus-video-rice

Video plugin for the Mupen64Plus v2.0 project, using OpenGL. This plugin is based on the RiceVideoLinux plugin from earlier versions of Mupen64Plus.
31 stars 40 forks source link

Everything renders with the same textures #64

Closed wareya closed 7 years ago

wareya commented 8 years ago

Happens 100% of the time when I boot the emulator with my own frontend and like 5-10% of the time when I boot the emulator with ui-console. Yeah, I have no idea.

When a texture is newly put onscreen, it replaces everything it can. Multitextured things act differently but it's just like a second texture slot doing its thing.

Doesn't happen with the pre-modern-GL Rice, or with other video plugins.

Latest git head.

A B

$ glxinfo|grep -E "string|version"
server glx vendor string: SGI
server glx version string: 1.4
client glx vendor string: Mesa Project and SGI
client glx version string: 1.4
GLX version: 1.4
    Max core profile version: 3.3
    Max compat profile version: 3.0
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.0
OpenGL vendor string: X.Org
OpenGL renderer string: Gallium 0.4 on AMD JUNIPER (DRM 2.43.0, LLVM 3.8.0)
OpenGL core profile version string: 3.3 (Core Profile) Mesa 11.2.2
OpenGL core profile shading language version string: 3.30
OpenGL version string: 3.0 Mesa 11.2.2
OpenGL shading language version string: 1.30
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 11.2.2
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00

$ pacman -Q|grep -E "video|mesa|dri"
dri2proto 2.8-2
dri3proto 1.0-1
lib32-mesa 11.2.2-1
lib32-mesa-libgl 11.2.2-1
mesa 11.2.2-1
mesa-demos 8.3.0-1
mesa-libgl 11.2.2-1
mesa-vdpau 11.2.2-1
videoproto 2.3.3-1
xf86-video-ati 1:7.7.0-1
xf86driproto 2.1.1-3
xorg-xdriinfo 1.0.5-1

core =libmupen64plus.so.2
video=mupen64plus-video-rice.so
audio=mupen64plus-audio-sdl.so
input=mupen64plus-input-sdl.so
rsp  =mupen64plus-rsp-hle.so
wareya commented 8 years ago

The bug happens way less often if I execute the emulator on the main thread instead of a secondary one, but for some reason it still happens once in a while, just like with ui-console.

thesourcehim commented 7 years ago

For me (I launch from ui-console) 50% of the time I get this bug and 50% I get no hi-res textures at all.

s-victor commented 7 years ago

I compiled latest source on fedora23, and getting either mostly black or random square colored texture on everything.

After trying some settings, I found a way to bypass this bug by editing "mupen64plus.cfg" file, remove everything under [Video-Rice] section and save it. Then set this file premissions to "read only". Run the emulator again and no more bugged texture.

It seems the bug has to do with how the cfg file is read/write (if the cfg file is writable, after first run, the emulator will still get bugged texture from the 2nd run and repeats).

Narann commented 7 years ago

Thanks, can you copy paste the Video-Rice section here?

s-victor commented 7 years ago

This is the auto-saved setting after the first run (with ui-console):

[Video-Rice]
# Mupen64Plus Rice Video Plugin config parameter version number
Version = 1
# Frame Buffer Emulation (0=ROM default, 1=disable)
FrameBufferSetting = 0
# Frequency to write back the frame buffer (0=every frame, 1=every other frame, etc)
FrameBufferWriteBackControl = 0
# Render-to-texture emulation (0=none, 1=ignore, 2=normal, 3=write back, 4=write back and reload)
RenderToTexture = 0
# Control when the screen will be updated (0=ROM default, 1=VI origin update, 2=VI origin change, 3=CI change, 4=first CI change, 5=first primitive draw, 6=before screen clear, 7=after screen drawn)
ScreenUpdateSetting = 1
# Force to use normal alpha blender
NormalAlphaBlender = False
# Use a faster algorithm to speed up texture loading and CRC computation
FastTextureLoading = False
# Use different texture coordinate clamping code
AccurateTextureMapping = True
# Force emulated frame buffers to be in N64 native resolution
InN64Resolution = False
# Try to reduce Video RAM usage (should never be used)
SaveVRAM = False
# Enable this option to have better render-to-texture quality
DoubleSizeForSmallTxtrBuf = False
# Force to use normal color combiner
DefaultCombinerDisable = False
# Enable game-specific settings from INI file
EnableHacks = True
# If enabled, graphics will be drawn in WinFrame mode instead of solid and texture mode
WinFrameMode = False
# N64 Texture Memory Full Emulation (may fix some games, may break others)
FullTMEMEmulation = False
# Enable vertex clipper for fog operations
OpenGLVertexClipper = False
# Enable/Disable SSE optimizations for capable CPUs
EnableSSE = True
# If this option is enabled, the plugin will skip every other frame
SkipFrame = False
# If enabled, texture enhancement will be done only for TxtRect ucode
TexRectOnly = False
# If enabled, texture enhancement will be done only for textures width+height<=128
SmallTextureOnly = False
# Select hi-resolution textures based only on the CRC and ignore format+size information (Glide64 compatibility)
LoadHiResCRCOnly = True
# Enable hi-resolution texture file loading
LoadHiResTextures = False
# Enable texture dumping
DumpTexturesToFiles = False
# Display On-screen FPS
ShowFPS = False
# Use Mipmapping? 0=no, 1=nearest, 2=bilinear, 3=trilinear
Mipmapping = 2
# Enable, Disable fog generation (0=Disable, 1=Enable)
FogMethod = 1
# Force to use texture filtering or not (0=auto: n64 choose, 1=force no filtering, 2=force filtering)
ForceTextureFilter = 0
# Primary texture enhancement filter (0=None, 1=2X, 2=2XSAI, 3=HQ2X, 4=LQ2X, 5=HQ4X, 6=Sharpen, 7=Sharpen More, 8=External, 9=Mirrored)
TextureEnhancement = 0
# Secondary texture enhancement filter (0 = none, 1-4 = filtered)
TextureEnhancementControl = 0
# Color bit depth to use for textures (0=default, 1=32 bits, 2=16 bits)
TextureQuality = 0
# Z-buffer depth (only 16 or 32)
OpenGLDepthBufferSetting = 16
# Enable/Disable MultiSampling (0=off, 2,4,8,16=quality)
MultiSampling = 0
# Color bit depth for rendering window (0=32 bits, 1=16 bits)
ColorQuality = 0
# OpenGL level to support (0=auto, 1=OGL_FRAGMENT_PROGRAM)
OpenGLRenderSetting = 0
# Enable/Disable Anisotropic Filtering for Mipmapping (0=no filtering, 2-16=quality). This is uneffective if Mipmapping is 0. If the given value is to high to be supported by your graphic card, the value will be the highest value your graphic card can support. Better result with Trilinear filtering
AnisotropicFiltering = 0
# If true, use polygon offset values specified below
ForcePolygonOffset = False
# Specifies a scale factor that is used to create a variable depth offset for each polygon
PolygonOffsetFactor = 0
# Is multiplied by an implementation-specific value to create a constant depth offset
PolygonOffsetUnits = 0
Narann commented 7 years ago

Thanks, @Vector3k, could you also please post the log of the first and the second run?

s-victor commented 7 years ago

Hi, I did several runs here the results, and more results and related cfg files in attached file: rice_testrun_160823.zip

1st run - using "mupen64plus.cfg_before_1st_run" - result: no bug, everything works wonderfully

$ ./mupen64plus m64p_test_rom.v64

Mupen64Plus Console User-Interface Version 2.5.0

UI-Console: attached to core library 'Mupen64Plus Core' version 2.5.0
UI-Console:             Includes support for Dynamic Recompiler.
Core: Goodname: Mupen64Plus Demo by Marshallh (GPL)
Core: Name: Mupen64Plus         
Core: MD5: DBF04773EC2B8ADF8A94DB7E3E461138
Core: CRC: DDBA4DE5 B107004A
Core: Imagetype: .v64 (byteswapped)
Core: Rom size: 1048576 bytes (or 1 Mb or 8 Megabits)
Core: Version: 1444
Core: Manufacturer: 0
Core: Country: Demo
UI-Console Status: Cheat codes disabled.
Video Warning: No version number in 'Rice-Video' config section. Setting defaults.
Video Warning: Old parameter config version detected : 0, updating to 1;
UI-Console: using Video plugin: 'Mupen64Plus OpenGL Video Plugin by Rice' v2.5.0
UI-Console: using Audio plugin: 'Mupen64Plus SDL Audio Plugin' v2.5.0
Input: Using auto-config file at: 'InputAutoCfg.ini'
UI-Console: using Input plugin: 'Mupen64Plus SDL Input Plugin' v2.5.0
UI-Console: using RSP plugin: 'Hacktarux/Azimer High-Level Emulation RSP Plugin' v2.5.0
Input: 0 SDL joysticks were found.
Input: N64 Controller #1: Forcing default keyboard configuration
Input: Using auto-config file at: 'InputAutoCfg.ini'
Input: 1 controller(s) found, 1 plugged in and usable in the emulator
Input Warning: Couldn't open rumble support for joystick #1
Input Warning: Couldn't open rumble support for joystick #2
Input Warning: Couldn't open rumble support for joystick #3
Input Warning: Couldn't open rumble support for joystick #4
Input: Mupen64Plus SDL Input Plugin version 2.5.0 initialized.
Video: SSE processing enabled.
Video: Found ROM 'Mupen64Plus', CRC e54dbadd4a0007b1-00
Video: Initializing OpenGL Device Context.
Core: Setting 32-bit video mode: 640x480
Video Warning: Failed to set GL_SWAP_CONTROL to 0. (it's 24)
Video Warning: Failed to set GL_BUFFER_SIZE to 32. (it's 24)
Video Warning: Failed to set GL_DEPTH_SIZE to 16. (it's 24)
Video: Using OpenGL: Gallium 0.4 on AMD PITCAIRN (DRM 2.43.0, LLVM 3.7.0) - 3.0 Mesa 11.1.0 (git-525f3c2) : X.Org
Audio: Initializing SDL audio subsystem...
Input Warning: Couldn't open rumble support for joystick #1
Input Warning: Couldn't open rumble support for joystick #2
Input Warning: Couldn't open rumble support for joystick #3
Input Warning: Couldn't open rumble support for joystick #4
Core: Starting R4300 emulator: Dynamic Recompiler
Core: R4300: starting 64-bit dynamic recompiler at: 0x7f02e5e92130
Core Status: Stopping emulation.
Core: R4300 emulator finished.
Core Status: Rom closed.

2nd run - using "mupen64plus.cfg_after_1st_run" (the cfg file is auto updated & saved after 1st run) - result: bugged, blue texture

$ ./mupen64plus m64p_test_rom.v64

Mupen64Plus Console User-Interface Version 2.5.0

UI-Console: attached to core library 'Mupen64Plus Core' version 2.5.0
UI-Console:             Includes support for Dynamic Recompiler.
Core: Goodname: Mupen64Plus Demo by Marshallh (GPL)
Core: Name: Mupen64Plus         
Core: MD5: DBF04773EC2B8ADF8A94DB7E3E461138
Core: CRC: DDBA4DE5 B107004A
Core: Imagetype: .v64 (byteswapped)
Core: Rom size: 1048576 bytes (or 1 Mb or 8 Megabits)
Core: Version: 1444
Core: Manufacturer: 0
Core: Country: Demo
UI-Console Status: Cheat codes disabled.
UI-Console: using Video plugin: 'Mupen64Plus OpenGL Video Plugin by Rice' v2.5.0
UI-Console: using Audio plugin: 'Mupen64Plus SDL Audio Plugin' v2.5.0
Input: Using auto-config file at: 'InputAutoCfg.ini'
UI-Console: using Input plugin: 'Mupen64Plus SDL Input Plugin' v2.5.0
UI-Console: using RSP plugin: 'Hacktarux/Azimer High-Level Emulation RSP Plugin' v2.5.0
Input: 0 SDL joysticks were found.
Input: N64 Controller #1: Forcing default keyboard configuration
Input: Using auto-config file at: 'InputAutoCfg.ini'
Input: 1 controller(s) found, 1 plugged in and usable in the emulator
Input Warning: Couldn't open rumble support for joystick #1
Input Warning: Couldn't open rumble support for joystick #2
Input Warning: Couldn't open rumble support for joystick #3
Input Warning: Couldn't open rumble support for joystick #4
Input: Mupen64Plus SDL Input Plugin version 2.5.0 initialized.
Video: SSE processing enabled.
Video: Found ROM 'Mupen64Plus', CRC e54dbadd4a0007b1-00
Video: Initializing OpenGL Device Context.
Core: Setting 32-bit video mode: 640x480
Video Warning: Failed to set GL_SWAP_CONTROL to 0. (it's 24)
Video Warning: Failed to set GL_BUFFER_SIZE to 32. (it's 24)
Video Warning: Failed to set GL_DEPTH_SIZE to 16. (it's 24)
Video: Using OpenGL: Gallium 0.4 on AMD PITCAIRN (DRM 2.43.0, LLVM 3.7.0) - 3.0 Mesa 11.1.0 (git-525f3c2) : X.Org
Audio: Initializing SDL audio subsystem...
Input Warning: Couldn't open rumble support for joystick #1
Input Warning: Couldn't open rumble support for joystick #2
Input Warning: Couldn't open rumble support for joystick #3
Input Warning: Couldn't open rumble support for joystick #4
Core: Starting R4300 emulator: Dynamic Recompiler
Core: R4300: starting 64-bit dynamic recompiler at: 0x7f71b7854130
Core Status: Stopping emulation.
Core: R4300 emulator finished.
Core Status: Rom closed.

Other runs - the only line in log that has changed is "Core: R4300: starting 64-bit dynamic recompiler at: ", and about 50% chance to get bug or no bug like the other guy said.

And I did another 25 runs with the readonly "mupen64plus.cfg_before_1st_run", results are all fine, no texture bug. the log is below:

$ ./mupen64plus m64p_test_rom.v64

Mupen64Plus Console User-Interface Version 2.5.0

UI-Console: attached to core library 'Mupen64Plus Core' version 2.5.0
UI-Console:             Includes support for Dynamic Recompiler.
Core Error: Couldn't open configuration file '/home/vectors/.config/mupen64plus/mupen64plus.cfg' for writing.
Core: Goodname: Mupen64Plus Demo by Marshallh (GPL)
Core: Name: Mupen64Plus         
Core: MD5: DBF04773EC2B8ADF8A94DB7E3E461138
Core: CRC: DDBA4DE5 B107004A
Core: Imagetype: .v64 (byteswapped)
Core: Rom size: 1048576 bytes (or 1 Mb or 8 Megabits)
Core: Version: 1444
Core: Manufacturer: 0
Core: Country: Demo
UI-Console Status: Cheat codes disabled.
Video Warning: No version number in 'Rice-Video' config section. Setting defaults.
Video Warning: Old parameter config version detected : 0, updating to 1;
UI-Console: using Video plugin: 'Mupen64Plus OpenGL Video Plugin by Rice' v2.5.0
UI-Console: using Audio plugin: 'Mupen64Plus SDL Audio Plugin' v2.5.0
Core Error: Couldn't open configuration file '/home/vectors/.config/mupen64plus/mupen64plus.cfg' for writing.
Core Error: Couldn't open configuration file '/home/vectors/.config/mupen64plus/mupen64plus.cfg' for writing.
Core Error: Couldn't open configuration file '/home/vectors/.config/mupen64plus/mupen64plus.cfg' for writing.
Core Error: Couldn't open configuration file '/home/vectors/.config/mupen64plus/mupen64plus.cfg' for writing.
Input: Using auto-config file at: 'InputAutoCfg.ini'
Core Error: Couldn't open configuration file '/home/vectors/.config/mupen64plus/mupen64plus.cfg' for writing.
UI-Console: using Input plugin: 'Mupen64Plus SDL Input Plugin' v2.5.0
UI-Console: using RSP plugin: 'Hacktarux/Azimer High-Level Emulation RSP Plugin' v2.5.0
Input: 0 SDL joysticks were found.
Core Error: Couldn't open configuration file '/home/vectors/.config/mupen64plus/mupen64plus.cfg' for writing.
Core Error: Couldn't open configuration file '/home/vectors/.config/mupen64plus/mupen64plus.cfg' for writing.
Core Error: Couldn't open configuration file '/home/vectors/.config/mupen64plus/mupen64plus.cfg' for writing.
Core Error: Couldn't open configuration file '/home/vectors/.config/mupen64plus/mupen64plus.cfg' for writing.
Input: N64 Controller #1: Forcing default keyboard configuration
Input: Using auto-config file at: 'InputAutoCfg.ini'
Core Error: Couldn't open configuration file '/home/vectors/.config/mupen64plus/mupen64plus.cfg' for writing.
Input: 1 controller(s) found, 1 plugged in and usable in the emulator
Input Warning: Couldn't open rumble support for joystick #1
Input Warning: Couldn't open rumble support for joystick #2
Input Warning: Couldn't open rumble support for joystick #3
Input Warning: Couldn't open rumble support for joystick #4
Input: Mupen64Plus SDL Input Plugin version 2.5.0 initialized.
Video: SSE processing enabled.
Video: Found ROM 'Mupen64Plus', CRC e54dbadd4a0007b1-00
Video: Initializing OpenGL Device Context.
Core: Setting 32-bit video mode: 640x480
Video Warning: Failed to set GL_SWAP_CONTROL to 0. (it's 24)
Video Warning: Failed to set GL_BUFFER_SIZE to 32. (it's 24)
Video Warning: Failed to set GL_DEPTH_SIZE to 16. (it's 24)
Video: Using OpenGL: Gallium 0.4 on AMD PITCAIRN (DRM 2.43.0, LLVM 3.7.0) - 3.0 Mesa 11.1.0 (git-525f3c2) : X.Org
Audio: Initializing SDL audio subsystem...
Input Warning: Couldn't open rumble support for joystick #1
Input Warning: Couldn't open rumble support for joystick #2
Input Warning: Couldn't open rumble support for joystick #3
Input Warning: Couldn't open rumble support for joystick #4
Core: Starting R4300 emulator: Dynamic Recompiler
Core: R4300: starting 64-bit dynamic recompiler at: 0x7fb4d7b04130
Core Status: Stopping emulation.
Core: R4300 emulator finished.
Core Status: Rom closed.
Core Error: Couldn't open configuration file '/home/vectors/.config/mupen64plus/mupen64plus.cfg' for writing.
Narann commented 7 years ago

Note for me:

The first time, there seems to be an update process:

Video Warning: No version number in 'Rice-Video' config section. Setting defaults.
Video Warning: Old parameter config version detected : 0, updating to 1;
Narann commented 7 years ago

Ok guys, big new, looks like https://github.com/mupen64plus/mupen64plus-video-rice/commit/e82afa7cf70616c9c96ff3ffc8aaf55e3007b3df should fix every texture troubles. I will let you confirm and will close this. It was a silly problem, so sorry for not having time to fix it before. Hope everything is ok now.

Narann commented 7 years ago

@wareya @thesourcehim @Vector3k, I suspect this problem to be solved with my latest fixes. Could you confirm? :D

s-victor commented 7 years ago

@Narann, Hi, sorry for the late reply, just complied and tested multiple times, and it works flawless now. Great work! Many thanks!

Narann commented 7 years ago

No, sorry having letting this so long! :D

wareya commented 7 years ago

I mean it was pretty hard to diagnose. It's all good.