simvx.graphics.gpu.memory¶
Buffer and image allocation helpers.
Module Contents¶
Functions¶
Create a VkBuffer with bound memory. Returns (buffer, memory). |
|
Create a VkImage with bound memory. Returns (image, memory). |
|
Create a VkSampler with configurable filtering. |
|
Transition image layout via one-time command buffer. |
|
Map device memory and copy a numpy array into it. |
|
Allocate and begin a one-time command buffer. |
|
End, submit, wait, and free a one-time command buffer. |
|
Upload pixel data to a device-local image via staging buffer. |
|
Re-upload pixel data to an existing VkImage (same dimensions). |
|
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.create_buffer(device: Any, physical_device: Any, size: int, usage: int, memory_flags: int) tuple[Any, Any][source]¶
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][source]¶
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[source]¶
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[source]¶
Transition image layout via one-time command buffer.
- simvx.graphics.gpu.memory.upload_numpy(device: Any, memory: Any, data: numpy.ndarray) None[source]¶
Map device memory and copy a numpy array into it.
- simvx.graphics.gpu.memory.begin_single_time_commands(device: Any, cmd_pool: Any) Any[source]¶
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[source]¶
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][source]¶
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.update_image_data(device: Any, physical_device: Any, queue: Any, cmd_pool: Any, image: Any, pixels: numpy.ndarray, width: int, height: int) None[source]¶
Re-upload pixel data to an existing VkImage (same dimensions).
Transitions the image from SHADER_READ_ONLY → TRANSFER_DST, copies the new pixel data via a staging buffer, then transitions back to SHADER_READ_ONLY.