Skip to main content

AnsweredBuffers

Struct AnsweredBuffers 

Source
pub struct AnsweredBuffers<S, F> {
    pub images: S,
    pub answer: F,
    pub reads: Vec<(BufferRead, u32)>,
    pub queries: Vec<(u32, Option<u32>)>,
    /* private fields */
}
Expand description

A read-only sampler combining image answers (for example super::AnsweredReads) with finite structured views. Successful structured reads retain both request and answer; failed reads stop with the request and reason. Image reads are delegated unchanged. Stores and atomics are refused, even if images could answer them. Buffer lengths come only from extents, never from an image sampler’s absent-view policy.

An undeclared structured view is an error. An element beyond a declared extent reads zero, D3D’s stated view rule, without calling answer. An invalid offset within an element is always refused. The executor may use Sampler::buffer_elements to resolve an out-of-range read before calling structured; queries records those extent requests, while reads records only the structured calls actually made, not a complete instruction trace. Lifted bounds guards can also read a valid element before masking its value away; the caller must answer every requested in-range word, not only the element it expects the final output to use.

Fields§

§images: S

The sampler that answers image reads.

§answer: F

The function that answers each structured read.

§reads: Vec<(BufferRead, u32)>

The structured reads made, each with the word answered.

§queries: Vec<(u32, Option<u32>)>

The extent requests made: the slot and the element count answered, None for an undeclared view.

Implementations§

Source§

impl<S, F> AnsweredBuffers<S, F>

Source

pub fn new( images: S, extents: BTreeMap<u32, BufferExtent>, answer: F, ) -> Result<Self, String>

Combine images with the structured views extents declares, by slot. A stride that is zero or not a multiple of 4, or an extent whose word count does not fit 32 bits, is refused.

Trait Implementations§

Source§

impl<S: Debug, F: Debug> Debug for AnsweredBuffers<S, F>

Source§

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

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

impl<S: Sampler, F: FnMut(BufferRead) -> Result<u32, String>> Sampler for AnsweredBuffers<S, F>

Source§

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

Answer a 2D Sample with the texel’s four lanes as floats, or an error that stops the evaluation.
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 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 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 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 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§

§

impl<S, F> Forget for AnsweredBuffers<S, F>

§

impl<S, F> Freeze for AnsweredBuffers<S, F>
where S: Freeze, F: Freeze,

§

impl<S, F> RefUnwindSafe for AnsweredBuffers<S, F>

§

impl<S, F> Send for AnsweredBuffers<S, F>
where S: Send, F: Send,

§

impl<S, F> Sync for AnsweredBuffers<S, F>
where S: Sync, F: Sync,

§

impl<S, F> Unpin for AnsweredBuffers<S, F>
where S: Unpin, F: Unpin,

§

impl<S, F> UnsafeUnpin for AnsweredBuffers<S, F>
where S: UnsafeUnpin, F: UnsafeUnpin,

§

impl<S, F> UnwindSafe for AnsweredBuffers<S, F>
where S: UnwindSafe, F: UnwindSafe,

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.