Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when loading project #1

Open
oh-wind opened this issue Dec 4, 2020 · 6 comments
Open

Crash when loading project #1

oh-wind opened this issue Dec 4, 2020 · 6 comments

Comments

@oh-wind
Copy link

oh-wind commented Dec 4, 2020

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

@dfranx
Copy link
Owner

dfranx commented Dec 4, 2020

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

@oh-wind
Copy link
Author

oh-wind commented Dec 5, 2020

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

@dfranx
Copy link
Owner

dfranx commented Dec 16, 2020

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:

AddMessage(Messages, ed::plugin::MessageType::Error, nullptr, "Cargo not properly set up", -1);

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.

@oh-wind
Copy link
Author

oh-wind commented Dec 17, 2020

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

@dfranx
Copy link
Owner

dfranx commented Dec 17, 2020

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

@oh-wind
Copy link
Author

oh-wind commented Dec 18, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants