Skip to content

cf_compile_shader_to_bytecode

Category: graphics
GitHub: cute_graphics.h


Compiles a shader to SPIR-V bytecode.

CF_ShaderBytecode cf_compile_shader_to_bytecode(const char* shader_src, CF_ShaderStage stage);
Parameters Description
shader_src Raw glsl, version 450, for the shader as a string.
stage The shaderstrage to differentiate between vertex or fragment shaders.

Remarks

This function is good for precompiling shaders to bytecode, which can help speed up app startup times. SPIR-V blobs can be saved straight to disk and shipped with your game. Load the bytecode blob pair (vertex + fragment shader blobs) into a CF_Shader via cf_make_shader_from_bytecode. The value returned from this function should be passed to cf_free_shader_bytecode when it is no longer needed.

CF_Shader
CF_ShaderBytecode
cf_make_shader_from_bytecode
cf_free_shader_bytecode