예제 #1
0
RenderShader::~RenderShader()
{
    // reduce the ref counts of the textures this shader was using
    for (uint32_t t=0;t<Texture::__SAMPLER_LAST__;t++)
    {
        if (m_textures[t]!=0xffffffff)
        {
            Texture* tex = m_sd->ResolveTexture(m_textures[t]);
            tex->DecrementUsage();
            m_textures[t] = 0xffffffff;
        }
    }
}
예제 #2
0
void RenderShader::ReplaceTexture(uint32_t th, uint32_t slot)
{
    if (m_textures[slot]!=0xffffffff)
    {
        Texture* current = m_sd->ResolveTexture(m_textures[slot]);
        if (current->DecrementUsage()==0)
        {
#pragma TODO("delete now?")
        }
    }

    m_textures[slot] = th;

    if (th!=0xffffffff)
    {
        Texture* ntex = m_sd->ResolveTexture(th);
        ntex->IncrementUsage();
    }
}