简体   繁体   中英

How could I simply compile GLSL to SPIR-V?

So I need to get the SPIR-V code of some GLSL

Every resource I can find on the topic involves setting up a whole enviroment for graphics and more.

In the simplest case when I have some GLSL code and I want to get the SPIR-V code, what would be the best way?

The Khronos group provide the Vulkan SDK, which is free to download. In that there is a command line tool glslc which you can call from the command line as so:

VulkanSDK/xxxx/Bin/glslc shader.vert -o vert.spv

An example on how to use it also available in the vulkan tutorial . It's pretty plug and play, just download the SDK and run from a terminal.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM