diff --git a/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx b/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx index 89c30d5a7a..ca364dc5a1 100755 --- a/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx +++ b/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx @@ -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; } diff --git a/panda/src/dxgsg9/dxTextureContext9.cxx b/panda/src/dxgsg9/dxTextureContext9.cxx index d454002cd0..c122f18cca 100755 --- a/panda/src/dxgsg9/dxTextureContext9.cxx +++ b/panda/src/dxgsg9/dxTextureContext9.cxx @@ -22,7 +22,7 @@ #include #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);