d9vk: Borderlands 2 problems

Despite other glitches the main one is the constantly degrading GPU usage (so FPS).

From ~100FPS to ~5FPS in several minutes.

The perf utility says:

std::_Hashtable<dxvk::D3D9SamplerKey, std::pair<dxvk::D3D9SamplerKey const, dxvk::Rcdxvk::DxvkSampler >, std::allocator<std::pair<dxvk::D3D9SamplerKey const, dxvk::Rcdxvk::DxvkSampler > >, std::__detail::_Select1st, dxvk::D3D9SamplerKeyEq, dxvk::D3D9SamplerKeyHash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_M_find_before_node (15,388 samples, 40.58%)

Test:

--- a/src/d3d9/d3d9_device.cpp
+++ b/src/d3d9/d3d9_device.cpp
@@ -3829,9 +3829,9 @@
     key.MaxMipLevel   = state[D3DSAMP_MAXMIPLEVEL];
     key.BorderColor   = D3DCOLOR(state[D3DSAMP_BORDERCOLOR]);
 
-    auto pair = m_samplers.find(key);
-    if (pair != m_samplers.end())
-      return pair->second;
+    //auto pair = m_samplers.find(key);
+    //if (pair != m_samplers.end())
+    //  return pair->second;
 
     auto mipFilter = DecodeMipFilter(key.MipFilter);
 
@@ -3855,7 +3855,7 @@
 
     Rc<DxvkSampler> sampler = m_dxvkDevice->createSampler(info);
 
-    m_samplers.insert(std::make_pair(key, sampler));
+    //m_samplers.insert(std::make_pair(key, sampler));
     return sampler;
   }
 

GPU usage seems OK with this patch, the problem indeed somewhere in the “sampler”.


Other problems (FYI):

  • high and constantly growing VRAM usage
  • rotated Ammo/Weapon/Damage hints
  • red texture borders (black is red)

d9vk-borderlands-2

EDIT: “black is red”

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 3
  • Comments: 28 (26 by maintainers)

Most upvoted comments

https://github.com/Joshua-Ashton/d9vk/blob/0595a6adc3df4dce18bc99b7b83217572bf453c1/src/d3d9/d3d9_device.cpp#L3837

Looks like this produces different values every time. Changing value to key.MipmapLodBias = 0; “fixes” problem.

P.S. I was able to create apitrace, but it’s too huge (I was very accurate in data collecting 😃 ). I should learn how to crop it, to preserve only valuable data. Maybe separate frame states, or so.

Ok, I’ll try to do my best.