Select complete source LOD explicitly and reject renderer allocation failures
This commit is contained in:
@@ -37,3 +37,22 @@ def scene_diagnostics(count, source_bytes):
|
||||
except Exception as exc:
|
||||
value["capacity_unavailable"] = type(exc).__name__
|
||||
return value
|
||||
|
||||
|
||||
class RendererMemoryGuard:
|
||||
"""A reported allocation failure invalidates the scene, even if Kit keeps running."""
|
||||
def __init__(self, log):
|
||||
self.log, self.offset, self.tail = log, 0, b""
|
||||
|
||||
def check(self):
|
||||
with self.log.open("rb") as stream:
|
||||
stream.seek(self.offset)
|
||||
while chunk := stream.read(65536):
|
||||
content = self.tail + chunk
|
||||
if (b"ERROR_OUT_OF_DEVICE_MEMORY" in content or
|
||||
b"Out of GPU memory allocating resource" in content):
|
||||
raise ScenePreparationError(
|
||||
"Недостаточно видеопамяти для полной сцены выбранной детализации. "
|
||||
"Прогон остановлен: корректность изображения не подтверждена.")
|
||||
self.tail = content[-128:]
|
||||
self.offset = stream.tell()
|
||||
|
||||
Reference in New Issue
Block a user