Skip to main content

ProgramShader

Struct ProgramShader 

Source
pub struct ProgramShader { /* private fields */ }
Expand description

A pixel program with the register view the D3D readers’ callers use.

Implementations§

Source§

impl ProgramShader

Source

pub fn new(program: Program) -> Result<Self, Error>

Compile program. Its inputs and outputs need their D3D registers (the lifter keeps them in provenance), and every resource a D3D bind slot.

Source

pub fn program(&self) -> &Program

The vertex or pixel program the shader runs.

Source

pub fn needs_quad(&self) -> bool

Whether a caller that wants this program’s exact results must run it as a quad (Executable::needs_quad).

Source§

impl ProgramShader

Source

pub fn execute_vertex( &self, inputs: &[[u32; 4]], buffers: &[(u32, &[[u32; 4]])], sampler: &mut dyn Sampler, ) -> Result<(Execution, [u32; 4]), Error>

Run a vertex program once on its input registers (the vertex’s attributes): its varyings in the register view, as PixelShader::execute gives them, and its clip-space position (SV_Position) as f32 bits. A program that is not a vertex program, or writes no position, refuses.

Source

pub fn execute_lockstep( &self, inputs: &[&[[u32; 4]]], derivatives: &[[[u32; 4]; 2]], buffers: &[(u32, &[[u32; 4]])], sampler: &mut dyn Sampler, ) -> Result<Vec<Execution>, Error>

PixelShader::execute_lanes without its second run: the invocations in lockstep, 16 at a time, and on an error the one the lockstep run met (of whichever invocation met one first in lockstep, which need not be the first to fail alone).

Trait Implementations§

Source§

impl Debug for ProgramShader

Source§

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

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

impl PixelShader for ProgramShader

Source§

fn interface(&self) -> &Interface

The program’s varyings and resources, in the iridia::Interface vocabulary.
Source§

fn input_count(&self) -> usize

Input registers an evaluation needs.
Source§

fn constant_buffers(&self) -> &[(u32, u32)]

Constant buffers the code reads: bind slot and its size in rows of four lanes.
Source§

fn textures(&self) -> &[u32]

Texture bind slots the code samples.
Source§

fn samplers(&self) -> &[u32]

Sampler bind slots the code uses.
Source§

fn execute( &self, inputs: &[[u32; 4]], buffers: &[(u32, &[[u32; 4]])], sampler: &mut dyn Sampler, ) -> Result<Execution, Error>

Evaluate once. Missing inputs or buffers are errors; no partial output is returned (the sampler may already have been called).
Source§

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.
Source§

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.
Source§

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.

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.