Skip to main content

AnsweredReads

Struct AnsweredReads 

Source
pub struct AnsweredReads<R, A> {
    pub answer: A,
    pub samples: Vec<ImageSample<R>>,
    pub loads: Vec<ImageLoad<R>>,
    pub queries: Vec<ImageQuery<R>>,
}
Expand description

A run’s texture reads, each answered by answer and recorded in the order the program made them (a read the answer refuses is not recorded; the run fails with its reason). As a Sampler (R a bind slot) it is a pixel program’s textures; stores, atomics and structured buffers are refused, as a sampler that gives none refuses them.

Fields§

§answer: A

How the reads are answered.

§samples: Vec<ImageSample<R>>

The samples answered, in order.

§loads: Vec<ImageLoad<R>>

The loads answered, in order.

§queries: Vec<ImageQuery<R>>

The queries answered, in order.

Implementations§

Source§

impl<R, A: Answer<R>> AnsweredReads<R, A>

Source

pub fn new(answer: A) -> Self

Reads answered by answer, with nothing recorded yet.

Source

pub fn sample(&mut self, request: ImageSample<R>) -> Result<[f32; 4], String>

Answer a sample and record it; a refused one is not recorded.

Source

pub fn load(&mut self, request: ImageLoad<R>) -> Result<[u32; 4], String>

Answer a load and record it; a refused one is not recorded.

Source

pub fn query(&mut self, request: ImageQuery<R>) -> Result<[u32; 4], String>

Answer a query and record it; a refused one is not recorded.

Source

pub fn counts(&self) -> TextureUse

How many reads of each kind were answered.

Trait Implementations§

Source§

impl<R: Debug, A: Debug> Debug for AnsweredReads<R, A>

Source§

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

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

impl<A: Answer<u32>> Sampler for AnsweredReads<u32, A>

Source§

fn sample(&mut self, request: Sample) -> Result<[f32; 4], String>

A plain 2D sample, answered as the image sample it is.

Source§

fn sample_image( &mut self, request: ImageSample<u32>, ) -> Result<[f32; 4], String>

A sample of any texture: 1D, 3D or cube, with a texel offset, a gather or a comparison. A plain 2D sample (or a 2D array’s layer) goes to Sampler::sample; anything else is refused unless the sampler answers it.
Source§

fn load_image(&mut self, request: ImageLoad<u32>) -> Result<[u32; 4], String>

A texel load of any texture. A 2D or 3D one (or a 2D array’s layer) goes to Sampler::load.
Source§

fn query_image(&mut self, request: ImageQuery<u32>) -> Result<[u32; 4], String>

A texture’s size, level count, layer count or sample count.
Source§

fn load(&mut self, request: Load) -> Result<[u32; 4], String>

The texel’s four lanes as its view returns them: f32 bits for a float view, the integers for a uint or sint one.
Source§

fn store(&mut self, request: Store) -> Result<(), String>

A store to an unordered-access view (Store): the lanes mask marks of value, at the address the program gives (a structured view’s lanes the consecutive words from the byte offset). Its effect is the caller’s: it reaches none of this evaluation’s outputs.
Source§

fn atomic_add(&mut self, request: AtomicAdd) -> Result<u32, String>

An atomic add (AtomicAdd); its result the word as it was before. The add itself is the caller’s effect.
Source§

fn structured( &mut self, slot: u32, element: u32, offset: u32, ) -> Result<u32, String>

The 32-bit word at byte offset of element element of the structured buffer at t<slot>.
Source§

fn buffer_elements(&mut self, slot: u32) -> Option<u32>

How many elements the buffer view at bind slot slot has, where the sampler knows. A program that reads past the end gets zeros (D3D’s rule) when this is stated; when it is not, no read is taken for out of range.
Source§

fn atomic_image(&mut self, request: ImageAtomic<u32>) -> Result<u32, String>

An atomic operation on a texel of a single-channel 32-bit unordered-access texture; its result is the word as it was before.
Source§

fn store_image(&mut self, request: ImageStore<u32>) -> Result<(), String>

A write to an unordered-access texture; the plain form is Sampler::store.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.