vsg-dev / vsgExamples

Example programs that test and illustrate how to use the VSG and optional add-on libraries
MIT License
148 stars 67 forks source link

vsgClip crashes #108

Closed shujaatak closed 2 years ago

shujaatak commented 3 years ago

vsgClip crashes at start with the following message:

availableFeatures.samplerAnisotropy = 1, limits.maxSamplerAnisotropy = 16
availableFeatures.shaderClipDistance = 1, limits.maxClipDistances = 8
availableFeatures.shaderCullDistance = 1, limits.maxCullDistances = 8
limits.maxCombinedClipAndCullDistances = 8
Could not create shaders.
shujaatak commented 3 years ago

I was too much in hurry and didn't read full instructions.

I had missed this step:

export PATH="$PATH:/path/to/vsgExamples/bin"
export VSG_FILE_PATH=/path/to/vsgExamples/data
robertosfield commented 3 years ago

Even without the VSG_FILE_PATH and PATH settings I wouldn't have expected a crash. Could you provide a stack trace for the condition that caused the crash?

I've tried to reproduce a crash at my end, but even with an invalid model path or no model path the lack of model is picked up and reported and the application exits gracefully.

shujaatak commented 3 years ago

I have Ubuntu 20.04.2 LTS 64-bit and Intel HD Graphics 5500.

I have built and make installed latest VulkanSceneGraph , vsgXchange, vsgImGui and vsgGIS, with vulkansdk-linux-x86_64-1.2.162.1.

I have built examples using this:

git clone https://github.com/vsg-dev/vsgExamples.git
cd vsgExamples
cmake .
make -j 8

Now in the current terminal, if I don't set paths like this:

export PATH="$PATH:/path/to/vsgExamples/bin"
export VSG_FILE_PATH=/path/to/vsgExamples/data

then if I run vsgclip example like this ./bin/vsgclip then I simply get this error in the terminal while a window appears and close instantly:

shujaat@shujaat:~/Downloads/vsgExamples$ ./bin/vsgclip 
windowTraits->swapchainPreferences.imageCount = 3
availableFeatures.samplerAnisotropy = 1, limits.maxSamplerAnisotropy = 16
availableFeatures.shaderClipDistance = 1, limits.maxClipDistances = 8
availableFeatures.shaderCullDistance = 1, limits.maxCullDistances = 8
limits.maxCombinedClipAndCullDistances = 8
Could not create shaders.
shujaatak commented 3 years ago

Could you provide a stack trace for the condition that caused the crash?

Hopefully the previous comment will help, if not then please let me know. If there is any other way to produce/provide stack trace then please let me know how to do that so that I can help.

robertosfield commented 3 years ago

On Sat, 4 Sept 2021 at 16:42, Shujaat Ali Khan @.***> wrote:

Could you provide a stack trace for the condition that caused the crash?

Hopefully the previous comment will help, if not then please let me know. If there is any other way to produce/provide stack trace then please let me know how to do that so that I can help.

There are a number of ways of doing it under Linux, but the one I use is simply run the application without gdb and when it crashes you then list the track trace with where. Compiling with debug helps produce more detailed info such as specific line numbers.

In the case of you running vsgclip, is it actually crashing? It may well be just exciting having not found the shaders it needs to run, in this case a more informative console warning is probably all that is required.

robertosfield commented 2 years ago

My best guess as to the cause of the problem is not build vsgExamples against vsgXchange, so the attempt to read the .vert and .frag shader files fails as vsgXchange provides the GLSL loader.

I've checked in a change to vsgExamples/state/CMakeLists.txt to ensure it's only built when vsgXchange is found. This should prevent this example from compiling without vsgXchange.

I may move the GLSL loader into the core VSG to avoid this issue, but this is clunky solution as well.