lovr.graphics.compileShader
EditCompiles shader code to SPIR-V bytecode. The bytecode can be passed to lovr.graphics.newShader
to create shaders, which will be faster than creating it from GLSL. The bytecode is portable, so bytecode compiled on one platform will work on other platforms. This allows shaders to be precompiled in a build step.
Arguments
Name | Type | Description |
stage | ShaderStage | The type of shader to compile. |
source | string | A string or filename with shader code. |
Returns
Name | Type | Description |
bytecode | Blob | A Blob containing compiled SPIR-V code. |
Arguments
Name | Type | Description |
stage | ShaderStage | The type of shader to compile. |
blob | Blob | A Blob containing shader code. |
Returns
Name | Type | Description |
bytecode | Blob | A Blob containing compiled SPIR-V code. |
Notes
The input can be GLSL or SPIR-V. If it's SPIR-V, it will be returned unchanged as a Blob.
If the shader fails to compile, an error will be thrown with the error message.