777 B
777 B
Shader::Release
void Release()
释放着色器持有的所有资源。
此方法继承自 IResource 接口。调用后:
- 清空源码字符串 (
m_sourceCode) - 清空编译后的二进制数据 (
m_compiledBinary) - 清空 Uniform 列表 (
m_uniforms) - 清空 Attribute 列表 (
m_attributes) - 释放 RHI 着色器资源指针 (
m_rhiResource) - 将
m_isValid标记为false
返回: 无
线程安全: ❌ 非线程安全
复杂度: O(n) - 取决于列表中元素数量
示例:
// 使用完 shader 后释放
ResourceHandle<Shader> vs = ResourceManager::Get().Load<Shader>("shaders/vertex.glsl");
// ... 使用着色器 ...
vs->Release();
相关文档
- Shader 总览 - 返回类总览