stohrendorf / CroftEngine

An open-source Tomb Raider 1 engine remake
Other
285 stars 18 forks source link

glitches on the ground #300

Open legluondunet opened 1 year ago

legluondunet commented 1 year ago

Hello, I just compiled today's git croftengine on Linux. Three things:

I tried to report this issue on youtrack but it seems I haven't permission to do that. Thank you for your help.

legluondunet commented 1 year ago
stohrendorf commented 1 year ago

Are the artifacts on her arms and legs consistent or do they change/flicker?

legluondunet commented 1 year ago

How to use your save file?

stohrendorf commented 1 year ago

You have a AMD GPU card ? How to use your save file?

As the visuals are that broken right now, it doesn't matter. Anyways, within the launcher, open the "configuration" tab, and select "show data location", it will (hopefully) open your file manager at the user data folder. There's a folder saves/tr1, place the extracted file there.

legluondunet commented 1 year ago

a video for bfee7da6638e895b8c9aa6c603b11c5067477e4a https://youtu.be/cfQw1av5I1A

stohrendorf commented 1 year ago

Huh. That video is actually interesting. How about dee3910c6a914bbcf4dbaa296f3605742598d239?

legluondunet commented 1 year ago
stohrendorf commented 1 year ago

Uhm... I'm sorry to say, but that's probably a bug either with the driver or the graphics card. The video shows stuff that shouldn't be possible with the overall changes in that commit. There's nothing more I can do, sorry.

Magnutic commented 1 year ago

I saw the same issue with RX5700XT, also on Linux (Mesa 22.2.5). I investigated a bit using apitrace, and for what it's worth it seems to have something to do with the use of bindless textures in the vsm-square-pass.

I did a little hack to force using traditional texture binding for this pass. It fixes the glitches on my machine. Here's a patch that can be applied on cd05510ca6353ec2b20efc0e544c54264066f0e5: https://gist.github.com/Magnutic/af0b45766530acdfee0c86707fb6e53e

(Disabling AMD debug output was needed to make apitrace work.)

There are also glitches when using the edge-outline outline. I suppose the same underlying issue may be the same, but I have not investigated that.

stohrendorf commented 1 year ago

Interesting. Your patch shouldn't work at all, because you're passing a texture handle name into glBindTexture, which expects a texture name. These are completely different things, and glBindTexture should report a GL_INVALID_VALUE error because it wasn't receiving a texture name.

The OpenGL specs say:

GL_INVALID_VALUE is generated if texture is not a name returned from a previous call to glGenTextures.

...but the handle you're passing in was generated from a call to glGetTextureSamplerHandle. I couldn't find anything about this being valid in the ARB_bindless_texture specs.

As it turns out, it's valid, as written in issue 12 in the ARB_bindless_texture specs.

stohrendorf commented 1 year ago

It might be that flooding the code base with a lot of glTextureBarrier could help, but as this is a rare case of texture corruption, I'm anything but sure.

stohrendorf commented 1 year ago

@legluondunet @Magnutic could you check whether the current revision reduced or, even better, resolved your issues? That would be awesome. Thanks in advance!

legluondunet commented 1 year ago

just tested, no changes.

stohrendorf commented 1 year ago

Thanks for the feedback. This is unfortunate. I'm currently working on refactoring the engine to Vulkan, but it's a lot of work, and I'm just scratching the surface.