Source code for simvx.graphics.gpu.context

"""GPU context — bundles core Vulkan handles used throughout the renderer."""

from __future__ import annotations

from typing import Any

from .commands import CommandContext

__all__ = ["GPUContext"]


[docs] class GPUContext: """Immutable bag of GPU handles shared across all renderer passes. Created once during Vulkan init and stored on Engine as ``engine.ctx``. Renderer passes should accept or store this rather than reaching into engine internals. """ __slots__ = ( "device", "physical_device", "graphics_queue", "present_queue", "graphics_qf", "cmd_ctx", ) def __init__( self, device: Any, physical_device: Any, graphics_queue: Any, present_queue: Any, graphics_qf: int, cmd_ctx: CommandContext, ) -> None: self.device = device self.physical_device = physical_device self.graphics_queue = graphics_queue self.present_queue = present_queue self.graphics_qf = graphics_qf self.cmd_ctx = cmd_ctx @property def command_pool(self) -> Any: """Shorthand for ``cmd_ctx.pool``.""" return self.cmd_ctx.pool