simvx.graphics.gpu.memory

Buffer and image allocation helpers.

Module Contents

Functions

create_buffer

Create a VkBuffer with bound memory. Returns (buffer, memory).

create_image

Create a VkImage with bound memory. Returns (image, memory).

create_sampler

Create a VkSampler with configurable filtering.

transition_image_layout

Transition image layout via one-time command buffer.

upload_numpy

Map device memory and copy a numpy array into it.

begin_single_time_commands

Allocate and begin a one-time command buffer.

end_single_time_commands

End, submit, wait, and free a one-time command buffer.

upload_image_data

Upload pixel data to a device-local image via staging buffer.

create_indirect_buffer

Create a host-visible buffer for VkDrawIndexedIndirectCommand array.

Data

API

simvx.graphics.gpu.memory.__all__

[‘create_buffer’, ‘create_image’, ‘create_sampler’, ‘transition_image_layout’, ‘upload_numpy’, ‘uplo…

simvx.graphics.gpu.memory.log

‘getLogger(…)’

simvx.graphics.gpu.memory.create_buffer(device: Any, physical_device: Any, size: int, usage: int, memory_flags: int) tuple[Any, Any]

Create a VkBuffer with bound memory. Returns (buffer, memory).

simvx.graphics.gpu.memory.create_image(device: Any, physical_device: Any, width: int, height: int, fmt: int, usage: int) tuple[Any, Any]

Create a VkImage with bound memory. Returns (image, memory).

simvx.graphics.gpu.memory.create_sampler(device: Any, filter_mode: int = vk.VK_FILTER_LINEAR) Any

Create a VkSampler with configurable filtering.

simvx.graphics.gpu.memory.transition_image_layout(device: Any, queue: Any, cmd_pool: Any, image: Any, old_layout: int, new_layout: int, aspect_mask: int = vk.VK_IMAGE_ASPECT_COLOR_BIT) None

Transition image layout via one-time command buffer.

simvx.graphics.gpu.memory.upload_numpy(device: Any, memory: Any, data: numpy.ndarray) None

Map device memory and copy a numpy array into it.

simvx.graphics.gpu.memory.begin_single_time_commands(device: Any, cmd_pool: Any) Any

Allocate and begin a one-time command buffer.

simvx.graphics.gpu.memory.end_single_time_commands(device: Any, queue: Any, cmd_pool: Any, cmd: Any) None

End, submit, wait, and free a one-time command buffer.

simvx.graphics.gpu.memory.upload_image_data(device: Any, physical_device: Any, queue: Any, cmd_pool: Any, pixels: numpy.ndarray, width: int, height: int, fmt: int = vk.VK_FORMAT_R8G8B8A8_UNORM) tuple[Any, Any]

Upload pixel data to a device-local image via staging buffer.

Args: pixels: Contiguous RGBA uint8 array, shape (height, width, 4).

Returns: (image, memory)

simvx.graphics.gpu.memory.create_indirect_buffer(device: Any, physical_device: Any, draw_count: int) tuple[Any, Any]

Create a host-visible buffer for VkDrawIndexedIndirectCommand array.