| 251 | } |
| 252 | |
| 253 | void MaterialSystem::removeMaterial(const MaterialID materialID) |
| 254 | { |
| 255 | FALCOR_CHECK(materialID.isValid() && materialID.get() < mMaterials.size(), "Material ID is invalid."); |
| 256 | |
| 257 | // Mark descriptors used by the deleted material as reserved. |
| 258 | // This is a workaround until we have dynamically sized descriptor arrays and proper resource tracking. |
| 259 | const auto& material = mMaterials[materialID.get()]; |
| 260 | mReservedTextureDescCount += material->getMaxTextureCount(); |
| 261 | mReservedBufferDescCount += material->getMaxBufferCount(); |
| 262 | mReservedTexture3DDescCount += material->getMaxTexture3DCount(); |
| 263 | |
| 264 | // Remove textures that were used by the material and loaded via the texture manager. |
| 265 | mpTextureManager->removeTextures(material.get()); |
| 266 | |
| 267 | // Remove the material. |
| 268 | mMaterials[materialID.get()] = nullptr; |
| 269 | mMaterialsChanged = true; |
| 270 | } |
| 271 | |
| 272 | void MaterialSystem::replaceMaterial(const MaterialID materialID, const ref<Material>& pReplacement) |
| 273 | { |
nothing calls this directly
no test coverage detected