Struct Surface

Source
pub struct Surface {
    pub ty: SurfaceType,
    pub init: SurfaceInit,
    pub format: Option<String>,
    pub format_hint: Option<Box<FormatHint>>,
    pub size: Option<Box<[u32; 3]>>,
    pub viewport_ratio: Option<Box<[f32; 2]>>,
    pub mip_levels: u32,
    pub mipmap_generate: bool,
    pub extra: Vec<Extra>,
}
Expand description

Declares a resource that can be used both as the source for texture samples and as the target of a rendering pass.

Fields§

§ty: SurfaceType

The type of this surface.

§init: SurfaceInit

An initialization option for this surface.

§format: Option<String>

Contains a string representing the texel format for this surface. If this element is not specified or understood by the application, then the application will attempt to use format_hint if it is provided; otherwise, it should use a common format linear R8G8B8A8.

§format_hint: Option<Box<FormatHint>>

An application uses format_hint if format does not exist or is not understood by the application and format_hint exists. This element describes the important features intended by the author so that the application can pick a format that best represents what the author wanted.

§size: Option<Box<[u32; 3]>>

Contains three integer values. If specified, the surface is sized to these exact dimensions in texels. Surfaces of type 1D and CUBE use only the first value. Surfaces of type 2D and RECT use only the first two values, representing width and then height. Type 3D uses all three values, representing width, height, and depth. Invalid if viewport_ratio is used.

§viewport_ratio: Option<Box<[f32; 2]>>

Contains two floating-point values representing width and then height. If specified, the surface is sized to a dimension based on these ratios of the viewport’s (backbuffer’s) dimensions. For example, viewport_ratio = Some([0.5, 2]) scales the surface’s width to half the viewport’s width and its height to twice the viewport’s height. This element is valid only for surfaces of type 2D or RECT. Invalid if size is used.

§mip_levels: u32

Contains the number of MIP levels in the surface. A value of 0 assumes that all MIP levels exist until a dimension becomes 1 texel. To create a surface that has only one level of MIP maps (mip = 0), set this to 1.

§mipmap_generate: bool

If false and not all subsurfaces are initialized because you have not provided MIP-map levels, the generated surface will have profile- and

platform-specific behavior. If true, the application is responsible for initializing the remainder of the subsurfaces; this is typically done through a graphics API render state or function that does this automatically, such as glGenerateMipmap().

§extra: Vec<Extra>

Provides arbitrary additional information about this element.

Implementations§

Source§

impl Surface

Source

pub fn new(ty: SurfaceType, init: SurfaceInit) -> Self

Construct a new Surface from mandatory parameters.

Trait Implementations§

Source§

impl Clone for Surface

Source§

fn clone(&self) -> Surface

Returns a copy 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 Surface

Source§

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

Formats the value using the given formatter. 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.