| 1089 | /////////////////////////////////////////// |
| 1090 | |
| 1091 | void 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 |
no test coverage detected