natiny_material_create

C
NatinyMaterial natiny_material_create(NatinyShader shader);

Builds a material from a shader's reflected constants, textures and vertex layout. Render pipelines are created lazily for the render states and target layouts used when drawing.

Parameters

Name Type Description
shader NatinyShader Shader handle from natiny_shader_load

Returns

Type Description
NatinyMaterial Material handle, or 0 on failure

Example

C
NatinyMaterial material = natiny_material_create(shader);

Notes

  • Creation fails for an invalid shader, unsupported vertex attributes, uniform blocks beyond the backend limit, layout errors, or too many fragment outputs.
  • The material retains a dependency on the shader. Destroy all materials made from a shader before destroying that shader.
  • Tags used by natiny_render_tag are added with natiny_material_add_tag. A material without tags is still usable through natiny_material_bind.