MCPcopy Create free account
hub / github.com/StereoKit/StereoKit / render_set_material

Function render_set_material

StereoKitC/systems/render.cpp:1091–1114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1089///////////////////////////////////////////
1090
1091void render_set_material(material_t material) {
1092 if (material == local.last_material)
1093 return;
1094 local.last_material = material;
1095 local.lists[local.list_active].stats.swaps_material++;
1096
1097 // Update and bind the material parameter buffer
1098 if (material->args.buffer != nullptr) {
1099 skg_buffer_bind(&material->args.buffer_gpu, material->args.buffer_bind, 0);
1100 }
1101
1102 // Bind the material textures
1103 for (int32_t i = 0; i < material->args.texture_count; i++) {
1104 if (local.global_textures[material->args.textures[i].bind.slot] == nullptr) {
1105 tex_t tex = material->args.textures[i].tex;
1106 if (tex->fallback != nullptr)
1107 tex = tex->fallback;
1108 skg_tex_bind(&tex->tex, material->args.textures[i].bind);
1109 }
1110 }
1111
1112 // And bind the pipeline
1113 skg_pipeline_bind(&material->pipeline);
1114}
1115
1116///////////////////////////////////////////
1117

Callers 2

render_blit_to_boundFunction · 0.85
render_list_execute_runFunction · 0.85

Calls 3

skg_buffer_bindFunction · 0.85
skg_tex_bindFunction · 0.85
skg_pipeline_bindFunction · 0.85

Tested by

no test coverage detected