-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make runtime shader compilation optional (#251)
* Move shader compilation to libcute-shader * Fix user shader compilation * Remove unnecessary include * Make cf_make_shader_from_bytecode more friendly to code generator * Add cute-shaderc * Implement draw shader compilation * Fix syntax error in generated header * Pre-compile builtin shaders * Pre-compile imgui shaders * Update hello_triangle sample * Update shallow_water sample * Update recolor sample * Update spaceshooter example * Update waves sample * Update metaballs sample * Make CI build both variants of CF_GLSLANG * Skip uploading artifact for variant without runtime shader compilation * Ensure that src/data/builtin_shaders_bytecode.h is rebuilt when needed * Simplify hello_triangle sample * Enable PIC in libcute-shader when building CF as a dynamic library * Stack allocate the list of builtin includes * Add VFS support in cute-shader * Make the runtime compiler lookup cf_shader_directory for include * Revert samples which uses inline shader * Add preprocessed shader source as comment in generated header * Style fix * Remove unnecessary dependencies * Add reflection info to shader compiler * Make CF use reflection info from cute-shader * Make CF and cute-shader share the CF_ShaderBytecode definition * Add extern "C" * Fetching and building of glslang optional * Make workflow use the new options * Add doc to CF_ShaderInputInfo * Clean up * Add -obytecode= to cute-shaderc to write raw SPIRV blob * Create documentation for changes * Typo and wornding in doc * Update coding style to follow CF convention * Add const to NULL declarations This allows the header to be compiled as C too.
- Loading branch information
Showing
35 changed files
with
10,013 additions
and
895 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[//]: # (This file is automatically generated by Cute Framework's docs parser.) | ||
[//]: # (Do not edit this file by hand!) | ||
[//]: # (See: https://github.com/RandyGaul/cute_framework/blob/master/samples/docs_parser.cpp) | ||
[](../header.md ':include') | ||
|
||
# CF_DrawShaderBytecode | ||
|
||
Category: [draw](/api_reference?id=draw) | ||
GitHub: [cute_draw.h](https://github.com/RandyGaul/cute_framework/blob/master/include/cute_draw.h) | ||
--- | ||
|
||
Bytecode for a draw shader. | ||
|
||
Struct Members | Description | ||
--- | --- | ||
`CF_ShaderBytecode draw_shader` | Bytecode for draw shader. | ||
`CF_ShaderBytecode blit_shader` | Bytecode for blit shader. | ||
|
||
## Remarks | ||
|
||
This can be created using the `cute-shaderc` compiler. | ||
|
||
## Related Pages | ||
|
||
[CF_Shader](/graphics/cf_shader.md) | ||
[cf_draw_push_shader](/draw/cf_draw_push_shader.md) | ||
[cf_draw_pop_shader](/draw/cf_draw_pop_shader.md) | ||
[cf_draw_peek_shader](/draw/cf_draw_peek_shader.md) | ||
[cf_make_draw_shader_from_bytecode](/draw/cf_make_draw_shader_from_bytecode.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[//]: # (This file is automatically generated by Cute Framework's docs parser.) | ||
[//]: # (Do not edit this file by hand!) | ||
[//]: # (See: https://github.com/RandyGaul/cute_framework/blob/master/samples/docs_parser.cpp) | ||
[](../header.md ':include') | ||
|
||
# cf_make_draw_shader_from_bytecode | ||
|
||
Category: [draw](/api_reference?id=draw) | ||
GitHub: [cute_draw.h](https://github.com/RandyGaul/cute_framework/blob/master/include/cute_draw.h) | ||
--- | ||
|
||
Creates a custom draw shader from bytecode. | ||
|
||
```cpp | ||
CF_Shader cf_make_draw_shader_from_bytecode(CF_DrawShaderBytecode bytecode); | ||
``` | ||
## Remarks | ||
Your shader must be written in GLSL 450, and must follow some specific rules to be compatible with the draw API. For more in-depth explanations, | ||
see CF's docs on [Draw Shaders](https://randygaul.github.io/cute_framework/#/topics/drawing?id=shaders). | ||
## Related Pages | ||
[CF_Shader](/graphics/cf_shader.md) | ||
[CF_DrawShaderBytecode](/draw/cf_drawshaderbytecode.md) | ||
[cf_draw_push_shader](/draw/cf_draw_push_shader.md) | ||
[cf_draw_pop_shader](/draw/cf_draw_pop_shader.md) | ||
[cf_draw_peek_shader](/draw/cf_draw_peek_shader.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[//]: # (This file is automatically generated by Cute Framework's docs parser.) | ||
[//]: # (Do not edit this file by hand!) | ||
[//]: # (See: https://github.com/RandyGaul/cute_framework/blob/master/samples/docs_parser.cpp) | ||
[](../header.md ':include') | ||
|
||
# cf_free_shader_bytecode | ||
|
||
Category: [graphics](/api_reference?id=graphics) | ||
GitHub: [cute_graphics.h](https://github.com/RandyGaul/cute_framework/blob/master/include/cute_graphics.h) | ||
--- | ||
|
||
Free a bytecode blob previously returned from [cf_compile_shader_to_bytecode](/graphics/cf_compile_shader_to_bytecode.md). | ||
|
||
```cpp | ||
void cf_free_shader_bytecode(CF_ShaderBytecode bytecode); | ||
``` | ||
Parameters | Description | ||
--- | --- | ||
bytecode | The bytecode blob to free. | ||
## Remarks | ||
This function must only be called on the bytecode blob returned from [cf_compile_shader_to_bytecode](/graphics/cf_compile_shader_to_bytecode.md). | ||
It cannot be called on the bytecode blob generated as a header from the `cute-shaderc` compiler. | ||
Oops, something went wrong.