pub trait PixelShader: Debug + Sync {
// Required methods
fn interface(&self) -> &Interface;
fn input_count(&self) -> usize;
fn constant_buffers(&self) -> &[(u32, u32)];
fn textures(&self) -> &[u32];
fn samplers(&self) -> &[u32];
fn execute(
&self,
inputs: &[[u32; 4]],
buffers: &[(u32, &[[u32; 4]])],
sampler: &mut dyn Sampler,
) -> Result<Execution, Error>;
// Provided methods
fn execute_with_derivatives(
&self,
inputs: &[[u32; 4]],
derivatives: &[[[u32; 4]; 2]],
buffers: &[(u32, &[[u32; 4]])],
sampler: &mut dyn Sampler,
) -> Result<Execution, Error> { ... }
fn execute_lanes(
&self,
inputs: &[&[[u32; 4]]],
derivatives: &[[[u32; 4]; 2]],
buffers: &[(u32, &[[u32; 4]])],
sampler: &mut dyn Sampler,
each: &mut dyn FnMut(usize, &Execution),
) -> Result<(), (usize, Error)> { ... }
fn execute_quad(
&self,
inputs: [&[[u32; 4]]; 4],
buffers: &[(u32, &[[u32; 4]])],
sampler: &mut dyn Sampler,
) -> Result<[Execution; 4], Error> { ... }
}Expand description
A checked pixel shader that can be evaluated.
Required Methods§
Sourcefn interface(&self) -> &Interface
fn interface(&self) -> &Interface
The program’s varyings and resources, in the iridia::Interface vocabulary.
Sourcefn input_count(&self) -> usize
fn input_count(&self) -> usize
Input registers an evaluation needs.
Sourcefn constant_buffers(&self) -> &[(u32, u32)]
fn constant_buffers(&self) -> &[(u32, u32)]
Constant buffers the code reads: bind slot and its size in rows of four lanes.
Provided Methods§
Sourcefn execute_with_derivatives(
&self,
inputs: &[[u32; 4]],
derivatives: &[[[u32; 4]; 2]],
buffers: &[(u32, &[[u32; 4]])],
sampler: &mut dyn Sampler,
) -> Result<Execution, Error>
fn execute_with_derivatives( &self, inputs: &[[u32; 4]], derivatives: &[[[u32; 4]; 2]], buffers: &[(u32, &[[u32; 4]])], sampler: &mut dyn Sampler, ) -> Result<Execution, Error>
Evaluate once with the inputs’ screen derivatives: per input register, its d/dx then d/dy lanes (f32 bits),
for programs that read derivatives. A bytecode that reads none evaluates as PixelShader::execute.
Sourcefn execute_lanes(
&self,
inputs: &[&[[u32; 4]]],
derivatives: &[[[u32; 4]; 2]],
buffers: &[(u32, &[[u32; 4]])],
sampler: &mut dyn Sampler,
each: &mut dyn FnMut(usize, &Execution),
) -> Result<(), (usize, Error)>
fn execute_lanes( &self, inputs: &[&[[u32; 4]]], derivatives: &[[[u32; 4]; 2]], buffers: &[(u32, &[[u32; 4]])], sampler: &mut dyn Sampler, each: &mut dyn FnMut(usize, &Execution), ) -> Result<(), (usize, Error)>
Evaluate invocations that share their inputs’ screen derivatives (derivatives, as
PixelShader::execute_with_derivatives takes them), each as that would alone: each is given every
invocation’s index and execution (the same outputs, instructions and samples), in order. On an error, the first
failing invocation’s index and its error, each given those before it. The sampler may be asked in another
order than one invocation after another. The default evaluates them one after another.
Sourcefn execute_quad(
&self,
inputs: [&[[u32; 4]]; 4],
buffers: &[(u32, &[[u32; 4]])],
sampler: &mut dyn Sampler,
) -> Result<[Execution; 4], Error>
fn execute_quad( &self, inputs: [&[[u32; 4]]; 4], buffers: &[(u32, &[[u32; 4]])], sampler: &mut dyn Sampler, ) -> Result<[Execution; 4], Error>
Evaluate a 2 x 2 quad together (lanes 0, 1 the top row, 2, 3 the bottom), its derivatives and implicit levels of detail the quad’s own. A bytecode without quad evaluation refuses.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".