MaterialDescriptorContext
- Namespace: Turian.Engine.Core
- Source File: MaterialDescriptorContext.cs
Holds the per-material descriptor set layout, allocation pool, and 1×1 fallback textures used by every MaterialResource. Constructed and owned by the render system; passed to GetContent when a draw requests a material.
Fields
UboBinding (uint) = 0: set=1, binding=0: per-material UBO (factors).
BaseColorBinding (uint) = 1: set=1, binding=1: combined image sampler — base color (sRGB).
MetallicRoughnessBinding (uint) = 2: set=1, binding=2: combined image sampler — metallic-roughness (linear; B=metallic, G=roughness).
NormalBinding (uint) = 3: set=1, binding=3: combined image sampler — tangent-space normal map (linear).
OcclusionBinding (uint) = 4: set=1, binding=4: combined image sampler — ambient occlusion (linear, R channel).
EmissiveBinding (uint) = 5: set=1, binding=5: combined image sampler — emissive (sRGB).
Properties
Vulkan
(Vulkan) : The Vulkan context used by all material resources built through this context.
SetLayout
(DescriptorSetLayout) : The descriptor set layout shared by every PBR material.
Defaults
(DefaultTextures) : Fallback 1×1 textures bound to material slots that have no glTF reference.
DefaultMaterial
(MaterialResource): Material resource the renderer binds for submeshes with no MaterialIndex: white base color, rough, non-metallic, no emissive. Geometry without an authored material draws through the PBR pipeline with it.
Public Methods
AllocateSet
public bool AllocateSet(DescriptorSetWriter writer, DescriptorSet set)
Allocates and writes a per-material descriptor set, adding a pool when the current one is full. A fixed cap would fail on any scene with more materials than it allowed — Bistro alone has 277.
Parameters:
writer(DescriptorSetWriter): The writer holding the material's buffer and image bindings.set(DescriptorSet): Receives the allocated set.
Returns: bool
truewhen the set was allocated and written.
Dispose
public void Dispose()