pub struct TextureBindingPlan {
slots: Vec<TextureSlot>,
aliases: Vec<(String, usize, &'static str)>,
}Expand description
Per-preset mapping from HLSL sampler names to the comp pass’s user-texture slots.
aliases carries the surface-level names the translator should
treat as referencing each slot. A single slot may carry multiple
aliases — sampler sampler_clouds; and sampler sampler_fw_clouds;
both resolve to the same logical clouds texture but pick different
filter samplers when sampled. The alias map maps a full sampler name
(e.g. "sampler_fw_clouds") to (slot_index, sampler_kind).
Fields§
§slots: Vec<TextureSlot>§aliases: Vec<(String, usize, &'static str)>Implementations§
Source§impl TextureBindingPlan
impl TextureBindingPlan
Sourcepub fn empty() -> Self
pub fn empty() -> Self
Empty plan — translate_shader_with_plan behaves identically to
translate_shader. Used by callers that don’t load disk
textures (CLI batch translate, tests) and as the default for
translate_shader itself.
Sourcepub fn slot_count(&self) -> usize
pub fn slot_count(&self) -> usize
Number of filled slots. Equal to the comp pipeline’s
user-texture bind count for this preset (the renderer fills the
remaining slots up to MAX_USER_TEXTURE_SLOTS with the fallback
texture).
Sourcepub fn slots(&self) -> &[TextureSlot]
pub fn slots(&self) -> &[TextureSlot]
Iterate slots in binding order. Index → slot.
Sourcepub fn add_slot(
&mut self,
pool_name: Option<String>,
texsize: [f32; 4],
aliases: &[(String, &'static str)],
) -> Option<usize>
pub fn add_slot( &mut self, pool_name: Option<String>, texsize: [f32; 4], aliases: &[(String, &'static str)], ) -> Option<usize>
Register one logical texture (pool_name = Some("clouds") or
None for fallback) along with the set of HLSL surface aliases
that reference it. Returns the slot index, or None when the
cap was already hit. Subsequent calls with new aliases for an
existing pool_name re-use the same slot.
Sourcepub fn lookup_tex2d(&self, sampler_name: &str) -> Option<(usize, &'static str)>
pub fn lookup_tex2d(&self, sampler_name: &str) -> Option<(usize, &'static str)>
Map an HLSL tex2D sampler name to a (slot_index, sampler_kind).
Returns None for built-in samplers (those are handled by
resolve_tex2d_sampler before the plan is consulted) and for
names the plan never registered an alias for.
Trait Implementations§
Source§impl Clone for TextureBindingPlan
impl Clone for TextureBindingPlan
Source§fn clone(&self) -> TextureBindingPlan
fn clone(&self) -> TextureBindingPlan
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more