Enum surfman::SurfaceAccess[][src]

pub enum SurfaceAccess {
    GPUOnly,
    GPUCPU,
    GPUCPUWriteCombined,
}
Expand description

Specifies how and if the CPU has direct access to the surface data.

No matter what value you choose here, the CPU can always indirectly upload data to the surface by, for example, drawing a full-screen quad. This enumeration simply describes whether the CPU has direct memory access to the surface, via a slice of pixel data.

You can achieve better performance by limiting surfaces to GPUOnly unless you need to access the data on the CPU. For surfaces marked as GPU-only, the GPU can use texture swizzling to improve memory locality.

Variants

GPUOnly

The surface data is accessible by the GPU only.

The lock_surface_data() method will return the SurfaceDataInaccessible error when called on this surface.

This is typically the flag you will want to use.

GPUCPU

The surface data is accessible by the GPU and CPU.

GPUCPUWriteCombined

The surface data is accessible by the GPU and CPU, and the CPU will send surface data over the bus to the GPU using write-combining if available.

Specifically, what this means is that data transfer will be optimized for the following patterns:

  1. Writing, not reading.

  2. Writing sequentially, filling every byte in a range.

This flag has no effect on correctness (at least on x86), but not following the rules above may result in severe performance consequences.

The driver is free to treat this as identical to GPUCPU.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.