1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-19 05:52:11 +01:00

[d3d11] Minor Map/Unmap optimizations

Avoid unnecessary LockContext call when unmapping a buffer.
This may actually improve performance if the context has
multithreaded protection enabled (e.g. D3D10).
This commit is contained in:
Philip Rebohle 2019-05-01 03:01:36 +02:00
parent f76fd8fa5d
commit e6eef1d1ec
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -174,7 +174,7 @@ namespace dxvk {
D3D11_MAPPED_SUBRESOURCE* pMappedResource) {
D3D10DeviceLock lock = LockContext();
if (!pResource || !pMappedResource)
if (unlikely(!pResource || !pMappedResource))
return E_INVALIDARG;
D3D11_RESOURCE_DIMENSION resourceDim = D3D11_RESOURCE_DIMENSION_UNKNOWN;
@ -182,7 +182,7 @@ namespace dxvk {
HRESULT hr;
if (resourceDim == D3D11_RESOURCE_DIMENSION_BUFFER) {
if (likely(resourceDim == D3D11_RESOURCE_DIMENSION_BUFFER)) {
hr = MapBuffer(
static_cast<D3D11Buffer*>(pResource),
MapType, MapFlags, pMappedResource);
@ -206,13 +206,13 @@ namespace dxvk {
void STDMETHODCALLTYPE D3D11ImmediateContext::Unmap(
ID3D11Resource* pResource,
UINT Subresource) {
D3D10DeviceLock lock = LockContext();
D3D11_RESOURCE_DIMENSION resourceDim = D3D11_RESOURCE_DIMENSION_UNKNOWN;
pResource->GetType(&resourceDim);
if (resourceDim != D3D11_RESOURCE_DIMENSION_BUFFER)
if (unlikely(resourceDim != D3D11_RESOURCE_DIMENSION_BUFFER)) {
D3D10DeviceLock lock = LockContext();
UnmapImage(GetCommonTexture(pResource), Subresource);
}
}