mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 15:58:05 +02:00
d3d12: reclaim in-flight BO memory on allocation failure
Assisted-by: Claude Opus 4.7 Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41322>
This commit is contained in:
parent
a1c7f7479d
commit
b8f2b968de
2 changed files with 11 additions and 6 deletions
|
|
@ -143,12 +143,15 @@ d3d12_bo_new(struct d3d12_screen *screen, uint64_t size, const pb_desc *pb_desc)
|
|||
d3d12_evicted : d3d12_resident;
|
||||
|
||||
D3D12_HEAP_PROPERTIES heap_pris = GetCustomHeapProperties(dev, heap_type);
|
||||
HRESULT hres = dev->CreateCommittedResource(&heap_pris,
|
||||
heap_flags,
|
||||
&res_desc,
|
||||
D3D12_RESOURCE_STATE_COMMON,
|
||||
NULL,
|
||||
IID_PPV_ARGS(&res));
|
||||
HRESULT hres;
|
||||
do {
|
||||
hres = dev->CreateCommittedResource(&heap_pris,
|
||||
heap_flags,
|
||||
&res_desc,
|
||||
D3D12_RESOURCE_STATE_COMMON,
|
||||
NULL,
|
||||
IID_PPV_ARGS(&res));
|
||||
} while (hres == E_OUTOFMEMORY && d3d12_screen_reclaim_one(screen));
|
||||
|
||||
if (FAILED(hres))
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -313,6 +313,7 @@ init_texture(struct d3d12_screen *screen,
|
|||
|
||||
HRESULT hres = E_FAIL;
|
||||
enum d3d12_residency_status init_residency;
|
||||
do {
|
||||
#ifndef _GAMING_XBOX
|
||||
|
||||
if (heap && screen->max_feature_level == D3D_FEATURE_LEVEL_1_0_GENERIC) {
|
||||
|
|
@ -400,6 +401,7 @@ init_texture(struct d3d12_screen *screen,
|
|||
IID_PPV_ARGS(&d3d12_res));
|
||||
}
|
||||
}
|
||||
} while (hres == E_OUTOFMEMORY && d3d12_screen_reclaim_one(screen));
|
||||
|
||||
if (FAILED(hres))
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue