glsl-layout icon indicating copy to clipboard operation
glsl-layout copied to clipboard

bigger-arrays feature doesn't work

Open foltik opened this issue 6 years ago • 1 comments

Cargo.toml

glsl-layout = { version = "0.3.2", features = ["bigger-arrays"] }

main.rs

use glsl_layout::AsStd140;

#[derive(Copy, Clone, AsStd140)]
struct MyStd140 {
    array: [f32; 256]
}

Gives the errors:

error[E0277]: the trait bound `[_GLSL_LAYOUT_MyStd140::_glsl_layout::Element<f32>; 256]: std::default::Default` is not satisfied
 --> src/main.rs:3:23
  |
3 | #[derive(Copy, Clone, AsStd140)]
  |                       ^^^^^^^^ the trait `std::default::Default` is not implemented for `[_GLSL_LAYOUT_MyStd140::_glsl_layout::Element<f32>; 256]`
  |
  = help: the following implementations were found:
            <&[T] as std::default::Default>
            <&mut [T] as std::default::Default>
            <[T; 0] as std::default::Default>
            <[T; 10] as std::default::Default>
          and 31 others
  = note: required by `std::default::Default::default`

error[E0277]: arrays only have std trait implementations for lengths 0..=32
 --> src/main.rs:3:23
  |
3 | #[derive(Copy, Clone, AsStd140)]
  |                       ^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[_GLSL_LAYOUT_MyStd140::_glsl_layout::Element<f32>; 256]`
  |
  = note: required because of the requirements on the impl of `std::fmt::Debug` for `[_GLSL_LAYOUT_MyStd140::_glsl_layout::Element<f32>; 256]`
  = note: required because of the requirements on the impl of `std::fmt::Debug` for `&[_GLSL_LAYOUT_MyStd140::_glsl_layout::Element<f32>; 256]`
  = note: required for the cast to the object type `dyn std::fmt::Debug`

foltik avatar Mar 07 '20 21:03 foltik

I guess the only option is to remove those bounds.

zakarumych avatar Mar 12 '20 13:03 zakarumych