pub enum Platform {
Metal,
Hlsl,
Glsl,
}Expand description
Shader source language families supported by the engine. Each variant matches one render backend: Metal, HLSL (DirectX), or GLSL (Vulkan).
A given build only ever constructs the variant for its own backend (see
current), so the other two read as never-constructed; key still matches
all three, so the type stays whole.
Variants§
Metal
Metal Shading Language, for the Metal backend.
Hlsl
HLSL, for the DirectX backend.
Glsl
GLSL, for the Vulkan backend.
Implementations§
Source§impl Platform
impl Platform
Sourcepub fn current() -> Self
pub fn current() -> Self
The shader platform the current binary’s rendering backend was built for. Resolved from the backend cfg (see build.rs), not the target OS, so a Windows Vulkan build correctly selects GLSL rather than HLSL.
Sourcepub fn accepts_ext(self, ext: &str) -> bool
pub fn accepts_ext(self, ext: &str) -> bool
Whether a shader source with the given file extension is usable on this
platform. The matching extension (metal / hlsl / glsl) is accepted;
a non-matching shader extension is rejected so a single-path source
authored for one backend doesn’t get fed to another; an unknown
extension is accepted by default (the build step surfaces a real compile
error later if the file truly can’t be built).
Shared by the per-platform source selection of Shader stages and
SdfVolume so both apply identical fallback rules.
Trait Implementations§
impl Copy for Platform
impl Eq for Platform
impl StructuralPartialEq for Platform
Auto Trait Implementations§
impl Freeze for Platform
impl RefUnwindSafe for Platform
impl Send for Platform
impl Sync for Platform
impl Unpin for Platform
impl UnsafeUnpin for Platform
impl UnwindSafe for Platform
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.