mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-29 17:52:18 +01:00
[d3d11] Implement DiscardResource for buffers
We don't suppor this for images, and we don't support DiscardView yet. Buffers can be invalidated, which may in some cases be beneficial in order to avoid synchronization on the GPU.
This commit is contained in:
parent
8044ce6c7e
commit
3fee20dfec
@ -61,20 +61,24 @@ namespace dxvk {
|
|||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void STDMETHODCALLTYPE D3D11DeviceContext::DiscardResource(ID3D11Resource * pResource) {
|
|
||||||
static bool s_errorShown = false;
|
void STDMETHODCALLTYPE D3D11DeviceContext::DiscardResource(ID3D11Resource* pResource) {
|
||||||
|
D3D11_RESOURCE_DIMENSION resType = D3D11_RESOURCE_DIMENSION_UNKNOWN;
|
||||||
if (!std::exchange(s_errorShown, true))
|
pResource->GetType(&resType);
|
||||||
Logger::err("D3D11DeviceContext::DiscardResource: Not implemented");
|
|
||||||
|
// We don't support the Discard API for images
|
||||||
|
if (resType == D3D11_RESOURCE_DIMENSION_BUFFER)
|
||||||
|
DiscardBuffer(reinterpret_cast<D3D11Buffer*>(pResource));
|
||||||
}
|
}
|
||||||
|
|
||||||
void STDMETHODCALLTYPE D3D11DeviceContext::DiscardView(ID3D11View * pResourceView) {
|
|
||||||
static bool s_errorShown = false;
|
void STDMETHODCALLTYPE D3D11DeviceContext::DiscardView(ID3D11View* pResourceView) {
|
||||||
|
// Ignore. We don't do Discard for images or image
|
||||||
if (!std::exchange(s_errorShown, true))
|
// subresources, and for buffers we could only really
|
||||||
Logger::err("D3D11DeviceContext::DiscardView: Not implemented");
|
// do this if the view covers the entire buffer.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void STDMETHODCALLTYPE D3D11DeviceContext::DiscardView1(
|
void STDMETHODCALLTYPE D3D11DeviceContext::DiscardView1(
|
||||||
ID3D11View* pResourceView,
|
ID3D11View* pResourceView,
|
||||||
const D3D11_RECT* pRects,
|
const D3D11_RECT* pRects,
|
||||||
@ -2711,6 +2715,15 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void D3D11DeviceContext::DiscardBuffer(
|
||||||
|
D3D11Buffer* pBuffer) {
|
||||||
|
EmitCs([cBuffer = pBuffer->GetBuffer()] (DxvkContext* ctx) {
|
||||||
|
ctx->invalidateBuffer(cBuffer,
|
||||||
|
cBuffer->allocPhysicalSlice());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void D3D11DeviceContext::SetConstantBuffers(
|
void D3D11DeviceContext::SetConstantBuffers(
|
||||||
DxbcProgramType ShaderStage,
|
DxbcProgramType ShaderStage,
|
||||||
D3D11ConstantBufferBindings& Bindings,
|
D3D11ConstantBufferBindings& Bindings,
|
||||||
|
@ -703,6 +703,9 @@ namespace dxvk {
|
|||||||
UINT CtrSlot,
|
UINT CtrSlot,
|
||||||
D3D11UnorderedAccessView* pUav);
|
D3D11UnorderedAccessView* pUav);
|
||||||
|
|
||||||
|
void DiscardBuffer(
|
||||||
|
D3D11Buffer* pBuffer);
|
||||||
|
|
||||||
void SetConstantBuffers(
|
void SetConstantBuffers(
|
||||||
DxbcProgramType ShaderStage,
|
DxbcProgramType ShaderStage,
|
||||||
D3D11ConstantBufferBindings& Bindings,
|
D3D11ConstantBufferBindings& Bindings,
|
||||||
|
@ -1603,7 +1603,7 @@ namespace dxvk {
|
|||||||
auto info = static_cast<D3D11_FEATURE_DATA_D3D11_OPTIONS*>(pFeatureSupportData);
|
auto info = static_cast<D3D11_FEATURE_DATA_D3D11_OPTIONS*>(pFeatureSupportData);
|
||||||
info->OutputMergerLogicOp = features.core.features.logicOp;
|
info->OutputMergerLogicOp = features.core.features.logicOp;
|
||||||
info->UAVOnlyRenderingForcedSampleCount = FALSE;
|
info->UAVOnlyRenderingForcedSampleCount = FALSE;
|
||||||
info->DiscardAPIsSeenByDriver = FALSE;
|
info->DiscardAPIsSeenByDriver = TRUE;
|
||||||
info->FlagsForUpdateAndCopySeenByDriver = FALSE;
|
info->FlagsForUpdateAndCopySeenByDriver = FALSE;
|
||||||
info->ClearView = FALSE;
|
info->ClearView = FALSE;
|
||||||
info->CopyWithOverlap = FALSE;
|
info->CopyWithOverlap = FALSE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user