shader-slang / slang

Making it easier to work with shaders
MIT License
2.05k stars 175 forks source link

Add an optional flag to set the capabilities of a compile using glsl's `#version` syntax #4756

Closed ArielG-NV closed 2 months ago

ArielG-NV commented 2 months ago

Problem: Currently if I write the following code:

#version 430
...

Slang ignores #version 430.

This is desired behavior in some scenarios, but a user may want to have their program conform to the #version 430 profile declared and output #version 430 when compiled to a GLSL target.

Solution: It was requested that with a new special compile flag enabled, if a user writes #version 430 Slang will add to its capabilities -capability GLSL_430.

csyonghe commented 2 months ago

Is this a user request?

ArielG-NV commented 2 months ago

Is this a user request?

@chaoticbob requested this as an option (optional flag)

csyonghe commented 2 months ago

I think this is slightly out of scope of our goals. The goal of our glsl onramp support is to allow as many existing glsl code to be compiled through Slang. It is not our goal to verify the rules of each glsl version. While we can support things like this, we need to draw a line on where we stop, e.g. do we support all the #extension directives? So my suggestion is that we should stay focused on our mission-critical priorities and not support this.

csyonghe commented 2 months ago

I am going to close this issue as won't fix due to scoping. We can revisit this if we need to change our strategy around glsl onramp in the future.