samdauwe / webgpu-native-examples

Collection of C-language examples that demonstrate basic rendering and computation in WebGPU native.
Apache License 2.0
393 stars 22 forks source link

Error with run sample #4

Open hefeng-oppo opened 2 years ago

hefeng-oppo commented 2 years ago

Hi, according to your guide, I has finished the compiler with webgpu-native-samples. But when run it , error accured,

-> error info: nianrui@oppo:~/webgpu_module/webgpu-native-examples/build/Releasex64$ ./wgpu_sample_launcher triangle 17:19:47 INFO /home/nianrui/webgpu_module/webgpu-native-examples/src/main.c:19: Running example: triangle GLFW Error occured, Error id: 65544, Description: X11: The DISPLAY environment variable is missing Failed to initialize GLFW Error: vkCreateInstance failed with VK_ERROR_INCOMPATIBLE_DRIVER at CheckVkSuccessImpl (/home/nianrui/webgpu_module/webgpu-native-examples/external/dawn/dawn/src/dawn/native/vulkan/VulkanError.cpp:88) at CreateVkInstance (/home/nianrui/webgpu_module/webgpu-native-examples/external/dawn/dawn/src/dawn/native/vulkan/BackendVk.cpp:363) at Initialize (/home/nianrui/webgpu_module/webgpu-native-examples/external/dawn/dawn/src/dawn/native/vulkan/BackendVk.cpp:238) at Create (/home/nianrui/webgpu_module/webgpu-native-examples/external/dawn/dawn/src/dawn/native/vulkan/BackendVk.cpp:168) at operator() (/home/nianrui/webgpu_module/webgpu-native-examples/external/dawn/dawn/src/dawn/native/vulkan/BackendVk.cpp:423)

Available adapters: Null backend () deviceID=0, vendorID=0x0, BackendType::Null, AdapterType::CPU GLFW Error occured, Error id: 65537, Description: The GLFW library is not initialized GLFW Error occured, Error id: 65537, Description: The GLFW library is not initialized

my environment is : System: Linux oppo 4.15.0-175-generic #184-Ubuntu SMP Thu Mar 24 17:48:36 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux GPU: 00:02.0 VGA compatible controller: Intel Corporation Device 3e92

Did you met it?

samdauwe commented 2 years ago

Hi,

from the error log it seems that is there something wrong with your Vulkan driver. Your GPU is a Intel Corporation Device 3e92 (Intel® UHD Graphics 630) that should have support for the Vulkan API.

Can you check if Vulkan information can be retrieved in relation with your current environment: $ vulkaninfo

In case this utility is not installed you can install it as follows: $ apt-get install vulkan-utils

In case this vulkaninfo utility returns the supported info for your system, you can also try running the vkcube application: $ apt-get install vulkan-tools $ vkcube

Do you see a spinning cube ? Do you have multiple GPUs in your setup (i.e. integrated Intel and discrete AMD/NVidia) ?

Another issue could be related to your Display environment setting, you can override this for another didplay like for instance $ DISPLAY=:0 ./wgpu_sample_launcher triangle

or

$ DISPLAY=:1 ./wgpu_sample_launcher triangle

Hope this helps.

Best regards, Sam

hefeng-oppo commented 2 years ago

Hi,

from the error log it seems that is there something wrong with your Vulkan driver. Your GPU is a Intel Corporation Device 3e92 (Intel® UHD Graphics 630) that should have support for the Vulkan API.

Can you check if Vulkan information can be retrieved in relation with your current environment: $ vulkaninfo

In case this utility is not installed you can install it as follows: $ apt-get install vulkan-utils

In case this vulkaninfo utility returns the supported info for your system, you can also try running the vkcube application: $ apt-get install vulkan-tools $ vkcube

Do you see a spinning cube ? Do you have multiple GPUs in your setup (i.e. integrated Intel and discrete AMD/NVidia) ?

Another issue could be related to your Display environment setting, you can override this for another didplay like for instance $ DISPLAY=:0 ./wgpu_sample_launcher triangle

or

$ DISPLAY=:1 ./wgpu_sample_launcher triangle

Hope this helps.

Best regards, Sam

You are right , I has no valkan, thanks so much!. But after installed vulkan, run sample with error :

image

For "vulkan no dri3 support detected - required for presentation", I had add info in /etc/X11/xorg.conf.d/20-intel.conf, but it means don't work as well (like as https://donjajo.com/enable-intel-dri3-xorg/#.YmZkQOi-uUk)

Did you meet it?

For "Unable to open file 'shaders/triangle/triangle.vert.spv', the file is ok, I don't know why, could you help me ? image

samdauwe commented 2 years ago

vulkan no dri3 support detected - required for presentation

Hi, from the error log it seems that is there something wrong with your Vulkan driver. Your GPU is a Intel Corporation Device 3e92 (Intel® UHD Graphics 630) that should have support for the Vulkan API. Can you check if Vulkan information can be retrieved in relation with your current environment: $ vulkaninfo In case this utility is not installed you can install it as follows: $ apt-get install vulkan-utils In case this vulkaninfo utility returns the supported info for your system, you can also try running the vkcube application: $ apt-get install vulkan-tools $ vkcube Do you see a spinning cube ? Do you have multiple GPUs in your setup (i.e. integrated Intel and discrete AMD/NVidia) ? Another issue could be related to your Display environment setting, you can override this for another didplay like for instance $ DISPLAY=:0 ./wgpu_sample_launcher triangle or $ DISPLAY=:1 ./wgpu_sample_launcher triangle Hope this helps. Best regards, Sam

You are right , I has no valkan, thanks so much!.

Good that installing Vulkan resolved the incompatible driver error!

But after installed vulkan, run sample with error :

image

For "vulkan no dri3 support detected - required for presentation", I had add info in /etc/X11/xorg.conf.d/20-intel.conf, but it means don't work as well (like as https://donjajo.com/enable-intel-dri3-xorg/#.YmZkQOi-uUk)

Did you meet it?

No, I never had this issue, it tested this on an Intel Iris Plus Graphics 640 (GT3e) and it worked without updating the file /etc/X11/xorg.conf.d/20-intel.conf I am on KDE but I am using Wayland instead of X11.

With the sentence 'but it means don't work as well' do you mean you are still getting the error or would this setting impact the performance ?

For "Unable to open file 'shaders/triangle/triangle.vert.spv', the file is ok, I don't know why, could you help me ? image

Ah, the _wgpu_samplelauncher should be started from the same directory where the executable is located, could you try: $ cd build//Debugx64 $ ./wgpu_sample_launcher triangle there are also examples where the shader source code is stored in the wgpu_sample_launcher executable and therefore do not need to load shader files: $ cd build//Debugx64 $ ./wgpu_sample_launcher instanced_cube

Hope this helps.

Best regards, Sam

hefeng-oppo commented 2 years ago

vulkan no dri3 support detected - required for presentation

Hi, from the error log it seems that is there something wrong with your Vulkan driver. Your GPU is a Intel Corporation Device 3e92 (Intel® UHD Graphics 630) that should have support for the Vulkan API. Can you check if Vulkan information can be retrieved in relation with your current environment: $ vulkaninfo In case this utility is not installed you can install it as follows: $ apt-get install vulkan-utils In case this vulkaninfo utility returns the supported info for your system, you can also try running the vkcube application: $ apt-get install vulkan-tools $ vkcube Do you see a spinning cube ? Do you have multiple GPUs in your setup (i.e. integrated Intel and discrete AMD/NVidia) ? Another issue could be related to your Display environment setting, you can override this for another didplay like for instance $ DISPLAY=:0 ./wgpu_sample_launcher triangle or $ DISPLAY=:1 ./wgpu_sample_launcher triangle Hope this helps. Best regards, Sam

You are right , I has no valkan, thanks so much!.

Good that installing Vulkan resolved the incompatible driver error!

But after installed vulkan, run sample with error : image For "vulkan no dri3 support detected - required for presentation", I had add info in /etc/X11/xorg.conf.d/20-intel.conf, but it means don't work as well (like as https://donjajo.com/enable-intel-dri3-xorg/#.YmZkQOi-uUk) Did you meet it?

No, I never had this issue, it tested this on an Intel Iris Plus Graphics 640 (GT3e) and it worked without updating the file /etc/X11/xorg.conf.d/20-intel.conf I am on KDE but I am using Wayland instead of X11.

With the sentence 'but it means don't work as well' do you mean you are still getting the error or would this setting impact the performance ?

For "Unable to open file 'shaders/triangle/triangle.vert.spv', the file is ok, I don't know why, could you help me ? image

Ah, the _wgpu_samplelauncher should be started from the same directory where the executable is located, could you try: $ cd build//Debugx64 $ ./wgpu_sample_launcher triangle there are also examples where the shader source code is stored in the wgpu_sample_launcher executable and therefore do not need to load shader files: $ cd build//Debugx64 $ ./wgpu_sample_launcher instanced_cube

Hope this helps.

Best regards, Sam

Thanks,

For Q1 "vulkan: No DRI3 support detected.." , It is reason that I used remote desktop. If use local desktop,there is no related notes to me.

For your suggestion image

I copy the compiler dir(webgpu_example_assert)to build/ReleaseX64/ (same as wgpu_sample_launcher ), But same error accured : "Unable to open file 'shaders/triangle/triangle.vert.spv'

Is it possible that the compiled product is wrong?

Best regards, Feng

hefeng-oppo commented 2 years ago

Hi, Sam

I have a new discovery on this issue(“Unable to open file ...”)

I can run successfully conway, please check attachment files(MP4).

As your suggestion, If I run some examples , error, occured. like as image

So I wonder if it is because of lack of tools, for opening .spv files

Best Regards, Feng

hefeng-oppo commented 2 years ago

https://user-images.githubusercontent.com/103252929/165213876-e063fc87-03ec-4e45-bb97-f73d2f9644f7.mp4

hefeng-oppo commented 2 years ago

Hi, Sam

The above issues are fixed, now i can run all examples with linux.

"So I wonder if it is because of lack of tools, for opening .spv files" -> It should be an intermediate file problem before compilation, it works as building the preject again after clear the dir named "webgpu_example_assert" in root dir.

So thank you very much for the previous help!

In the next stage, we may have limited consideration of using this WebGPU capability on the Android platform。 Finally, have you experienced WebGPU capabilities on ARM(android) devices?

Best Regards, Feng

samdauwe commented 2 years ago

Hi, Feng

Those are a lot of questions, I will group my answers in one post.

For Q1 "vulkan: No DRI3 support detected.." , It is reason that I used remote desktop. If use local desktop,there is no related > notes to me.

Ah, I did not know that you were using remote desktop. I never tried it, but remote desktop is slower than local desktop. Good that the error was gone when using local desktop

I copy the compiler dir(webgpu_example_assert)to build/ReleaseX64/ (same as wgpu_sample_launcher ), But same error >accured : "Unable to open file 'shaders/triangle/triangle.vert.spv'

Is it possible that the compiled product is wrong?

This seems to be a deployment issue, as the shader files are loaded from the assets folder. The CMake file therefore contains the following section:

afbeelding

And should copy the 'webgpu-native-examples/assets' folder to the deployment folder 'build/Debugx64/assets'. and the deployment directory should look like this:

afbeelding

On your system, was the assets folder not created in the deployment folder ? I tested on different system and Ubuntu versions but did not have this issue before.

I can run successfully conway, please check attachment files(MP4). So I wonder if it is because of lack of tools, for opening .spv files

There are a couple of options I demonstrate in the examples:

  1. Loading shader code from .spv files located on the disc. These .spv files contain bytecode compiled from GLSL files.
  2. Loading shader code from .wgsl files located on the disc. WGSL is the new shading language developed for WebGPU.
  3. Storing WGSL code as a character array in the 'wgpu_sample_launcher' executable. I used this for shorter shader code fragments.

In the case of the Conway example there was not a lot of shader code involved so I had chosen option 3. and no shader code files needed to be loaded from disc and therefore the demo application worked without the assets folder.

The above issues are fixed, now i can run all examples with linux.

That is good news! How did you manage to resolve the issues?

"So I wonder if it is because of lack of tools, for opening .spv files" -> It should be an intermediate file problem before compilation, it works as building the preject again after clear the dir named "webgpu_example_assert" in root dir.

I tried to do a new Git checkout and build from scratch but I cannot reproduce the error you have reported. Did you do something different compared to the instructions described in the Readme ?

So thank you very much for the previous help!

Happy to hear that you were able to run the examples!

In the next stage, we may have limited consideration of using this WebGPU capability on the Android platform。 Finally, have you experienced WebGPU capabilities on ARM(android) devices?

WebGPU standard is not yet final and there is not much documentation available at this moment so it make sense to postpone the adoption of the technology.

I did not try this yet, but I have seem posts from people on the WebGPU forum that could compiler Google Dawn for Android. So it should be possible to support ARM (android)devices. I could add this to my future Roadmap if you are interested to have the examples running on Android once the WebGPU spec is finalized ?

To support your WebGPU application on Android you have 2 options:

  1. Compile Google Dawn for Android and make you application compatible with Android. This option I did not try yet.
  2. Compile you native WebGPU application for Web (using WebAssembly) and run in any browser. At the moment only desktop browser support this and not yet the browsers for Android but the support will come in the future.

Out of interest, what is your intended use case ? Do you want to port an existing Android application to WebGPU or are you considering/evaluating WebGPU for a new project ?

Best Regards, Feng

Best regards, Sam

hefeng-oppo commented 2 years ago

Hi, Sam

I tried to do a new Git checkout and build from scratch but I cannot reproduce the error you have reported. Did you do ### something different compared to the instructions described in the Readme ?

The main problem is the compilation environment. It would be better if you can add some compilation environment descriptions, such as the Linux kernel version, GCC G++, etc.

I did not try this yet, but I have seem posts from people on the WebGPU forum that could compiler Google Dawn for Android. So it should be possible to support ARM (android)devices. I could add this to my future Roadmap if you are interested to have the examples running on Android once the WebGPU spec is finalized ?

yeah, I'm very interested in doing this. I will consider running your samples on the android platform recently. If you encounter any problems, I hope to continue to communicate with you. Thanks for your suggestions about android platform.

Out of interest, what is your intended use case ? Do you want to port an existing Android application to WebGPU or are you considering/evaluating WebGPU for a new project ?

Yeah. We have plans to build a unified cross-platform capability for mobile devices based on WebGPU to serve more complex graphics rendering in the future, such as immersive games, 3D graphics editing, etc.

What is your recent roadmap please? Have you considered doing something related? If possible,hope to continue to communicate with you about related things via email(hefeng2@oppo.com is mine)

Best regards, Feng

samdauwe commented 2 years ago

Hi, Feng

I tried to do a new Git checkout and build from scratch but I cannot reproduce the error you have reported. Did you do ### something different compared to the instructions described in the Readme ?

The main problem is the compilation environment. It would be better if you can add some compilation environment descriptions, such as the Linux kernel version, GCC G++, etc.

Thanks for the feedback! Continuous integration (i.e. using GitHub) using different compiler versions is indeed missing and the Readme does not contain information about the minimal build environment. This information is something I need to add to the Readme.

I did not try this yet, but I have seem posts from people on the WebGPU forum that could compiler Google Dawn for Android. So it should be possible to support ARM (android)devices. I could add this to my future Roadmap if you are interested to have the examples running on Android once the WebGPU spec is finalized ?

yeah, I'm very interested in doing this. I will consider running your samples on the android platform recently. If you encounter any problems, I hope to continue to communicate with you. Thanks for your suggestions about android platform.

I don't have much experience with Android development but it should similar to getting a Vulkan application running on Android, because that is the approach I took for Linux. Feel free to keep me updated on your progress.

Out of interest, what is your intended use case ? Do you want to port an existing Android application to WebGPU or are you considering/evaluating WebGPU for a new project ?

Yeah. We have plans to build a unified cross-platform capability for mobile devices based on WebGPU to serve more complex graphics rendering in the future, such as immersive games, 3D graphics editing, etc.

That sound interesting! Do you have already some references on the web you could point me to or is this too early ?

What is your recent roadmap please? Have you considered doing something related? If possible,hope to continue to communicate with you about related things via email(hefeng2@oppo.com is mine)

I have some ideas for the few months as described in the Readme file, you can find them here. I think porting the old but very famous WebGL aquarium to WebGPU and getting it running on native, WebAssembly and Android would be a nice project.

In case you have some interesting ideas or references to existing projects about immersive games, 3D graphics, new technologies, etc. please let me know, it could be interesting for a new project.

Thanks for your email info, I will keep you posted on this project when I achieved some new milestones or interesting demo application. My email address can be found in the Git commit log of the repo or you can communicate using GitHub.

Best regards, Feng

Best regards, Sam

hefeng-oppo commented 2 years ago

Hi, Sam

That sound interesting! Do you have already some references on the web you could point me to or is this too early ?

Sorry, I'm working on this, but I'm running into issues with Dawn(chromium) on Android and it's slow. If there is an update, will synchronize with you in time. Now I will try one thing wich same as you said :

In case you have some interesting ideas or references to existing projects about immersive games, 3D graphics, new technologies, etc. please let me know, it could be interesting for a new project.

Thanks for your email info, I will keep you posted on this project when I achieved some new milestones or interesting demo application. My email address can be found in the Git commit log of the repo or you can communicate using GitHub.

Ok. I got your email. I really look forward to your ability to add WebGPU capabilities on ARM devices to your roadmap, so that we can discuss related topics together later. I'm sure this will be a very interesting thing.

Best regards, Feng