nicegraf
|
Data Fields | |
ngf_stage_type | type |
const void * | content |
uint32_t | content_length |
const char * | debug_name |
const char * | entry_point_name |
Describes a programmable shader stage.
const void* ngf_shader_stage_info::content |
This shall be a pointer to a memory buffer containing the code for the shader stage.
The specific contents of the buffer depend on which backend nicegraf is being used with:
Additionally, the Metal backend expects the code to contain a special comment, mapping all <descriptor set, binding> pairs to the native Metal argument table slots. The comment shall be a C-style block comment - beginning with a forward slash, followed by an asterisk - containing the following word:
followed by a newline character.
Each of the following lines until the end of the comment shall have the following format:
where s
is the set number, b
is the binding number within the set, and m
is the index of the corresponding resource in Metal's argument table.
For example, let's say the Metal shader refers to index 3 in the texture argument table. Adding the following line to the binding map comment
would tell the nicegraf metal backend to use the third slot of the texture argument table when an image is bound to set 0, binding 1 using ngf_cmd_bind_resources.
When compiling HLSL shaders using nicegraf-shaderc, the comment with the binding map is generated automatically.
uint32_t ngf_shader_stage_info::content_length |
The number of bytes in the ngf_shader_stage_info::content buffer.
const char* ngf_shader_stage_info::debug_name |
Optional name, will appear in debug logs, may be NULL.
const char* ngf_shader_stage_info::entry_point_name |
Entry point name for this shader stage.
ngf_stage_type ngf_shader_stage_info::type |
Stage type (vert/frag/etc.)