Skip to content

Support non-float fragment filling #36

@chronicl

Description

@chronicl

Currently shame always converts to float vecs when passing to the fragment stage

fn vec_fill_any<T: ScalarType, L: Len>(v: &vec<T, L>, method: FragmentSampleMethod, loc: Location) -> Any {
match T::SCALAR_TYPE {
ir::ScalarType::F16 | ir::ScalarType::F32 | ir::ScalarType::F64 => v.as_any(),
ir::ScalarType::U32 | ir::ScalarType::I32 | ir::ScalarType::Bool => {
// convert to vec<f32, L> then fill.
Any::new_vec(L::LEN, ir::ScalarType::F32, &[v.as_any()])
}
}
.fill_fragments(loc, method)
}

I believe this should not be the case. For example, you should be able to use fill_flat on a u32x1 to pass a u32x1 to the fragment stage. The conversion to floats would be removed (which I prefer anyway, because the user can easily convert to floats themselves using to_f32, which is more explicit).

The type-safe way to implement this is to have a SupportsFill<Fill> trait and make Fill a trait instead of an enum. However, when/if this is implemented, please keep a non-type-safe version that takes an enum as input too (making it a runtime error if a non-float vec is used with a fill rate other than flat).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions