c++directx-11hlslpixel-shader

Which texture slot should be used to start where I need 7th and 8th slot together among 0 to 8 index of 9 resources


I have total 9 texture resources among them I need 2 resources together for a pixel shader. In that case what should be the texture slot start index if I need the 7th and 8th texture resources only. (e.g. Texture2D foo1 : register(t7) and Texture2D foo2 : register(t8))

void PSSetShaderResources(
   UINT                     StartSlot,
   UINT                     NumViews,
   ID3D11ShaderResourceView * const *ppShaderResourceViews
);

EDIT: I have a wrapper class for managing shaders where I am dealing with multiple resources like below:

ID3D11DeviceContextPtr context = renderer->Context();
std::vector<ID3D11ShaderResourceView*> srvs;

    for(auto texture : m_textures)
    {
        srvs.push_back(texture->ShaderResourceView());
    }
    context->PSSetShaderResources(m_startSlot, srvs.size(), srvs.data());

Solution

  • I have found from this post that you may provide a resource collection of textures at once and mention a start index from where to collect them from buffer it's provided.