mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 16:20:11 -04:00
direct: Fix TexMemWatcher crash when graphics memory reaches 1 GB
Closes #975 Co-authored-by: rdb <git@rdb.name>
This commit is contained in:
parent
5d6ff0ecc8
commit
5fdbc97499
@ -327,7 +327,10 @@ class TexMemWatcher(DirectObject):
|
|||||||
|
|
||||||
if self.dynamicLimit:
|
if self.dynamicLimit:
|
||||||
# Choose a suitable limit by rounding to the next power of two.
|
# Choose a suitable limit by rounding to the next power of two.
|
||||||
self.limit = Texture.upToPower2(self.totalSize)
|
limit = 1
|
||||||
|
while limit < self.totalSize:
|
||||||
|
limit *= 2
|
||||||
|
self.limit = limit
|
||||||
|
|
||||||
# Set our GSG to limit itself to no more textures than we
|
# Set our GSG to limit itself to no more textures than we
|
||||||
# expect to display onscreen, so we don't go crazy with
|
# expect to display onscreen, so we don't go crazy with
|
||||||
@ -883,7 +886,7 @@ class TexMemWatcher(DirectObject):
|
|||||||
matches.append((match, tp))
|
matches.append((match, tp))
|
||||||
|
|
||||||
if matches:
|
if matches:
|
||||||
return max(matches)[1]
|
return max(matches, key=lambda match: match[0])[1]
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def findHolePieces(self, area):
|
def findHolePieces(self, area):
|
||||||
@ -937,7 +940,7 @@ class TexMemWatcher(DirectObject):
|
|||||||
def findLargestHole(self):
|
def findLargestHole(self):
|
||||||
holes = self.findAvailableHoles(0)
|
holes = self.findAvailableHoles(0)
|
||||||
if holes:
|
if holes:
|
||||||
return max(holes)[1]
|
return max(holes, key=lambda hole: hole[0])[1]
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def findAvailableHoles(self, area, w = None, h = None):
|
def findAvailableHoles(self, area, w = None, h = None):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user