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 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.__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 * 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) 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.