mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
fixed losing textures
This commit is contained in:
parent
c740062d29
commit
131f768d8d
@ -353,6 +353,8 @@ upload_texture(DXTextureContext9 *dtc, bool force) {
|
||||
}
|
||||
|
||||
dtc->delete_texture();
|
||||
dtc->update_data_size_bytes(0);
|
||||
dtc->mark_unloaded();
|
||||
|
||||
if (_incomplete_render && !force) {
|
||||
bool has_image = _supports_compressed_texture ? tex->has_ram_image() : tex->has_uncompressed_ram_image();
|
||||
@ -5136,6 +5138,8 @@ check_dx_allocation (HRESULT result, int allocation_size, int attempts)
|
||||
size_t current_size = _prepared_objects->_graphics_memory_lru.get_total_size();
|
||||
size_t target_size = max(current_size - allocation_size * attempts, 0);
|
||||
_prepared_objects->_graphics_memory_lru.evict_to(target_size);
|
||||
dxgsg9_cat.info()
|
||||
<< "Evicted " << current_size - _prepared_objects->_graphics_memory_lru.get_total_size() << " bytes of texture memory to make room for more.\n";
|
||||
if (_prepared_objects->_graphics_memory_lru.get_total_size() < current_size) {
|
||||
retry = true;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <time.h>
|
||||
|
||||
#define DEBUG_SURFACES false
|
||||
#define DEBUG_TEXTURES false
|
||||
#define DEBUG_TEXTURES true
|
||||
|
||||
TypeHandle DXTextureContext9::_type_handle;
|
||||
|
||||
@ -83,6 +83,10 @@ evict_lru() {
|
||||
mark_used_lru();
|
||||
return;
|
||||
}
|
||||
if (dxgsg9_cat.is_debug()) {
|
||||
dxgsg9_cat.debug()
|
||||
<< "Evicting " << *get_texture() << "\n";
|
||||
}
|
||||
|
||||
dequeue_lru();
|
||||
delete_texture();
|
||||
@ -820,6 +824,13 @@ create_texture(DXScreenData &scrn) {
|
||||
|
||||
int attempts;
|
||||
|
||||
if (dxgsg9_cat.is_debug()) {
|
||||
dxgsg9_cat.debug()
|
||||
<< "Creating " << *tex << ", " << data_size << " bytes, "
|
||||
<< scrn._d3d_device->GetAvailableTextureMem()
|
||||
<< " reported available.\n";
|
||||
}
|
||||
|
||||
attempts = 0;
|
||||
do
|
||||
{
|
||||
@ -850,8 +861,8 @@ create_texture(DXScreenData &scrn) {
|
||||
}
|
||||
|
||||
attempts++;
|
||||
}
|
||||
while (scrn._dxgsg9 -> check_dx_allocation (hr, data_size, attempts));
|
||||
} while (scrn._dxgsg9 -> check_dx_allocation (hr, data_size, attempts));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
dxgsg9_cat.error()
|
||||
<< "D3D create_texture failed!" << D3DERRORSTRING(hr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user