aap/librw

Problem with Mipmaps in ReVC

Opened this issue · 3 comments

I'm running it on a PlayStation Classic which is a armv7 device similar to a raspberry pi 3. When I have the engine convert the textures to optimal format like this:
2023-12-24 02-31-16 mp4_snapshot_00 52 484

It would produce corrupt textures like this. It seems to be a mipmap problem:
2023-12-16 18-52-08 mp4_snapshot_01 37 931
2023-12-16 18-52-08 mp4_snapshot_01 43 325
2023-12-16 18-52-08 mp4_snapshot_29 33 479
2023-12-16 18-52-08 mp4_snapshot_29 39 169
2023-12-16 18-52-08 mp4_snapshot_29 44 310

Seems like when it's in closer view, it looks correct, but when at a further distance it is skewed like its going bigger instead of smaller or something
2023-12-24 04-18-08 mp4_snapshot_00 00 272
2023-12-24 04-18-08 mp4_snapshot_00 06 727

Originally I followed MastaG's solution of disabling the convert textures and having it use the stock gta3.img.
#71

This works however the game crashes often, like every 13 minutes. In this video clip it crashed 4 times in the span of 47 minutes
https://www.youtube.com/watch?v=Eyuo2HqkHb4

The PSC only has 1gb of ram so I assume maybe it ran out of memory. However i found a solution by using magictxd. basically I have it clear the mipmaps and reconstruct the IMG archives
Untitled

When I do this I am able to play for 2+ hours without crashing. Though it may still occasionally crash when there's a lot going on
https://youtu.be/dzQbEmjE-Qk

So I was wondering if there's a way to edit the source code so that it generates the mipmaps properly? My theory is that it's going in the opposite direction, like a negative value is going the opposite direction. I don't know anything about programming I'm just guessing

aap commented

My guess would be that the auto-generated mipmaps are buggy on that implementation of OpenGL.
You could try getting rid of this code and see if it fixes anything:

                        if(level == 0 && natras->autogenMipmap)
                                glGenerateMipmap(GL_TEXTURE_2D);

My guess would be that the auto-generated mipmaps are buggy on that implementation of OpenGL. You could try getting rid of this code and see if it fixes anything:

                        if(level == 0 && natras->autogenMipmap)
                                glGenerateMipmap(GL_TEXTURE_2D);

Sadly it still produce corrupt textures when I delete the code above. Got any other possible fixes? What's weird is Re3 and ReLCS convert textures and it has no issues

Have you found the solution? I have the same one. It just crops mipmaps instead of downscaling. And only on gles