[][src]Trait web_glitz::pipeline::interface_block::InterfaceBlockComponent

pub unsafe trait InterfaceBlockComponent: StableRepr {
    fn check_compatibility<'a, 'b, I>(
        component_offset: usize,
        remainder: &'a mut I
    ) -> CheckCompatibility
    where
        I: Iterator<Item = &'b MemoryUnitDescriptor>,
        'b: 'a
; }

Trait that may be implemented on types that are to be used as struct members for a struct deriving InterfaceBlock.

If all members of a struct implement InterfaceBlockComponent, then the InterfaceBlock can be automatically derived (see the documentation for InterfaceBlock for an example).

This trait may be automatically derived for a struct, if all of the struct's members implement InterfaceBlockComponent as well.

Unsafe

If check_compatibility returns CheckCompatibility::Finished or CheckCompatibility::Continue, then the type must be compatible with the memory layout it was checked against, otherwise pipelines that use this type as part of an interface block may produce unpredictable results.

Required methods

fn check_compatibility<'a, 'b, I>(
    component_offset: usize,
    remainder: &'a mut I
) -> CheckCompatibility where
    I: Iterator<Item = &'b MemoryUnitDescriptor>,
    'b: 'a, 

Checks whether this component is compatible with a certain memory layout, when used at offset component_offset relative to the start of the interface block in which it is used.

Implementers may assume the remainder iterator to be advanced to the first memory unit that is expected to be provided by this type, such that the first call to Iterator::next yields the first MemoryUnitDescriptor this type is expected to match. The implementation may expect the iterator to yield MemoryUnitDescriptors in order of offset (MemoryUnitDescriptor::offset). If the type does not contain a memory unit matching the memory unit's UnitLayout (MemoryUnitDescriptor::layout) at the memory unit's offset, then CheckCompatibility::Incompatible must be returned. Note that the offset of any memory units yielded by the iterator are relative to the start of the interface block, not relative to the start of this component: given internal_offset an offset relative to the start of the component, the offset relative to the start of the interface block may be computed as component_offset + internal_offset.

The implementation is expected to advance the iterator once for every memory unit this type defines (not once for every component - you may pass the iterator to a sub-component which is then expected to advance the iterator once for every memory unit it defines, in a recursive fashion), such that the iterator may be passed on to the next component (if any) afterwards. If the iterator completes during this operation (Iterator::next returns None), then the implementation is expected to return CheckCompatibility::Finished (unless the component was found to be incompatible with a prior memory unit descriptor, in which case CheckCompatibility::Incompatible should be returned).

Loading content...

Implementors

impl InterfaceBlockComponent for boolean[src]

impl InterfaceBlockComponent for bvec2[src]

impl InterfaceBlockComponent for bvec3[src]

impl InterfaceBlockComponent for bvec4[src]

impl InterfaceBlockComponent for float[src]

impl InterfaceBlockComponent for int[src]

impl InterfaceBlockComponent for ivec2[src]

impl InterfaceBlockComponent for ivec3[src]

impl InterfaceBlockComponent for ivec4[src]

impl InterfaceBlockComponent for mat2x2[src]

impl InterfaceBlockComponent for mat2x3[src]

impl InterfaceBlockComponent for mat2x4[src]

impl InterfaceBlockComponent for mat3x2[src]

impl InterfaceBlockComponent for mat3x3[src]

impl InterfaceBlockComponent for mat3x4[src]

impl InterfaceBlockComponent for mat4x2[src]

impl InterfaceBlockComponent for mat4x3[src]

impl InterfaceBlockComponent for mat4x4[src]

impl InterfaceBlockComponent for uint[src]

impl InterfaceBlockComponent for uvec2[src]

impl InterfaceBlockComponent for uvec3[src]

impl InterfaceBlockComponent for uvec4[src]

impl InterfaceBlockComponent for vec2[src]

impl InterfaceBlockComponent for vec3[src]

impl InterfaceBlockComponent for vec4[src]

impl<const LEN: usize> InterfaceBlockComponent for array<boolean, { LEN }>[src]

impl<const LEN: usize> InterfaceBlockComponent for array<bvec2, { LEN }>[src]

impl<const LEN: usize> InterfaceBlockComponent for array<bvec3, { LEN }>[src]

impl<const LEN: usize> InterfaceBlockComponent for array<bvec4, { LEN }>[src]

impl<const LEN: usize> InterfaceBlockComponent for array<float, { LEN }>[src]

impl<const LEN: usize> InterfaceBlockComponent for array<int, { LEN }>[src]

impl<const LEN: usize> InterfaceBlockComponent for array<ivec2, { LEN }>[src]

impl<const LEN: usize> InterfaceBlockComponent for array<ivec3, { LEN }>[src]

impl<const LEN: usize> InterfaceBlockComponent for array<ivec4, { LEN }>[src]

impl<const LEN: usize> InterfaceBlockComponent for array<mat2x2, { LEN }>[src]

impl<const LEN: usize> InterfaceBlockComponent for array<mat2x3, { LEN }>[src]

impl<const LEN: usize> InterfaceBlockComponent for array<mat2x4, { LEN }>[src]

impl<const LEN: usize> InterfaceBlockComponent for array<mat3x2, { LEN }>[src]

impl<const LEN: usize> InterfaceBlockComponent for array<mat3x3, { LEN }>[src]

impl<const LEN: usize> InterfaceBlockComponent for array<mat3x4, { LEN }>[src]

impl<const LEN: usize> InterfaceBlockComponent for array<mat4x2, { LEN }>[src]

impl<const LEN: usize> InterfaceBlockComponent for array<mat4x3, { LEN }>[src]

impl<const LEN: usize> InterfaceBlockComponent for array<mat4x4, { LEN }>[src]

impl<const LEN: usize> InterfaceBlockComponent for array<uint, { LEN }>[src]

impl<const LEN: usize> InterfaceBlockComponent for array<uvec2, { LEN }>[src]

impl<const LEN: usize> InterfaceBlockComponent for array<uvec3, { LEN }>[src]

impl<const LEN: usize> InterfaceBlockComponent for array<uvec4, { LEN }>[src]

impl<const LEN: usize> InterfaceBlockComponent for array<vec2, { LEN }>[src]

impl<const LEN: usize> InterfaceBlockComponent for array<vec3, { LEN }>[src]

impl<const LEN: usize> InterfaceBlockComponent for array<vec4, { LEN }>[src]

Loading content...