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

Support for Custom GLSL Code in Slang #5687

Open
Calonca opened this issue Nov 26, 2024 · 0 comments
Open

Support for Custom GLSL Code in Slang #5687

Calonca opened this issue Nov 26, 2024 · 0 comments

Comments

@Calonca
Copy link

Calonca commented Nov 26, 2024

Description

I am using Slang to create compute shaders for use in Godot. In Godot, the shader source code must include the #[compute] directive at the top of the file.

I attempted to achieve this by adding the following line to the computeMain function.

__requirePrelude(R"(#[compute])");

However, compilation to GLSL fails with the following error:

internal error 99999: unimplemented feature in Slang compiler: unexpected IR opcode during code emit
    __requirePrelude(R"(#[compute])");

Question

Is it possible to support the addition of custom GLSL code (e.g., directives like #[compute]) in Slang shaders? If not, are there any alternative approaches or workarounds for embedding such directives in the generated GLSL code for compatibility with Godot?

Steps to Reproduce

  1. Use Slang to create a compute shader.
  2. Add __requirePrelude(R"(#[compute])"); inside the compute function.
  3. Compile the shader to GLSL using the Slang compiler.

Expected Behavior

The #[compute] directive should be successfully added to the GLSL output for compatibility with Godot.

Actual Behavior

The compilation fails with an internal error.

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

1 participant