Example #1
0
bool CD3DEffect::SetResources(LPCSTR handle, ID3D11ShaderResourceView** ppSRViews, size_t count)
{
  if (m_effect)
  {
    ID3DX11EffectShaderResourceVariable* var = m_effect->GetVariableByName(handle)->AsShaderResource();
    if (var->IsValid())
      return SUCCEEDED(var->SetResourceArray(ppSRViews, 0, count));
  }
  return false;
}
void DX11Shader::setTextureArray(const char* strName, Texture texture, UINT uTexture)
{
    ID3DX11EffectShaderResourceVariable*  pTextureVariable;

    pTextureVariable = m_pEffect->pEffect->GetVariableByName(strName)->AsShaderResource();
    if (pTextureVariable->IsValid()) {
        pTextureVariable->SetResourceArray(&texture.getData()->m_pShaderResource, uTexture, 1);
    }
    else {
        EventManager::Instance().postMessage("Unknown shaderresource variable: %s in shader: %s", strName, m_pEffect->strName);
    }
}