OGRECave / ogre-next

aka ogre v2 - scene-oriented, flexible 3D C++ engine
https://ogrecave.github.io/ogre-next/api/latest
Other
1.09k stars 235 forks source link

Demos crash on Vulkan, Debian, shaders #471

Open cryham opened 3 weeks ago

cryham commented 3 weeks ago

System Information

Detailled description

So, I just got latest 3.0.0 built (but maybe this happened before too). I'm trying to start any demos using Vulkan RS, and almost all crash at start, listing some common shader errors. One mostly from ESM/GaussianLogFilterH_ps_VK. Only Sample_ImageVoxelizer has different error, in 0AabbCalcultor_cs. ONLY: Sample_Tutorial00_Basic, Sample_Tutorial01_Initialization, Sample_Tutorial_VulkanExternal are starting. ogre.cfg is default, I didn't change any option.

Ogre.log

Ogre Sample_ImageVoxelizer.log Ogre Sample_InstantRadiosity.log Ogre Sample_PlanarReflections.log Ogre Sample_Tutorial_Terrain.log ogre.cfg.txt

So what is the problem here, is it something bad in Ogre's Vulkan shaders? Or my GPU and drivers (I doubt)?

When using OpenGL 3+ RS, all demos start.

darksylinc commented 3 weeks ago

This problem often happens when the RenderSystem_Vulkan is incorrectly linking against shaderc/glslang found in your system, instead of the one provided via https://github.com/OGRECave/ogre-next-deps

Check the CMake values of Vulkan_SHADERC_INCLUDE_DIR, Vulkan_SHADERC_LIB_REL, Vulkan_INCLUDE_DIR, Vulkan_LIBRARY & Vulkan_GLSLC_EXECUTABLE.

image

cryham commented 3 weeks ago

OK actually I have them so: Had to click Advanced Is this good or bad? 04_20-08-57

cryham commented 3 weeks ago

Hmm should I have there these instead or those /usr/ ? /home/ch/_sr/Ogre/ogre-next-deps/src/vulkan/basic-sdk/include/vulkan/ /home/ch/_sr/Ogre/ogre-next-deps/src/vulkan/basic-sdk/lib/linux64/libvulkan.so.1.2.148 And if so how could I do it in CMake.txt automatically so it stays?

darksylinc commented 3 weeks ago

In theory it looks good because the problem should be with Vulkan_SHADERC_INCLUDE_DIR, Vulkan_SHADERC_LIB_REL, & Vulkan_GLSLC_EXECUTABLE.

But you could try setting Vulkan_INCLUDE_DIR & Vulkan_LIBRARY to /home/ch/_sr/Ogre/ogre-next/Dependencies/include and /home/ch/_sr/Ogre/ogre-next/Dependencies/lib/libvulkan.so respectively; then ninja clean or make clean and build again.

darksylinc commented 3 weeks ago

And if so how could I do it in CMake*.txt automatically so it stays?

Often if you just change them in CMake GUI and click regenerate, they change themselves, with the value staying.

If they resets themselves, you may have to edit find_package(Vulkan) to #find_package(Vulkan) in Dependencies.cmake temporarily.

cryham commented 3 weeks ago

I'm afraid this didn't fix it. So I added these args to my cmake command for OgreNext in my .py script:

                    '-D Vulkan_INCLUDE_DIR="/home/ch/_sr/Ogre/ogre-next-deps/src/vulkan/basic-sdk/include/vulkan" '+
                    '-D Vulkan_LIBRARY="/home/ch/_sr/Ogre/ogre-next-deps/src/vulkan/basic-sdk/lib/linux64/libvulkan.so" '+

I see the paths are there in /home/ch/_sr/Ogre/ogre-next/build/Release/CMakeCache.txt like so:

//Path to a library.
TINYXML_LIBRARIES:FILEPATH=/usr/lib/x86_64-linux-gnu/libtinyxml.so

//Path to a program.
Vulkan_GLSLC_EXECUTABLE:FILEPATH=/home/ch/_sr/Ogre/ogre-next/Dependencies/bin/glslc

//Path to a file.
Vulkan_INCLUDE_DIR:PATH=/home/ch/_sr/Ogre/ogre-next-deps/src/vulkan/basic-sdk/include/vulkan

//Path to a library.
Vulkan_LIBRARY:FILEPATH=/home/ch/_sr/Ogre/ogre-next-deps/src/vulkan/basic-sdk/lib/linux64/libvulkan.so

//Path to a file.
Vulkan_SHADERC_INCLUDE_DIR:PATH=/home/ch/_sr/Ogre/ogre-next/Dependencies/include

//Path to a library.
Vulkan_SHADERC_LIB_REL:FILEPATH=/home/ch/_sr/Ogre/ogre-next/Dependencies/lib/libshaderc_combined.a

//Path to a file.
X11_ICE_INCLUDE_PATH:PATH=/usr/include

I did ninja clean in /home/ch/_sr/Ogre/ogre-next/build/Release/ and I started my .py script that builds OgreNext, MyGui and SR3. I see the binaries of samples are new, datetime is from now. But I still get the same crashes. Any idea? Ogre.log

cryham commented 3 weeks ago

Okay I remembered it now. I fixed this in SR3 files /home/ch/_sr/_sr3c/data/materials/Common/GLSL/GaussianBlurLogFilter_ps.glsl I have now: for(int i=NUM_WEIGHTS - 1; i > 0; i--) for(int i=0; i<NUM_WEIGHTS - 1; i++ ) instead of int i; for( i=NUM_WEIGHTS - 1; (--i) > 0; ) for( i=0; i<NUM_WEIGHTS - 1; ++i ) Did it even have to be so in for? Although ESM didn't work for me in SR3, didn't see shadows at all IIRC. Well it's still crashing. Other files too.

cryham commented 3 weeks ago

Hmm maybe I need to update ogre-next-deps? But how do I do that after using basically that script that builds ogre and gets ogre-next-deps itself. git submodule update --recursive --remote ?

cryham commented 3 weeks ago

Ugh I think I messed up something.

-- Build files have been written to: /home/ch/_sr/Ogre/ogre-next/build/Release
ninja: error: '/home/ch/_sr/Ogre/ogre-next/Dependencies/lib/libshaderc_combined.a', needed by 'lib/RenderSystem_Vulkan.so.3.0', missing and no known rule to make it

Any help?

darksylinc commented 3 weeks ago

Ugh I think I messed up something.

That error means the file does not exist, which means it wasn't generated. Perhaps you're missing Python 3.x (which is needed to build shaderc)?

I don't know how to update ogre-next-deps because it rarely updates, so I just clone it again:

git clone --recurse-submodules --shallow-submodules https://github.com/OGRECave/ogre-next-deps

As for building the dependencies:

cd ogre-next-deps
mkdir build
cd build
echo "--- Building ogre-next-deps ---"
cmake  -G Ninja .. || exit $?
ninja || exit $?
ninja install || exit $?
cryham commented 3 weeks ago

I got Python 3.x for sure whereis python3 python3: /usr/bin/python3 /usr/lib/python3 /etc/python3 /usr/share/python3 /usr/share/man/man1/python3.1.gz

Right. Yeah I did remove Ogre, ogre-next and ogre-next-deps and just did that all again. Now I don't even have Vulkan RS :( 04_22-01-14 Ugh IDK, I'm running out of patience for today. I didn't use Vulkan in months anyway.

Hmm what is this? //Path to Vulkan SDK e.g. C:\VulkanSDK\1.2.148.1 or /home/user/vulkansdk OGRE_VULKAN_SDK:STRING= Do I need it?

darksylinc commented 3 weeks ago

Do not focus so much on ogre-next, I suspect something is wrong in ogre-next-deps.

This is how my version looks like after building:

image

It seems like you're missing libshaderc* in the build folder.

Check the CMake settings in ogre-next-deps and that everything is being built.

cryham commented 3 weeks ago

Okay this is how it looks for me, after building, seems there is less stuff in lib/ but libshaderc are present

04_22-34-09 04_22-37-26``