shader-slang / slang

Making it easier to work with shaders
http://shader-slang.com
Other
2.9k stars 210 forks source link

Is there support for OpenGL ES? #5635

Closed cprkv closed 3 days ago

cprkv commented 3 days ago

I need to write GLSL shaders with slang (#version 300 es) and it looks like slangc doesn't support output to such format. I try using this command:

.\slangc.exe test.slang -profile glsl_330 -o test.vert -entry main

but it outputs shader with #version 450. What should I use to output #version 300 es shaders?

jkwak-work commented 3 days ago

GLSL as a target is only experimental. I don't think GLSL ES is supported even as an experimental feature.

csyonghe commented 3 days ago

Our glsl generation is only for generating Vulkan flavored glsl. Using that glsl output for OpenGL es may work if you simply replace that version line with something that gles expects, but this isn’t an officially supported use scenario. We can reconsider the support level for traditional OpenGL flavored glsl as a target if there are sufficient need for this.

cprkv commented 3 days ago

I managed to get OpenGL ES shader via spirv-cross:

.\slangc.exe test.slang -profile spirv_1_5 -o test.spv -entry main
.\spirv-cross.exe test.spv --es --version 300 --stage vert --output test.vert 

So closing the issue.