simvx.graphics.gpu.descriptors

Descriptor pool, layout, and set management.

Module Contents

Classes

DescriptorWriteBatch

Collects VkWriteDescriptorSet structs and flushes them in a single Vulkan call.

Functions

create_descriptor_pool

Create a descriptor pool for SSBO descriptors (+ optional image samplers).

create_ssbo_layout

Create a descriptor set layout with N SSBO bindings + optional sampler bindings.

allocate_descriptor_set

Allocate a single descriptor set from the pool.

create_texture_descriptor_pool

Create a descriptor pool for combined image samplers.

create_texture_descriptor_layout

Create set layout for texture array (fixed-size combined image samplers).

write_texture_descriptor

Write a single texture to the texture array at the given index.

write_image_descriptor

Write a combined image sampler to a descriptor set at the given binding.

write_ssbo_descriptor

Write a single SSBO buffer binding to a descriptor set.

Data

API

simvx.graphics.gpu.descriptors.log[source]

‘getLogger(…)’

simvx.graphics.gpu.descriptors.__all__

[‘DescriptorWriteBatch’, ‘create_descriptor_pool’, ‘create_ssbo_layout’, ‘allocate_descriptor_set’, …

simvx.graphics.gpu.descriptors.create_descriptor_pool(device: Any, max_sets: int = 4, extra_samplers: int = 0, ssbo_count: int = 0) Any[source]

Create a descriptor pool for SSBO descriptors (+ optional image samplers).

If ssbo_count is given it overrides the default max_sets * 4 SSBO descriptor count.

simvx.graphics.gpu.descriptors.create_ssbo_layout(device: Any, binding_count: int = 3, extra_samplers: int = 0, trailing_ssbos: int = 0) Any[source]

Create a descriptor set layout with N SSBO bindings + optional sampler bindings.

Binding order: binding_count SSBOs, then extra_samplers image samplers, then trailing_ssbos additional SSBOs (fragment-only, for tile light data etc.).

simvx.graphics.gpu.descriptors.allocate_descriptor_set(device: Any, pool: Any, layout: Any) Any[source]

Allocate a single descriptor set from the pool.

simvx.graphics.gpu.descriptors.create_texture_descriptor_pool(device: Any, max_textures: int = MAX_TEXTURES) Any[source]

Create a descriptor pool for combined image samplers.

simvx.graphics.gpu.descriptors.create_texture_descriptor_layout(device: Any, max_textures: int = MAX_TEXTURES) Any[source]

Create set layout for texture array (fixed-size combined image samplers).

simvx.graphics.gpu.descriptors.write_texture_descriptor(device: Any, descriptor_set: Any, texture_index: int, image_view: Any, sampler: Any) None[source]

Write a single texture to the texture array at the given index.

simvx.graphics.gpu.descriptors.write_image_descriptor(device: Any, descriptor_set: Any, binding: int, image_view: Any, sampler: Any) None[source]

Write a combined image sampler to a descriptor set at the given binding.

simvx.graphics.gpu.descriptors.write_ssbo_descriptor(device: Any, descriptor_set: Any, binding: int, buffer: Any, size: int) None[source]

Write a single SSBO buffer binding to a descriptor set.

class simvx.graphics.gpu.descriptors.DescriptorWriteBatch(device: Any)[source]

Collects VkWriteDescriptorSet structs and flushes them in a single Vulkan call.

Usage::

batch = DescriptorWriteBatch(device)
batch.ssbo(ds, 0, buf_a, size_a)
batch.ssbo(ds, 1, buf_b, size_b)
batch.image(ds, 2, view, sampler)
batch.flush()

Can also be used as a context manager – flush() is called on exit::

with DescriptorWriteBatch(device) as batch:
    batch.ssbo(ds, 0, buf, size)

Initialization

__slots__

(‘_device’, ‘_writes’)

ssbo(descriptor_set: Any, binding: int, buffer: Any, size: int) simvx.graphics.gpu.descriptors.DescriptorWriteBatch[source]

Queue an SSBO descriptor write.

image(descriptor_set: Any, binding: int, image_view: Any, sampler: Any) simvx.graphics.gpu.descriptors.DescriptorWriteBatch[source]

Queue a combined image sampler descriptor write.

texture(descriptor_set: Any, texture_index: int, image_view: Any, sampler: Any) simvx.graphics.gpu.descriptors.DescriptorWriteBatch[source]

Queue a texture array element descriptor write.

raw(write: vulkan.VkWriteDescriptorSet) simvx.graphics.gpu.descriptors.DescriptorWriteBatch[source]

Queue a pre-built VkWriteDescriptorSet.

flush() int[source]

Submit all queued writes in a single vkUpdateDescriptorSets call.

Returns the number of writes submitted. The internal queue is cleared.

__enter__() simvx.graphics.gpu.descriptors.DescriptorWriteBatch[source]
__exit__(*exc: object) None[source]
__len__() int[source]