D3D11 discard in BeginRenderPass
continuous-integration/drone/push Build is failing Details

d3d11
cosmonaut 2024-03-06 11:32:23 -08:00
parent 5db754719a
commit efd26f474a
1 changed files with 25 additions and 1 deletions

View File

@ -1611,7 +1611,7 @@ static Refresh_Texture* D3D11_CreateTexture(
d3d11Texture->levelCount = textureCreateInfo->levelCount;
d3d11Texture->layerCount = textureCreateInfo->layerCount;
d3d11Texture->isCube = textureCreateInfo->isCube;
d3d11Texture->isRenderTarget = isColorTarget | isDepthStencil;
d3d11Texture->isRenderTarget = isColorTarget || isDepthStencil;
d3d11Texture->shaderView = srv;
d3d11Texture->subresources = SDL_malloc(
@ -3033,6 +3033,14 @@ static void D3D11_BeginRenderPass(
if (texture->subresources[subresourceIndex].msaaHandle != NULL)
{
if (colorAttachmentInfos[i].writeOption == REFRESH_WRITEOPTIONS_SAFEDISCARD)
{
ID3D11DeviceContext1_DiscardView(
d3d11CommandBuffer->context,
(ID3D11View*) texture->subresources[subresourceIndex].msaaTargetView
);
}
d3d11CommandBuffer->colorTargetResolveTexture[i] = texture;
d3d11CommandBuffer->colorTargetResolveSubresourceIndex[i] = subresourceIndex;
d3d11CommandBuffer->colorTargetMsaaHandle[i] = texture->subresources[subresourceIndex].msaaHandle;
@ -3041,6 +3049,14 @@ static void D3D11_BeginRenderPass(
}
else
{
if (colorAttachmentInfos[i].writeOption == REFRESH_WRITEOPTIONS_SAFEDISCARD)
{
ID3D11DeviceContext1_DiscardView(
d3d11CommandBuffer->context,
(ID3D11View*) texture->subresources[subresourceIndex].colorTargetView
);
}
rtvs[i] = texture->subresources[subresourceIndex].colorTargetView;
}
}
@ -3056,6 +3072,14 @@ static void D3D11_BeginRenderPass(
texture->levelCount
);
if (depthStencilAttachmentInfo->writeOption == REFRESH_WRITEOPTIONS_SAFEDISCARD)
{
ID3D11DeviceContext1_DiscardView(
d3d11CommandBuffer->context,
(ID3D11View*) texture->subresources[subresourceIndex].depthStencilTargetView
);
}
dsv = texture->subresources[subresourceIndex].depthStencilTargetView;
}