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

Texture filtering is broken in Rice. #37

Closed Narann closed 9 years ago

Narann commented 9 years ago

...and I finally understood why!

rice_fitlering_broken_001

rice_fitlering_broken_002

So, as you maybe know, OpenGL bind filtering parameter per Textures.

While, on the N64 side, texture filtering is a global parameter and not texture dependent:

The function ApplyTextureFilter() apply the filter values to the current binded OpenGL textures. Of course, each time it does it you can be sure the binded texture change and potentially lost the filter you set on it... This is why this function is called almost everywhere in the code. Just go here and to a search).

For the test, I've tried to apply the wanted filter on every OpenGL texture each time CRender::SetTextureFilter() is called. The could looked like:

Kind of brute force... This bring to massive slowdown but totally fix the problem.

Notice this is "fixed" by new OpenGL version, see gtruc review for more info. It's so simple I'm so sad to need to do a workaround...

I have multiple ways to fix this problem:

There is other options, I'm still investigating. I also notice Rice does not have any place where texture are explicitly bound. For example, removing the texture binding from SetTextureUFlag() (which is only supposed to put some UV flags) make almost every texture blacks. This mean the textures are only binded at this place...

Narann commented 9 years ago

A tiny commit that should fix most of the problems: https://github.com/Narann/mupen64plus-video-rice/commit/6b9b76c57e5cbb98a57568382bda8ade282d1188

Narann commented 9 years ago

I will close this issue. I'm sure there is still some filtering problems here and there but it's no more completely broken. Each future broken filtering should have its own ticket.