simvx.graphics.gpu.descriptors¶
Descriptor pool, layout, and set management.
Module Contents¶
Classes¶
Collects VkWriteDescriptorSet structs and flushes them in a single Vulkan call. |
Functions¶
Create a descriptor pool from a |
|
Create a descriptor set layout from a list of |
|
Create a descriptor pool for SSBO descriptors (+ optional image samplers). |
|
Create a descriptor set layout with N SSBO bindings + optional sampler bindings. |
|
Allocate a single descriptor set from the pool. |
|
Create a descriptor pool for combined image samplers. |
|
Create set layout for texture array (fixed-size combined image samplers). |
|
Write a single texture to the texture array at the given index. |
|
Write a combined image sampler to a descriptor set at the given binding. |
|
Write a single SSBO buffer binding to a descriptor set. |
Data¶
API¶
- simvx.graphics.gpu.descriptors.log¶
‘getLogger(…)’
- simvx.graphics.gpu.descriptors.__all__¶
[‘DescriptorWriteBatch’, ‘allocate_descriptor_set’, ‘create_descriptor_pool’, ‘create_descriptor_set…
- simvx.graphics.gpu.descriptors.create_pool_for_types(device: Any, sizes: dict[int, int], max_sets: int = 1) Any[source]¶
Create a descriptor pool from a
{descriptor_type: count}mapping.General-purpose alternative to :func:
create_descriptor_pool(which is specialised for SSBO + sampler workloads). Use this for compute passes that mix STORAGE_IMAGE, COMBINED_IMAGE_SAMPLER, UNIFORM_BUFFER, etc.
- simvx.graphics.gpu.descriptors.create_descriptor_set_layout(device: Any, bindings: list[tuple[int, int, int, int]]) Any[source]¶
Create a descriptor set layout from a list of
(binding, type, stage_flags, count)tuples.
- 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 * 4SSBO 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_countSSBOs, thenextra_samplersimage samplers, thentrailing_ssbosadditional 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, image_layout: int = vk.VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL) simvx.graphics.gpu.descriptors.DescriptorWriteBatch[source]¶
Queue a combined image sampler descriptor write (default layout: SHADER_READ_ONLY_OPTIMAL).
- storage_image(descriptor_set: Any, binding: int, image_view: Any, image_layout: int = vk.VK_IMAGE_LAYOUT_GENERAL) simvx.graphics.gpu.descriptors.DescriptorWriteBatch[source]¶
Queue a storage image descriptor write (compute writeable target).
- uniform_buffer(descriptor_set: Any, binding: int, buffer: Any, size: int) simvx.graphics.gpu.descriptors.DescriptorWriteBatch[source]¶
Queue a uniform buffer 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.