compile_shader
Compiles shader files to SPIR-V or DXIL with automatic compiler selection by extension. Reports errors with file and line, supporting Vulkan and DirectX targets.
Instructions
Compile a shader and report errors with file and line.
The compiler is chosen from the file extension:
.vert .frag .comp .geom .tesc .tese .mesh .task .rgen .rchit .rahit .rmiss .rint .rcall -> glslc (Vulkan SPIR-V). Nothing else is needed.
.glsl -> glslc, but you must pass
stage(vertex, fragment, compute, geometry, tesscontrol, tesseval, mesh, task or a ray-tracing stage)..hlsl -> dxc. You must pass
profile, e.g. "ps_6_6" or "cs_6_0". Pass spirv=true to target Vulkan instead of DXIL..fx -> fxc, which also needs
profile.
glslangValidator is used automatically if glslc is not installed.
The output file is written beside the source unless output says
otherwise, and is subject to the same write confinement as write_file:
the download root, or a directory in BIONIC_PROJECT_ROOTS.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| spirv | No | ||
| stage | No | ||
| output | No | ||
| source | Yes | ||
| profile | No | ||
| working_directory | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |