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§
Provided Methods§
Sourcefn load(&mut self, request: ImageLoad<Element>) -> Result<[u32; 4], String>
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.
Sourcefn query(&mut self, request: ImageQuery<Element>) -> Result<[u32; 4], String>
fn query(&mut self, request: ImageQuery<Element>) -> Result<[u32; 4], String>
Answer a size or level-count query with its lanes.
Sourcefn store_image(&mut self, request: ImageStore<ResourceId>) -> Result<(), String>
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.
Sourcefn trace_ray(&mut self, request: TraceRay<'_>) -> Result<(), String>
fn trace_ray(&mut self, request: TraceRay<'_>) -> Result<(), String>
TraceRay, for a ray tracing pipeline’s program: run what the ray hits and misses.
Sourcefn report_hit(&mut self, request: ReportHit<'_>) -> Result<bool, String>
fn report_hit(&mut self, request: ReportHit<'_>) -> Result<bool, String>
ReportHit, for an intersection program: whether the hit was accepted.
Sourcefn call_shader(&mut self, request: CallShader<'_>) -> Result<(), String>
fn call_shader(&mut self, request: CallShader<'_>) -> Result<(), String>
CallShader, for a ray tracing pipeline’s program.
Sourcefn atomic_image(
&mut self,
request: ImageAtomic<ResourceId>,
) -> Result<u32, String>
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.
Sourcefn store_buffer(
&mut self,
view: ResourceId,
word: u32,
value: [u32; 4],
mask: u8,
) -> Result<(), String>
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.
Sourcefn read_buffer(
&mut self,
view: ResourceId,
word: u32,
count: u8,
) -> Result<[u32; 4], String>
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.
Sourcefn buffer_words(&mut self, view: ResourceId) -> Result<u32, String>
fn buffer_words(&mut self, view: ResourceId) -> Result<u32, String>
How many words a buffer the caller did not bind has.
Sourcefn atomic_add(
&mut self,
view: ResourceId,
word: u32,
value: u32,
) -> Result<u32, String>
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".