PluginRust icon indicating copy to clipboard operation
PluginRust copied to clipboard

Crash when loading project

Open oh-wind opened this issue 4 years ago • 6 comments

After installing the plugin, I tried to open "2D Rust", but SHADERed crashed

I don't know how to get the crash log

OS: windows_X86_64 SHADERed version: 1.4.2

oh-wind avatar Dec 04 '20 16:12 oh-wind

Go to the Window -> Options and then turn on the Logs and Stream logs to log.txt options. BTW have you ran the ./setup.sh in the rust-gpu? This plugin requires some additional steps to make it work

dfranx avatar Dec 04 '20 20:12 dfranx

I cloned the source code of rust-gpu and ran the setup.bat script, and successfully ran the example cargo run --bin example-runner-wgpu. But I still crash when loading the project. Did I overlook some steps?

SHADERed Log

[15:02:51] Loading template list
[15:02:51] Initializing Dear ImGUI
[15:02:51] Creating various UI view objects
[15:02:51] Initializing gizmo...
[15:02:51] Loading a 3D model from file "data/gizmo.obj"
[15:02:51] Loaded gizmo 3D model
[15:02:51] Finished with initializing gizmo
[15:02:51] Setting up the bounding box
[15:02:51] Setting up cubemap preview system...
[15:02:51] Setting up cubemap preview system...
[15:02:51] Loading a 3D model from file "data/vector_handle.obj"
[15:02:51] Loading a 3D model from file "data/vector_point.obj"
[15:02:51] Loading keyboard shortcuts
[15:02:51] Loaded shortcut information
[15:02:51] Setting up cubemap preview system...
[15:02:51] Loading theme list
[15:02:51] Loading a theme from file ./themes/cherry.ini
[15:02:51] Loading a theme from file ./themes/corporategray.ini
[15:02:51] Loading a theme from file ./themes/dracula.ini
[15:02:51] Loading a theme from file ./themes/gray.ini
[15:02:51] Loading a theme from file ./themes/lightgreen.ini
[15:02:51] Setting DPI to 1.250000
[15:02:51] Applying UI theme to SHADERed
[15:02:51] Loading code snippets
[15:02:51] Setting up the splash screen
[15:02:51] Creating EditorEngine...
[15:02:51] Applying UI theme to SHADERed
[15:02:51] Creating a new project from template
[15:02:51] Clearing PipelineManager contents
[15:02:51] Opening a project file D:/ProgramFiles/SHADERed/templates/GLSL/template.sprj
[15:02:51] Clearing PipelineManager contents
[15:02:51] Clearing ObjectManager contents...
[15:02:51] Parsing a V2 project file...
[15:02:51] Added a shader pass Simple to the project
[15:02:51] Adding a pipeline item Box to the project
[15:02:51] Item Box added to the project
[15:02:51] Opening a pipeline item in the PropertyUI
[15:02:51] Finished with parsing a project file
[15:02:51] Created EditorEngine
[15:02:51] Updating fonts...
[15:02:51] Applying UI theme to SHADERed
[15:02:51] Checking for updates with WebAPI
[15:02:51] Loading "Rust" plugin.
[15:02:51] Plugin "Rust" successfully initialized.
[15:02:52] Caching a new shader pass Simple
[15:02:52] Starting to transcompile a HLSL shader shaders/SimpleVS.glsl
[15:02:52] Starting to transcompile a HLSL shader shaders/SimplePS.glsl
[15:03:20] Opening a project file D:\workspace\self\shader\rust2d\project.sprj
[15:03:20] Clearing PipelineManager contents
[15:03:20] Deleting item Simple
[15:03:20] Clearing ObjectManager contents...
[15:03:20] Parsing a V2 project file...
[15:03:20] Added a shader pass Main to the project
[15:03:20] Adding a pipeline item FSQuad to the project
[15:03:20] Item FSQuad added to the project
[15:03:20] Finished with parsing a project file
[15:03:20] Caching a new shader pass Main
[15:03:20] Plugin is compiling the shader to SPIR-V

oh-wind avatar Dec 05 '20 07:12 oh-wind

Sorry for the slow response.

I discovered that this happens when cargo / rustup is not properly set up. Plugin would call AddMessage with group parameter set to nullptr which would then cause the crash (I've fixed this in one of the latest commits). The only such message produced by PluginRust is this one: https://github.com/dfranx/PluginRust/blob/a178dfa008dfcc6ac9a799596d85cec3769e6c08/dllmain.cpp#L227

Make sure that you have set proper version of rustup to be used outside of the rust-gpu directory.

You can run the rustup show command to see all the toolchains and which one is used.

dfranx avatar Dec 16 '20 01:12 dfranx

Hi~

You can run the rustup show command to see all the toolchains and which one is used.

At first my default toolchain was stable-x86_64-pc-windows-msvc, now I changed it to nightly-2020-11-24-x86_64-pc-windows-msvc, but it still crashes...

> rustup show Default host: x86_64-pc-windows-msvc rustup home: C:\Users\ *** \ .rustup

installed toolchains

stable-x86_64-pc-windows-msvc nightly-2020-11-24-x86_64-pc-windows-msvc (default) nightly-x86_64-pc-windows-msvc

active toolchain

nightly-2020-11-24-x86_64-pc-windows-msvc (overridden by '\?\D:\rust-gpu\rust-toolchain') rustc 1.50.0-nightly (d9a105fdd 2020-11-23)

SHADERed Log:

...... [14:09:14] Loading "Rust" plugin. [14:09:14] Plugin "Rust" successfully initialized. ...... [14:10:09] Opening a project file D:\workspace\self\shader\rust2d\project.sprj [14:10:09] Clearing PipelineManager contents [14:10:09] Deleting item Simple [14:10:09] Clearing ObjectManager contents... [14:10:09] Parsing a V2 project file... [14:10:09] Added a shader pass Main to the project [14:10:09] Adding a pipeline item FSQuad to the project [14:10:09] Item FSQuad added to the project [14:10:09] Finished with parsing a project file [14:10:09] Caching a new shader pass Main [14:10:09] Plugin is compiling the shader to SPIR-V

oh-wind avatar Dec 17 '20 06:12 oh-wind

Hey, I assume you are using rust_codegen_spirv.dll provided with the plugin? That one was built by some older version of rustup. I recommend that you run cargo build --release in the rust-gpu/crates/rustc_codegen_spirv directory and then replace the old .dll with the newly compiled rustc_codegen_spirv.dll

Setting this plugin up is a bit difficult right now, but it might change in the future

dfranx avatar Dec 17 '20 13:12 dfranx

Thank you for your reply.

I cloned your source code to find the error, and then found that SHADERed crashes when I try to call the AddMessage() function. So I deleted all the places calling this,and then the SHADERed window was successfully created! but there was an error message in it. I don't know much about the development of SHADERed plugin. I think this is because I am missing a library?

And I noticed that you used std :: ofstream writer (" rust_crates/shader/src/lib.rs") to copy the code to the rust_crates/shader crate. But I didn't copy rust_crates to the SHADERed root directory, which caused the copy to not work and the compilation to fail

oh-wind avatar Dec 18 '20 08:12 oh-wind