Skip to main content

Backend

Trait Backend 

Source
pub trait Backend {
    // Required method
    fn sample(
        &mut self,
        request: ImageSample<Element>,
    ) -> Result<[f32; 4], String>;

    // Provided methods
    fn load(&mut self, request: ImageLoad<Element>) -> Result<[u32; 4], String> { ... }
    fn query(
        &mut self,
        request: ImageQuery<Element>,
    ) -> Result<[u32; 4], String> { ... }
    fn store_image(
        &mut self,
        request: ImageStore<ResourceId>,
    ) -> Result<(), String> { ... }
    fn trace_ray(&mut self, request: TraceRay<'_>) -> Result<(), String> { ... }
    fn report_hit(&mut self, request: ReportHit<'_>) -> Result<bool, String> { ... }
    fn call_shader(&mut self, request: CallShader<'_>) -> Result<(), String> { ... }
    fn atomic_image(
        &mut self,
        request: ImageAtomic<ResourceId>,
    ) -> Result<u32, String> { ... }
    fn store_buffer(
        &mut self,
        view: ResourceId,
        word: u32,
        value: [u32; 4],
        mask: u8,
    ) -> Result<(), String> { ... }
    fn read_buffer(
        &mut self,
        view: ResourceId,
        word: u32,
        count: u8,
    ) -> Result<[u32; 4], String> { ... }
    fn buffer_words(&mut self, view: ResourceId) -> Result<u32, String> { ... }
    fn atomic_add(
        &mut self,
        view: ResourceId,
        word: u32,
        value: u32,
    ) -> Result<u32, String> { ... }
}
Expand description

Everything an evaluation asks of its caller: texture sampling, loads, queries, and the effects of unordered-access writes. A request the caller cannot answer is an error that stops the evaluation. Reads of buffers need no call: the buffers are bound before the run.

Required Methods§

Source

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

Answer a texture sample with the texel’s four lanes, or an error that stops the evaluation.

Provided Methods§

Source

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

The texel’s four lanes as its view returns them: f32 bits for a float view, the integers otherwise.

Source

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

Answer a size or level-count query with its lanes.

Source

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

Write a texel of an unordered-access texture. The effect is the caller’s: it reaches none of this evaluation’s reads.

Source

fn trace_ray(&mut self, request: TraceRay<'_>) -> Result<(), String>

TraceRay, for a ray tracing pipeline’s program: run what the ray hits and misses.

Source

fn report_hit(&mut self, request: ReportHit<'_>) -> Result<bool, String>

ReportHit, for an intersection program: whether the hit was accepted.

Source

fn call_shader(&mut self, request: CallShader<'_>) -> Result<(), String>

CallShader, for a ray tracing pipeline’s program.

Source

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

An atomic operation on one texel; its result the word as it was before.

Source

fn store_buffer( &mut self, view: ResourceId, word: u32, value: [u32; 4], mask: u8, ) -> Result<(), String>

Words written to a buffer: the lanes mask marks of value, to the consecutive 32-bit words from word word of the buffer. The effect is the caller’s: it reaches none of this evaluation’s reads.

Source

fn read_buffer( &mut self, view: ResourceId, word: u32, count: u8, ) -> Result<[u32; 4], String>

count (1 to 4) consecutive 32-bit words from word word of a buffer the caller did not bind (super::Resources::buffers); lanes past count are 0.

Source

fn buffer_words(&mut self, view: ResourceId) -> Result<u32, String>

How many words a buffer the caller did not bind has.

Source

fn atomic_add( &mut self, view: ResourceId, word: u32, value: u32, ) -> Result<u32, String>

An atomic add to word word of a buffer; its result the word as it was before.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§