Skip to content

Commit

Permalink
[D3D11] Fix binding table for internal render target textures.
Browse files Browse the repository at this point in the history
Internal textures that are created automaticlaly by D3D11RenderTarget (when no attachment texture is specified) are not tracked in the D3D11BindingTable.
Hence, D3D11BindingTable::SetRenderTargets() must accept null pointers of individual binding locators.
  • Loading branch information
LukasBanana committed Jun 23, 2024
1 parent f3fce13 commit 1160610
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion sources/Renderer/Direct3D11/RenderState/D3D11BindingTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ void D3D11BindingTable::SetVertexBuffers(
{
for_range(i, count)
{
LLGL_ASSERT_PTR(locators[i]);
if (locators[i]->type == D3D11BindingLocator::D3DLocator_RWBuffer)
{
EvictAllOutputBindings(locators[i]);
Expand Down Expand Up @@ -116,6 +117,7 @@ void D3D11BindingTable::SetShaderResourceViews(
{
for_range(i, count)
{
LLGL_ASSERT_PTR(locators[i]);
if (locators[i]->type != D3D11BindingLocator::D3DLocator_ReadOnly)
{
EvictAllOutputBindings(locators[i], &subresourceRanges[i]);
Expand All @@ -133,6 +135,7 @@ void D3D11BindingTable::SetShaderResourceViews(
const D3D11SubresourceRange fullRange{ 0u, ~0u };
for_range(i, count)
{
LLGL_ASSERT_PTR(locators[i]);
if (locators[i]->type != D3D11BindingLocator::D3DLocator_ReadOnly)
{
EvictAllOutputBindings(locators[i]);
Expand Down Expand Up @@ -170,6 +173,7 @@ void D3D11BindingTable::SetUnorderedAccessViews(
{
for_range(i, count)
{
LLGL_ASSERT_PTR(locators[i]);
if (locators[i]->type != D3D11BindingLocator::D3DLocator_ReadOnly)
{
EvictAllBindings(locators[i], &subresourceRanges[i]);
Expand All @@ -183,6 +187,7 @@ void D3D11BindingTable::SetUnorderedAccessViews(
const D3D11SubresourceRange fullRange{ 0u, ~0u };
for_range(i, count)
{
LLGL_ASSERT_PTR(locators[i]);
if (locators[i]->type != D3D11BindingLocator::D3DLocator_ReadOnly)
{
EvictAllBindings(locators[i]);
Expand Down Expand Up @@ -225,7 +230,10 @@ void D3D11BindingTable::SetRenderTargets(
{
LLGL_ASSERT_PTR(renderTargetSubresourceRanges);
for_range(slot, count)
EvictAllBindings(renderTargetLocators[slot], renderTargetSubresourceRanges);
{
if (D3D11BindingLocator* locator = renderTargetLocators[slot])
EvictAllBindings(locator, renderTargetSubresourceRanges);
}
rtvCount_ = count;
}
else
Expand Down

0 comments on commit 1160610

Please sign in to comment.