TextureBindingPlan

Struct TextureBindingPlan 

Source
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

Source

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.

Source

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

Source

pub fn slots(&self) -> &[TextureSlot]

Iterate slots in binding order. Index → slot.

Source

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.

Source

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

Source§

fn clone(&self) -> TextureBindingPlan

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TextureBindingPlan

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TextureBindingPlan

Source§

fn default() -> TextureBindingPlan

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.