Skip to content

Instantly share code, notes, and snippets.

@floooh
Created April 24, 2019 09:51
Show Gist options
  • Save floooh/09cd534b175430cd0a8dff6d1b8637ad to your computer and use it in GitHub Desktop.
Save floooh/09cd534b175430cd0a8dff6d1b8637ad to your computer and use it in GitHub Desktop.
sg_shader shd = sg_make_shader(&(sg_shader_desc){
.attrs = {
[0] = { .sem_name="POS", .sem_index=0 },
[1] = { .sem_name="COLOR", .sem_index=0 }
},
.vs.source = ...
"struct vs_in {\n"
" float4 pos: POS;\n"
" float4 color: COLOR;\n"
"};\n"
...
.fs.source = ..
});
sg_pipeline pip = sg_make_pipeline(&(sg_pipeline_desc){
.layout = {
.attrs = {
/* semantic name and index looked up from attrs table in shader */
[0] = { .format = SG_VERTEXFORMAT_FLOAT3 },
[1] = { .format = SG_VERTEXFORMAT_FLOAT4 }
}
},
.shader = shd
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment