Skip to content

Instantly share code, notes, and snippets.

@olsonjeffery
Created June 16, 2015 23:41
Show Gist options
  • Save olsonjeffery/8d32b855c667c5981fec to your computer and use it in GitHub Desktop.
Save olsonjeffery/8d32b855c667c5981fec to your computer and use it in GitHub Desktop.
issue w/ gfx_parameters! and large arrays
gfx_parameters!( Uniforms {
// projection stuff
u_Model@ model: [[f32; 4]; 4],
u_View@ view: [[f32; 4]; 4],
u_Proj@ proj: [[f32; 4]; 4],
// texture data
t_CharMap@ char_map: [f32; 16384],
t_Tile@ tile: gfx::shade::TextureParam<R>,
});
let data = Uniforms {
model: Matrix4::identity().into_fixed(),
view: Matrix4::identity().into_fixed(),
proj: cgmath::perspective(cgmath::deg(60.0f32),
stream.get_aspect_ratio(),
0.1, 4000.0
).into_fixed(),
tile: (tile_texture, None),
char_map: [0.0f32; 16384],
_r: std::marker::PhantomData,
};
bash-3.2$ cargo run
Compiling basilisk-brut v0.0.1 (file:///Users/jeff/src/basilisk-brut)
<gfx macros>:4:9: 4:23 error: the trait `core::fmt::Debug` is not implemented for the type `[f32; 16384]` [E0277]
<gfx macros>:4 $ ( pub $ field : $ ty , ) * pub _r : :: std:: marker:: PhantomData < R > , }
^~~~~~~~~~~~~~
<gfx macros>:3:22: 3:27 note: in expansion of #[derive_Debug]
<gfx macros>:3:22: 3:27 note: expansion site
<gfx macros>:1:1: 48:8 note: in expansion of gfx_parameters!
src/client/main.rs:49:1: 57:4 note: expansion site
<gfx macros>:4:9: 4:23 note: `[f32; 16384]` cannot be formatted using `:?`; if it is defined in your crate, add `#[derive(Debug)]` or manually implement it
<gfx macros>:4 $ ( pub $ field : $ ty , ) * pub _r : :: std:: marker:: PhantomData < R > , }
^~~~~~~~~~~~~~
<gfx macros>:3:22: 3:27 note: in expansion of #[derive_Debug]
<gfx macros>:3:22: 3:27 note: expansion site
<gfx macros>:1:1: 48:8 note: in expansion of gfx_parameters!
src/client/main.rs:49:1: 57:4 note: expansion site
<gfx macros>:4:9: 4:23 error: the trait `core::clone::Clone` is not implemented for the type `[f32; 16384]` [E0277]
<gfx macros>:4 $ ( pub $ field : $ ty , ) * pub _r : :: std:: marker:: PhantomData < R > , }
^~~~~~~~~~~~~~
<gfx macros>:3:14: 3:19 note: in expansion of #[derive_Clone]
<gfx macros>:3:14: 3:19 note: expansion site
<gfx macros>:1:1: 48:8 note: in expansion of gfx_parameters!
src/client/main.rs:49:1: 57:4 note: expansion site
<gfx macros>:19:6: 19:7 error: the trait `core::clone::Clone` is not implemented for the type `[f32; 16384]` [E0277]
<gfx macros>:19 if ! < $ ty as Parameter < R >> :: check_uniform ( u ) {
^
note: in expansion of for loop expansion
<gfx macros>:14:68: 24:6 note: expansion site
<gfx macros>:1:1: 48:8 note: in expansion of gfx_parameters!
src/client/main.rs:49:1: 57:4 note: expansion site
<gfx macros>:19:6: 19:7 error: the trait `core::convert::From<[f32; 16384]>` is not implemented for the type `gfx::device::shade::UniformValue` [E0277]
<gfx macros>:19 if ! < $ ty as Parameter < R >> :: check_uniform ( u ) {
^
note: in expansion of for loop expansion
<gfx macros>:14:68: 24:6 note: expansion site
<gfx macros>:1:1: 48:8 note: in expansion of gfx_parameters!
src/client/main.rs:49:1: 57:4 note: expansion site
<gfx macros>:47:52: 47:73 error: no method named `put` found for type `[f32; 16384]` in the current scope
<gfx macros>:47 $ ( if let Some ( id ) = $ field { self . $ field . put ( id , storage ) ; } )
^~~~~~~~~~~~~~~~~~~~~
note: in expansion of if let expansion
<gfx macros>:47:5: 47:77 note: expansion site
<gfx macros>:1:1: 48:8 note: in expansion of gfx_parameters!
src/client/main.rs:49:1: 57:4 note: expansion site
error: aborting due to 5 previous errors
Could not compile `basilisk-brut`.
To learn more, run the command again with --verbose.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment