Usage

Struct Usage 

Source
pub struct Usage(/* private fields */);
Expand description

[docs.microsoft.com] DWORD / D3DUSAGE_*

Usage options that identify how resources are to be used.

Implementations§

Source§

impl Usage

Source

pub const fn from_unchecked(d3d: u32) -> Self

Convert from an underlying winapi D3D... type. This is probably safe… probably…

Source

pub const fn into(self) -> u32

Convert back into an underlying winapi D3D... type.

Source§

impl Usage

Source

pub const None: Usage

Source

pub const AutoGenMipMap: Usage

The resource will automatically generate mipmaps. See Automatic Generation of Mipmaps (Direct3D 9). Automatic generation of mipmaps is not supported for volume textures and depth stencil surfaces/textures. This usage is not valid for a resource in system memory ([Pool::SystemMem]).

Source

pub const DepthStencil: Usage

The resource will be a depth stencil buffer. Usage::DepthStencil can only be used with [Pool::Default].

Source

pub const DMap: Usage

The resource will be a displacement map.

Source

pub const DoNotClip: Usage

Set to indicate that the vertex buffer content will never require clipping. When rendering with buffers that have this flag set, the D3DRS_CLIPPING render state must be set to false.

Source

pub const Dynamic: Usage

Set to indicate that the vertex buffer requires dynamic memory use. This is useful for drivers because it enables them to decide where to place the buffer. In general, static vertex buffers are placed in video memory and dynamic vertex buffers are placed in AGP memory. Note that there is no separate static use. If you do not specify Usage::Dynamic, the vertex buffer is made static. Usage::Dynamic is strictly enforced through the [Lock::Discard] and [Lock::NoOverwrite] locking flags. As a result, [Lock::Discard] and [Lock::NoOverwrite] are valid only on vertex buffers created with Usage::Dynamic. They are not valid flags on static vertex buffers. For more information, see Managing Resources (Direct3D 9).

For more information about using dynamic vertex buffers, see Performance Optimizations (Direct3D 9).

Usage::Dynamic and [Pool::Managed] are incompatible and should not be used together. See [Pool].

Textures can specify Usage::Dynamic. However, managed textures cannot use Usage::Dynamic. For more information about dynamic textures, see Using Dynamic Textures.

Source

pub const NonSecure: Usage

Allow a shared surface created by a secure application to be opened by a non-secure application that has the shared handle. Differences between Direct3D 9 and Direct3D 9Ex: This flag is available in Direct3D 9Ex only.

Source

pub const NPatches: Usage

Set to indicate that the vertex buffer is to be used for drawing N-patches.

Source

pub const Points: Usage

Set to indicate that the vertex or index buffer will be used for drawing point sprites. The buffer will be loaded in system memory if software vertex processing is needed to emulate point sprites.

Source

pub const RenderTarget: Usage

The resource will be a render target. Usage::RenderTarget can only be used with [Pool::Default].

Source

pub const RTPatches: Usage

Set to indicate that the vertex buffer is to be used for drawing high-order primitives.

Source

pub const SoftwareProcessing: Usage

If this flag is used, vertex processing is done in software. If this flag is not used, vertex processing is done in hardware.

The Usage::SoftwareProcessing flag can be set when mixed-mode or software vertex processing (D3DCREATE_MIXED_VERTEXPROCESSING / D3DCREATE_SOFTWARE_VERTEXPROCESSING) is enabled for that device. Usage::SoftwareProcessing must be set for buffers to be used with software vertex processing in mixed mode, but it should not be set for the best possible performance when using hardware index processing in mixed mode (D3DCREATE_HARDWARE_VERTEXPROCESSING). However, setting Usage::SoftwareProcessing is the only option when a single buffer is used with both hardware and software vertex processing. Usage::SoftwareProcessing is allowed for mixed and software devices.

Usage::SoftwareProcessing is used with CheckDeviceFormat to find out if a particular texture format can be used as a vertex texture during software vertex processing. If it can, the texture must be created in [Pool::Scratch].

Source

pub const TextAPI: Usage

This usage flag must be specified for vertex buffers and source surfaces, used in calls to [IDirect3DDevice9ExExt::compose_rects]. Textures created with this usage flag cannot be used for texture filtering. Vertex buffers, created with this usage flag, cannot be used as input stream sources.

Differences between Direct3D 9 and Direct3D 9Ex: This flag is available in Direct3D 9Ex only.

Source

pub const WriteOnly: Usage

Informs the system that the application writes only to the vertex buffer. Using this flag enables the driver to choose the best memory location for efficient write operations and rendering. Attempts to read from a vertex buffer that is created with this capability will fail. Buffers created with [Pool::Default] that do not specify Usage::WriteOnly may suffer a severe performance penalty. Usage::WriteOnly only affects the performance of [Pool::Default] buffers.

Source

pub const RestrictedContent: Usage

Setting this flag indicates that the resource might contain protected content.

Differences between Direct3D 9 and Direct3D 9Ex: This flag is available in Direct3D 9Ex only.

Source

pub const RestrictSharedResource: Usage

Setting this flag indicates that access to the shared resource should be restricted.

Differences between Direct3D 9 and Direct3D 9Ex: This flag is available in Direct3D 9Ex only.

Source

pub const RestrictSharedResourceDriver: Usage

Setting this flag indicates that the driver should restrict access to the shared resource. The caller must create an authenticated channel with the driver. The driver should then allow access to processes that attempt to open that shared resource.

Differences between Direct3D 9 and Direct3D 9Ex: This flag is available in Direct3D 9Ex only.

Trait Implementations§

Source§

impl BitOr for Usage

Source§

type Output = Usage

The resulting type after applying the | operator.
Source§

fn bitor(self, other: Self) -> Self

Performs the | operation. Read more
Source§

impl BitOrAssign for Usage

Source§

fn bitor_assign(&mut self, other: Self)

Performs the |= operation. Read more
Source§

impl Clone for Usage

Source§

fn clone(&self) -> Usage

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 Usage

Source§

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

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

impl Default for Usage

Source§

fn default() -> Self

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

impl From<Usage> for u32

Source§

fn from(value: Usage) -> Self

Converts to this type from the input type.
Source§

impl Hash for Usage

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Usage

Source§

fn cmp(&self, other: &Usage) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Usage

Source§

fn eq(&self, other: &Usage) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Usage

Source§

fn partial_cmp(&self, other: &Usage) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for Usage

Source§

impl Eq for Usage

Source§

impl StructuralPartialEq for Usage

Auto Trait Implementations§

§

impl Freeze for Usage

§

impl RefUnwindSafe for Usage

§

impl Send for Usage

§

impl Sync for Usage

§

impl Unpin for Usage

§

impl UnwindSafe for Usage

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.