Try / OpenGothic

Reimplementation of Gothic 2 Notr
MIT License
1.16k stars 82 forks source link

MacOS: Issue with player and NPC model rendering #407

Open Pakisan opened 1 year ago

Pakisan commented 1 year ago

Hi @Try,

image

I compiled client from master and last release tag. In both cases same scenario - buggy models render

Launched with and without flags:

➜  opengothic git:(v0.69) ✗ ./Gothic2Notr.sh -g ~/Downloads/GothicII -g2 -ms 1 -rt 1 -window -v
OpenGothic v1.0 dev
2023-02-12 05:08:03.703 Gothic2Notr[32804:958200] Metal API Validation Enabled
GPU = AMD Radeon Pro 560
Depth format = Depth32F Shadow format = Depth16
[phoenix] world: parsing object [MeshAndBsp % 0 0]
[phoenix] bsp_tree: parsing chunk c000
[phoenix] bsp_tree: parsing chunk c010
[phoenix] bsp_tree: parsing chunk c040
[phoenix] bsp_tree: parsing chunk c045
[phoenix] bsp_tree: parsing chunk c050
[phoenix] bsp_tree: parsing chunk c0ff
[phoenix] mesh: 1 bytes remaining in section b020
[phoenix] world: parsing object [VobTree % 0 0]
[phoenix] world: parsing object [WayNet % 0 0]
[phoenix] world: parsing object [EndMarker % 0 0]
unable to load sound fx: ENV_NIGHT_TONSOFINSECTS
unable to load sound fx: OW_BIRD11
[phoenix] model_script: unexpected value for event_tag_type: "      "
[phoenix] model_script: 4 bytes remaining in section f5a3

Graphics:

➜  ~ system_profiler SPDisplaysDataType
Graphics/Displays:

    Intel HD Graphics 630:

      Chipset Model: Intel HD Graphics 630
      Type: GPU
      Bus: Built-In
      VRAM (Dynamic, Max): 1536 MB
      Vendor: Intel
      Device ID: 0x591b
      Revision ID: 0x0004
      Automatic Graphics Switching: Supported
      gMux Version: 4.0.29 [3.2.8]
      Metal Support: Metal 3
      Displays:
        Color LCD:
          Display Type: Built-In Retina LCD
          Resolution: 2880 x 1800 Retina
          Framebuffer Depth: 24-Bit Color (ARGB8888)
          Main Display: Yes
          Mirror: Off
          Online: Yes
          Automatically Adjust Brightness: Yes
          Connection Type: Internal

    Radeon Pro 560:

      Chipset Model: Radeon Pro 560
      Type: GPU
      Bus: PCIe
      PCIe Lane Width: x8
      VRAM (Total): 4 GB
      Vendor: AMD (0x1002)
      Device ID: 0x67ef
      Revision ID: 0x00c0
      ROM Revision: 113-C980AJ-927
      VBIOS Version: 113-C9801AU-A02
      EFI Driver Version: 01.A0.927
      Automatic Graphics Switching: Supported
      gMux Version: 4.0.29 [3.2.8]
      Metal Support: Metal 2
Try commented 1 year ago

Hi, @Pakisan and thanks for bug-report!

This issue might be related to cache-maintenance, because this is one thing that differ between M1-chip and Radeon. Can you run game with -v command line key, to see if Metal will print any warnings?

Pakisan commented 1 year ago

I already tried with -v flag, no warnings at all - log in message above. I compiled and launched client on intel based Mac

Try commented 1 year ago

Marked as help-wanted, since can't reproduce on my mac

Pakisan commented 1 year ago

No problem, I can collect all required information. Can you tell what to do? I have software engineering background, but I don't know much about games in case of rendering for example.

May problem be related with?

[phoenix] model_script: unexpected value for event_tag_type: " " [phoenix] model_script: 4 bytes remaining in section f5a3

Try commented 1 year ago

May problem be related with?

I don't think so

By look of things:

GPU = AMD Radeon Pro 560

I've been testing on M1. And they do have different rules for cache-synchronization. So it make sense to look into MtBuffer::implUpdate maybe for Amd it's broken.

UPD: found fishy looking code there, yet it's probably not your case

Pakisan commented 1 year ago

Tried your patch:

➜  OpenGothic git:(v0.69) ✗ cmake --build ./build --target Gothic2Notr
[  1%] Built target LinearMath
[  1%] Built target miniz
[ 21%] Built target shader
[ 42%] Built target GothicShaders
[ 43%] Built target squish
[ 44%] Built target lexy_file
[ 44%] Built target glm_static
[ 47%] Built target phoenix
[ 48%] Built target squish-tempest
[ 49%] Built target shaders
[ 51%] Built target zlibstatic
[ 51%] Built target genfiles
[ 52%] Built target png_static
[ 61%] Built target OpenAL
[ 62%] Built target spirv-cross-core
[ 62%] Built target spirv-cross-glsl
[ 62%] Built target spirv-cross-msl
[ 62%] Built target spirv-cross-hlsl
[ 62%] Building CXX object lib/Tempest/Engine/CMakeFiles/Tempest.dir/gapi/metal/mtbuffer.cpp.o
[ 62%] Linking CXX shared library ../../../opengothic/libTempest.dylib
[ 74%] Built target Tempest
[ 83%] Built target BulletCollision
[ 87%] Built target BulletDynamics
[ 87%] Linking CXX executable opengothic/Gothic2Notr
[100%] Built target Gothic2Notr

No changes

r4shpro commented 1 year ago

Greetings @Try !

That is one hell of the mindblowing things you have done! The great port. Thank you for this beauty!

I have stubbled upon the same problem:

> (base) dmitryz@Dmitrys-MBP opengothic % ./Gothic2Notr.sh -g ~/OpenGothic/app -g2 -ms 1 -rt 1 -window -v
OpenGothic v1.0 dev
2023-03-11 10:34:16.745 Gothic2Notr[2510:91995] Metal API Validation Enabled
no *.ini file in path - using default settings

---crashlog(std::system_error(Invalid shader module))---
GPU: ?

zsh: abort      ./Gothic2Notr.sh -g ~/OpenGothic/app -g2 -ms 1 -rt 1 -window -v

the full log is attached log.txt

I am able to make the game running though, just cannot set any of those arguments. I have also tested with the unofficial g2 patch of the last version (including Wasteland mod) - all runs smoothly.