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:
parent
f76fd8fa5d
commit
e6eef1d1ec
@ -174,7 +174,7 @@ namespace dxvk {
|
|||||||
D3D11_MAPPED_SUBRESOURCE* pMappedResource) {
|
D3D11_MAPPED_SUBRESOURCE* pMappedResource) {
|
||||||
D3D10DeviceLock lock = LockContext();
|
D3D10DeviceLock lock = LockContext();
|
||||||
|
|
||||||
if (!pResource || !pMappedResource)
|
if (unlikely(!pResource || !pMappedResource))
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
D3D11_RESOURCE_DIMENSION resourceDim = D3D11_RESOURCE_DIMENSION_UNKNOWN;
|
D3D11_RESOURCE_DIMENSION resourceDim = D3D11_RESOURCE_DIMENSION_UNKNOWN;
|
||||||
@ -182,7 +182,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
if (resourceDim == D3D11_RESOURCE_DIMENSION_BUFFER) {
|
if (likely(resourceDim == D3D11_RESOURCE_DIMENSION_BUFFER)) {
|
||||||
hr = MapBuffer(
|
hr = MapBuffer(
|
||||||
static_cast<D3D11Buffer*>(pResource),
|
static_cast<D3D11Buffer*>(pResource),
|
||||||
MapType, MapFlags, pMappedResource);
|
MapType, MapFlags, pMappedResource);
|
||||||
@ -206,13 +206,13 @@ namespace dxvk {
|
|||||||
void STDMETHODCALLTYPE D3D11ImmediateContext::Unmap(
|
void STDMETHODCALLTYPE D3D11ImmediateContext::Unmap(
|
||||||
ID3D11Resource* pResource,
|
ID3D11Resource* pResource,
|
||||||
UINT Subresource) {
|
UINT Subresource) {
|
||||||
D3D10DeviceLock lock = LockContext();
|
|
||||||
|
|
||||||
D3D11_RESOURCE_DIMENSION resourceDim = D3D11_RESOURCE_DIMENSION_UNKNOWN;
|
D3D11_RESOURCE_DIMENSION resourceDim = D3D11_RESOURCE_DIMENSION_UNKNOWN;
|
||||||
pResource->GetType(&resourceDim);
|
pResource->GetType(&resourceDim);
|
||||||
|
|
||||||
if (resourceDim != D3D11_RESOURCE_DIMENSION_BUFFER)
|
if (unlikely(resourceDim != D3D11_RESOURCE_DIMENSION_BUFFER)) {
|
||||||
|
D3D10DeviceLock lock = LockContext();
|
||||||
UnmapImage(GetCommonTexture(pResource), Subresource);
|
UnmapImage(GetCommonTexture(pResource), Subresource);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user